91529972960007c959d7a96a4c1cfd2adc042a8d
[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 Tue Feb 22 23:55:00 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_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_getgrent=''
367 d_getgrps=''
368 d_gethbyaddr=''
369 d_gethbyname=''
370 d_gethent=''
371 aphostname=''
372 d_gethname=''
373 d_phostname=''
374 d_uname=''
375 d_gethostprotos=''
376 d_getlogin=''
377 d_getmnt=''
378 d_getmntent=''
379 d_getnbyaddr=''
380 d_getnbyname=''
381 d_getnent=''
382 d_getnetprotos=''
383 d_getpent=''
384 d_getpgid=''
385 d_getpgrp2=''
386 d_bsdgetpgrp=''
387 d_getpgrp=''
388 d_getppid=''
389 d_getprior=''
390 d_getpbyname=''
391 d_getpbynumber=''
392 d_getprotoprotos=''
393 d_getpwent=''
394 d_getsent=''
395 d_getservprotos=''
396 d_getspent=''
397 d_getspnam=''
398 d_getsbyname=''
399 d_getsbyport=''
400 d_gnulibc=''
401 d_hasmntopt=''
402 d_htonl=''
403 d_iconv=''
404 d_inetaton=''
405 d_int64_t=''
406 d_isascii=''
407 d_killpg=''
408 d_lchown=''
409 d_ldbl_dig=''
410 d_link=''
411 d_locconv=''
412 d_lockf=''
413 d_longdbl=''
414 longdblsize=''
415 d_longlong=''
416 longlongsize=''
417 d_lstat=''
418 d_mblen=''
419 d_mbstowcs=''
420 d_mbtowc=''
421 d_memchr=''
422 d_memcmp=''
423 d_memcpy=''
424 d_memmove=''
425 d_memset=''
426 d_mkdir=''
427 d_mkdtemp=''
428 d_mkfifo=''
429 d_mkstemp=''
430 d_mkstemps=''
431 d_mktime=''
432 d_mmap=''
433 mmaptype=''
434 d_mprotect=''
435 d_msg=''
436 d_msgctl=''
437 d_msgget=''
438 d_msgrcv=''
439 d_msgsnd=''
440 d_msync=''
441 d_munmap=''
442 d_nice=''
443 d_open3=''
444 d_fpathconf=''
445 d_pathconf=''
446 d_pause=''
447 d_pipe=''
448 d_poll=''
449 d_portable=''
450 d_old_pthread_create_joinable=''
451 old_pthread_create_joinable=''
452 d_pthread_yield=''
453 d_sched_yield=''
454 sched_yield=''
455 d_readdir=''
456 d_rewinddir=''
457 d_seekdir=''
458 d_telldir=''
459 d_readlink=''
460 d_rename=''
461 d_rmdir=''
462 d_safebcpy=''
463 d_safemcpy=''
464 d_sanemcmp=''
465 d_select=''
466 d_sem=''
467 d_semctl=''
468 d_semget=''
469 d_semop=''
470 d_setegid=''
471 d_seteuid=''
472 d_setgrent=''
473 d_setgrps=''
474 d_sethent=''
475 d_setlinebuf=''
476 d_setlocale=''
477 d_setnent=''
478 d_setpent=''
479 d_setpgid=''
480 d_setpgrp2=''
481 d_bsdsetpgrp=''
482 d_setpgrp=''
483 d_setprior=''
484 d_setpwent=''
485 d_setregid=''
486 d_setresgid=''
487 d_setresuid=''
488 d_setreuid=''
489 d_setrgid=''
490 d_setruid=''
491 d_setsent=''
492 d_setsid=''
493 d_setspent=''
494 d_setvbuf=''
495 d_sfio=''
496 usesfio=''
497 d_shm=''
498 d_shmat=''
499 d_shmatprototype=''
500 shmattype=''
501 d_shmctl=''
502 d_shmdt=''
503 d_shmget=''
504 d_sigaction=''
505 d_sigsetjmp=''
506 d_msg_ctrunc=''
507 d_msg_dontroute=''
508 d_msg_oob=''
509 d_msg_peek=''
510 d_msg_proxy=''
511 d_oldsock=''
512 d_scm_rights=''
513 d_socket=''
514 d_sockpair=''
515 sockethdr=''
516 socketlib=''
517 d_socklen_t=''
518 d_sqrtl=''
519 d_statblks=''
520 d_statfs_f_flags=''
521 d_statfs_s=''
522 d_fstatvfs=''
523 d_statvfs=''
524 d_stdio_cnt_lval=''
525 d_stdio_ptr_lval=''
526 d_stdiobase=''
527 d_stdstdio=''
528 stdio_base=''
529 stdio_bufsiz=''
530 stdio_cnt=''
531 stdio_filbuf=''
532 stdio_ptr=''
533 d_index=''
534 d_strchr=''
535 d_strcoll=''
536 d_strctcpy=''
537 d_strerrm=''
538 d_strerror=''
539 d_sysernlst=''
540 d_syserrlst=''
541 d_strtod=''
542 d_strtol=''
543 d_strtold=''
544 d_strtoll=''
545 d_strtoul=''
546 d_strtoull=''
547 d_strtouq=''
548 d_strxfrm=''
549 d_symlink=''
550 d_syscall=''
551 d_sysconf=''
552 d_system=''
553 d_tcgetpgrp=''
554 d_tcsetpgrp=''
555 d_telldirproto=''
556 d_time=''
557 timetype=''
558 clocktype=''
559 d_times=''
560 d_truncate=''
561 d_tzname=''
562 d_umask=''
563 d_semctl_semid_ds=''
564 d_semctl_semun=''
565 d_union_semun=''
566 d_ustat=''
567 d_vfork=''
568 usevfork=''
569 d_voidsig=''
570 signal_t=''
571 d_volatile=''
572 d_charvspr=''
573 d_vprintf=''
574 d_wait4=''
575 d_waitpid=''
576 d_wcstombs=''
577 d_wctomb=''
578 dlext=''
579 cccdlflags=''
580 ccdlflags=''
581 dlsrc=''
582 ld=''
583 lddlflags=''
584 usedl=''
585 doublesize=''
586 ebcdic=''
587 fflushNULL=''
588 fflushall=''
589 fpossize=''
590 fpostype=''
591 gidformat=''
592 gidsign=''
593 gidsize=''
594 gidtype=''
595 groupstype=''
596 h_fcntl=''
597 h_sysfile=''
598 i_arpainet=''
599 db_hashtype=''
600 db_prefixtype=''
601 i_db=''
602 i_dbm=''
603 i_rpcsvcdbm=''
604 d_dirnamlen=''
605 direntrytype=''
606 i_dirent=''
607 i_dld=''
608 i_dlfcn=''
609 i_fcntl=''
610 i_float=''
611 i_gdbm=''
612 d_grpasswd=''
613 i_grp=''
614 i_iconv=''
615 i_inttypes=''
616 i_limits=''
617 i_locale=''
618 i_machcthr=''
619 i_malloc=''
620 i_math=''
621 i_memory=''
622 i_mntent=''
623 i_ndbm=''
624 i_netdb=''
625 i_neterrno=''
626 i_netinettcp=''
627 i_niin=''
628 i_sysin=''
629 i_poll=''
630 i_pthread=''
631 d_pwage=''
632 d_pwchange=''
633 d_pwclass=''
634 d_pwcomment=''
635 d_pwexpire=''
636 d_pwgecos=''
637 d_pwpasswd=''
638 d_pwquota=''
639 i_pwd=''
640 i_sfio=''
641 i_shadow=''
642 i_socks=''
643 i_stddef=''
644 i_stdlib=''
645 i_string=''
646 strings=''
647 i_sysaccess=''
648 i_sysdir=''
649 i_sysfile=''
650 d_voidtty=''
651 i_bsdioctl=''
652 i_sysfilio=''
653 i_sysioctl=''
654 i_syssockio=''
655 i_syslog=''
656 i_sysmman=''
657 i_sysmode=''
658 i_sysmount=''
659 i_sysndir=''
660 i_sysparam=''
661 i_sysresrc=''
662 i_syssecrt=''
663 i_sysselct=''
664 i_sysstat=''
665 i_sysstatfs=''
666 i_sysstatvfs=''
667 i_systimes=''
668 i_systypes=''
669 i_sysuio=''
670 i_sysun=''
671 i_sysutsname=''
672 i_sysvfs=''
673 i_syswait=''
674 i_sgtty=''
675 i_termio=''
676 i_termios=''
677 i_systime=''
678 i_systimek=''
679 i_time=''
680 timeincl=''
681 i_unistd=''
682 i_ustat=''
683 i_utime=''
684 i_values=''
685 i_stdarg=''
686 i_varargs=''
687 i_varhdr=''
688 i_vfork=''
689 inc_version_list=''
690 inc_version_list_init=''
691 installprefix=''
692 installprefixexp=''
693 installstyle=''
694 installusrbinperl=''
695 intsize=''
696 longsize=''
697 shortsize=''
698 d_fpos64_t=''
699 d_off64_t=''
700 libc=''
701 ldlibpthname=''
702 libperl=''
703 shrpenv=''
704 useshrplib=''
705 glibpth=''
706 libpth=''
707 loclibpth=''
708 plibpth=''
709 xlibpth=''
710 ignore_versioned_solibs=''
711 libs=''
712 libsdirs=''
713 libsfiles=''
714 libsfound=''
715 libspath=''
716 lns=''
717 d_PRIEldbl=''
718 d_PRIFldbl=''
719 d_PRIGldbl=''
720 d_PRIeldbl=''
721 d_PRIfldbl=''
722 d_PRIgldbl=''
723 sPRIEldbl=''
724 sPRIFldbl=''
725 sPRIGldbl=''
726 sPRIeldbl=''
727 sPRIfldbl=''
728 sPRIgldbl=''
729 lseeksize=''
730 lseektype=''
731 make_set_make=''
732 d_mymalloc=''
733 freetype=''
734 mallocobj=''
735 mallocsrc=''
736 malloctype=''
737 usemymalloc=''
738 installman1dir=''
739 man1dir=''
740 man1direxp=''
741 man1ext=''
742 installman3dir=''
743 man3dir=''
744 man3direxp=''
745 man3ext=''
746 huge=''
747 large=''
748 medium=''
749 models=''
750 small=''
751 split=''
752 modetype=''
753 multiarch=''
754 mydomain=''
755 myhostname=''
756 phostname=''
757 c=''
758 n=''
759 d_eofnblk=''
760 eagain=''
761 o_nonblock=''
762 rd_nodata=''
763 netdb_hlen_type=''
764 netdb_host_type=''
765 netdb_name_type=''
766 netdb_net_type=''
767 groupcat=''
768 hostcat=''
769 passcat=''
770 orderlib=''
771 ranlib=''
772 package=''
773 spackage=''
774 pager=''
775 api_revision=''
776 api_subversion=''
777 api_version=''
778 api_versionstring=''
779 patchlevel=''
780 subversion=''
781 version=''
782 perladmin=''
783 perlpath=''
784 d_nv_preserves_uv=''
785 i16size=''
786 i16type=''
787 i32size=''
788 i32type=''
789 i64size=''
790 i64type=''
791 i8size=''
792 i8type=''
793 ivsize=''
794 ivtype=''
795 nvsize=''
796 nvtype=''
797 u16size=''
798 u16type=''
799 u32size=''
800 u32type=''
801 u64size=''
802 u64type=''
803 u8size=''
804 u8type=''
805 uvsize=''
806 uvtype=''
807 ivdformat=''
808 uvoformat=''
809 uvuformat=''
810 uvxformat=''
811 pidtype=''
812 prefix=''
813 prefixexp=''
814 installprivlib=''
815 privlib=''
816 privlibexp=''
817 prototype=''
818 ptrsize=''
819 d_PRIX64=''
820 d_PRId64=''
821 d_PRIi64=''
822 d_PRIo64=''
823 d_PRIu64=''
824 d_PRIx64=''
825 sPRIX64=''
826 sPRId64=''
827 sPRIi64=''
828 sPRIo64=''
829 sPRIu64=''
830 sPRIx64=''
831 d_quad=''
832 quadkind=''
833 quadtype=''
834 uquadtype=''
835 drand01=''
836 randbits=''
837 randfunc=''
838 randseedtype=''
839 seedfunc=''
840 installscript=''
841 scriptdir=''
842 scriptdirexp=''
843 selectminbits=''
844 selecttype=''
845 sh=''
846 sig_count=''
847 sig_name=''
848 sig_name_init=''
849 sig_num=''
850 sig_num_init=''
851 installsitearch=''
852 sitearch=''
853 sitearchexp=''
854 installsitebin=''
855 sitebin=''
856 sitebinexp=''
857 installsitelib=''
858 sitelib=''
859 sitelibexp=''
860 siteprefix=''
861 siteprefixexp=''
862 sizetype=''
863 so=''
864 sharpbang=''
865 shsharp=''
866 spitshell=''
867 src=''
868 ssizetype=''
869 startperl=''
870 startsh=''
871 stdchar=''
872 d_stdio_stream_array=''
873 stdio_stream_array=''
874 sysman=''
875 trnl=''
876 uidformat=''
877 uidsign=''
878 uidsize=''
879 uidtype=''
880 archname64=''
881 use64bits=''
882 uselargefiles=''
883 uselongdouble=''
884 usemorebits=''
885 usemultiplicity=''
886 nm_opt=''
887 nm_so_opt=''
888 runnm=''
889 usenm=''
890 useperlio=''
891 usesocks=''
892 d_oldpthreads=''
893 use5005threads=''
894 useithreads=''
895 usethreads=''
896 incpath=''
897 mips_type=''
898 usrinc=''
899 d_vendorbin=''
900 installvendorbin=''
901 vendorbin=''
902 vendorbinexp=''
903 d_vendorlib=''
904 installvendorlib=''
905 vendorlib=''
906 vendorlibexp=''
907 usevendorprefix=''
908 vendorprefix=''
909 vendorprefixexp=''
910 defvoidused=''
911 voidflags=''
912 pm_apiversion=''
913 xs_apiversion=''
914 CONFIG=''
915
916 define='define'
917 undef='undef'
918 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
919 rmlist=''
920
921 : We must find out about Eunice early
922 eunicefix=':'
923 if test -f /etc/unixtovms; then
924         eunicefix=/etc/unixtovms
925 fi
926 if test -f /etc/unixtovms.exe; then
927         eunicefix=/etc/unixtovms.exe
928 fi
929
930 i_whoami=''
931 : set useposix=false in your hint file to disable the POSIX extension.
932 useposix=true
933 : set useopcode=false in your hint file to disable the Opcode extension.
934 useopcode=true
935 : Trailing extension.  Override this in a hint file, if needed.
936 _exe=''
937 : Extra object files, if any, needed on this platform.
938 archobjs=''
939 : Possible local include directories to search.
940 : Set locincpth to "" in a hint file to defeat local include searches.
941 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
942 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
943 :
944 : no include file wanted by default
945 inclwanted=''
946
947 groupstype=''
948 : change the next line if compiling for Xenix/286 on Xenix/386
949 xlibpth='/usr/lib/386 /lib/386'
950 : Possible local library directories to search.
951 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
952 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
953
954 : general looking path for locating libraries
955 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
956 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
957 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
958 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
959 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
960
961 : Private path used by Configure to find libraries.  Its value
962 : is prepended to libpth. This variable takes care of special
963 : machines, like the mips.  Usually, it should be empty.
964 plibpth=''
965
966 : default library list
967 libswanted=''
968 : some systems want to use only the non-versioned libso:s
969 ignore_versioned_solibs=''
970 : set usemultiplicity on the Configure command line to enable multiplicity.
971 : set usesocks on the Configure command line to enable socks.
972 : set usethreads on the Configure command line to enable threads.
973 : full support for void wanted by default
974 defvoidused=15
975
976 : List of libraries we want.
977 : If anyone needs -lnet, put it in a hint file.
978 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
979 libswanted="$libswanted dld ld sun m c cposix posix"
980 libswanted="$libswanted ndir dir crypt sec"
981 libswanted="$libswanted ucb bsd BSD PW x"
982 : We probably want to search /usr/shlib before most other libraries.
983 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
984 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
985 glibpth="/usr/shlib $glibpth"
986 : Do not use vfork unless overridden by a hint file.
987 usevfork=false
988
989 : Find the basic shell for Bourne shell scripts
990 case "$sh" in
991 '')
992         case "$SYSTYPE" in
993         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
994         *) xxx='/bin/sh';;
995         esac
996         if test -f "$xxx"; then
997                 sh="$xxx"
998         else
999                 : Build up a list and do a single loop so we can 'break' out.
1000                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1001                 for xxx in sh bash ksh pdksh ash; do
1002                         for p in $pth; do
1003                                 try="$try ${p}/${xxx}"
1004                         done
1005                 done
1006                 for xxx in $try; do
1007                         if test -f "$xxx"; then
1008                                 sh="$xxx";
1009                                 break
1010                         elif test -f "$xxx.exe"; then
1011                                 sh="$xxx";
1012                                 break
1013                         fi
1014                 done
1015         fi
1016         ;;
1017 esac
1018
1019 case "$sh" in
1020 '')     cat <<EOM >&2
1021 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1022
1023 Usually it's in /bin/sh.  How did you even get this far?
1024 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1025 we'll try to straighten this all out.
1026 EOM
1027         exit 1
1028         ;;
1029 esac
1030
1031 : see if sh knows # comments
1032 if `$sh -c '#' >/dev/null 2>&1`; then
1033         shsharp=true
1034         spitshell=cat
1035         xcat=/bin/cat
1036         test -f $xcat || xcat=/usr/bin/cat
1037         echo "#!$xcat" >try
1038         $eunicefix try
1039         chmod +x try
1040         ./try > today
1041         if test -s today; then
1042                 sharpbang='#!'
1043         else
1044                 echo "#! $xcat" > try
1045                 $eunicefix try
1046                 chmod +x try
1047                 ./try > today
1048                 if test -s today; then
1049                         sharpbang='#! '
1050                 else
1051                         sharpbang=': use '
1052                 fi
1053         fi
1054 else
1055         echo " "
1056         echo "Your $sh doesn't grok # comments--I will strip them later on."
1057         shsharp=false
1058         cd ..
1059         echo "exec grep -v '^[  ]*#'" >spitshell
1060         chmod +x spitshell
1061         $eunicefix spitshell
1062         spitshell=`pwd`/spitshell
1063         cd UU
1064         echo "I presume that if # doesn't work, #! won't work either!"
1065         sharpbang=': use '
1066 fi
1067 rm -f try today
1068
1069 : figure out how to guarantee sh startup
1070 case "$startsh" in
1071 '') startsh=${sharpbang}${sh} ;;
1072 *)
1073 esac
1074 cat >try <<EOSS
1075 $startsh
1076 set abc
1077 test "$?abc" != 1
1078 EOSS
1079
1080 chmod +x try
1081 $eunicefix try
1082 if ./try; then
1083         : echo "Yup, it does."
1084 else
1085         echo "Hmm... '$startsh' does not guarantee sh startup..."
1086         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1087 fi
1088 rm -f try
1089
1090
1091 : Save command line options in file UU/cmdline.opt for later use in
1092 : generating config.sh.
1093 cat > cmdline.opt <<EOSH
1094 # Configure command line arguments.
1095 config_arg0='$0'
1096 config_args='$*'
1097 config_argc=$#
1098 EOSH
1099 argn=1
1100 for arg in "$@"; do
1101         cat >>cmdline.opt <<EOSH
1102 config_arg$argn='$arg'
1103 EOSH
1104         argn=`expr $argn + 1`
1105 done
1106
1107 : produce awk script to parse command line options
1108 cat >options.awk <<'EOF'
1109 BEGIN {
1110         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1111
1112         len = length(optstr);
1113         for (i = 1; i <= len; i++) {
1114                 c = substr(optstr, i, 1);
1115                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1116                 if (a == ":") {
1117                         arg[c] = 1;
1118                         i++;
1119                 }
1120                 opt[c] = 1;
1121         }
1122 }
1123 {
1124         expect = 0;
1125         str = $0;
1126         if (substr(str, 1, 1) != "-") {
1127                 printf("'%s'\n", str);
1128                 next;
1129         }
1130         len = length($0);
1131         for (i = 2; i <= len; i++) {
1132                 c = substr(str, i, 1);
1133                 if (!opt[c]) {
1134                         printf("-%s\n", substr(str, i));
1135                         next;
1136                 }
1137                 printf("-%s\n", c);
1138                 if (arg[c]) {
1139                         if (i < len)
1140                                 printf("'%s'\n", substr(str, i + 1));
1141                         else
1142                                 expect = 1;
1143                         next;
1144                 }
1145         }
1146 }
1147 END {
1148         if (expect)
1149                 print "?";
1150 }
1151 EOF
1152
1153 : process the command line options
1154 set X `for arg in "$@"; do echo "X$arg"; done |
1155         sed -e s/X// | awk -f options.awk`
1156 eval "set $*"
1157 shift
1158 rm -f options.awk
1159
1160 : set up default values
1161 fastread=''
1162 reuseval=false
1163 config_sh=''
1164 alldone=''
1165 error=''
1166 silent=''
1167 extractsh=''
1168 override=''
1169 knowitall=''
1170 rm -f optdef.sh posthint.sh
1171 cat >optdef.sh <<EOS
1172 $startsh
1173 EOS
1174
1175
1176 : option parsing
1177 while test $# -gt 0; do
1178         case "$1" in
1179         -d) shift; fastread=yes;;
1180         -e) shift; alldone=cont;;
1181         -f)
1182                 shift
1183                 cd ..
1184                 if test -r "$1"; then
1185                         config_sh="$1"
1186                 else
1187                         echo "$me: cannot read config file $1." >&2
1188                         error=true
1189                 fi
1190                 cd UU
1191                 shift;;
1192         -h) shift; error=true;;
1193         -r) shift; reuseval=true;;
1194         -s) shift; silent=true; realsilent=true;;
1195         -E) shift; alldone=exit;;
1196         -K) shift; knowitall=true;;
1197         -O) shift; override=true;;
1198         -S) shift; silent=true; extractsh=true;;
1199         -D)
1200                 shift
1201                 case "$1" in
1202                 *=)
1203                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1204                         echo "$me: ignoring -D $1" >&2
1205                         ;;
1206                 *=*) echo "$1" | \
1207                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1208                 *) echo "$1='define'" >> optdef.sh;;
1209                 esac
1210                 shift
1211                 ;;
1212         -U)
1213                 shift
1214                 case "$1" in
1215                 *=) echo "$1" >> optdef.sh;;
1216                 *=*)
1217                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1218                         echo "$me: ignoring -U $1" >&2
1219                         ;;
1220                 *) echo "$1='undef'" >> optdef.sh;;
1221                 esac
1222                 shift
1223                 ;;
1224         -A)
1225             shift
1226             xxx=''
1227             yyy="$1"
1228             zzz=''
1229             uuu=undef
1230             case "$yyy" in
1231             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1232                  case "$zzz" in
1233                  *:*) zzz='' ;;
1234                  *)   xxx=append
1235                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1236                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1237                  esac
1238                  ;;
1239             esac
1240             case "$xxx" in
1241             '')  case "$yyy" in
1242                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1243                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1244                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1245                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1246                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1247                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1248                  esac
1249                  ;;       
1250             esac
1251             case "$xxx" in
1252             append)
1253                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1254             clear)
1255                 echo "$yyy=''"                  >> posthint.sh ;;
1256             define)
1257                 case "$zzz" in
1258                 '') zzz=define ;;
1259                 esac
1260                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1261             eval)
1262                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1263             prepend)
1264                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1265             undef)
1266                 case "$zzz" in
1267                 '') zzz="$uuu" ;;
1268                 esac
1269                 echo "$yyy=$zzz"                >> posthint.sh ;;
1270             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1271             esac
1272             shift
1273             ;;
1274         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1275             exit 0;;
1276         --) break;;
1277         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1278         *) break;;
1279         esac
1280 done
1281
1282 case "$error" in
1283 true)
1284         cat >&2 <<EOM
1285 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1286                  [-U symbol] [-U symbol=] [-A command:symbol...]
1287   -d : use defaults for all answers.
1288   -e : go on without questioning past the production of config.sh.
1289   -f : specify an alternate default configuration file.
1290   -h : print this help message and exit (with an error status).
1291   -r : reuse C symbols value if possible (skips costly nm extraction).
1292   -s : silent mode, only echoes questions and essential information.
1293   -D : define symbol to have some value:
1294          -D symbol         symbol gets the value 'define'
1295          -D symbol=value   symbol gets the value 'value'
1296   -E : stop at the end of questions, after having produced config.sh.
1297   -K : do not use unless you know what you are doing.
1298   -O : let -D and -U override definitions from loaded configuration file.
1299   -S : perform variable substitutions on all .SH files (can mix with -f)
1300   -U : undefine symbol:
1301          -U symbol    symbol gets the value 'undef'
1302          -U symbol=   symbol gets completely empty
1303   -A : manipulate symbol after the platform specific hints have been applied:
1304          -A symbol=value                append " "value to symbol
1305          -A append:symbol=value         append value to symbol
1306          -A define:symbol=value         define symbol to have value
1307          -A clear:symbol                define symbol to be ''
1308          -A define:symbol               define symbol to be 'define'
1309          -A eval:symbol=value           define symbol to be eval of value
1310          -A prepend:symbol=value        prepend value to symbol
1311          -A undef:symbol                define symbol to be 'undef'
1312          -A undef:symbol=               define symbol to be ''
1313   -V : print version number and exit (with a zero status).
1314 EOM
1315         exit 1
1316         ;;
1317 esac
1318
1319 : Sanity checks
1320 case "$fastread$alldone" in
1321 yescont|yesexit) ;;
1322 *)
1323         if test ! -t 0; then
1324                 echo "Say 'sh Configure', not 'sh <Configure'"
1325                 exit 1
1326         fi
1327         ;;
1328 esac
1329
1330 exec 4>&1
1331 case "$silent" in
1332 true) exec 1>/dev/null;;
1333 esac
1334
1335 : run the defines and the undefines, if any, but leave the file out there...
1336 touch optdef.sh
1337 . ./optdef.sh
1338 : create the posthint manipulation script and leave the file out there...
1339 touch posthint.sh
1340
1341 : set package name
1342 package=perl5
1343 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1344 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1345 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1346 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1347 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1348 esac
1349
1350 : Some greps do not return status, grrr.
1351 echo "grimblepritz" >grimble
1352 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1353         contains=contains
1354 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1355         contains=grep
1356 else
1357         contains=contains
1358 fi
1359 rm -f grimble
1360 : the following should work in any shell
1361 case "$contains" in
1362 contains*)
1363         echo " "
1364         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1365         cat >contains <<'EOSS'
1366 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1367 EOSS
1368 chmod +x contains
1369 esac
1370
1371 : Find the path to the source tree
1372 case "$src" in
1373 '') case "$0" in
1374     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1375          case "$src" in
1376          /*)    ;;
1377          *)     src=`cd ../$src && pwd` ;;
1378          esac
1379          ;;
1380     *)   src='.';;
1381     esac;;
1382 esac
1383 case "$src" in
1384 '')     src=/
1385         rsrc=/
1386         ;;
1387 /*) rsrc="$src";;
1388 *) rsrc="../$src";;
1389 esac
1390 if test -f $rsrc/Configure && \
1391         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1392 then
1393    : found it, so we are ok.
1394 else
1395         rsrc=''
1396         for src in . .. ../.. ../../.. ../../../..; do
1397                 if test -f ../$src/Configure && \
1398                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1399                 then
1400                         rsrc=../$src
1401                         break
1402                 fi
1403         done
1404 fi
1405 case "$rsrc" in
1406 '')
1407         cat <<EOM >&4
1408
1409 Sorry, I can't seem to locate the source dir for $package.  Please start
1410 Configure with an explicit path -- i.e. /some/path/Configure.
1411
1412 EOM
1413         exit 1
1414         ;;
1415 ../.)   rsrc='..';;
1416 *)
1417         echo " "
1418         echo "Sources for $package found in \"$src\"." >&4
1419         ;;
1420 esac
1421
1422 : script used to extract .SH files with variable substitutions
1423 cat >extract <<'EOS'
1424 CONFIGDOTSH=true
1425 echo "Doing variable substitutions on .SH files..."
1426 if test -f $src/MANIFEST; then
1427         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1428 else
1429         echo "(Looking for .SH files under the source directory.)"
1430         set x `(cd $src; find . -name "*.SH" -print)`
1431 fi
1432 shift
1433 case $# in
1434 0) set x `(cd $src; echo *.SH)`; shift;;
1435 esac
1436 if test ! -f $src/$1; then
1437         shift
1438 fi
1439 mkdir_p='
1440 name=$1;
1441 create="";
1442 while test $name; do
1443         if test ! -d "$name"; then
1444                 create="$name $create";
1445                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1446                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1447         else
1448                 name="";
1449         fi;
1450 done;
1451 for file in $create; do
1452         mkdir $file;
1453 done
1454 '
1455 for file in $*; do
1456         case "$src" in
1457         ".")
1458                 case "$file" in
1459                 */*)
1460                         dir=`expr X$file : 'X\(.*\)/'`
1461                         file=`expr X$file : 'X.*/\(.*\)'`
1462                         (cd $dir && . ./$file)
1463                         ;;
1464                 *)
1465                         . ./$file
1466                         ;;
1467                 esac
1468                 ;;
1469         *)
1470                 case "$file" in
1471                 */*)
1472                         dir=`expr X$file : 'X\(.*\)/'`
1473                         file=`expr X$file : 'X.*/\(.*\)'`
1474                         (set x $dir; shift; eval $mkdir_p)
1475                         sh <$src/$dir/$file
1476                         ;;
1477                 *)
1478                         sh <$src/$file
1479                         ;;
1480                 esac
1481                 ;;
1482         esac
1483 done
1484 if test -f $src/config_h.SH; then
1485         if test ! -f config.h; then
1486         : oops, they left it out of MANIFEST, probably, so do it anyway.
1487         . $src/config_h.SH
1488         fi
1489 fi
1490 EOS
1491
1492 : extract files and exit if asked to do so
1493 case "$extractsh" in
1494 true)
1495         case "$realsilent" in
1496         true) ;;
1497         *) exec 1>&4;;
1498         esac
1499         case "$config_sh" in
1500         '') config_sh='config.sh';;
1501         esac
1502         echo " "
1503         echo "Fetching answers from $config_sh..."
1504         cd ..
1505         . $config_sh
1506         test "$override" && . ./optdef.sh
1507         echo " "
1508         . UU/extract
1509         rm -rf UU
1510         echo "Done."
1511         exit 0
1512         ;;
1513 esac
1514
1515 : Eunice requires " " instead of "", can you believe it
1516 echo " "
1517 : Here we go...
1518 echo "Beginning of configuration questions for $package."
1519
1520 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1521
1522 : first determine how to suppress newline on echo command
1523 echo " "
1524 echo "Checking echo to see how to suppress newlines..."
1525 (echo "hi there\c" ; echo " ") >.echotmp
1526 if $contains c .echotmp >/dev/null 2>&1 ; then
1527         echo "...using -n."
1528         n='-n'
1529         c=''
1530 else
1531         cat <<'EOM'
1532 ...using \c
1533 EOM
1534         n=''
1535         c='\c'
1536 fi
1537 echo $n "The star should be here-->$c"
1538 echo '*'
1539 rm -f .echotmp
1540
1541 : Now test for existence of everything in MANIFEST
1542 echo " "
1543 if test -f $rsrc/MANIFEST; then
1544         echo "First let's make sure your kit is complete.  Checking..." >&4
1545         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1546         rm -f missing
1547         tmppwd=`pwd`
1548         for filelist in x??; do
1549                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1550         done
1551         if test -s missing; then
1552                 cat missing >&4
1553                 cat >&4 <<'EOM'
1554
1555 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1556
1557 You have the option of continuing the configuration process, despite the
1558 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1559 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1560 and contact the author (perlbug@perl.com).
1561
1562 EOM
1563                 echo $n "Continue? [n] $c" >&4
1564                 read ans
1565                 case "$ans" in
1566                 y*)
1567                         echo "Continuing..." >&4
1568                         rm -f missing
1569                         ;;
1570                 *)
1571                         echo "ABORTING..." >&4
1572                         kill $$
1573                         ;;
1574                 esac
1575         else
1576                 echo "Looks good..."
1577         fi
1578 else
1579         echo "There is no MANIFEST file.  I hope your kit is complete !"
1580 fi
1581 rm -f missing x??
1582
1583 echo " "
1584 : Find the appropriate value for a newline for tr
1585 if test -n "$DJGPP"; then
1586        trnl='\012'
1587 fi
1588 if test X"$trnl" = X; then
1589         case "`echo foo|tr '\n' x 2>/dev/null`" in
1590         foox) trnl='\n' ;;
1591         esac
1592 fi
1593 if test X"$trnl" = X; then
1594         case "`echo foo|tr '\012' x 2>/dev/null`" in
1595         foox) trnl='\012' ;;
1596         esac
1597 fi
1598 if test X"$trnl" = X; then
1599         cat <<EOM >&2
1600
1601 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1602
1603 EOM
1604         exit 1
1605 fi
1606
1607 : compute the number of columns on the terminal for proper question formatting
1608 case "$COLUMNS" in
1609 '') COLUMNS='80';;
1610 esac
1611
1612 : set up the echo used in my read
1613 myecho="case \"\$xxxm\" in
1614 '') echo $n \"\$rp $c\" >&4;;
1615 *) case \"\$rp\" in
1616         '') echo $n \"[\$xxxm] $c\";;
1617         *)
1618                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1619                         echo \"\$rp\" >&4
1620                         echo $n \"[\$xxxm] $c\" >&4
1621                 else
1622                         echo $n \"\$rp [\$xxxm] $c\" >&4
1623                 fi
1624                 ;;
1625         esac;;
1626 esac"
1627
1628 : now set up to do reads with possible shell escape and default assignment
1629 cat <<EOSC >myread
1630 $startsh
1631 xxxm=\$dflt
1632 $myecho
1633 ans='!'
1634 case "\$fastread" in
1635 yes) case "\$dflt" in
1636         '') ;;
1637         *) ans='';
1638                 case "\$silent-\$rp" in
1639                 true-) ;;
1640                 *) echo " " >&4;;
1641                 esac;;
1642         esac;;
1643 *) case "\$silent" in
1644         true) case "\$rp" in
1645                 '') ans='';;
1646                 esac;;
1647         esac;;
1648 esac
1649 while expr "X\$ans" : "X!" >/dev/null; do
1650         read answ
1651         set x \$xxxm
1652         shift
1653         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1654         case  "\$answ" in
1655         "!")
1656                 sh 1>&4
1657                 echo " "
1658                 $myecho
1659                 ;;
1660         !*)
1661                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1662                 shift
1663                 sh 1>&4 -c "\$*"
1664                 echo " "
1665                 $myecho
1666                 ;;
1667         "\$ans")
1668                 case "\$ans" in
1669                 \\&*)
1670                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1671                         shift
1672                         case "\$1" in
1673                         -d)
1674                                 fastread=yes
1675                                 echo "(OK, I'll run with -d after this question.)" >&4
1676                                 ;;
1677                         -*)
1678                                 echo "*** Sorry, \$1 not supported yet." >&4
1679                                 ;;
1680                         esac
1681                         $myecho
1682                         ans=!
1683                         ;;
1684                 esac;;
1685         *)
1686                 case "\$aok" in
1687                 y)
1688                         echo "*** Substitution done -- please confirm."
1689                         xxxm="\$ans"
1690                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1691                         xxxm="\$ans"
1692                         ans=!
1693                         ;;
1694                 *)
1695                         echo "*** Error -- try again."
1696                         ans=!
1697                         ;;
1698                 esac
1699                 $myecho
1700                 ;;
1701         esac
1702         case "\$ans\$xxxm\$nostick" in
1703         '')
1704                 ans=!
1705                 $myecho
1706                 ;;
1707         esac
1708 done
1709 case "\$ans" in
1710 '') ans="\$xxxm";;
1711 esac
1712 EOSC
1713
1714 : create .config dir to save info across Configure sessions
1715 test -d ../.config || mkdir ../.config
1716 cat >../.config/README <<EOF
1717 This directory created by Configure to save information that should
1718 persist across sessions for $package.
1719
1720 You may safely delete it if you wish.
1721 EOF
1722
1723 : general instructions
1724 needman=true
1725 firsttime=true
1726 user=`(logname) 2>/dev/null`
1727 case "$user" in
1728 '') user=`whoami 2>&1`;;
1729 esac
1730 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1731         firsttime=false
1732         echo " "
1733         rp='Would you like to see the instructions?'
1734         dflt=n
1735         . ./myread
1736         case "$ans" in
1737         [yY]*) ;;
1738         *) needman=false;;
1739         esac
1740 fi
1741 if $needman; then
1742         cat <<EOH
1743
1744 This installation shell script will examine your system and ask you questions
1745 to determine how the perl5 package should be installed. If you get
1746 stuck on a question, you may use a ! shell escape to start a subshell or
1747 execute a command.  Many of the questions will have default answers in square
1748 brackets; typing carriage return will give you the default.
1749
1750 On some of the questions which ask for file or directory names you are allowed
1751 to use the ~name construct to specify the login directory belonging to "name",
1752 even if you don't have a shell which knows about that.  Questions where this is
1753 allowed will be marked "(~name ok)".
1754
1755 EOH
1756         rp=''
1757         dflt='Type carriage return to continue'
1758         . ./myread
1759         cat <<'EOH'
1760
1761 The prompter used in this script allows you to use shell variables and
1762 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1763 in the default answer, as if the default line was a set of arguments given to a
1764 script shell.  This means you may also use $* to repeat the whole default line,
1765 so you do not have to re-type everything to add something to the default.
1766
1767 Everytime there is a substitution, you will have to confirm.  If there is an
1768 error (e.g. an unmatched backtick), the default answer will remain unchanged
1769 and you will be prompted again.
1770
1771 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1772 the questions and use the computed defaults (or the previous answers if there
1773 was already a config.sh file). Type 'Configure -h' for a list of options.
1774 You may also start interactively and then answer '& -d' at any prompt to turn
1775 on the non-interactive behaviour for the remainder of the execution.
1776
1777 EOH
1778         . ./myread
1779         cat <<EOH
1780
1781 Much effort has been expended to ensure that this shell script will run on any
1782 Unix system.  If despite that it blows up on yours, your best bet is to edit
1783 Configure and run it again.  If you can't run Configure for some reason,
1784 you'll have to generate a config.sh file by hand.  Whatever problems you
1785 have, let me (perlbug@perl.com) know how I blew it.
1786
1787 This installation script affects things in two ways:
1788
1789 1) it may do direct variable substitutions on some of the files included
1790    in this kit.
1791 2) it builds a config.h file for inclusion in C programs.  You may edit
1792    any of these files as the need arises after running this script.
1793
1794 If you make a mistake on a question, there is no easy way to back up to it
1795 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1796 files.  Configure will offer to let you do this before it runs the SH files.
1797
1798 EOH
1799         dflt='Type carriage return to continue'
1800         . ./myread
1801         case "$firsttime" in
1802         true) echo $user >>../.config/instruct;;
1803         esac
1804 fi
1805
1806 : find out where common programs are
1807 echo " "
1808 echo "Locating common programs..." >&4
1809 cat <<EOSC >loc
1810 $startsh
1811 case \$# in
1812 0) exit 1;;
1813 esac
1814 thing=\$1
1815 shift
1816 dflt=\$1
1817 shift
1818 for dir in \$*; do
1819         case "\$thing" in
1820         .)
1821         if test -d \$dir/\$thing; then
1822                 echo \$dir
1823                 exit 0
1824         fi
1825         ;;
1826         *)
1827         for thisthing in \$dir/\$thing; do
1828                 : just loop through to pick last item
1829         done
1830         if test -f \$thisthing; then
1831                 echo \$thisthing
1832                 exit 0
1833         elif test -f \$dir/\$thing.exe; then
1834                 if test -n "$DJGPP"; then
1835                         echo \$dir/\$thing.exe
1836                 else
1837                         : on Eunice apparently
1838                         echo \$dir/\$thing
1839                 fi
1840                 exit 0
1841         fi
1842         ;;
1843         esac
1844 done
1845 echo \$dflt
1846 exit 1
1847 EOSC
1848 chmod +x loc
1849 $eunicefix loc
1850 loclist="
1851 awk
1852 cat
1853 comm
1854 cp
1855 echo
1856 expr
1857 grep
1858 ls
1859 make
1860 mkdir
1861 rm
1862 sed
1863 sort
1864 touch
1865 tr
1866 uniq
1867 "
1868 trylist="
1869 Mcc
1870 ar
1871 byacc
1872 cpp
1873 csh
1874 date
1875 egrep
1876 gzip
1877 less
1878 ln
1879 more
1880 nm
1881 nroff
1882 perl
1883 pg
1884 test
1885 uname
1886 zip
1887 "
1888 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1889 pth="$pth /lib /usr/lib"
1890 for file in $loclist; do
1891         eval xxx=\$$file
1892         case "$xxx" in
1893         /*|?:[\\/]*)
1894                 if test -f "$xxx"; then
1895                         : ok
1896                 else
1897                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1898                         xxx=`./loc $file $file $pth`
1899                 fi
1900                 ;;
1901         '') xxx=`./loc $file $file $pth`;;
1902         *) xxx=`./loc $xxx $xxx $pth`;;
1903         esac
1904         eval $file=$xxx
1905         eval _$file=$xxx
1906         case "$xxx" in
1907         /*)
1908                 echo $file is in $xxx.
1909                 ;;
1910         ?:[\\/]*)
1911                 echo $file is in $xxx.
1912                 ;;
1913         *)
1914                 echo "I don't know where '$file' is, and my life depends on it." >&4
1915                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1916                 exit 1
1917                 ;;
1918         esac
1919 done
1920 echo " "
1921 echo "Don't worry if any of the following aren't found..."
1922 say=offhand
1923 for file in $trylist; do
1924         eval xxx=\$$file
1925         case "$xxx" in
1926         /*|?:[\\/]*)
1927                 if test -f "$xxx"; then
1928                         : ok
1929                 else
1930                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1931                         xxx=`./loc $file $file $pth`
1932                 fi
1933                 ;;
1934         '') xxx=`./loc $file $file $pth`;;
1935         *) xxx=`./loc $xxx $xxx $pth`;;
1936         esac
1937         eval $file=$xxx
1938         eval _$file=$xxx
1939         case "$xxx" in
1940         /*)
1941                 echo $file is in $xxx.
1942                 ;;
1943         ?:[\\/]*)
1944                 echo $file is in $xxx.
1945                 ;;
1946         *)
1947                 echo "I don't see $file out there, $say."
1948                 say=either
1949                 ;;
1950         esac
1951 done
1952 case "$egrep" in
1953 egrep)
1954         echo "Substituting grep for egrep."
1955         egrep=$grep
1956         ;;
1957 esac
1958 case "$ln" in
1959 ln)
1960         echo "Substituting cp for ln."
1961         ln=$cp
1962         ;;
1963 esac
1964 case "$test" in
1965 test)
1966         echo "Hopefully test is built into your sh."
1967         ;;
1968 *)
1969         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1970                 echo "Using the test built into your sh."
1971                 test=test
1972                 _test=test
1973         fi
1974         ;;
1975 esac
1976 case "$echo" in
1977 echo)
1978         echo "Hopefully echo is built into your sh."
1979         ;;
1980 '') ;;
1981 *)
1982         echo " "
1983 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1984         $echo $n "hi there$c" >foo1
1985         echo $n "hi there$c" >foo2
1986         if cmp foo1 foo2 >/dev/null 2>&1; then
1987                 echo "They are compatible.  In fact, they may be identical."
1988         else
1989                 case "$n" in
1990                 '-n') n='' c='\c';;
1991                 *) n='-n' c='';;
1992                 esac
1993                 cat <<FOO
1994 They are not compatible!  You are probably running ksh on a non-USG system.
1995 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1996 have echo built in and we may have to run some Bourne shell scripts.  That
1997 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1998
1999 FOO
2000                 $echo $n "The star should be here-->$c"
2001                 $echo "*"
2002         fi
2003         $rm -f foo1 foo2
2004         ;;
2005 esac
2006
2007 : determine whether symbolic links are supported
2008 echo " "
2009 $touch blurfl
2010 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2011         echo "Symbolic links are supported." >&4
2012         lns="$ln -s"
2013 else
2014         echo "Symbolic links are NOT supported." >&4
2015         lns="$ln"
2016 fi
2017 $rm -f blurfl sym
2018
2019 : see whether [:lower:] and [:upper:] are supported character classes
2020 echo " "
2021 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2022 ABYZ)
2023         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2024         up='[:upper:]'
2025         low='[:lower:]'
2026         ;;
2027 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2028         # (0xc9 and 0xd1), therefore that is a nice testing point.
2029         if test "X$up" = X -o "X$low" = X; then
2030             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2031             ij) up='[A-Z]'
2032                 low='[a-z]'
2033                 ;;
2034             esac
2035         fi
2036         if test "X$up" = X -o "X$low" = X; then
2037             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2038             ij) up='A-Z'
2039                 low='a-z'
2040                 ;;
2041             esac
2042         fi
2043         if test "X$up" = X -o "X$low" = X; then
2044             case "`echo IJ | od -x 2>/dev/null`" in
2045             *C9D1*|*c9d1*)
2046                 echo "Hey, this might be EBCDIC." >&4
2047                 if test "X$up" = X -o "X$low" = X; then
2048                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2049                     ij) up='[A-IJ-RS-Z]'
2050                         low='[a-ij-rs-z]'
2051                         ;;
2052                     esac
2053                 fi
2054                 if test "X$up" = X -o "X$low" = X; then
2055                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2056                     ij) up='A-IJ-RS-Z'
2057                         low='a-ij-rs-z'
2058                         ;;
2059                     esac
2060                 fi
2061                 ;;
2062             esac
2063         fi
2064 esac
2065 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2066 ij)
2067     echo "Using $up and $low to convert case." >&4
2068     ;;
2069 *)
2070     echo "I don't know how to translate letters from upper to lower case." >&4
2071     echo "Your tr is not acting any way I know of." >&4
2072     exit 1
2073     ;;
2074 esac
2075 : set up the translation script tr, must be called with ./tr of course
2076 cat >tr <<EOSC
2077 $startsh
2078 case "\$1\$2" in
2079 '[A-Z][a-z]') exec $tr '$up' '$low';;
2080 '[a-z][A-Z]') exec $tr '$low' '$up';;
2081 esac
2082 exec $tr "\$@"
2083 EOSC
2084 chmod +x tr
2085 $eunicefix tr
2086
2087 : Try to determine whether config.sh was made on this system
2088 case "$config_sh" in
2089 '')
2090 myuname=`$uname -a 2>/dev/null`
2091 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2092 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2093 # because the A-Z/a-z are not consecutive.
2094 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2095         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2096 newmyuname="$myuname"
2097 dflt=n
2098 case "$knowitall" in
2099 '')
2100         if test -f ../config.sh; then
2101                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2102                         eval "`grep myuname= ../config.sh`"
2103                 fi
2104                 if test "X$myuname" = "X$newmyuname"; then
2105                         dflt=y
2106                 fi
2107         fi
2108         ;;
2109 *) dflt=y;;
2110 esac
2111
2112 : Get old answers from old config file if Configure was run on the
2113 : same system, otherwise use the hints.
2114 hint=default
2115 cd ..
2116 if test -f config.sh; then
2117         echo " "
2118         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2119         . UU/myread
2120         case "$ans" in
2121         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2122         *)  echo "Fetching default answers from your old config.sh file..." >&4
2123                 tmp_n="$n"
2124                 tmp_c="$c"
2125                 tmp_sh="$sh"
2126                 . ./config.sh
2127                 cp config.sh UU
2128                 n="$tmp_n"
2129                 c="$tmp_c"
2130                 : Older versions did not always set $sh.  Catch re-use of such
2131                 : an old config.sh.
2132                 case "$sh" in
2133                 '') sh="$tmp_sh" ;;
2134                 esac
2135                 hint=previous
2136                 ;;
2137         esac
2138 fi
2139 if test ! -f config.sh; then
2140         $cat <<EOM
2141
2142 First time through, eh?  I have some defaults handy for some systems
2143 that need some extra help getting the Configure answers right:
2144
2145 EOM
2146         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2147         dflt=''
2148         : Half the following guesses are probably wrong... If you have better
2149         : tests or hints, please send them to perlbug@perl.com
2150         : The metaconfig authors would also appreciate a copy...
2151         $test -f /irix && osname=irix
2152         $test -f /xenix && osname=sco_xenix
2153         $test -f /dynix && osname=dynix
2154         $test -f /dnix && osname=dnix
2155         $test -f /lynx.os && osname=lynxos
2156         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2157         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2158         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2159         $test -f /bin/mips && /bin/mips && osname=mips
2160         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2161                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2162         $test -d /usr/apollo/bin && osname=apollo
2163         $test -f /etc/saf/_sactab && osname=svr4
2164         $test -d /usr/include/minix && osname=minix
2165         if $test -d /MachTen -o -d /MachTen_Folder; then
2166                 osname=machten
2167                 if $test -x /sbin/version; then
2168                         osvers=`/sbin/version | $awk '{print $2}' |
2169                         $sed -e 's/[A-Za-z]$//'`
2170                 elif $test -x /usr/etc/version; then
2171                         osvers=`/usr/etc/version | $awk '{print $2}' |
2172                         $sed -e 's/[A-Za-z]$//'`
2173                 else
2174                         osvers="$2.$3"
2175                 fi
2176         fi
2177
2178         $test -f /sys/posix.dll &&
2179                 $test -f /usr/bin/what &&
2180                 set X `/usr/bin/what /sys/posix.dll` &&
2181                 $test "$3" = UWIN &&
2182                 osname=uwin &&
2183                 osvers="$5"
2184
2185         if $test -f $uname; then
2186                 set X $myuname
2187                 shift
2188
2189                 case "$5" in
2190                 fps*) osname=fps ;;
2191                 mips*)
2192                         case "$4" in
2193                         umips) osname=umips ;;
2194                         *) osname=mips ;;
2195                         esac;;
2196                 [23]100) osname=mips ;;
2197                 next*) osname=next ;;
2198                 i386*)
2199                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2200                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2201                                 osname='sco'
2202                                 osvers=$tmp
2203                         elif $test -f /etc/kconfig; then
2204                                 osname=isc
2205                                 if test "$lns" = "$ln -s"; then
2206                                         osvers=4
2207                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2208                                         osvers=3
2209                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2210                                         osvers=2
2211                                 fi
2212                         fi
2213                         tmp=''
2214                         ;;
2215                 pc*)
2216                         if test -n "$DJGPP"; then
2217                                 osname=dos
2218                                 osvers=djgpp
2219                         fi
2220                         ;;
2221                 esac
2222
2223                 case "$1" in
2224                 aix) osname=aix
2225                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2226                         case "$tmp" in
2227                         'not found') osvers="$4"."$3" ;;
2228                         '<3240'|'<>3240') osvers=3.2.0 ;;
2229                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2230                         '=3250'|'>3250') osvers=3.2.5 ;;
2231                         *) osvers=$tmp;;
2232                         esac
2233                         ;;
2234                 bsd386) osname=bsd386
2235                         osvers=`$uname -r`
2236                         ;;
2237                 cygwin*) osname=cygwin
2238                         osvers="$3"
2239                         ;;
2240                 *dc.osx) osname=dcosx
2241                         osvers="$3"
2242                         ;;
2243                 dnix) osname=dnix
2244                         osvers="$3"
2245                         ;;
2246                 domainos) osname=apollo
2247                         osvers="$3"
2248                         ;;
2249                 dgux) osname=dgux 
2250                         osvers="$3"
2251                         ;;
2252                 dynixptx*) osname=dynixptx
2253                         osvers=`echo "$4"|sed 's/^v//'`
2254                         ;;
2255                 freebsd) osname=freebsd 
2256                         osvers="$3" ;;
2257                 genix) osname=genix ;;
2258                 hp*) osname=hpux 
2259                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2260                         ;;
2261                 irix*) osname=irix
2262                         case "$3" in
2263                         4*) osvers=4 ;;
2264                         5*) osvers=5 ;;
2265                         *)      osvers="$3" ;;
2266                         esac
2267                         ;;
2268                 linux) osname=linux
2269                         case "$3" in
2270                         *)      osvers="$3" ;;
2271                         esac
2272                         ;;
2273                 MiNT) osname=mint
2274                         ;;
2275                 netbsd*) osname=netbsd
2276                         osvers="$3"
2277                         ;;
2278                 news-os) osvers="$3"
2279                         case "$3" in
2280                         4*) osname=newsos4 ;;
2281                         *) osname=newsos ;;
2282                         esac
2283                         ;;
2284                 next*) osname=next ;;
2285                 POSIX-BC | posix-bc ) osname=posix-bc
2286                         osvers="$3"
2287                         ;;
2288                 powerux | power_ux | powermax_os | powermaxos | \
2289                 powerunix | power_unix) osname=powerux
2290                         osvers="$3"
2291                         ;;
2292                 qnx) osname=qnx
2293                         osvers="$4"
2294                         ;;
2295                 solaris) osname=solaris
2296                         case "$3" in
2297                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2298                         *)      osvers="$3" ;;
2299                         esac
2300                         ;;
2301                 sunos) osname=sunos
2302                         case "$3" in
2303                         5*) osname=solaris
2304                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2305                         *)      osvers="$3" ;;
2306                         esac
2307                         ;;
2308                 titanos) osname=titanos
2309                         case "$3" in
2310                         1*) osvers=1 ;;
2311                         2*) osvers=2 ;;
2312                         3*) osvers=3 ;;
2313                         4*) osvers=4 ;;
2314                         *)      osvers="$3" ;;
2315                         esac
2316                         ;;
2317                 ultrix) osname=ultrix
2318                         osvers="$3"
2319                         ;;
2320                 osf1|mls+)      case "$5" in
2321                                 alpha)
2322                                         osname=dec_osf
2323                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2324                                         ;;
2325                         hp*)    osname=hp_osf1  ;;
2326                         mips)   osname=mips_osf1 ;;
2327                         esac
2328                         ;;
2329                 unixware) osname=svr5
2330                         osvers="$4"
2331                         ;;
2332                 uts) osname=uts
2333                         osvers="$3"
2334                         ;;
2335                 $2) case "$osname" in
2336                         *isc*) ;;
2337                         *freebsd*) ;;
2338                         svr*)
2339                                 : svr4.x or possibly later
2340                                 case "svr$3" in 
2341                                 ${osname}*)
2342                                         osname=svr$3
2343                                         osvers=$4
2344                                         ;;
2345                                 esac
2346                                 case "$osname" in
2347                                 svr4.0)
2348                                         : Check for ESIX
2349                                         if test -f /stand/boot ; then
2350                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2351                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2352                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2353                                                         if test -n "$isesix"; then
2354                                                                 osname=esix4
2355                                                         fi
2356                                                 fi
2357                                         fi
2358                                         ;;
2359                                 esac
2360                                 ;;
2361                         *)      if test -f /etc/systemid; then
2362                                         osname=sco
2363                                         set `echo $3 | $sed 's/\./ /g'` $4
2364                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2365                                                 osvers=$1.$2.$3
2366                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2367                                                 osvers=$1.$2
2368                                         elif $test -f $src/hints/sco_$1.sh; then
2369                                                 osvers=$1
2370                                         fi
2371                                 else
2372                                         case "$osname" in
2373                                         '') : Still unknown.  Probably a generic Sys V.
2374                                                 osname="sysv"
2375                                                 osvers="$3"
2376                                                 ;;
2377                                         esac
2378                                 fi
2379                                 ;;
2380                         esac
2381                         ;;
2382                 *)      case "$osname" in
2383                         '') : Still unknown.  Probably a generic BSD.
2384                                 osname="$1"
2385                                 osvers="$3"
2386                                 ;;
2387                         esac
2388                         ;;
2389                 esac
2390         else
2391                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2392                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2393                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2394                                 osname=news_os
2395                         fi
2396                         $rm -f UU/kernel.what
2397                 elif test -d c:/.; then
2398                         set X $myuname
2399                         osname=os2
2400                         osvers="$5"
2401                 fi
2402         fi
2403         
2404         : Now look for a hint file osname_osvers, unless one has been
2405         : specified already.
2406         case "$hintfile" in
2407         ''|' ')
2408                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2409                 : Also try without trailing minor version numbers.
2410                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2411                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2412                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2413                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2414                 case "$file" in
2415                 '') dflt=none ;;
2416                 *)  case "$osvers" in
2417                         '') dflt=$file
2418                                 ;;
2419                         *)  if $test -f $src/hints/$file.sh ; then
2420                                         dflt=$file
2421                                 elif $test -f $src/hints/$xfile.sh ; then
2422                                         dflt=$xfile
2423                                 elif $test -f $src/hints/$xxfile.sh ; then
2424                                         dflt=$xxfile
2425                                 elif $test -f $src/hints/$xxxfile.sh ; then
2426                                         dflt=$xxxfile
2427                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2428                                         dflt=$xxxxfile
2429                                 elif $test -f "$src/hints/${osname}.sh" ; then
2430                                         dflt="${osname}"
2431                                 else
2432                                         dflt=none
2433                                 fi
2434                                 ;;
2435                         esac
2436                         ;;
2437                 esac
2438                 if $test -f Policy.sh ; then
2439                         case "$dflt" in
2440                         *Policy*) ;;
2441                         none) dflt="Policy" ;;
2442                         *) dflt="Policy $dflt" ;;
2443                         esac
2444                 fi
2445                 ;;
2446         *)
2447                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2448                 ;;
2449         esac
2450
2451         if $test -f Policy.sh ; then
2452                 $cat <<EOM
2453
2454 There's also a Policy hint file available, which should make the
2455 site-specific (policy) questions easier to answer.
2456 EOM
2457
2458         fi
2459
2460         $cat <<EOM
2461
2462 You may give one or more space-separated answers, or "none" if appropriate.
2463 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2464 is a good thing.  DO NOT give a wrong version or a wrong OS.
2465
2466 EOM
2467
2468         rp="Which of these apply, if any?"
2469         . UU/myread
2470         tans=$ans
2471         for file in $tans; do
2472                 if $test X$file = XPolicy -a -f Policy.sh; then
2473                         . Policy.sh
2474                         $cat Policy.sh >> UU/config.sh
2475                 elif $test -f $src/hints/$file.sh; then
2476                         . $src/hints/$file.sh
2477                         $cat $src/hints/$file.sh >> UU/config.sh
2478                 elif $test X$tans = X -o X$tans = Xnone ; then
2479                         : nothing
2480                 else
2481                         : Give one chance to correct a possible typo.
2482                         echo "$file.sh does not exist"
2483                         dflt=$file
2484                         rp="hint to use instead?"
2485                         . UU/myread
2486                         for file in $ans; do
2487                                 if $test -f "$src/hints/$file.sh"; then
2488                                         . $src/hints/$file.sh
2489                                         $cat $src/hints/$file.sh >> UU/config.sh
2490                                 elif $test X$ans = X -o X$ans = Xnone ; then
2491                                         : nothing
2492                                 else
2493                                         echo "$file.sh does not exist -- ignored."
2494                                 fi
2495                         done
2496                 fi
2497         done
2498
2499         hint=recommended
2500         : Remember our hint file for later.
2501         if $test -f "$src/hints/$file.sh" ; then
2502                 hintfile="$file"
2503         else
2504                 hintfile=''
2505         fi
2506 fi
2507 cd UU
2508 ;;
2509 *)
2510         echo " "
2511         echo "Fetching default answers from $config_sh..." >&4
2512         tmp_n="$n"
2513         tmp_c="$c"
2514         cd ..
2515         cp $config_sh config.sh 2>/dev/null
2516         chmod +w config.sh
2517         . ./config.sh
2518         cd UU
2519         cp ../config.sh .
2520         n="$tmp_n"
2521         c="$tmp_c"
2522         hint=previous
2523         ;;
2524 esac
2525 test "$override" && . ./optdef.sh
2526 myuname="$newmyuname"
2527
2528 : Restore computed paths
2529 for file in $loclist $trylist; do
2530         eval $file="\$_$file"
2531 done
2532
2533 cat << EOM
2534
2535 Configure uses the operating system name and version to set some defaults.
2536 The default value is probably right if the name rings a bell. Otherwise,
2537 since spelling matters for me, either accept the default or answer "none"
2538 to leave it blank.
2539
2540 EOM
2541 case "$osname" in
2542         ''|' ')
2543                 case "$hintfile" in
2544                 ''|' '|none) dflt=none ;;
2545                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2546                 esac
2547                 ;;
2548         *) dflt="$osname" ;;
2549 esac
2550 rp="Operating system name?"
2551 . ./myread
2552 case "$ans" in
2553 none)  osname='' ;;
2554 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2555 esac
2556 echo " "
2557 case "$osvers" in
2558         ''|' ')
2559                 case "$hintfile" in
2560                 ''|' '|none) dflt=none ;;
2561                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2562                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2563                         case "$dflt" in
2564                         ''|' ') dflt=none ;;
2565                         esac
2566                         ;;
2567                 esac
2568                 ;;
2569         *) dflt="$osvers" ;;
2570 esac
2571 rp="Operating system version?"
2572 . ./myread
2573 case "$ans" in
2574 none)  osvers='' ;;
2575 *) osvers="$ans" ;;
2576 esac
2577
2578
2579 . ./posthint.sh
2580
2581 : who configured the system
2582 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2583 cf_by=`(logname) 2>/dev/null`
2584 case "$cf_by" in
2585 "")
2586         cf_by=`(whoami) 2>/dev/null`
2587         case "$cf_by" in
2588         "") cf_by=unknown ;;
2589         esac ;;
2590 esac
2591
2592 : set up the script used to warn in case of inconsistency
2593 cat <<EOS >whoa
2594 $startsh
2595 EOS
2596 cat <<'EOSC' >>whoa
2597 dflt=y
2598 echo " "
2599 echo "*** WHOA THERE!!! ***" >&4
2600 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2601 rp="    Keep the $hint value?"
2602 . ./myread
2603 case "$ans" in
2604 y) td=$was; tu=$was;;
2605 esac
2606 EOSC
2607
2608 : function used to set $1 to $val
2609 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2610 case "$val$was" in
2611 $define$undef) . ./whoa; eval "$var=\$td";;
2612 $undef$define) . ./whoa; eval "$var=\$tu";;
2613 *) eval "$var=$val";;
2614 esac'
2615
2616 case "$usethreads" in
2617 $define|true|[yY]*)     dflt='y';;
2618 *) dflt='n';;
2619 esac
2620 cat <<EOM
2621
2622 Perl can be built to take advantage of threads on some systems.
2623 To do so, Configure can be run with -Dusethreads.
2624
2625 Note that threading is a highly experimental feature, and
2626 some known race conditions still remain.  If you choose to try
2627 it, be very sure to not actually deploy it for production
2628 purposes.  README.threads has more details, and is required
2629 reading if you enable threads.
2630
2631 If this doesn't make any sense to you, just accept the default '$dflt'.
2632 EOM
2633 rp='Build a threading Perl?'
2634 . ./myread
2635 case "$ans" in
2636 y|Y)    val="$define" ;;
2637 *)      val="$undef" ;;
2638 esac
2639 set usethreads
2640 eval $setvar
2641
2642 case "$usethreads" in
2643 $define)
2644         $cat <<EOM
2645
2646 As of 5.5.640, Perl has two different internal threading implementations,
2647 the 5.005 version (5005threads) and an interpreter-based version
2648 (ithreads) that has one interpreter per thread.  Both are very 
2649 experimental.  This arrangement exists to help developers work out
2650 which one is better.
2651
2652 If you're a casual user, you probably don't want interpreter-threads
2653 at this time.  There doesn't yet exist a way to create threads from
2654 within Perl in this model, i.e., "use Thread;" will NOT work.
2655 EOM
2656         : Default to ithreads unless overridden on command line or with
2657         : old config.sh
2658         dflt='y'
2659         case "$use5005threads" in
2660                 $define|true|[yY]*) dflt='n';;
2661         esac
2662         case "$useithreads" in
2663                 $undef|false|[nN]*) dflt='n';;
2664         esac
2665         rp='Use interpreter-based ithreads?'
2666         . ./myread
2667         case "$ans" in
2668         y|Y)    val="$define" ;;
2669         *)      val="$undef" ;;
2670         esac
2671         set useithreads
2672         eval $setvar
2673         : Now set use5005threads to the opposite value.
2674         case "$useithreads" in
2675         $define) val="$undef" ;;
2676         *) val="$define" ;;
2677         esac
2678         set use5005threads
2679         eval $setvar
2680         ;;
2681 *)
2682         useithreads="$undef"
2683         use5005threads="$undef"
2684         ;;
2685 esac
2686
2687 case "$d_oldpthreads" in
2688 '')     : Configure tests would be welcome here.  For now, assume undef.
2689         val="$undef" ;;
2690 *)      val="$d_oldpthreads" ;;
2691 esac
2692 set d_oldpthreads
2693 eval $setvar
2694
2695
2696 case "$usethreads" in
2697 "$define"|true|[yY]*)
2698 : Look for a hint-file generated 'call-back-unit'.  If the
2699 : user has specified that a threading perl is to be built,
2700 : we may need to set or change some other defaults.
2701         if $test -f usethreads.cbu; then
2702                 echo "Your platform has some specific hints for threaded builds, using them..."
2703                 . ./usethreads.cbu
2704         else
2705                 $cat <<EOM
2706 (Your platform doesn't have any specific hints for threaded builds.
2707  Assuming POSIX threads, then.)
2708 EOM
2709         fi
2710         ;;
2711 esac
2712
2713 cat <<EOM
2714
2715 Perl can be built so that multiple Perl interpreters can coexist
2716 within the same Perl executable.
2717 EOM
2718
2719 case "$useithreads" in
2720 $define)
2721         cat <<EOM
2722 This multiple interpreter support is required for interpreter-based threads.
2723 EOM
2724         val="$define"
2725         ;;
2726 *)      case "$usemultiplicity" in
2727         $define|true|[yY]*)     dflt='y';;
2728         *) dflt='n';;
2729         esac
2730         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2731         rp='Build Perl for multiplicity?'
2732         . ./myread
2733         case "$ans" in
2734         y|Y)    val="$define" ;;
2735         *)      val="$undef" ;;
2736         esac
2737         ;;
2738 esac
2739 set usemultiplicity
2740 eval $setvar
2741
2742 : determine where manual pages are on this system
2743 echo " "
2744 case "$sysman" in
2745 '') 
2746         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2747         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2748         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2749         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2750         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2751         sysman=`./loc . /usr/man/man1 $syspath`
2752         ;;
2753 esac
2754 if $test -d "$sysman"; then
2755         echo "System manual is in $sysman." >&4
2756 else
2757         echo "Could not find manual pages in source form." >&4
2758 fi
2759
2760 : see what memory models we can support
2761 case "$models" in
2762 '')
2763         $cat >pdp11.c <<'EOP'
2764 int main() {
2765 #ifdef pdp11
2766         exit(0);
2767 #else
2768         exit(1);
2769 #endif
2770 }
2771 EOP
2772         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2773         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2774                 dflt='unsplit split'
2775         else
2776                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2777                 case "$tans" in
2778                 X) dflt='none';;
2779                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2780                                 dflt='small'
2781                         else
2782                                 dflt=''
2783                         fi
2784                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2785                                 dflt="$dflt medium"
2786                         fi
2787                         if $test -d /lib/large || $test -d /usr/lib/large; then
2788                                 dflt="$dflt large"
2789                         fi
2790                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2791                                 dflt="$dflt huge"
2792                         fi
2793                 esac
2794         fi;;
2795 *) dflt="$models";;
2796 esac
2797 $cat <<EOM
2798  
2799 Some systems have different model sizes.  On most systems they are called
2800 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2801 split.  If your system doesn't support different memory models, say "none".
2802 If you wish to force everything to one memory model, say "none" here and
2803 put the appropriate flags later when it asks you for other cc and ld flags.
2804 Venix systems may wish to put "none" and let the compiler figure things out.
2805 (In the following question multiple model names should be space separated.)
2806
2807 The default for most systems is "none".
2808
2809 EOM
2810 rp="Which memory models are supported?"
2811 . ./myread
2812 models="$ans"
2813
2814 case "$models" in
2815 none)
2816         small=''
2817         medium=''
2818         large=''
2819         huge=''
2820         unsplit=''
2821         split=''
2822         ;;
2823 *split)
2824         case "$split" in
2825         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2826                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2827                         dflt='-i'
2828                 else
2829                         dflt='none'
2830                 fi;;
2831         *) dflt="$split";;
2832         esac
2833         rp="What flag indicates separate I and D space?"
2834         . ./myread
2835         tans="$ans"
2836         case "$tans" in
2837         none) tans='';;
2838         esac
2839         split="$tans"
2840         unsplit='';;
2841 *large*|*small*|*medium*|*huge*)
2842         case "$models" in
2843         *large*)
2844                 case "$large" in
2845                 '') dflt='-Ml';;
2846                 *) dflt="$large";;
2847                 esac
2848         rp="What flag indicates large model?"
2849         . ./myread
2850         tans="$ans"
2851         case "$tans" in
2852         none) tans='';
2853         esac
2854         large="$tans";;
2855         *) large='';;
2856         esac
2857         case "$models" in
2858         *huge*) case "$huge" in
2859                 '') dflt='-Mh';;
2860                 *) dflt="$huge";;
2861                 esac
2862                 rp="What flag indicates huge model?"
2863                 . ./myread
2864                 tans="$ans"
2865                 case "$tans" in
2866                 none) tans='';
2867                 esac
2868                 huge="$tans";;
2869         *) huge="$large";;
2870         esac
2871         case "$models" in
2872         *medium*) case "$medium" in
2873                 '') dflt='-Mm';;
2874                 *) dflt="$medium";;
2875                 esac
2876                 rp="What flag indicates medium model?"
2877                 . ./myread
2878                 tans="$ans"
2879                 case "$tans" in
2880                 none) tans='';
2881                 esac
2882                 medium="$tans";;
2883         *) medium="$large";;
2884         esac
2885         case "$models" in
2886         *small*) case "$small" in
2887                 '') dflt='none';;
2888                 *) dflt="$small";;
2889                 esac
2890                 rp="What flag indicates small model?"
2891                 . ./myread
2892                 tans="$ans"
2893                 case "$tans" in
2894                 none) tans='';
2895                 esac
2896                 small="$tans";;
2897         *) small='';;
2898         esac
2899         ;;
2900 *)
2901         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2902         ;;
2903 esac
2904 $rm -f pdp11.* pdp11
2905
2906 : make some quick guesses about what we are up against
2907 echo " "
2908 $echo $n "Hmm...  $c"
2909 echo exit 1 >bsd
2910 echo exit 1 >usg
2911 echo exit 1 >v7
2912 echo exit 1 >osf1
2913 echo exit 1 >eunice
2914 echo exit 1 >xenix
2915 echo exit 1 >venix
2916 echo exit 1 >os2
2917 d_bsd="$undef"
2918 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2919 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2920 then
2921         echo "Looks kind of like an OSF/1 system, but we'll see..."
2922         echo exit 0 >osf1
2923 elif test `echo abc | tr a-z A-Z` = Abc ; then
2924         xxx=`./loc addbib blurfl $pth`
2925         if $test -f $xxx; then
2926         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2927                 echo exit 0 >bsd
2928                 echo exit 0 >usg
2929         else
2930                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2931                         echo "Looks kind of like an extended USG system, but we'll see..."
2932                 else
2933                         echo "Looks kind of like a USG system, but we'll see..."
2934                 fi
2935                 echo exit 0 >usg
2936         fi
2937 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2938         echo "Looks kind of like a BSD system, but we'll see..."
2939         d_bsd="$define"
2940         echo exit 0 >bsd
2941 else
2942         echo "Looks kind of like a Version 7 system, but we'll see..."
2943         echo exit 0 >v7
2944 fi
2945 case "$eunicefix" in
2946 *unixtovms*)
2947         $cat <<'EOI'
2948 There is, however, a strange, musty smell in the air that reminds me of
2949 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2950 EOI
2951         echo exit 0 >eunice
2952         d_eunice="$define"
2953 : it so happens the Eunice I know will not run shell scripts in Unix format
2954         ;;
2955 *)
2956         echo " "
2957         echo "Congratulations.  You aren't running Eunice."
2958         d_eunice="$undef"
2959         ;;
2960 esac
2961 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2962 case "$p_" in
2963 :) ;;
2964 *)
2965         $cat <<'EOI'
2966 I have the feeling something is not exactly right, however...don't tell me...
2967 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2968 EOI
2969         echo exit 0 >os2
2970         ;;
2971 esac
2972 if test -f /xenix; then
2973         echo "Actually, this looks more like a XENIX system..."
2974         echo exit 0 >xenix
2975         d_xenix="$define"
2976 else
2977         echo " "
2978         echo "It's not Xenix..."
2979         d_xenix="$undef"
2980 fi
2981 chmod +x xenix
2982 $eunicefix xenix
2983 if test -f /venix; then
2984         echo "Actually, this looks more like a VENIX system..."
2985         echo exit 0 >venix
2986 else
2987         echo " "
2988         if ./xenix; then
2989                 : null
2990         else
2991                 echo "Nor is it Venix..."
2992         fi
2993 fi
2994 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2995 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2996 $rm -f foo
2997
2998 : see if we need a special compiler
2999 echo " "
3000 if ./usg; then
3001         case "$cc" in
3002         '') case "$Mcc" in
3003                 /*) dflt='Mcc';;
3004                 *) case "$large" in
3005                         -M*) dflt='cc';;
3006                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3007                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3008                                                 dflt='cc'
3009                                         else
3010                                                 dflt='cc -M'
3011                                         fi
3012                                 else
3013                                         dflt='cc'
3014                                 fi;;
3015                         esac;;
3016                 esac;;
3017         *)  dflt="$cc";;
3018         esac
3019         case "$dflt" in
3020         *M*)    $cat <<'EOM'
3021 On some older systems the default C compiler will not resolve multiple global
3022 references that happen to have the same name.  On some such systems the "Mcc"
3023 command may be used to force these to be resolved.  On other systems a "cc -M"
3024 command is required.  (Note that the -M flag on other systems indicates a
3025 memory model to use!) If you have the Gnu C compiler, you might wish to use
3026 that instead.
3027
3028 EOM
3029         ;;
3030         esac
3031         rp="Use which C compiler?"
3032         . ./myread
3033         cc="$ans"
3034 else
3035         case "$cc" in
3036         '') dflt=cc;;
3037         *) dflt="$cc";;
3038         esac
3039         rp="Use which C compiler?"
3040         . ./myread
3041         cc="$ans"
3042 fi
3043 : Look for a hint-file generated 'call-back-unit'.  Now that the
3044 : user has specified the compiler, we may need to set or change some
3045 : other defaults.
3046 if $test -f cc.cbu; then
3047     . ./cc.cbu
3048 fi
3049 echo " "
3050 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3051 $cat >gccvers.c <<EOM
3052 #include <stdio.h>
3053 int main() {
3054 #ifdef __GNUC__
3055 #ifdef __VERSION__
3056         printf("%s\n", __VERSION__);
3057 #else
3058         printf("%s\n", "1");
3059 #endif
3060 #endif
3061         exit(0);
3062 }
3063 EOM
3064 if $cc $ldflags -o gccvers gccvers.c; then
3065         gccversion=`./gccvers`
3066         case "$gccversion" in
3067         '') echo "You are not using GNU cc." ;;
3068         *)  echo "You are using GNU cc $gccversion."
3069             ;;
3070         esac
3071 else
3072         echo " "
3073         echo "*** WHOA THERE!!! ***" >&4
3074         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3075         case "$knowitall" in
3076         '')
3077         echo "    You'd better start hunting for one and let me know about it." >&4
3078                 exit 1
3079                 ;;
3080         esac
3081 fi
3082 $rm -f gccvers*
3083 case "$gccversion" in
3084 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3085 esac
3086
3087 : decide how portable to be.  Allow command line overrides.
3088 case "$d_portable" in
3089 "$undef") ;;
3090 *)      d_portable="$define" ;;
3091 esac
3092
3093 : set up shell script to do ~ expansion
3094 cat >filexp <<EOSS
3095 $startsh
3096 : expand filename
3097 case "\$1" in
3098  ~/*|~)
3099         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3100         ;;
3101  ~*)
3102         if $test -f /bin/csh; then
3103                 /bin/csh -f -c "glob \$1"
3104                 failed=\$?
3105                 echo ""
3106                 exit \$failed
3107         else
3108                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3109                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3110                 if $test ! -d "\$dir"; then
3111                         me=\`basename \$0\`
3112                         echo "\$me: can't locate home directory for: \$name" >&2
3113                         exit 1
3114                 fi
3115                 case "\$1" in
3116                 */*)
3117                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3118                         ;;
3119                 *)
3120                         echo \$dir
3121                         ;;
3122                 esac
3123         fi
3124         ;;
3125 *)
3126         echo \$1
3127         ;;
3128 esac
3129 EOSS
3130 chmod +x filexp
3131 $eunicefix filexp
3132
3133 : now set up to get a file name
3134 cat <<EOS >getfile
3135 $startsh
3136 EOS
3137 cat <<'EOSC' >>getfile
3138 tilde=''
3139 fullpath=''
3140 already=''
3141 skip=''
3142 none_ok=''
3143 exp_file=''
3144 nopath_ok=''
3145 orig_rp="$rp"
3146 orig_dflt="$dflt"
3147 case "$gfpth" in
3148 '') gfpth='.' ;;
3149 esac
3150
3151 case "$fn" in
3152 *\(*)
3153         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3154         fn=`echo $fn | sed 's/(.*)//'`
3155         ;;
3156 esac
3157
3158 case "$fn" in
3159 *:*)
3160         loc_file=`expr $fn : '.*:\(.*\)'`
3161         fn=`expr $fn : '\(.*\):.*'`
3162         ;;
3163 esac
3164
3165 case "$fn" in
3166 *~*) tilde=true;;
3167 esac
3168 case "$fn" in
3169 */*) fullpath=true;;
3170 esac
3171 case "$fn" in
3172 *+*) skip=true;;
3173 esac
3174 case "$fn" in
3175 *n*) none_ok=true;;
3176 esac
3177 case "$fn" in
3178 *e*) exp_file=true;;
3179 esac
3180 case "$fn" in
3181 *p*) nopath_ok=true;;
3182 esac
3183
3184 case "$fn" in
3185 *f*) type='File';;
3186 *d*) type='Directory';;
3187 *l*) type='Locate';;
3188 esac
3189
3190 what="$type"
3191 case "$what" in
3192 Locate) what='File';;
3193 esac
3194
3195 case "$exp_file" in
3196 '')
3197         case "$d_portable" in
3198         "$define") ;;
3199         *) exp_file=true;;
3200         esac
3201         ;;
3202 esac
3203
3204 cd ..
3205 while test "$type"; do
3206         redo=''
3207         rp="$orig_rp"
3208         dflt="$orig_dflt"
3209         case "$tilde" in
3210         true) rp="$rp (~name ok)";;
3211         esac
3212         . UU/myread
3213         if test -f UU/getfile.ok && \
3214                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3215         then
3216                 value="$ans"
3217                 ansexp="$ans"
3218                 break
3219         fi
3220         case "$ans" in
3221         none)
3222                 value=''
3223                 ansexp=''
3224                 case "$none_ok" in
3225                 true) type='';;
3226                 esac
3227                 ;;
3228         *)
3229                 case "$tilde" in
3230                 '') value="$ans"
3231                         ansexp="$ans";;
3232                 *)
3233                         value=`UU/filexp $ans`
3234                         case $? in
3235                         0)
3236                                 if test "$ans" != "$value"; then
3237                                         echo "(That expands to $value on this system.)"
3238                                 fi
3239                                 ;;
3240                         *) value="$ans";;
3241                         esac
3242                         ansexp="$value"
3243                         case "$exp_file" in
3244                         '') value="$ans";;
3245                         esac
3246                         ;;
3247                 esac
3248                 case "$fullpath" in
3249                 true)
3250                         case "$ansexp" in
3251                         /*) value="$ansexp" ;;
3252                         *)
3253                                 redo=true
3254                                 case "$already" in
3255                                 true)
3256                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3257                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3258                                         ;;
3259                                 *)
3260                                 echo "Please give a full path name, starting with slash." >&4
3261                                         case "$tilde" in
3262                                         true)
3263                                 echo "Note that using ~name is ok provided it expands well." >&4
3264                                                 already=true
3265                                                 ;;
3266                                         esac
3267                                 esac
3268                                 ;;
3269                         esac
3270                         ;;
3271                 esac
3272                 case "$redo" in
3273                 '')
3274                         case "$type" in
3275                         File)
3276                                 for fp in $gfpth; do
3277                                         if test "X$fp" = X.; then
3278                                             pf="$ansexp"
3279                                         else    
3280                                             pf="$fp/$ansexp"
3281                                         fi
3282                                         if test -f "$pf"; then
3283                                                 type=''
3284                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3285                                         then
3286                                                 echo "($value is not a plain file, but that's ok.)"
3287                                                 type=''
3288                                         fi
3289                                         if test X"$type" = X; then
3290                                             value="$pf"
3291                                             break
3292                                         fi
3293                                 done
3294                                 ;;
3295                         Directory)
3296                                 for fp in $gfpth; do
3297                                         if test "X$fp" = X.; then
3298                                             pf="$ansexp"
3299                                         else    
3300                                             pf="$fp/$ansexp"
3301                                         fi
3302                                         if test -d "$pf"; then
3303                                                 type=''
3304                                                 value="$pf"
3305                                                 break
3306                                         fi
3307                                 done
3308                                 ;;
3309                         Locate)
3310                                 if test -d "$ansexp"; then
3311                                         echo "(Looking for $loc_file in directory $value.)"
3312                                         value="$value/$loc_file"
3313                                         ansexp="$ansexp/$loc_file"
3314                                 fi
3315                                 if test -f "$ansexp"; then
3316                                         type=''
3317                                 fi
3318                                 case "$nopath_ok" in
3319                                 true)   case "$value" in
3320                                         */*) ;;
3321                                         *)      echo "Assuming $value will be in people's path."
3322                                                 type=''
3323                                                 ;;
3324                                         esac
3325                                         ;;
3326                                 esac
3327                                 ;;
3328                         esac
3329
3330                         case "$skip" in
3331                         true) type='';
3332                         esac
3333
3334                         case "$type" in
3335                         '') ;;
3336                         *)
3337                                 if test "$fastread" = yes; then
3338                                         dflt=y
3339                                 else
3340                                         dflt=n
3341                                 fi
3342                                 rp="$what $value doesn't exist.  Use that name anyway?"
3343                                 . UU/myread
3344                                 dflt=''
3345                                 case "$ans" in
3346                                 y*) type='';;
3347                                 *) echo " ";;
3348                                 esac
3349                                 ;;
3350                         esac
3351                         ;;
3352                 esac
3353                 ;;
3354         esac
3355 done
3356 cd UU
3357 ans="$value"
3358 rp="$orig_rp"
3359 dflt="$orig_dflt"
3360 rm -f getfile.ok
3361 test "X$gfpthkeep" != Xy && gfpth=""
3362 EOSC
3363
3364 : What should the include directory be ?
3365 echo " "
3366 $echo $n "Hmm...  $c"
3367 dflt='/usr/include'
3368 incpath=''
3369 mips_type=''
3370 if $test -f /bin/mips && /bin/mips; then
3371         echo "Looks like a MIPS system..."
3372         $cat >usr.c <<'EOCP'
3373 #ifdef SYSTYPE_BSD43
3374 /bsd43
3375 #endif
3376 EOCP
3377         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3378                 dflt='/bsd43/usr/include'
3379                 incpath='/bsd43'
3380                 mips_type='BSD 4.3'
3381         else
3382                 mips_type='System V'
3383         fi
3384         $rm -f usr.c usr.out
3385         echo "and you're compiling with the $mips_type compiler and libraries."
3386         xxx_prompt=y
3387         echo "exit 0" >mips
3388 else
3389         echo "Doesn't look like a MIPS system."
3390         xxx_prompt=n
3391         echo "exit 1" >mips
3392 fi
3393 chmod +x mips
3394 $eunicefix mips
3395 case "$usrinc" in
3396 '') ;;
3397 *) dflt="$usrinc";;
3398 esac
3399 case "$xxx_prompt" in
3400 y)      fn=d/
3401         echo " "
3402         rp='Where are the include files you want to use?'
3403         . ./getfile
3404         usrinc="$ans"
3405         ;;
3406 *)      usrinc="$dflt"
3407         ;;
3408 esac
3409
3410 : see how we invoke the C preprocessor
3411 echo " "
3412 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3413 cat <<'EOT' >testcpp.c
3414 #define ABC abc
3415 #define XYZ xyz
3416 ABC.XYZ
3417 EOT
3418 cd ..
3419 if test ! -f cppstdin; then
3420         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3421                 # AIX cc -E doesn't show the absolute headerfile
3422                 # locations but we'll cheat by using the -M flag.
3423                 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
3424         else
3425                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3426         fi
3427 else
3428         echo "Keeping your $hint cppstdin wrapper."
3429 fi
3430 chmod 755 cppstdin
3431 wrapper=`pwd`/cppstdin
3432 ok='false'
3433 cd UU
3434
3435 if $test "X$cppstdin" != "X" && \
3436         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3437         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3438 then
3439         echo "You used to use $cppstdin $cppminus so we'll use that again."
3440         case "$cpprun" in
3441         '') echo "But let's see if we can live without a wrapper..." ;;
3442         *)
3443                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3444                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3445                 then
3446                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3447                         ok='true'
3448                 else
3449                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3450                 fi
3451                 ;;
3452         esac
3453 else
3454         case "$cppstdin" in
3455         '') ;;
3456         *)
3457                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3458                 ;;
3459         esac
3460 fi
3461
3462 if $ok; then
3463         : nothing
3464 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3465         $cc -E <testcpp.c >testcpp.out 2>&1; \
3466         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3467         echo "Yup, it does."
3468         x_cpp="$cc -E"
3469         x_minus='';
3470 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3471         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3473         echo "Yup, it does."
3474         x_cpp="$cc -E"
3475         x_minus='-';
3476 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3477         $cc -P <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "Yipee, that works!"
3480         x_cpp="$cc -P"
3481         x_minus='';
3482 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3483         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3484         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3485         echo "At long last!"
3486         x_cpp="$cc -P"
3487         x_minus='-';
3488 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3489         $cpp <testcpp.c >testcpp.out 2>&1; \
3490         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3491         echo "It works!"
3492         x_cpp="$cpp"
3493         x_minus='';
3494 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3495         $cpp - <testcpp.c >testcpp.out 2>&1; \
3496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3497         echo "Hooray, it works!  I was beginning to wonder."
3498         x_cpp="$cpp"
3499         x_minus='-';
3500 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3501         $wrapper <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         x_cpp="$wrapper"
3504         x_minus=''
3505         echo "Eureka!"
3506 else
3507         dflt=''
3508         rp="No dice.  I can't find a C preprocessor.  Name one:"
3509         . ./myread
3510         x_cpp="$ans"
3511         x_minus=''
3512         $x_cpp <testcpp.c >testcpp.out 2>&1
3513         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3514                 echo "OK, that will do." >&4
3515         else
3516 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3517                 exit 1
3518         fi
3519 fi
3520
3521 case "$ok" in
3522 false)
3523         cppstdin="$x_cpp"
3524         cppminus="$x_minus"
3525         cpprun="$x_cpp"
3526         cpplast="$x_minus"
3527         set X $x_cpp
3528         shift
3529         case "$1" in
3530         "$cpp")
3531                 echo "Perhaps can we force $cc -E using a wrapper..."
3532                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3533                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3534                 then
3535                         echo "Yup, we can."
3536                         cppstdin="$wrapper"
3537                         cppminus='';
3538                 else
3539                         echo "Nope, we'll have to live without it..."
3540                 fi
3541                 ;;
3542         esac
3543         case "$cpprun" in
3544         "$wrapper")
3545                 cpprun=''
3546                 cpplast=''
3547                 ;;
3548         esac
3549         ;;
3550 esac
3551
3552 case "$cppstdin" in
3553 "$wrapper"|'cppstdin') ;;
3554 *) $rm -f $wrapper;;
3555 esac
3556 $rm -f testcpp.c testcpp.out
3557
3558 : Set private lib path
3559 case "$plibpth" in
3560 '') if ./mips; then
3561                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3562         fi;;
3563 esac
3564 case "$libpth" in
3565 ' ') dlist='';;
3566 '') dlist="$loclibpth $plibpth $glibpth";;
3567 *) dlist="$libpth";;
3568 esac
3569
3570 : Now check and see which directories actually exist, avoiding duplicates
3571 libpth=''
3572 for xxx in $dlist
3573 do
3574     if $test -d $xxx; then
3575                 case " $libpth " in
3576                 *" $xxx "*) ;;
3577                 *) libpth="$libpth $xxx";;
3578                 esac
3579     fi
3580 done
3581 $cat <<'EOM'
3582
3583 Some systems have incompatible or broken versions of libraries.  Among
3584 the directories listed in the question below, please remove any you
3585 know not to be holding relevant libraries, and add any that are needed.
3586 Say "none" for none.
3587
3588 EOM
3589 case "$libpth" in
3590 '') dflt='none';;
3591 *)
3592         set X $libpth
3593         shift
3594         dflt=${1+"$@"}
3595         ;;
3596 esac
3597 rp="Directories to use for library searches?"
3598 . ./myread
3599 case "$ans" in
3600 none) libpth=' ';;
3601 *) libpth="$ans";;
3602 esac
3603
3604 : compute shared library extension
3605 case "$so" in
3606 '')
3607         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3608                 dflt='sl'
3609         else
3610                 dflt='so'
3611         fi
3612         ;;
3613 *) dflt="$so";;
3614 esac
3615 $cat <<EOM
3616
3617 On some systems, shared libraries may be available.  Answer 'none' if
3618 you want to suppress searching of shared libraries for the remainder
3619 of this configuration.
3620
3621 EOM
3622 rp='What is the file extension used for shared libraries?'
3623 . ./myread
3624 so="$ans"
3625
3626 : Define several unixisms.
3627 : Hints files or command line option can be used to override them.
3628 : The convoluted testing is in case hints files set either the old
3629 : or the new name.
3630 case "$_exe" in
3631 '')     case "$exe_ext" in
3632     '') ;;
3633         *)      _exe="$exe_ext" ;;
3634         esac
3635         ;;
3636 esac
3637 case "$_a" in
3638 '')     case "$lib_ext" in
3639     '') _a='.a';;
3640         *)      _a="$lib_ext" ;;
3641         esac
3642         ;;
3643 esac
3644 case "$_o" in
3645 '') case "$obj_ext" in
3646         '')     _o='.o';;
3647         *)      _o="$obj_ext";;
3648         esac
3649         ;;
3650 esac
3651 case "$p_" in
3652 '') case "$path_sep" in
3653         '')     p_=':';;
3654         *)      p_="$path_sep";;
3655         esac
3656         ;;
3657 esac
3658 exe_ext=$_exe
3659 lib_ext=$_a
3660 obj_ext=$_o
3661 path_sep=$p_
3662
3663 : Which makefile gets called first.  This is used by make depend.
3664 case "$firstmakefile" in
3665 '') firstmakefile='makefile';;
3666 esac
3667
3668 case "$usesocks" in
3669 $define|true|[yY]*)     dflt='y';;
3670 *) dflt='n';;
3671 esac
3672 cat <<EOM
3673
3674 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3675 Configure must be run with -Dusesocks.
3676
3677 If this doesn't make any sense to you, just accept the default '$dflt'.
3678 EOM
3679 rp='Build Perl for SOCKS?'
3680 . ./myread
3681 case "$ans" in
3682 y|Y)    val="$define" ;;     
3683 *)      val="$undef" ;;
3684 esac
3685 set usesocks
3686 eval $setvar
3687
3688 : Looking for optional libraries
3689 echo " "
3690 echo "Checking for optional libraries..." >&4
3691 case "$libs" in
3692 ' '|'') dflt='';;
3693 *) dflt="$libs";;
3694 esac
3695 case "$libswanted" in
3696 '') libswanted='c_s';;
3697 esac
3698 case "$usesocks" in
3699 $define)
3700         libswanted="$libswanted socks5 socks5_sh"
3701         ;;
3702 esac
3703 libsfound=''
3704 libsfiles=''
3705 libsdirs=''
3706 libspath=''
3707 for thisdir in $libpth $xlibpth; do
3708   test -d $thisdir && libspath="$libspath $thisdir"
3709 done
3710 for thislib in $libswanted; do
3711         for thisdir in $libspath; do
3712             xxx=''
3713             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3714                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3715                 $test -f "$xxx" && eval $libscheck
3716                 $test -f "$xxx" && libstyle=shared
3717             fi
3718             if test ! -f "$xxx"; then
3719                 xxx=$thisdir/lib$thislib.$so
3720                 $test -f "$xxx" && eval $libscheck
3721                 $test -f "$xxx" && libstyle=shared
3722             fi  
3723             if test ! -f "$xxx"; then
3724                 xxx=$thisdir/lib$thislib$_a
3725                 $test -f "$xxx" && eval $libscheck
3726                 $test -f "$xxx" && libstyle=static
3727             fi
3728             if test ! -f "$xxx"; then
3729                 xxx=$thisdir/$thislib$_a
3730                 $test -f "$xxx" && eval $libscheck
3731                 $test -f "$xxx" && libstyle=static
3732             fi
3733             if test ! -f "$xxx"; then
3734                 xxx=$thisdir/lib${thislib}_s$_a
3735                 $test -f "$xxx" && eval $libscheck
3736                 $test -f "$xxx" && libstyle=static
3737             fi
3738             if test ! -f "$xxx"; then
3739                 xxx=$thisdir/Slib$thislib$_a
3740                 $test -f "$xxx" && eval $libscheck
3741                 $test -f "$xxx" && libstyle=static
3742             fi
3743             if $test -f "$xxx"; then
3744                 case "$libstyle" in
3745                 shared) echo "Found -l$thislib (shared)." ;;
3746                 static) echo "Found -l$thislib." ;;
3747                 *)      echo "Found -l$thislib ($libstyle)." ;;
3748                 esac
3749                 case " $dflt " in
3750                 *"-l$thislib "*);;
3751                 *) dflt="$dflt -l$thislib"
3752                    libsfound="$libsfound $xxx"
3753                    yyy=`basename $xxx`
3754                    libsfiles="$libsfiles $yyy"
3755                    yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
3756                    case " $libsdirs " in
3757                    *" $yyy "*) ;;
3758                    *) libsdirs="$libsdirs $yyy" ;;
3759                    esac
3760                    ;;
3761                 esac
3762                 break
3763             fi  
3764         done
3765         if $test ! -f "$xxx"; then
3766             echo "No -l$thislib."
3767         fi
3768 done
3769 set X $dflt
3770 shift
3771 dflt="$*"
3772 case "$libs" in
3773 '') dflt="$dflt";;
3774 *) dflt="$libs";;
3775 esac
3776 case "$dflt" in
3777 ' '|'') dflt='none';;
3778 esac
3779
3780 $cat <<EOM
3781
3782 In order to compile $package on your machine, a number of libraries
3783 are usually needed.  Include any other special libraries here as well.
3784 Say "none" for none.  The default list is almost always right.
3785 EOM
3786
3787 echo " "
3788 rp="What libraries to use?"
3789 . ./myread
3790 case "$ans" in
3791 none) libs=' ';;
3792 *) libs="$ans";;
3793 esac
3794
3795 : determine optimization, if desired, or use for debug flag also
3796 case "$optimize" in
3797 ' '|$undef) dflt='none';;
3798 '') dflt='-O';;
3799 *) dflt="$optimize";;
3800 esac
3801 $cat <<EOH
3802
3803 By default, $package compiles with the -O flag to use the optimizer.
3804 Alternately, you might want to use the symbolic debugger, which uses
3805 the -g flag (on traditional Unix systems).  Either flag can be
3806 specified here.  To use neither flag, specify the word "none".
3807
3808 EOH
3809 rp="What optimizer/debugger flag should be used?"
3810 . ./myread
3811 optimize="$ans"
3812 case "$optimize" in
3813 'none') optimize=" ";;
3814 esac
3815
3816 dflt=''
3817 : We will not override a previous value, but we might want to
3818 : augment a hint file
3819 case "$hint" in
3820 default|recommended)
3821         case "$gccversion" in
3822         1*) dflt='-fpcc-struct-return' ;;
3823         esac
3824         case "$optimize" in
3825         *-g*) dflt="$dflt -DDEBUGGING";;
3826         esac
3827         case "$gccversion" in
3828         2*) if test -d /etc/conf/kconfig.d &&
3829                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3830                 then
3831                         dflt="$dflt -posix"
3832                 fi
3833                 ;;
3834         esac
3835         case "$gccversion" in
3836         1*) ;;
3837         2.[0-8]*) ;;
3838         ?*)     echo " "
3839                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3840                 echo 'int main(void) { return 0; }' > gcctest.c
3841                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3842                         echo "Yes, it does." 2>&1
3843                         case "$ccflags" in
3844                         *strict-aliasing*) 
3845                                 echo "Leaving current flags $ccflags alone." 2>&1
3846                                 ;;
3847                         *) dflt="$dflt -fno-strict-aliasing" ;;
3848                         esac
3849                 else
3850                         echo "Nope, it doesn't, but that's ok." 2>&1
3851                 fi
3852                 ;;
3853         esac
3854         ;;
3855 esac
3856
3857 case "$mips_type" in
3858 *BSD*|'') inclwanted="$locincpth $usrinc";;
3859 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3860 esac
3861 for thisincl in $inclwanted; do
3862         if $test -d $thisincl; then
3863                 if $test x$thisincl != x$usrinc; then
3864                         case "$dflt" in
3865                         *$thisincl*);;
3866                         *) dflt="$dflt -I$thisincl";;
3867                         esac
3868                 fi
3869         fi
3870 done
3871
3872 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3873         xxx=true;
3874 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3875         xxx=true;
3876 else
3877         xxx=false;
3878 fi;
3879 if $xxx; then
3880         case "$dflt" in
3881         *$2*);;
3882         *) dflt="$dflt -D$2";;
3883         esac;
3884 fi'
3885
3886 set signal.h LANGUAGE_C; eval $inctest
3887
3888 case "$usesocks" in
3889 $define)
3890         ccflags="$ccflags -DSOCKS"
3891         ;;
3892 esac
3893
3894 case "$hint" in
3895 default|recommended) dflt="$ccflags $dflt" ;;
3896 *) dflt="$ccflags";;
3897 esac
3898
3899 case "$dflt" in
3900 ''|' ') dflt=none;;
3901 esac
3902 $cat <<EOH
3903
3904 Your C compiler may want other flags.  For this question you should include
3905 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3906 but you should NOT include libraries or ld flags like -lwhatever.  If you
3907 want $package to honor its debug switch, you should include -DDEBUGGING here.
3908 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3909
3910 To use no flags, specify the word "none".
3911
3912 EOH
3913 set X $dflt
3914 shift
3915 dflt=${1+"$@"}
3916 rp="Any additional cc flags?"
3917 . ./myread
3918 case "$ans" in
3919 none) ccflags='';;
3920 *) ccflags="$ans";;
3921 esac
3922
3923 : the following weeds options from ccflags that are of no interest to cpp
3924 cppflags="$ccflags"
3925 case "$gccversion" in
3926 1*) cppflags="$cppflags -D__GNUC__"
3927 esac
3928 case "$mips_type" in
3929 '');;
3930 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3931 esac
3932 case "$cppflags" in
3933 '');;
3934 *)
3935         echo " "
3936         echo "Let me guess what the preprocessor flags are..." >&4
3937         set X $cppflags
3938         shift
3939         cppflags=''
3940         $cat >cpp.c <<'EOM'
3941 #define BLURFL foo
3942
3943 BLURFL xx LFRULB
3944 EOM
3945         previous=''
3946         for flag in $*
3947         do
3948                 case "$flag" in
3949                 -*) ftry="$flag";;
3950                 *) ftry="$previous $flag";;
3951                 esac
3952                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3953                         >cpp1.out 2>/dev/null && \
3954                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3955                         >cpp2.out 2>/dev/null && \
3956                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3957                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3958                 then
3959                         cppflags="$cppflags $ftry"
3960                         previous=''
3961                 else
3962                         previous="$flag"
3963                 fi
3964         done
3965         set X $cppflags
3966         shift
3967         cppflags=${1+"$@"}
3968         case "$cppflags" in
3969         *-*)  echo "They appear to be: $cppflags";;
3970         esac
3971         $rm -f cpp.c cpp?.out
3972         ;;
3973 esac
3974
3975 : flags used in final linking phase
3976 case "$ldflags" in
3977 '') if ./venix; then
3978                 dflt='-i -z'
3979         else
3980                 dflt=''
3981         fi
3982         case "$ccflags" in
3983         *-posix*) dflt="$dflt -posix" ;;
3984         esac
3985         ;;
3986 *) dflt="$ldflags";;
3987 esac
3988
3989 : Try to guess additional flags to pick up local libraries.
3990 for thislibdir in $libpth; do
3991         case " $loclibpth " in
3992         *" $thislibdir "*)
3993                 case "$dflt " in 
3994                 *"-L$thislibdir "*) ;;
3995                 *)  dflt="$dflt -L$thislibdir" ;;
3996                 esac
3997                 ;;
3998         esac
3999 done
4000
4001 case "$dflt" in
4002 '') dflt='none' ;;
4003 esac
4004
4005 $cat <<EOH
4006
4007 Your C linker may need flags.  For this question you should
4008 include -L/whatever and any other flags used by the C linker, but you
4009 should NOT include libraries like -lwhatever.
4010
4011 Make sure you include the appropriate -L/path flags if your C linker
4012 does not normally search all of the directories you specified above,
4013 namely
4014         $libpth
4015 To use no flags, specify the word "none".
4016
4017 EOH
4018
4019 rp="Any additional ld flags (NOT including libraries)?"
4020 . ./myread
4021 case "$ans" in
4022 none) ldflags='';;
4023 *) ldflags="$ans";;
4024 esac
4025 rmlist="$rmlist pdp11"
4026
4027 : coherency check
4028 echo " "
4029 echo "Checking your choice of C compiler and flags for coherency..." >&4
4030 $cat > try.c <<'EOF'
4031 #include <stdio.h>
4032 int main() { printf("Ok\n"); exit(0); }
4033 EOF
4034 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4035 shift
4036 $cat >try.msg <<'EOM'
4037 I've tried to compile and run the following simple program:
4038
4039 EOM
4040 $cat try.c >> try.msg
4041
4042 $cat >> try.msg <<EOM
4043
4044 I used the command:
4045
4046         $*
4047         ./try
4048
4049 and I got the following output:
4050
4051 EOM
4052 dflt=y
4053 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4054         if sh -c './try' >>try.msg 2>&1; then
4055                 xxx=`./try`
4056                 case "$xxx" in
4057                 "Ok") dflt=n ;;
4058                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4059                         case " $libs " in
4060                         *" -lsfio "*)
4061                                 cat >> try.msg <<'EOQS'
4062 If $libs contains -lsfio, and sfio is mis-configured, then it
4063 sometimes (apparently) runs and exits with a 0 status, but with no
4064 output!  It may have to do with sfio's use of _exit vs. exit.
4065
4066 EOQS
4067                                 rp="You have a big problem.  Shall I abort Configure"
4068                                 dflt=y
4069                                 ;;
4070                         esac
4071                         ;;
4072                 esac
4073         else
4074                 echo "The program compiled OK, but exited with status $?." >>try.msg
4075                 rp="You have a problem.  Shall I abort Configure"
4076                 dflt=y
4077         fi
4078 else
4079         echo "I can't compile the test program." >>try.msg
4080         rp="You have a BIG problem.  Shall I abort Configure"
4081         dflt=y
4082 fi
4083 case "$dflt" in
4084 y)
4085         $cat try.msg >&4
4086         case "$knowitall" in
4087         '')
4088                 echo "(The supplied flags or libraries might be incorrect.)"
4089                 ;;
4090         *) dflt=n;;
4091         esac
4092         echo " "
4093         . ./myread
4094         case "$ans" in
4095         n*|N*) ;;
4096         *)      echo "Ok.  Stopping Configure." >&4
4097                 exit 1
4098                 ;;
4099         esac
4100         ;;
4101 n) echo "OK, that should do.";;
4102 esac
4103 $rm -f try try.* core
4104
4105 : define an is-a-typedef? function
4106 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4107 case "$inclist" in
4108 "") inclist="sys/types.h";;
4109 esac;
4110 eval "varval=\$$var";
4111 case "$varval" in
4112 "")
4113         $rm -f temp.c;
4114         for inc in $inclist; do
4115                 echo "#include <$inc>" >>temp.c;
4116         done;
4117         echo "#ifdef $type" >> temp.c;
4118         echo "printf(\"We have $type\");" >> temp.c;
4119         echo "#endif" >> temp.c;
4120         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4121         if $contains $type temp.E >/dev/null 2>&1; then
4122                 eval "$var=\$type";
4123         else
4124                 eval "$var=\$def";
4125         fi;
4126         $rm -f temp.?;;
4127 *) eval "$var=\$varval";;
4128 esac'
4129
4130 : define an is-a-typedef? function that prompts if the type is not available.
4131 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4132 case "$inclist" in
4133 "") inclist="sys/types.h";;
4134 esac;
4135 eval "varval=\$$var";
4136 case "$varval" in
4137 "")
4138         $rm -f temp.c;
4139         for inc in $inclist; do
4140                 echo "#include <$inc>" >>temp.c;
4141         done;
4142         echo "#ifdef $type" >> temp.c;
4143         echo "printf(\"We have $type\");" >> temp.c;
4144         echo "#endif" >> temp.c;
4145         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4146         echo " " ;
4147         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4148         if $contains $type temp.E >/dev/null 2>&1; then
4149                 echo "$type found." >&4;
4150                 eval "$var=\$type";
4151         else
4152                 echo "$type NOT found." >&4;
4153                 dflt="$def";
4154                 . ./myread ;
4155                 eval "$var=\$ans";
4156         fi;
4157         $rm -f temp.?;;
4158 *) eval "$var=\$varval";;
4159 esac'
4160
4161 : define a shorthand compile call
4162 compile='
4163 mc_file=$1;
4164 shift;
4165 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4166 : define a shorthand compile call for compilations that should be ok.
4167 compile_ok='
4168 mc_file=$1;
4169 shift;
4170 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4171
4172 : check for lengths of integral types
4173 echo " "
4174 case "$intsize" in
4175 '')
4176         echo "Checking to see how big your integers are..." >&4
4177         $cat >intsize.c <<'EOCP'
4178 #include <stdio.h>
4179 int main()
4180 {
4181         printf("intsize=%d;\n", (int)sizeof(int));
4182         printf("longsize=%d;\n", (int)sizeof(long));
4183         printf("shortsize=%d;\n", (int)sizeof(short));
4184         exit(0);
4185 }
4186 EOCP
4187         set intsize
4188         if eval $compile_ok && ./intsize > /dev/null; then
4189                 eval `./intsize`
4190                 echo "Your integers are $intsize bytes long."
4191                 echo "Your long integers are $longsize bytes long."
4192                 echo "Your short integers are $shortsize bytes long."
4193         else
4194                 $cat >&4 <<EOM
4195 !
4196 Help! I can't compile and run the intsize test program: please enlighten me!
4197 (This is probably a misconfiguration in your system or libraries, and
4198 you really ought to fix it.  Still, I'll try anyway.)
4199 !
4200 EOM
4201                 dflt=4
4202                 rp="What is the size of an integer (in bytes)?"
4203                 . ./myread
4204                 intsize="$ans"
4205                 dflt=$intsize
4206                 rp="What is the size of a long integer (in bytes)?"
4207                 . ./myread
4208                 longsize="$ans"
4209                 dflt=2
4210                 rp="What is the size of a short integer (in bytes)?"
4211                 . ./myread
4212                 shortsize="$ans"
4213         fi
4214         ;;
4215 esac
4216 $rm -f intsize intsize.*
4217
4218 : see what type lseek is declared as in the kernel
4219 rp="What is the type used for lseek's offset on this system?"
4220 set off_t lseektype long stdio.h sys/types.h
4221 eval $typedef_ask
4222
4223 echo " "
4224 $echo $n "Checking to see how big your file offsets are...$c" >&4
4225 $cat >try.c <<EOCP
4226 #include <sys/types.h>
4227 #include <stdio.h>
4228 int main()
4229 {
4230     printf("%d\n", (int)sizeof($lseektype));
4231     return(0); 
4232 }
4233 EOCP
4234 set try
4235 if eval $compile_ok; then
4236         lseeksize=`./try`
4237         $echo " $lseeksize bytes." >&4
4238 else
4239         dflt=$longsize
4240         echo " "
4241         echo "(I can't seem to compile the test program.  Guessing...)"
4242         rp="What is the size of your file offsets (in bytes)?"
4243         . ./myread
4244         lseeksize="$ans"
4245 fi
4246 $rm -f try.c try
4247
4248 : see what type file positions are declared as in the library
4249 rp="What is the type for file position used by fsetpos()?"
4250 set fpos_t fpostype long stdio.h sys/types.h
4251 eval $typedef_ask
4252
4253 echo " "
4254 case "$fpostype" in
4255 *_t) zzz="$fpostype"    ;;
4256 *)   zzz="fpos_t"       ;;
4257 esac
4258 $echo $n "Checking the size of $zzz...$c" >&4 
4259 cat > try.c <<EOCP
4260 #include <sys/types.h>
4261 #include <stdio.h>
4262 int main() {
4263     printf("%d\n", (int)sizeof($fpostype));
4264     exit(0);
4265 }
4266 EOCP
4267 set try
4268 if eval $compile_ok; then
4269         yyy=`./try`
4270         case "$yyy" in
4271         '')     fpossize=4
4272                 echo " " >&4
4273                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4274                 ;;
4275         *)      fpossize=$yyy
4276                 echo " $fpossize bytes." >&4
4277                 ;;
4278         esac
4279 else
4280         dflt="$longsize"
4281         echo " " >&4
4282         echo "(I can't compile the test program.  Guessing...)" >&4
4283         rp="What is the size of your file positions (in bytes)?"
4284         . ./myread
4285         fpossize="$ans"
4286 fi
4287
4288
4289
4290 case "$lseeksize:$fpossize" in
4291 8:8) cat <<EOM
4292
4293 You can have files larger than 2 gigabytes.
4294 EOM
4295    val="$define" ;;
4296 *)    case "$uselargefiles" in
4297    "$undef"|false|[nN]*) dflt='n' ;;
4298    *)   dflt='y' ;;
4299    esac
4300    cat <<EOM
4301
4302 Perl can be built to understand large files (files larger than 2 gigabytes)
4303 on some systems.  To do so, Configure can be run with -Duselargefiles.
4304
4305 If this doesn't make any sense to you, just accept the default '$dflt'.
4306 EOM
4307    rp='Try to understand large files, if available?'
4308    . ./myread
4309    case "$ans" in
4310    y|Y)         val="$define" ;;
4311    *)           val="$undef"  ;;
4312    esac
4313    ;;
4314 esac
4315 set uselargefiles
4316 eval $setvar
4317 case "$uselargefiles" in
4318 "$define")
4319 : Look for a hint-file generated 'call-back-unit'.  If the
4320 : user has specified that a large files perl is to be built,
4321 : we may need to set or change some other defaults.
4322         if $test -f uselfs.cbu; then
4323                 echo "Your platform has some specific hints for large file builds, using them..."
4324                 . ./uselfs.cbu
4325                 echo " "
4326                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4327                 $cat >try.c <<EOCP
4328 #include <sys/types.h>
4329 #include <stdio.h>
4330 int main()
4331 {
4332     printf("%d\n", (int)sizeof($lseektype));
4333     return(0); 
4334 }
4335 EOCP
4336                 set try
4337                 if eval $compile_ok; then
4338                         lseeksize=`./try`
4339                         $echo " $lseeksize bytes." >&4
4340                 else
4341                         dflt="$lseeksize"
4342                         echo " "
4343                         echo "(I can't seem to compile the test program.  Guessing...)"
4344                         rp="What is the size of your file offsets (in bytes)?"
4345                         . ./myread
4346                         lseeksize="$ans"
4347                 fi
4348                 case "$fpostype" in
4349                 *_t) zzz="$fpostype"    ;;
4350                 *)   zzz="fpos_t"       ;;
4351                 esac
4352                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4353                 $cat > try.c <<EOCP
4354 #include <sys/types.h>
4355 #include <stdio.h>
4356 int main() {
4357     printf("%d\n", (int)sizeof($fpostype));
4358     exit(0);
4359 }
4360 EOCP
4361                 set try
4362                 if eval $compile_ok; then
4363                         yyy=`./try`
4364                         dflt="$lseeksize"
4365                         case "$yyy" in
4366                         '')     echo " "
4367                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4368                                 ;;
4369                         *)      fpossize=$yyy
4370                                 echo " $fpossize bytes."
4371                                 ;;
4372                         esac
4373                 else
4374                         dflt="$fpossize"
4375                         echo " "
4376                         echo "(I can't compile the test program.  Guessing...)" >&4
4377                         rp="What is the size of your file positions (in bytes)?"
4378                         . ./myread
4379                         fpossize="$ans"
4380                 fi
4381                 $rm -f try.c try
4382         fi
4383         ;;
4384 esac
4385
4386
4387 case "$usemorebits" in
4388 "$define"|true|[yY]*)
4389         use64bits="$define"
4390         uselongdouble="$define"
4391         usemorebits="$define"
4392         ;;
4393 *)      usemorebits="$undef"
4394         ;;
4395 esac
4396
4397
4398 case "$intsize:$longsize" in
4399 8:*|*:8) cat <<EOM
4400
4401 You have natively 64-bit integers.
4402 EOM
4403    val="$define"
4404    ;;
4405 *) case "$ccflags" in
4406    *-DUSE_64_BITS*|*-DUSE_LONG_LONG*) use64bits="$define";;
4407    *) case "$uselonglong" in
4408       $define|true|[yY]*) use64bits="$define";;
4409       esac
4410       ;;
4411    esac
4412    case "$use64bits" in
4413    $define|true|[yY]*) dflt='y';;
4414    *) dflt='n';;
4415    esac
4416 cat <<EOM
4417
4418 Perl can be built to take advantage of 64-bit integer types
4419 on some systems.  To do so, Configure can be run with -Duse64bits.
4420
4421 If this doesn't make any sense to you, just accept the default '$dflt'.
4422 EOM
4423    rp='Try to use 64-bit integers, if available?'
4424    . ./myread
4425    case "$ans" in
4426    [yY]*) val="$define" ;;
4427    *)     val="$undef"  ;;
4428    esac
4429    ;;
4430 esac
4431 set use64bits
4432 eval $setvar
4433
4434 case "$archname64" in
4435 '') archname64='' ;;    # not a typo
4436 esac
4437
4438 case "$use64bits" in
4439 "$define"|true|[yY]*)
4440 : Look for a hint-file generated 'call-back-unit'.  If the
4441 : user has specified that a 64-bit perl is to be built,
4442 : we may need to set or change some other defaults.
4443         if $test -f use64bits.cbu; then
4444                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4445                 . ./use64bits.cbu
4446         else
4447                 $cat <<EOM
4448 (Your platform doesn't have any specific hints for 64-bit builds.)
4449 EOM
4450                 case "$intsize:$longsize" in
4451 8:*|*:8) cat <<EOM
4452 (This is probably okay, as your system is a natively 64-bit system.)
4453 EOM
4454                   ;;
4455                 esac
4456                 case "$gccversion" in
4457                 '')     ;;
4458                 *)      case "$ccflags" in
4459                         *-DUSE_64_BITS*) ;;
4460                         *) $cat <<EOM
4461 But since you seem to be using gcc, I will now add -DUSE_64_BITS
4462 to the compilation flags to get long longs.
4463 EOM
4464                            ccflags="$ccflags -DUSE_64_BITS"
4465                            ;;
4466                         esac
4467                         ;;
4468                 esac
4469         fi
4470         ;;
4471 esac
4472
4473 : determine the architecture name
4474 echo " "
4475 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4476         tarch=`arch`"-$osname"
4477 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4478         if uname -m > tmparch 2>&1 ; then
4479                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4480                         -e 's/$/'"-$osname/" tmparch`
4481         else
4482                 tarch="$osname"
4483         fi
4484         $rm -f tmparch
4485 else
4486         tarch="$osname"
4487 fi
4488 case "$myarchname" in
4489 ''|"$tarch") ;;
4490 *)
4491         echo "(Your architecture name used to be $myarchname.)"
4492         archname=''
4493         ;;
4494 esac
4495 myarchname="$tarch"
4496 case "$archname" in
4497 '') dflt="$tarch";;
4498 *) dflt="$archname";;
4499 esac
4500 rp='What is your architecture name'
4501 . ./myread
4502 archname="$ans"
4503 case "$usethreads" in
4504 $define)
4505         echo "Threads selected." >&4
4506         case "$archname" in
4507         *-thread*) echo "...and architecture name already has -thread." >&4
4508                 ;;
4509         *)      archname="$archname-thread"
4510                 echo "...setting architecture name to $archname." >&4
4511                 ;;
4512         esac
4513         ;;
4514 esac
4515 case "$usemultiplicity" in
4516 $define)
4517         echo "Multiplicity selected." >&4
4518         case "$archname" in
4519         *-multi*) echo "...and architecture name already has -multi." >&4
4520                 ;;
4521         *)      archname="$archname-multi"
4522                 echo "...setting architecture name to $archname." >&4
4523                 ;;
4524         esac
4525         ;;
4526 esac
4527 case "$use64bits" in
4528 $define)
4529         case "$archname64" in
4530         '')
4531                 ;;
4532         *)
4533                 case "$archname" in
4534                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4535                         ;;
4536                 *)      archname="$archname-$archname64"
4537                         echo "...setting architecture name to $archname." >&4
4538                         ;;
4539                 esac
4540                 ;;
4541         esac
4542 esac
4543
4544 : determine root of directory hierarchy where package will be installed.
4545 case "$prefix" in
4546 '')
4547         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4548         ;;
4549 *)
4550         dflt="$prefix"
4551         ;;
4552 esac
4553 $cat <<EOM
4554
4555 By default, $package will be installed in $dflt/bin, manual pages
4556 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4557 installation directories. Typically this is something like /usr/local.
4558 If you wish to have binaries under /usr/bin but other parts of the
4559 installation under /usr/local, that's ok: you will be prompted
4560 separately for each of the installation directories, the prefix being
4561 only used to set the defaults.
4562
4563 EOM
4564 fn=d~
4565 rp='Installation prefix to use?'
4566 . ./getfile
4567 oldprefix=''
4568 case "$prefix" in
4569 '') ;;
4570 *)
4571         case "$ans" in
4572         "$prefix") ;;
4573         *) oldprefix="$prefix";;
4574         esac
4575         ;;
4576 esac
4577 prefix="$ans"
4578 prefixexp="$ansexp"
4579
4580 : is AFS running?
4581 echo " "
4582 case "$afs" in
4583 $define|true)   afs=true ;;
4584 $undef|false)   afs=false ;;
4585 *)      if test -d /afs; then
4586                 afs=true
4587         else
4588                 afs=false
4589         fi
4590         ;;
4591 esac
4592 if $afs; then
4593         echo "AFS may be running... I'll be extra cautious then..." >&4
4594 else
4595         echo "AFS does not seem to be running..." >&4
4596 fi
4597
4598 : determine installation prefix for where package is to be installed.
4599 if $afs; then 
4600 $cat <<EOM
4601
4602 Since you are running AFS, I need to distinguish the directory in which
4603 files will reside from the directory in which they are installed (and from
4604 which they are presumably copied to the former directory by occult means).
4605
4606 EOM
4607         case "$installprefix" in
4608         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4609         *) dflt="$installprefix";;
4610         esac
4611 else
4612 $cat <<EOM
4613
4614 In some special cases, particularly when building $package for distribution,
4615 it is convenient to distinguish between the directory in which files should 
4616 be installed from the directory ($prefix) in which they 
4617 will eventually reside.  For most users, these two directories are the same.
4618
4619 EOM
4620         case "$installprefix" in
4621         '') dflt=$prefix ;;
4622         *) dflt=$installprefix;;
4623         esac
4624 fi
4625 fn=d~
4626 rp='What installation prefix should I use for installing files?'
4627 . ./getfile
4628 installprefix="$ans"
4629 installprefixexp="$ansexp"
4630
4631 : set the prefixit variable, to compute a suitable default value
4632 prefixit='case "$3" in
4633 ""|none)
4634         case "$oldprefix" in
4635         "") eval "$1=\"\$$2\"";;
4636         *)
4637                 case "$3" in
4638                 "") eval "$1=";;
4639                 none)
4640                         eval "tp=\"\$$2\"";
4641                         case "$tp" in
4642                         ""|" ") eval "$1=\"\$$2\"";;
4643                         *) eval "$1=";;
4644                         esac;;
4645                 esac;;
4646         esac;;
4647 *)
4648         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4649         case "$tp" in
4650         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4651         /*-$oldprefix/*|\~*-$oldprefix/*)
4652                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4653         *) eval "$1=\"\$$2\"";;
4654         esac;;
4655 esac'
4656
4657 : set the base revision
4658 baserev=5.0
4659
4660
4661 : get the patchlevel
4662 echo " "
4663 echo "Getting the current patchlevel..." >&4
4664 if $test -r $rsrc/patchlevel.h;then
4665         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4666         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4667         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4668         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4669         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4670 else
4671         patchlevel=0
4672         subversion=0
4673         api_revision=0
4674         api_version=0
4675         api_subversion=0
4676 fi
4677 $echo $n "(You have $package" $c
4678 case "$package" in
4679 "*$baserev")    ;;
4680 *)              $echo $n " $baserev" $c ;;
4681 esac
4682 $echo $n " patchlevel $patchlevel" $c
4683 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4684 echo ".)"
4685 case "$osname" in
4686 dos|vms)
4687         : XXX Should be a Configure test for double-dots in filenames.
4688         version=`echo $baserev $patchlevel $subversion | \
4689                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4690         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4691                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4692         ;;
4693 *)
4694         version=`echo $baserev $patchlevel $subversion | \
4695                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4696         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4697                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4698         ;;
4699 esac
4700 : Special case the 5.005_xx maintenance series, which used 5.005
4701 : without any subversion label as a subdirectory in $sitelib
4702 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4703         api_versionstring='5.005'
4704 fi
4705
4706 : determine installation style
4707 : For now, try to deduce it from prefix unless it is already set.
4708 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4709 case "$installstyle" in
4710 '')     case "$prefix" in
4711                 *perl*) dflt='lib';;
4712                 *) dflt='lib/perl5' ;;
4713         esac
4714         ;;
4715 *)      dflt='lib/perl5' ;;
4716 esac
4717 : Probably not worth prompting for this since we prompt for all
4718 : the directories individually, and the prompt would be too long and
4719 : confusing anyway.
4720 installstyle=$dflt
4721
4722 : determine where private library files go
4723 : Usual default is /usr/local/lib/perl5/$version.
4724 : Also allow things like /opt/perl/lib/$version, since 
4725 : /opt/perl/lib/perl5... would be redundant.
4726 : The default "style" setting is made in installstyle.U
4727 case "$installstyle" in
4728 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4729 *)       set dflt privlib lib/$version ;;
4730 esac
4731 eval $prefixit
4732 $cat <<EOM
4733
4734 There are some auxiliary files for $package that need to be put into a
4735 private library directory that is accessible by everyone.
4736
4737 EOM
4738 fn=d~+
4739 rp='Pathname where the private library files will reside?'
4740 . ./getfile
4741 privlib="$ans"
4742 privlibexp="$ansexp"
4743 : Change installation prefix, if necessary.
4744 if $test X"$prefix" != X"$installprefix"; then
4745         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4746 else
4747         installprivlib="$privlibexp"
4748 fi
4749
4750 : set the prefixup variable, to restore leading tilda escape
4751 prefixup='case "$prefixexp" in
4752 "$prefix") ;;
4753 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4754 esac'
4755
4756 : determine where public architecture dependent libraries go
4757 set archlib archlib
4758 eval $prefixit
4759 : privlib default is /usr/local/lib/$package/$version
4760 : archlib default is /usr/local/lib/$package/$version/$archname
4761 : privlib may have an optional trailing /share.
4762 tdflt=`echo $privlib | $sed 's,/share$,,'`
4763 tdflt=$tdflt/$archname
4764 case "$archlib" in
4765 '')     dflt=$tdflt
4766         ;;
4767 *)      dflt="$archlib"
4768     ;;
4769 esac
4770 $cat <<EOM
4771
4772 $spackage contains architecture-dependent library files.  If you are
4773 sharing libraries in a heterogeneous environment, you might store
4774 these files in a separate location.  Otherwise, you can just include
4775 them with the rest of the public library files.
4776
4777 EOM
4778 fn=d+~
4779 rp='Where do you want to put the public architecture-dependent libraries?'
4780 . ./getfile
4781 archlib="$ans"
4782 archlibexp="$ansexp"
4783 if $test X"$archlib" = X"$privlib"; then
4784         d_archlib="$undef"
4785 else
4786         d_archlib="$define"
4787 fi
4788 : Change installation prefix, if necessary.
4789 if $test X"$prefix" != X"$installprefix"; then
4790         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4791 else
4792         installarchlib="$archlibexp"
4793 fi
4794
4795
4796 : Binary compatibility with 5.005 is not possible for builds
4797 : with advanced features
4798 case "$usethreads$usemultiplicity" in
4799 *define*)
4800         bincompat5005="$undef"
4801         d_bincompat5005="$undef"
4802         ;;
4803 *)      $cat <<EOM
4804
4805 Perl 5.006 can be compiled for binary compatibility with 5.005.
4806 If you decide to do so, you will be able to continue using most
4807 of the extensions that were compiled for Perl 5.005.
4808
4809 EOM
4810         case "$bincompat5005$d_bincompat5005" in
4811         *"$undef"*) dflt=n ;;
4812         *) dflt=y ;;
4813         esac
4814         rp='Binary compatibility with Perl 5.005?'
4815         . ./myread
4816         case "$ans" in
4817         y*) val="$define" ;;
4818         *)  val="$undef" ;;
4819         esac
4820         set d_bincompat5005
4821         eval $setvar
4822         case "$d_bincompat5005" in
4823         "$define")
4824                 bincompat5005="$define"
4825                 ;;
4826         *)      bincompat5005="$undef"
4827                 d_bincompat5005="$undef"
4828                 ;;
4829         esac
4830         ;;
4831 esac
4832
4833
4834 : see if setuid scripts can be secure
4835 $cat <<EOM
4836
4837 Some kernels have a bug that prevents setuid #! scripts from being
4838 secure.  Some sites have disabled setuid #! scripts because of this.
4839
4840 First let's decide if your kernel supports secure setuid #! scripts.
4841 (If setuid #! scripts would be secure but have been disabled anyway,
4842 don't say that they are secure if asked.)
4843
4844 EOM
4845
4846 val="$undef"
4847 if $test -d /dev/fd; then
4848         echo "#!$ls" >reflect
4849         chmod +x,u+s reflect
4850         ./reflect >flect 2>&1
4851         if $contains "/dev/fd" flect >/dev/null; then
4852                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4853                 val="$define"
4854         else
4855                 $cat <<EOM
4856 If you are not sure if they are secure, I can check but I'll need a
4857 username and password different from the one you are using right now.
4858 If you don't have such a username or don't want me to test, simply
4859 enter 'none'.
4860
4861 EOM
4862                 rp='Other username to test security of setuid scripts with?'
4863                 dflt='none'
4864                 . ./myread
4865                 case "$ans" in
4866                 n|none)
4867                         case "$d_suidsafe" in
4868                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4869                                 dflt=n;;
4870                         "$undef")
4871                                 echo "Well, the $hint value is *not* secure." >&4
4872                                 dflt=n;;
4873                         *)      echo "Well, the $hint value *is* secure." >&4
4874                                 dflt=y;;
4875                         esac
4876                         ;;
4877                 *)
4878                         $rm -f reflect flect
4879                         echo "#!$ls" >reflect
4880                         chmod +x,u+s reflect
4881                         echo >flect
4882                         chmod a+w flect
4883                         echo '"su" will (probably) prompt you for '"$ans's password."
4884                         su $ans -c './reflect >flect'
4885                         if $contains "/dev/fd" flect >/dev/null; then
4886                                 echo "Okay, it looks like setuid scripts are secure." >&4
4887                                 dflt=y
4888                         else
4889                                 echo "I don't think setuid scripts are secure." >&4
4890                                 dflt=n
4891                         fi
4892                         ;;
4893                 esac
4894                 rp='Does your kernel have *secure* setuid scripts?'
4895                 . ./myread
4896                 case "$ans" in
4897                 [yY]*)  val="$define";;
4898                 *)      val="$undef";;
4899                 esac
4900         fi
4901 else
4902         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4903         echo "(That's for file descriptors, not floppy disks.)"
4904         val="$undef"
4905 fi
4906 set d_suidsafe
4907 eval $setvar
4908
4909 $rm -f reflect flect
4910
4911 : now see if they want to do setuid emulation
4912 echo " "
4913 val="$undef"
4914 case "$d_suidsafe" in
4915 "$define")
4916         val="$undef"
4917         echo "No need to emulate SUID scripts since they are secure here." >& 4
4918         ;;
4919 *)
4920         $cat <<EOM
4921 Some systems have disabled setuid scripts, especially systems where
4922 setuid scripts cannot be secure.  On systems where setuid scripts have
4923 been disabled, the setuid/setgid bits on scripts are currently
4924 useless.  It is possible for $package to detect those bits and emulate
4925 setuid/setgid in a secure fashion.  This emulation will only work if
4926 setuid scripts have been disabled in your kernel.
4927
4928 EOM
4929         case "$d_dosuid" in
4930         "$define") dflt=y ;;
4931         *) dflt=n ;;
4932         esac
4933         rp="Do you want to do setuid/setgid emulation?"
4934         . ./myread
4935         case "$ans" in
4936         [yY]*)  val="$define";;
4937         *)      val="$undef";;
4938         esac
4939         ;;
4940 esac
4941 set d_dosuid
4942 eval $setvar
4943
4944 : determine filename position in cpp output
4945 echo " "
4946 echo "Computing filename position in cpp output for #include directives..." >&4
4947 echo '#include <stdio.h>' > foo.c
4948 $cat >fieldn <<EOF
4949 $startsh
4950 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4951 $grep '^[       ]*#.*stdio\.h' | \
4952 while read cline; do
4953         pos=1
4954         set \$cline
4955         while $test \$# -gt 0; do
4956                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4957                         echo "\$pos"
4958                         exit 0
4959                 fi
4960                 shift
4961                 pos=\`expr \$pos + 1\`
4962         done
4963 done
4964 EOF
4965 chmod +x fieldn
4966 fieldn=`./fieldn`
4967 $rm -f foo.c fieldn
4968 case $fieldn in
4969 '') pos='???';;
4970 1) pos=first;;
4971 2) pos=second;;
4972 3) pos=third;;
4973 *) pos="${fieldn}th";;
4974 esac
4975 echo "Your cpp writes the filename in the $pos field of the line."
4976
4977 : locate header file
4978 $cat >findhdr <<EOF
4979 $startsh
4980 wanted=\$1
4981 name=''
4982 for usrincdir in $usrinc
4983 do
4984         if test -f \$usrincdir/\$wanted; then
4985                 echo "\$usrincdir/\$wanted"
4986                 exit 0
4987         fi
4988 done
4989 awkprg='{ print \$$fieldn }'
4990 echo "#include <\$wanted>" > foo\$\$.c
4991 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4992 $grep "^[       ]*#.*\$wanted" | \
4993 while read cline; do
4994         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4995         case "\$name" in
4996         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4997         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4998         *) exit 2;;
4999         esac;
5000 done;
5001 #
5002 # status = 0: grep returned 0 lines, case statement not executed
5003 # status = 1: headerfile found
5004 # status = 2: while loop executed, no headerfile found
5005 #
5006 status=\$?
5007 $rm -f foo\$\$.c;
5008 if test \$status -eq 1; then
5009         exit 0;
5010 fi
5011 exit 1
5012 EOF
5013 chmod +x findhdr
5014
5015 : define an alternate in-header-list? function
5016 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5017 cont=true; xxf="echo \"<\$1> found.\" >&4";
5018 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5019 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5020 esac;
5021 case $# in 4) instead=instead;; *) instead="at last";; esac;
5022 while $test "$cont"; do
5023         xxx=`./findhdr $1`
5024         var=$2; eval "was=\$$2";
5025         if $test "$xxx" && $test -r "$xxx";
5026         then eval $xxf;
5027         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5028                 cont="";
5029         else eval $xxnf;
5030         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5031         set $yyy; shift; shift; yyy=$@;
5032         case $# in 0) cont="";;
5033         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5034                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5035         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5036                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5037         esac;
5038 done;
5039 while $test "$yyy";
5040 do set $yyy; var=$2; eval "was=\$$2";
5041         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5042         set $yyy; shift; shift; yyy=$@;
5043 done'
5044
5045 : see if this is a malloc.h system
5046 set malloc.h i_malloc
5047 eval $inhdr
5048
5049 : see if stdlib is available
5050 set stdlib.h i_stdlib
5051 eval $inhdr
5052
5053 : determine which malloc to compile in
5054 echo " "
5055 case "$usemymalloc" in
5056 ''|[yY]*|true|$define)  dflt='y' ;;
5057 *)      dflt='n' ;;
5058 esac
5059 rp="Do you wish to attempt to use the malloc that comes with $package?"
5060 . ./myread
5061 usemymalloc="$ans"
5062 case "$ans" in
5063 y*|true)
5064         usemymalloc='y'
5065         mallocsrc='malloc.c'
5066         mallocobj="malloc$_o"
5067         d_mymalloc="$define"
5068         case "$libs" in
5069         *-lmalloc*)
5070                 : Remove malloc from list of libraries to use
5071                 echo "Removing unneeded -lmalloc from library list" >&4
5072                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5073                 shift
5074                 libs="$*"
5075                 echo "libs = $libs" >&4
5076                 ;;
5077         esac
5078         ;;
5079 *)
5080         usemymalloc='n'
5081         mallocsrc=''
5082         mallocobj=''
5083         d_mymalloc="$undef"
5084         ;;
5085 esac
5086
5087 : compute the return types of malloc and free
5088 echo " "
5089 $cat >malloc.c <<END
5090 #$i_malloc I_MALLOC
5091 #$i_stdlib I_STDLIB
5092 #include <stdio.h>
5093 #include <sys/types.h>
5094 #ifdef I_MALLOC
5095 #include <malloc.h>
5096 #endif
5097 #ifdef I_STDLIB
5098 #include <stdlib.h>
5099 #endif
5100 #ifdef TRY_MALLOC
5101 void *malloc();
5102 #endif
5103 #ifdef TRY_FREE
5104 void free();
5105 #endif
5106 END
5107 case "$malloctype" in
5108 '')
5109         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5110                 malloctype='void *'
5111         else
5112                 malloctype='char *'
5113         fi
5114         ;;
5115 esac
5116 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5117
5118 case "$freetype" in
5119 '')
5120         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5121                 freetype='void'
5122         else
5123                 freetype='int'
5124         fi
5125         ;;
5126 esac
5127 echo "Your system uses $freetype free(), it would seem." >&4
5128 $rm -f malloc.[co]
5129 $cat <<EOM
5130
5131 The installation process will also create a directory for
5132 vendor-supplied add-ons.  Vendors who supply perl with their system
5133 may find it convenient to place all vendor-supplied files in this
5134 directory rather than in the main distribution directory.  This will
5135 ease upgrades between binary-compatible maintenance versions of perl.
5136
5137 Of course you may also use these directories in whatever way you see
5138 fit.  For example, you might use them to access modules shared over a
5139 company-wide network.
5140
5141 The default answer should be fine for most people.
5142 This causes further questions about vendor add-ons to be skipped
5143 and no vendor-specific directories will be configured for perl.
5144
5145 EOM
5146 rp='Do you want to configure vendor-specific add-on directories?'
5147 case "$usevendorprefix" in
5148 define|true|[yY]*) dflt=y ;;
5149 *) dflt=n ;;
5150 esac
5151 . ./myread
5152 case "$ans" in
5153 [yY]*)  fn=d~+
5154         rp='Installation prefix to use for vendor-supplied add-ons?'
5155         case "$vendorprefix" in
5156         '') dflt='' ;;
5157         *)  dflt=$vendorprefix ;;
5158         esac
5159         . ./getfile
5160         oldvendorprefix=''
5161         case "$vendorprefix" in
5162         '') ;;
5163         *)      case "$ans" in
5164                 "$prefix") ;;
5165                 *) oldvendorprefix="$prefix";;
5166                 esac
5167                 ;;
5168         esac
5169         usevendorprefix="$define"
5170         vendorprefix="$ans"
5171         vendorprefixexp="$ansexp"
5172         ;;
5173 *)      usevendorprefix="$undef"
5174         vendorprefix=''
5175         vendorprefixexp=''
5176         ;;
5177 esac
5178
5179 case "$vendorprefix" in
5180 '')     d_vendorlib="$undef"
5181         vendorlib=''
5182         vendorlibexp=''
5183         ;;
5184 *)      d_vendorlib="$define"
5185         : determine where vendor-supplied modules go.
5186         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5187         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5188         case "$installstyle" in
5189         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5190         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5191         esac
5192         fn=d~+
5193         rp='Pathname for the vendor-supplied library files?'
5194         . ./getfile
5195         vendorlib="$ans"
5196         vendorlibexp="$ansexp"
5197         : Change installation prefix, if necessary.
5198         if $test X"$prefix" != X"$installprefix"; then
5199                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5200         else
5201                 installvendorlib="$vendorlibexp"
5202         fi
5203         ;;
5204 esac
5205
5206 : Cruising for prototypes
5207 echo " "
5208 echo "Checking out function prototypes..." >&4
5209 $cat >prototype.c <<'EOCP'
5210 int main(int argc, char *argv[]) {
5211         exit(0);}
5212 EOCP
5213 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5214         echo "Your C compiler appears to support function prototypes."
5215         val="$define"
5216 else
5217         echo "Your C compiler doesn't seem to understand function prototypes."
5218         val="$undef"
5219 fi
5220 set prototype
5221 eval $setvar
5222 $rm -f prototype*
5223
5224 case "$prototype" in
5225 "$define") ;;
5226 *)      ansi2knr='ansi2knr'
5227         echo " "
5228         cat <<EOM >&4
5229
5230 $me:  FATAL ERROR:
5231 This version of $package can only be compiled by a compiler that 
5232 understands function prototypes.  Unfortunately, your C compiler 
5233         $cc $ccflags
5234 doesn't seem to understand them.  Sorry about that.
5235
5236 If GNU cc is available for your system, perhaps you could try that instead.  
5237
5238 Eventually, we hope to support building Perl with pre-ANSI compilers.
5239 If you would like to help in that effort, please contact <perlbug@perl.org>.
5240
5241 Aborting Configure now.
5242 EOM
5243         exit 2
5244         ;;
5245 esac
5246
5247 : determine where public executables go
5248 echo " "
5249 set dflt bin bin
5250 eval $prefixit
5251 fn=d~
5252 rp='Pathname where the public executables will reside?'
5253 . ./getfile
5254 if $test "X$ansexp" != "X$binexp"; then
5255         installbin=''
5256 fi
5257 bin="$ans"
5258 binexp="$ansexp"
5259 : Change installation prefix, if necessary.
5260 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5261 if $test X"$prefix" != X"$installprefix"; then
5262         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5263 else
5264         installbin="$binexp"
5265 fi
5266
5267 $cat <<EOM
5268
5269 After $package is installed, you may wish to install various
5270 add-on modules and utilities.  Typically, these add-ons will
5271 be installed under $prefix with the rest
5272 of this package.  However, you may wish to install such add-ons
5273 elsewhere under a different prefix.
5274
5275 If you do not wish to put everything under a single prefix, that's
5276 ok.  You will be prompted for the individual locations; this siteprefix
5277 is only used to suggest the defaults.
5278
5279 The default should be fine for most people.
5280
5281 EOM
5282 fn=d~+
5283 rp='Installation prefix to use for add-on modules and utilities?'
5284 : XXX Here might be another good place for an installstyle setting.
5285 case "$siteprefix" in
5286 '') dflt=$prefix ;;
5287 *)  dflt=$siteprefix ;;
5288 esac
5289 . ./getfile
5290 oldsiteprefix=''
5291 case "$siteprefix" in
5292 '') ;;
5293 *)
5294         case "$ans" in
5295         "$prefix") ;;
5296         *) oldsiteprefix="$prefix";;
5297         esac
5298         ;;
5299 esac
5300 siteprefix="$ans"
5301 siteprefixexp="$ansexp"
5302
5303 : determine where site specific libraries go.
5304 : Usual default is /usr/local/lib/perl5/site_perl/$version
5305 : The default "style" setting is made in installstyle.U
5306 : XXX No longer works with Prefixit stuff.
5307 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5308 case "$installstyle" in
5309 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5310 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5311 esac
5312 $cat <<EOM
5313
5314 The installation process will create a directory for
5315 site-specific extensions and modules.  Most users find it convenient
5316 to place all site-specific files in this directory rather than in the
5317 main distribution directory.
5318
5319 EOM
5320 fn=d~+
5321 rp='Pathname for the site-specific library files?'
5322 . ./getfile
5323 sitelib="$ans"
5324 sitelibexp="$ansexp"
5325 : Change installation prefix, if necessary.
5326 if $test X"$prefix" != X"$installprefix"; then
5327         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5328 else
5329         installsitelib="$sitelibexp"
5330 fi
5331
5332 : Determine list of previous versions to include in @INC
5333 $cat > getverlist <<EOPL
5334 #!$perl -w
5335 use File::Basename;
5336 \$api_versionstring = "$api_versionstring";
5337 \$version = "$version";
5338 \$sitelib = "$sitelib";
5339 \$archname = "$archname";
5340 EOPL
5341         $cat >> getverlist <<'EOPL'
5342 # Can't have leading @ because metaconfig interprets it as a command!
5343 ;@inc_version_list=();
5344 $stem=dirname($sitelib);
5345 # Redo to do opendir/readdir? 
5346 if (-d $stem) {
5347     chdir($stem);
5348     ;@candidates = glob("5.*");
5349 }
5350 else {
5351     ;@candidates = ();
5352 }
5353
5354 # XXX ToDo:  These comparisons must be reworked when two-digit
5355 # subversions come along, so that 5.7.10 compares as greater than
5356 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5357 # widespread that we can use the built-in version vectors rather
5358 # than reinventing them here.  For 5.6.0, however, we must
5359 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5360 foreach $d (@candidates) {
5361     if ($d lt $version) {
5362         if ($d ge $api_versionstring) {
5363             unshift(@inc_version_list, "$d/$archname", $d);
5364         }
5365         elsif ($d ge "5.005") {
5366             unshift(@inc_version_list, $d);
5367         }
5368     }
5369     else {
5370         # Skip newer version.  I.e. don't look in
5371         # 5.7.0 if we're installing 5.6.1.
5372     }
5373 }
5374
5375 if (@inc_version_list) {
5376     print join(' ', @inc_version_list);
5377 }
5378 else {
5379     # Blank space to preserve value for next Configure run.
5380     print " ";
5381 }
5382 EOPL
5383 chmod +x getverlist
5384 case "$inc_version_list" in
5385 '')     if test -x $perl; then
5386                 dflt=`$perl getverlist`
5387         else
5388                 dflt='none'
5389         fi
5390         ;;
5391 $undef) dflt='none' ;;
5392 *)  dflt="$inc_version_list" ;;
5393 esac
5394 $cat <<'EOM'
5395
5396 In order to ease the process of upgrading, this version of perl 
5397 can be configured to use modules built and installed with earlier 
5398 versions of perl that were installed under $prefix.  Specify here
5399 the list of earlier versions that this version of perl should check.
5400 If Configure detected no earlier versions of perl installed under
5401 $prefix, then the list will be empty.  Answer 'none' to tell perl
5402 to not search earlier versions.
5403
5404 The default should almost always be sensible, so if you're not sure,
5405 just accept the default.
5406 EOM
5407
5408 rp='List of earlier versions to include in @INC?'
5409 . ./myread
5410 case "$ans" in
5411 [Nn]one) inc_version_list=' ' ;;
5412 *) inc_version_list="$ans" ;;
5413 esac
5414 case "$inc_version_list" in
5415 ''|' ') 
5416         inc_version_list_init='0';;
5417 *)      inc_version_list_init=`echo $inc_version_list |
5418                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5419         ;;
5420 esac
5421 $rm -f getverlist
5422
5423 : determine whether to install perl also as /usr/bin/perl
5424
5425 echo " "
5426 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5427         $cat <<EOM
5428 Many scripts expect to perl to be installed as /usr/bin/perl.
5429 I can install the perl you are about to compile also as /usr/bin/perl
5430 (in addition to $installbin/perl).
5431 EOM
5432         case "$installusrbinperl" in
5433         "$undef"|[nN]*) dflt='n';;
5434         *)              dflt='y';;
5435         esac
5436         rp="Do you want to install perl as /usr/bin/perl?"
5437         . ./myread
5438         case "$ans" in
5439         [yY]*)  val="$define";;
5440         *)      val="$undef" ;;
5441         esac
5442 else
5443         val="$undef"
5444 fi
5445 set installusrbinperl
5446 eval $setvar
5447
5448 echo " "
5449 echo "Checking for GNU C Library..." >&4
5450 cat >gnulibc.c <<EOM
5451 #include <stdio.h>
5452 int main()
5453 {
5454 #ifdef __GLIBC__
5455     exit(0);
5456 #else
5457     exit(1);
5458 #endif
5459 }
5460 EOM
5461 set gnulibc
5462 if eval $compile_ok && ./gnulibc; then
5463         val="$define"
5464         echo "You are using the GNU C Library"
5465 else
5466         val="$undef"
5467         echo "You are not using the GNU C Library"
5468 fi
5469 $rm -f gnulibc*
5470 set d_gnulibc
5471 eval $setvar
5472
5473 : see if nm is to be used to determine whether a symbol is defined or not
5474 case "$usenm" in
5475 '')
5476         dflt=''
5477         case "$d_gnulibc" in
5478         "$define")
5479                 echo " "
5480                 echo "nm probably won't work on the GNU C Library." >&4
5481                 dflt=n
5482                 ;;
5483         esac
5484         case "$dflt" in
5485         '') 
5486                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5487                         echo " "
5488                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5489                         echo "'nm' won't be sufficient on this sytem." >&4
5490                         dflt=n
5491                 fi
5492                 ;;
5493         esac
5494         case "$dflt" in
5495         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5496                 if $test $dflt -gt 20; then
5497                         dflt=y
5498                 else
5499                         dflt=n
5500                 fi
5501                 ;;
5502         esac
5503         ;;
5504 *)
5505         case "$usenm" in
5506         true|$define) dflt=y;;
5507         *) dflt=n;;
5508         esac
5509         ;;
5510 esac
5511 $cat <<EOM
5512
5513 I can use $nm to extract the symbols from your C libraries. This
5514 is a time consuming task which may generate huge output on the disk (up
5515 to 3 megabytes) but that should make the symbols extraction faster. The
5516 alternative is to skip the 'nm' extraction part and to compile a small
5517 test program instead to determine whether each symbol is present. If
5518 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5519 this may be the best solution.
5520
5521 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5522
5523 EOM
5524 rp="Shall I use $nm to extract C symbols from the libraries?"
5525 . ./myread
5526 case "$ans" in
5527 [Nn]*) usenm=false;;
5528 *) usenm=true;;
5529 esac
5530
5531 runnm=$usenm
5532 case "$reuseval" in
5533 true) runnm=false;;
5534 esac
5535
5536 : nm options which may be necessary
5537 case "$nm_opt" in
5538 '') if $test -f /mach_boot; then
5539                 nm_opt=''       # Mach
5540         elif $test -d /usr/ccs/lib; then
5541                 nm_opt='-p'     # Solaris (and SunOS?)
5542         elif $test -f /dgux; then
5543                 nm_opt='-p'     # DG-UX
5544         elif $test -f /lib64/rld; then
5545                 nm_opt='-p'     # 64-bit Irix
5546         else
5547                 nm_opt=''
5548         fi;;
5549 esac
5550
5551 : nm options which may be necessary for shared libraries but illegal
5552 : for archive libraries.  Thank you, Linux.
5553 case "$nm_so_opt" in
5554 '')     case "$myuname" in
5555         *linux*)
5556                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5557                         nm_so_opt='--dynamic'
5558                 fi
5559                 ;;
5560         esac
5561         ;;
5562 esac
5563
5564 case "$runnm" in
5565 true)
5566 : get list of predefined functions in a handy place
5567 echo " "
5568 case "$libc" in
5569 '') libc=unknown
5570         case "$libs" in
5571         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5572         esac
5573         ;;
5574 esac
5575 libnames='';
5576 case "$libs" in
5577 '') ;;
5578 *)  for thislib in $libs; do
5579         case "$thislib" in
5580         -lc|-lc_s)
5581                 : Handle C library specially below.
5582                 ;;
5583         -l*)
5584                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5585                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5586                         :
5587                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5588                         :
5589                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5590                         :
5591                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5592                         :
5593                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5594                         :
5595                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5596                         :
5597                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5598                         :
5599                 else
5600                         try=''
5601                 fi
5602                 libnames="$libnames $try"
5603                 ;;
5604         *) libnames="$libnames $thislib" ;;
5605         esac
5606         done
5607         ;;
5608 esac
5609 xxx=normal
5610 case "$libc" in
5611 unknown)
5612         set /lib/libc.$so
5613         for xxx in $libpth; do
5614                 $test -r $1 || set $xxx/libc.$so
5615                 : The messy sed command sorts on library version numbers.
5616                 $test -r $1 || \
5617                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5618                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5619                                 h
5620                                 s/[0-9][0-9]*/0000&/g
5621                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5622                                 G
5623                                 s/\n/ /' | \
5624                          sort | $sed -e 's/^.* //'`
5625                 eval set \$$#
5626         done
5627         $test -r $1 || set /usr/ccs/lib/libc.$so
5628         $test -r $1 || set /lib/libsys_s$_a
5629         ;;
5630 *)
5631         set blurfl
5632         ;;
5633 esac
5634 if $test -r "$1"; then
5635         echo "Your (shared) C library seems to be in $1."
5636         libc="$1"
5637 elif $test -r /lib/libc && $test -r /lib/clib; then
5638         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5639         xxx=apollo
5640         libc='/lib/clib /lib/libc'
5641         if $test -r /lib/syslib; then
5642                 echo "(Your math library is in /lib/syslib.)"
5643                 libc="$libc /lib/syslib"
5644         fi
5645 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5646         echo "Your C library seems to be in $libc, as you said before."
5647 elif $test -r $incpath/usr/lib/libc$_a; then
5648         libc=$incpath/usr/lib/libc$_a;
5649         echo "Your C library seems to be in $libc.  That's fine."
5650 elif $test -r /lib/libc$_a; then
5651         libc=/lib/libc$_a;
5652         echo "Your C library seems to be in $libc.  You're normal."
5653 else
5654         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5655                 :
5656         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5657                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5658         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5659                 :
5660         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5661                 :
5662         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5663                 :
5664         else
5665                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5666         fi
5667         if $test -r "$tans"; then
5668                 echo "Your C library seems to be in $tans, of all places."
5669                 libc=$tans
5670         else
5671                 libc='blurfl'
5672         fi
5673 fi
5674 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5675         dflt="$libc"
5676         cat <<EOM
5677
5678 If the guess above is wrong (which it might be if you're using a strange
5679 compiler, or your machine supports multiple models), you can override it here.
5680
5681 EOM
5682 else
5683         dflt=''
5684         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5685         cat >&4 <<EOM
5686 I can't seem to find your C library.  I've looked in the following places:
5687
5688 EOM
5689         $sed 's/^/      /' libpath
5690         cat <<EOM
5691
5692 None of these seems to contain your C library. I need to get its name...
5693
5694 EOM
5695 fi
5696 fn=f
5697 rp='Where is your C library?'
5698 . ./getfile
5699 libc="$ans"
5700
5701 echo " "
5702 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5703 set X `cat libnames`
5704 shift
5705 xxx=files
5706 case $# in 1) xxx=file; esac
5707 echo "Extracting names from the following $xxx for later perusal:" >&4
5708 echo " "
5709 $sed 's/^/      /' libnames >&4
5710 echo " "
5711 $echo $n "This may take a while...$c" >&4
5712
5713 for file in $*; do
5714         case $file in
5715         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5716         *) $nm $nm_opt $file 2>/dev/null;;
5717         esac
5718 done >libc.tmp
5719
5720 $echo $n ".$c"
5721 $grep fprintf libc.tmp > libc.ptf
5722 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5723 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5724 xxx='[ADTSIW]'
5725 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5726         eval $xscan;\
5727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728                 eval $xrun
5729 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5730         eval $xscan;\
5731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732                 eval $xrun
5733 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5734         eval $xscan;\
5735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736                 eval $xrun
5737 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5738         eval $xscan;\
5739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740                 eval $xrun
5741 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5750                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5751         eval $xscan;\
5752         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5753                 eval $xrun
5754 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5755         eval $xscan;\
5756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757                 eval $xrun
5758 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5759         eval $xscan;\
5760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761                 eval $xrun
5762 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5763         eval $xscan;\
5764         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5765                 eval $xrun
5766 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5767         eval $xscan;\
5768         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5769                 eval $xrun
5770 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5771         eval $xscan;\
5772         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5773                 eval $xrun
5774 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5775         eval $xscan;\
5776         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5777                 eval $xrun
5778 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5779         eval $xscan;\
5780         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5781                 eval $xrun
5782 else
5783         $nm -p $* 2>/dev/null >libc.tmp
5784         $grep fprintf libc.tmp > libc.ptf
5785         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5786                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5787         then
5788                 nm_opt='-p'
5789                 eval $xrun
5790         else
5791                 echo " "
5792                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5793                 com=''
5794                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5795                         for thisname in $libnames $libc; do
5796                                 $ar t $thisname >>libc.tmp
5797                         done
5798                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5799                         echo "Ok." >&4
5800                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5801                         # Repeat libc to extract forwarders to DLL entries too
5802                         for thisname in $libnames $libc; do
5803                                 $ar tv $thisname >>libc.tmp
5804                                 # Revision 50 of EMX has bug in $ar.
5805                                 # it will not extract forwarders to DLL entries
5806                                 # Use emximp which will extract exactly them.
5807                                 emximp -o tmp.imp $thisname \
5808                                     2>/dev/null && \
5809                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5810                                     < tmp.imp >>libc.tmp
5811                                 $rm tmp.imp
5812                         done
5813                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5814                         echo "Ok." >&4
5815                 else
5816                         echo "$ar didn't seem to work right." >&4
5817                         echo "Maybe this is a Cray...trying bld instead..." >&4
5818                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5819                         then
5820                                 for thisname in $libnames; do
5821                                         bld t $libnames | \
5822                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5823                                         $ar t $thisname >>libc.tmp
5824                                 done
5825                                 echo "Ok." >&4
5826                         else
5827                                 echo "That didn't work either.  Giving up." >&4
5828                                 exit 1
5829                         fi
5830                 fi
5831         fi
5832 fi
5833 nm_extract="$com"
5834 if $test -f /lib/syscalls.exp; then
5835         echo " "
5836         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5837         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5838 fi
5839 ;;
5840 esac
5841 $rm -f libnames libpath
5842
5843 : see if dld is available
5844 set dld.h i_dld
5845 eval $inhdr
5846
5847 : is a C symbol defined?
5848 csym='tlook=$1;
5849 case "$3" in
5850 -v) tf=libc.tmp; tc=""; tdc="";;
5851 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5852 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5853 esac;
5854 tx=yes;
5855 case "$reuseval-$4" in
5856 true-) ;;
5857 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5858 esac;
5859 case "$tx" in
5860 yes)
5861         case "$runnm" in
5862         true)
5863                 if $contains $tlook $tf >/dev/null 2>&1;
5864                 then tval=true;
5865                 else tval=false;
5866                 fi;;
5867         *)
5868                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5869                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5870                 then tval=true;
5871                 else tval=false;
5872                 fi;
5873                 $rm -f t t.c;;
5874         esac;;
5875 *)
5876         case "$tval" in
5877         $define) tval=true;;
5878         *) tval=false;;
5879         esac;;
5880 esac;
5881 eval "$2=$tval"'
5882
5883 : define an is-in-libc? function
5884 inlibc='echo " "; td=$define; tu=$undef;
5885 sym=$1; var=$2; eval "was=\$$2";
5886 tx=yes;
5887 case "$reuseval$was" in
5888 true) ;;
5889 true*) tx=no;;
5890 esac;
5891 case "$tx" in
5892 yes)
5893         set $sym tres -f;
5894         eval $csym;
5895         case "$tres" in
5896         true)
5897                 echo "$sym() found." >&4;
5898                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5899         *)
5900                 echo "$sym() NOT found." >&4;
5901                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5902         esac;;
5903 *)
5904         case "$was" in
5905         $define) echo "$sym() found." >&4;;
5906         *) echo "$sym() NOT found." >&4;;
5907         esac;;
5908 esac'
5909
5910 : see if dlopen exists
5911 xxx_runnm="$runnm"
5912 runnm=false
5913 set dlopen d_dlopen
5914 eval $inlibc
5915 runnm="$xxx_runnm"
5916
5917 : determine which dynamic loading, if any, to compile in
5918 echo " "
5919 dldir="ext/DynaLoader"
5920 case "$usedl" in
5921 $define|y|true)
5922         dflt='y'
5923         usedl="$define"
5924         ;;
5925 $undef|n|false)
5926         dflt='n'
5927         usedl="$undef"
5928         ;;
5929 *) 
5930         dflt='n'
5931         case "$d_dlopen" in
5932             $define) dflt='y' ;;
5933         esac
5934         case "$i_dld" in
5935             $define) dflt='y' ;;
5936         esac
5937         : Does a dl_xxx.xs file exist for this operating system
5938         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5939         ;;
5940 esac
5941 rp="Do you wish to use dynamic loading?"
5942 . ./myread
5943 usedl="$ans"
5944 case "$ans" in
5945 y*) usedl="$define"
5946         case "$dlsrc" in
5947         '')
5948                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5949                         dflt="$dldir/dl_${osname}.xs"
5950                 elif $test "$d_dlopen" = "$define" ; then
5951                         dflt="$dldir/dl_dlopen.xs"
5952                 elif $test "$i_dld" = "$define" ; then
5953                         dflt="$dldir/dl_dld.xs"
5954                 else
5955                         dflt=''
5956                 fi
5957                 ;;
5958         *)      dflt="$dldir/$dlsrc"
5959                 ;;
5960         esac
5961     echo "The following dynamic loading files are available:"
5962         : Can not go over to $dldir because getfile has path hard-coded in.
5963         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5964         rp="Source file to use for dynamic loading"
5965         fn="fne"
5966         gfpth="$src"
5967         . ./getfile
5968         usedl="$define"
5969         : emulate basename
5970         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5971
5972         $cat << EOM
5973
5974 Some systems may require passing special flags to $cc -c to
5975 compile modules that will be used to create a shared library.
5976 To use no flags, say "none".
5977
5978 EOM
5979     case "$cccdlflags" in
5980     '') case "$gccversion" in
5981                 '') case "$osname" in
5982                         hpux)   dflt='+z' ;;
5983                         next)   dflt='none' ;;
5984                         irix*)  dflt='-KPIC' ;;
5985                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5986                         sunos)  dflt='-pic' ;;
5987                         *)      dflt='none' ;;
5988                     esac
5989                         ;;
5990                 *)  case "$osname" in
5991                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5992                         *)      dflt='-fpic' ;;
5993                     esac ;;
5994             esac ;;
5995         ' ') dflt='none' ;;
5996     *)  dflt="$cccdlflags" ;;
5997     esac
5998     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5999     . ./myread
6000     case "$ans" in
6001     none) cccdlflags=' ' ;;
6002     *) cccdlflags="$ans" ;;
6003     esac
6004
6005     cat << EOM
6006
6007 Some systems use ld to create libraries that can be dynamically loaded,
6008 while other systems (such as those using ELF) use $cc.
6009
6010 EOM
6011         case "$ld" in
6012         '')     $cat >try.c <<'EOM'
6013 /* Test for whether ELF binaries are produced */
6014 #include <fcntl.h>
6015 #include <stdlib.h>
6016 int main() {
6017         char b[4];
6018         int i = open("a.out",O_RDONLY);
6019         if(i == -1) 
6020                 exit(1); /* fail */
6021         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6022                 exit(0); /* succeed (yes, it's ELF) */
6023         else
6024                 exit(1); /* fail */
6025 }
6026 EOM
6027                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6028                         cat <<EOM
6029 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6030 EOM
6031                         dflt="$cc"
6032                 else
6033                         echo "I'll use ld to build dynamic libraries."
6034                         dflt='ld'
6035                 fi
6036                 rm -f try.c a.out
6037                 ;;
6038         *)      dflt="$ld"
6039                 ;;
6040         esac
6041
6042     rp="What command should be used to create dynamic libraries?"
6043     . ./myread
6044         ld="$ans"
6045
6046     cat << EOM
6047
6048 Some systems may require passing special flags to $ld to create a
6049 library that can be dynamically loaded.  If your ld flags include
6050 -L/other/path options to locate libraries outside your loader's normal
6051 search path, you may need to specify those -L options here as well.  To
6052 use no flags, say "none".
6053
6054 EOM
6055     case "$lddlflags" in
6056     '') case "$osname" in
6057                         beos) dflt='-nostart' ;;
6058                         hpux)  dflt='-b +vnocompatwarnings' ;;
6059                         linux|irix*)    dflt='-shared' ;;
6060                         next)  dflt='none' ;;
6061                         solaris) dflt='-G' ;;
6062                         sunos) dflt='-assert nodefinitions' ;;
6063                         svr4*|esix*) dflt="-G $ldflags" ;;
6064                 *)     dflt='none' ;;
6065                         esac
6066                         ;;
6067     *) dflt="$lddlflags" ;;
6068     esac
6069
6070         : Try to guess additional flags to pick up local libraries.
6071         : Be careful not to append to a plain 'none'
6072         case "$dflt" in
6073         none) dflt='' ;;
6074         esac
6075         for thisflag in $ldflags; do
6076                 case "$thisflag" in
6077                 -L*)
6078                         case " $dflt " in
6079                         *" $thisflag "*) ;;
6080                         *) dflt="$dflt $thisflag" ;;
6081                         esac
6082                         ;;
6083                 esac
6084         done
6085
6086         case "$dflt" in
6087         ''|' ') dflt='none' ;;
6088         esac
6089
6090     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6091     . ./myread
6092     case "$ans" in
6093     none) lddlflags=' ' ;;
6094     *) lddlflags="$ans" ;;
6095     esac
6096
6097         cat <<EOM
6098
6099 Some systems may require passing special flags to $cc to indicate that
6100 the resulting executable will use dynamic linking.  To use no flags,
6101 say "none".
6102
6103 EOM
6104     case "$ccdlflags" in
6105     '') case "$osname" in
6106                 hpux)   dflt='-Wl,-E' ;;
6107                 linux)  dflt='-rdynamic' ;;
6108                 next)   dflt='none' ;;
6109                 sunos)  dflt='none' ;;
6110                 *)      dflt='none' ;;
6111             esac ;;
6112     ' ')  dflt='none' ;;
6113     *)  dflt="$ccdlflags" ;;
6114     esac
6115     rp="Any special flags to pass to $cc to use dynamic linking?"
6116     . ./myread
6117     case "$ans" in
6118     none) ccdlflags=' ' ;;
6119     *) ccdlflags="$ans" ;;
6120     esac
6121     ;;
6122 *)  usedl="$undef"
6123         ld='ld'
6124     dlsrc='dl_none.xs'
6125     lddlflags=''
6126     ccdlflags=''
6127     ;;
6128 esac
6129
6130 also=''
6131 case "$usedl" in
6132 $undef)
6133         # No dynamic loading being used, so don't bother even to prompt.
6134         useshrplib='false'
6135         ;;
6136 *)      case "$useshrplib" in
6137         '')     case "$osname" in
6138                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6139                         dflt=y
6140                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6141                         ;;
6142                 next*)
6143                         case "$osvers" in
6144                         4*)     dflt=y
6145                                 also='Building a shared libperl is needed for MAB support.'
6146                                 ;;
6147                         *)      dflt=n
6148                                 ;;
6149                         esac
6150                         ;;
6151                 *)      dflt=n
6152                         ;;
6153                 esac
6154                 ;;
6155         $define|true|[Yy]*)
6156                 dflt=y
6157                 ;;
6158         *)      dflt=n
6159                 ;;
6160         esac
6161         $cat << EOM
6162
6163 The perl executable is normally obtained by linking perlmain.c with
6164 libperl${_a}, any static extensions (usually just DynaLoader), and
6165 any other libraries needed on this system (such as -lm, etc.).  Since
6166 your system supports dynamic loading, it is probably possible to build
6167 a shared libperl.$so.  If you will have more than one executable linked
6168 to libperl.$so, this will significantly reduce the size of each
6169 executable, but it may have a noticeable affect on performance.  The
6170 default is probably sensible for your system.
6171 $also
6172
6173 EOM
6174         rp="Build a shared libperl.$so (y/n)"
6175         . ./myread
6176         case "$ans" in
6177         true|$define|[Yy]*)
6178                 useshrplib='true'  ;;
6179         *)      useshrplib='false' ;;
6180         esac
6181         ;;
6182 esac
6183
6184 case "$useshrplib" in
6185 true)
6186         case "$libperl" in
6187         '')
6188                 # Figure out a good name for libperl.so.  Since it gets stored in
6189                 # a version-specific architecture-dependent library, the version
6190                 # number isn't really that important, except for making cc/ld happy.
6191                 #
6192                 # A name such as libperl.so.3.1
6193                 majmin="libperl.$so.$patchlevel.$subversion"
6194                 # A name such as libperl.so.301
6195                 majonly=`echo $patchlevel $subversion |
6196                         $awk '{printf "%d%02d", $1, $2}'`
6197                 majonly=libperl.$so.$majonly
6198                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6199                 # rely on figuring it out from the naming of libc.
6200                 case "${osname}${osvers}" in
6201                 next4*)
6202                         dflt=libperl.5.$so
6203                         # XXX How handle the --version stuff for MAB?
6204                         ;;
6205                 linux*)  # ld won't link with a bare -lperl otherwise.
6206                         dflt=libperl.$so
6207                         ;;
6208                 cygwin*) # include version
6209                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6210                         ;;
6211                 *)      # Try to guess based on whether libc has major.minor.
6212                         case "$libc" in
6213                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6214                         *libc.$so.[0-9]*) dflt=$majonly ;;
6215                         *)      dflt=libperl.$so ;;
6216                         esac
6217                         ;;
6218                 esac
6219                 ;;
6220         *)      dflt=$libperl
6221                 ;;
6222         esac
6223         cat << EOM
6224
6225 I need to select a good name for the shared libperl.  If your system uses
6226 library names with major and minor numbers, then you might want something
6227 like $majmin.  Alternatively, if your system uses a single version
6228 number for shared libraries, then you might want to use $majonly.
6229 Or, your system might be quite happy with a simple libperl.$so.
6230
6231 Since the shared libperl will get installed into a version-specific
6232 architecture-dependent directory, the version number of the shared perl
6233 library probably isn't important, so the default should be o.k.
6234
6235 EOM
6236         rp='What name do you want to give to the shared libperl?'
6237         . ./myread
6238         libperl=$ans
6239         echo "Ok, I'll use $libperl"
6240         ;;
6241 *)
6242         libperl="libperl${_a}"
6243         ;;
6244 esac
6245
6246 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6247 case "$shrpdir" in
6248 '') ;;
6249 *)      $cat >&4 <<EOM
6250 WARNING:  Use of the shrpdir variable for the installation location of
6251 the shared $libperl is not supported.  It was never documented and
6252 will not work in this version.  Let me (perlbug@perl.com)
6253 know of any problems this may cause.
6254
6255 EOM
6256         case "$shrpdir" in
6257         "$archlibexp/CORE")
6258                 $cat >&4 <<EOM
6259 But your current setting of $shrpdir is
6260 the default anyway, so it's harmless.
6261 EOM
6262                 ;;
6263         *)
6264                 $cat >&4 <<EOM
6265 Further, your current attempted setting of $shrpdir
6266 conflicts with the value of $archlibexp/CORE
6267 that installperl will use.
6268 EOM
6269                 ;;
6270         esac
6271         ;;
6272 esac
6273
6274 # How will the perl executable find the installed shared $libperl?
6275 # Add $xxx to ccdlflags.
6276 # If we can't figure out a command-line option, use $shrpenv to
6277 # set env LD_RUN_PATH.  The main perl makefile uses this.
6278 shrpdir=$archlibexp/CORE
6279 xxx=''
6280 tmp_shrpenv=''
6281 if "$useshrplib"; then
6282     case "$osname" in 
6283         aix)
6284                 # We'll set it in Makefile.SH...
6285                 ;;
6286         solaris|netbsd)
6287                 xxx="-R $shrpdir"
6288                 ;;
6289         freebsd)
6290                 xxx="-Wl,-R$shrpdir"
6291                 ;;
6292         linux|irix*|dec_osf)
6293                 xxx="-Wl,-rpath,$shrpdir"
6294                 ;;
6295         next)
6296                 # next doesn't like the default...
6297                 ;;
6298         beos)
6299                 # beos doesn't like the default, either.
6300                 ;;
6301         hpux*)
6302                 # hpux doesn't like the default, either.
6303                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6304                 ;;
6305         *)
6306                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6307                 ;;
6308         esac
6309         case "$xxx" in
6310         '') ;;
6311         *)      
6312                 # Only add $xxx if it isn't already in ccdlflags.
6313                 case " $ccdlflags " in
6314                 *" $xxx "*)     ;;
6315                 *)      ccdlflags="$ccdlflags $xxx"
6316                         cat <<EOM >&4
6317
6318 Adding $xxx to the flags
6319 passed to $ld so that the perl executable will find the 
6320 installed shared $libperl.
6321
6322 EOM
6323                         ;;
6324                 esac
6325                 ;;
6326         esac
6327 fi
6328 # Fix ccdlflags in AIX for building external extensions.
6329 # (For building Perl itself bare -bE:perl.exp is needed,
6330 #  Makefile.SH takes care of this.)
6331 case "$osname" in
6332 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6333 esac
6334 # Respect a hint or command-line value.
6335 case "$shrpenv" in
6336 '') shrpenv="$tmp_shrpenv" ;;
6337 esac
6338 case "$ldlibpthname" in
6339 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6340 none)   ldlibpthname='' ;;
6341 esac
6342
6343 : determine where manual pages go
6344 set man1dir man1dir none
6345 eval $prefixit
6346 $cat <<EOM
6347
6348 $spackage has manual pages available in source form.
6349 EOM
6350 case "$nroff" in
6351 nroff)
6352         echo "However, you don't have nroff, so they're probably useless to you."
6353         case "$man1dir" in
6354         '') man1dir="none";;
6355         esac;;
6356 esac
6357 echo "If you don't want the manual sources installed, answer 'none'."
6358 case "$man1dir" in
6359 ' ') dflt=none
6360         ;;
6361 '')
6362         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6363         lookpath="$lookpath $prefixexp/man/p_man/man1"
6364         lookpath="$lookpath $prefixexp/man/u_man/man1"
6365         lookpath="$lookpath $prefixexp/man/man.1"
6366         case "$sysman" in
6367         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6368         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6369         esac
6370         set dflt
6371         eval $prefixup
6372         ;;
6373 *)  dflt="$man1dir"
6374         ;;
6375 esac
6376 echo " "
6377 fn=dn+~
6378 rp="Where do the main $spackage manual pages (source) go?"
6379 . ./getfile
6380 if $test "X$man1direxp" != "X$ansexp"; then
6381         installman1dir=''
6382 fi
6383 man1dir="$ans"
6384 man1direxp="$ansexp"
6385 case "$man1dir" in
6386 '')     man1dir=' '
6387         installman1dir='';;
6388 esac
6389
6390 : Change installation prefix, if necessary.
6391 if $test X"$prefix" != X"$installprefix"; then
6392         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6393 else
6394         installman1dir="$man1direxp"
6395 fi
6396
6397 : What suffix to use on installed man pages
6398
6399 case "$man1dir" in
6400 ' ')
6401         man1ext='0'
6402         ;;
6403 *)
6404         rp="What suffix should be used for the main $spackage man pages?"
6405         case "$man1ext" in
6406         '')     case "$man1dir" in
6407                 *1)  dflt=1 ;;
6408                 *1p) dflt=1p ;;
6409                 *1pm) dflt=1pm ;;
6410                 *l) dflt=l;;
6411                 *n) dflt=n;;
6412                 *o) dflt=o;;
6413                 *p) dflt=p;;
6414                 *C) dflt=C;;
6415                 *L) dflt=L;;
6416                 *L1) dflt=L1;;
6417                 *) dflt=1;;
6418                 esac
6419                 ;;
6420         *)      dflt="$man1ext";;
6421         esac
6422         . ./myread
6423         man1ext="$ans"
6424         ;;
6425 esac
6426
6427 : see if we can have long filenames
6428 echo " "
6429 rmlist="$rmlist /tmp/cf$$"
6430 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6431 first=123456789abcdef
6432 second=/tmp/cf$$/$first
6433 $rm -f $first $second
6434 if (echo hi >$first) 2>/dev/null; then
6435         if $test -f 123456789abcde; then
6436                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6437                 val="$undef"
6438         else
6439                 if (echo hi >$second) 2>/dev/null; then
6440                         if $test -f /tmp/cf$$/123456789abcde; then
6441                                 $cat <<'EOM'
6442 That's peculiar... You can have filenames longer than 14 characters, but only
6443 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6444 I shall consider your system cannot support long filenames at all.
6445 EOM
6446                                 val="$undef"
6447                         else
6448                                 echo 'You can have filenames longer than 14 characters.' >&4
6449                                 val="$define"
6450                         fi
6451                 else
6452                         $cat <<'EOM'
6453 How confusing! Some of your filesystems are sane enough to allow filenames
6454 longer than 14 characters but some others like /tmp can't even think about them.
6455 So, for now on, I shall assume your kernel does not allow them at all.
6456 EOM
6457                         val="$undef"
6458                 fi
6459         fi
6460 else
6461         $cat <<'EOM'
6462 You can't have filenames longer than 14 chars.  You can't even think about them!
6463 EOM
6464         val="$undef"
6465 fi 
6466 set d_flexfnam
6467 eval $setvar
6468 $rm -rf /tmp/cf$$ 123456789abcde*
6469
6470 : determine where library module manual pages go
6471 set man3dir man3dir none
6472 eval $prefixit
6473 $cat <<EOM
6474
6475 $spackage has manual pages for many of the library modules.
6476 EOM
6477
6478 case "$nroff" in
6479 nroff)
6480         $cat <<'EOM'
6481 However, you don't have nroff, so they're probably useless to you.
6482 EOM
6483         case "$man3dir" in
6484         '') man3dir="none";;
6485         esac;;
6486 esac
6487
6488 case "$d_flexfnam" in
6489 undef)
6490         $cat <<'EOM'
6491 However, your system can't handle the long file names like File::Basename.3. 
6492 EOM
6493         case "$man3dir" in
6494         '') man3dir="none";;
6495         esac;;
6496 esac
6497
6498 echo "If you don't want the manual sources installed, answer 'none'."
6499 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6500 case "$man3dir" in
6501 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6502         if $test -d "$privlib/man/man3"; then
6503                 cat <<EOM >&4
6504
6505 WARNING:  Previous versions of perl installed man3 pages into
6506 $privlib/man/man3.  This version will suggest a 
6507 new default of $dflt.  
6508 EOM
6509                 tdflt=$dflt
6510                 dflt='n'
6511                 rp='Do you wish to preserve the old behavior?(y/n)'
6512                 . ./myread
6513                 case "$ans" in
6514                 y*) dflt="$privlib/man/man3" ;;
6515                 *)  dflt=$tdflt ;;
6516                 esac
6517     fi
6518         ;;
6519 ' ') dflt=none;;
6520 *)      dflt="$man3dir" ;;
6521 esac
6522 echo " "
6523 fn=dn+~
6524 rp="Where do the $package library man pages (source) go?"
6525 . ./getfile
6526 man3dir="$ans"
6527 man3direxp="$ansexp"
6528 case "$man1dir" in
6529 '')     man3dir=' '
6530         installman3dir='';;
6531 esac
6532
6533 : Change installation prefix, if necessary.
6534 if $test X"$prefix" != X"$installprefix"; then
6535         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6536 else
6537         installman3dir="$man3direxp"
6538 fi
6539
6540 : What suffix to use on installed man pages
6541 case "$man3dir" in
6542 ' ')
6543         man3ext='0'
6544         ;;
6545 *)
6546         rp="What suffix should be used for the $package library man pages?"
6547         case "$man3ext" in
6548         '')     case "$man3dir" in
6549                 *3)  dflt=3 ;;
6550                 *3p) dflt=3p ;;
6551                 *3pm) dflt=3pm ;;
6552                 *l) dflt=l;;
6553                 *n) dflt=n;;
6554                 *o) dflt=o;;
6555                 *p) dflt=p;;
6556                 *C) dflt=C;;
6557                 *L) dflt=L;;
6558                 *L3) dflt=L3;;
6559                 *) dflt=3;;
6560                 esac
6561                 ;;
6562         *)      dflt="$man3ext";;
6563         esac
6564         . ./myread
6565         man3ext="$ans"
6566         ;;
6567 esac
6568
6569 : see if we have to deal with yellow pages, now NIS.
6570 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6571         if $test -f /usr/etc/nibindd; then
6572                 echo " "
6573                 echo "I'm fairly confident you're on a NeXT."
6574                 echo " "
6575                 rp='Do you get the hosts file via NetInfo?'
6576                 dflt=y
6577                 case "$hostcat" in
6578                 nidump*) ;;
6579                 '') ;;
6580                 *) dflt=n;;
6581                 esac
6582                 . ./myread
6583                 case "$ans" in
6584                 y*) hostcat='nidump hosts .';;
6585                 *)      case "$hostcat" in
6586                         nidump*) hostcat='';;
6587                         esac
6588                         ;;
6589                 esac
6590         fi
6591         case "$hostcat" in
6592         nidump*) ;;
6593         *)
6594                 case "$hostcat" in
6595                 *ypcat*) dflt=y;;
6596                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6597                                 dflt=y
6598                         else
6599                                 dflt=n
6600                         fi;;
6601                 *) dflt=n;;
6602                 esac
6603                 echo " "
6604                 rp='Are you getting the hosts file via yellow pages?'
6605                 . ./myread
6606                 case "$ans" in
6607                 y*) hostcat='ypcat hosts';;
6608                 *) hostcat='cat /etc/hosts';;
6609                 esac
6610                 ;;
6611         esac
6612 fi
6613 case "$hostcat" in
6614 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6615 esac
6616 case "$groupcat" in
6617 '') test -f /etc/group && groupcat='cat /etc/group';;
6618 esac
6619 case "$passcat" in
6620 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6621 esac
6622
6623 : now get the host name
6624 echo " "
6625 echo "Figuring out host name..." >&4
6626 case "$myhostname" in
6627 '') cont=true
6628         echo 'Maybe "hostname" will work...'
6629         if tans=`sh -c hostname 2>&1` ; then
6630                 myhostname=$tans
6631                 phostname=hostname
6632                 cont=''
6633         fi
6634         ;;
6635 *) cont='';;
6636 esac
6637 if $test "$cont"; then
6638         if ./xenix; then
6639                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6640                 if tans=`cat /etc/systemid 2>&1` ; then
6641                         myhostname=$tans
6642                         phostname='cat /etc/systemid'
6643                         echo "Whadyaknow.  Xenix always was a bit strange..."
6644                         cont=''
6645                 fi
6646         elif $test -r /etc/systemid; then
6647                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6648         fi
6649 fi
6650 if $test "$cont"; then
6651         echo 'No, maybe "uuname -l" will work...'
6652         if tans=`sh -c 'uuname -l' 2>&1` ; then
6653                 myhostname=$tans
6654                 phostname='uuname -l'
6655         else
6656                 echo 'Strange.  Maybe "uname -n" will work...'
6657                 if tans=`sh -c 'uname -n' 2>&1` ; then
6658                         myhostname=$tans
6659                         phostname='uname -n'
6660                 else
6661                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6662                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6663                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6664                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6665                         else
6666                                 case "$myhostname" in
6667                                 '') echo "Does this machine have an identity crisis or something?"
6668                                         phostname='';;
6669                                 *)
6670                                         echo "Well, you said $myhostname before..."
6671                                         phostname='echo $myhostname';;
6672                                 esac
6673                         fi
6674                 fi
6675         fi
6676 fi
6677 : you do not want to know about this
6678 set $myhostname
6679 myhostname=$1
6680
6681 : verify guess
6682 if $test "$myhostname" ; then
6683         dflt=y
6684         rp='Your host name appears to be "'$myhostname'".'" Right?"
6685         . ./myread
6686         case "$ans" in
6687         y*) ;;
6688         *) myhostname='';;
6689         esac
6690 fi
6691
6692 : bad guess or no guess
6693 while $test "X$myhostname" = X ; do
6694         dflt=''
6695         rp="Please type the (one word) name of your host:"
6696         . ./myread
6697         myhostname="$ans"
6698 done
6699
6700 : translate upper to lower if necessary
6701 case "$myhostname" in
6702 *[A-Z]*)
6703         echo "(Normalizing case in your host name)"
6704         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6705         ;;
6706 esac
6707
6708 case "$myhostname" in
6709 *.*)
6710         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6711         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6712         echo "(Trimming domain name from host name--host name is now $myhostname)"
6713         ;;
6714 *) case "$mydomain" in
6715         '')
6716                 {
6717                         test "X$hostcat" = "Xypcat hosts" &&
6718                         ypmatch "$myhostname" hosts 2>/dev/null |\
6719                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6720                         $test -s hosts
6721                 } || {
6722                         test "X$hostcat" != "X" &&
6723                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6724                                         /[       ]$myhostname[  . ]/p" > hosts
6725                 }
6726                 tmp_re="[       . ]"
6727                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6728                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6729                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6730                         hosts | $sort | $uniq | \
6731                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6732                 case `$echo X$dflt` in
6733                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6734                         dflt=.
6735                         ;;
6736                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6737                         ;;
6738                 esac
6739                 case "$dflt" in
6740                 .)
6741                         tans=`./loc resolv.conf X /etc /usr/etc`
6742                         if $test -f "$tans"; then
6743                                 echo "(Attempting domain name extraction from $tans)"
6744                                 dflt=.`$sed -n -e 's/   / /g' \
6745                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6746                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6747                                 case "$dflt" in
6748                                 .) dflt=.`$sed -n -e 's/        / /g' \
6749                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6750                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6751                                         ;;
6752                                 esac
6753                         fi
6754                         ;;
6755                 esac
6756                 case "$dflt" in
6757                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6758                         dflt=.`sh -c domainname 2>/dev/null`
6759                         case "$dflt" in
6760                         '') dflt='.';;
6761                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6762                         esac
6763                         ;;
6764                 esac
6765                 case "$dflt" in
6766                 .) echo "(Lost all hope -- silly guess then)"
6767                         dflt='.uucp'
6768                         ;;
6769                 esac
6770                 $rm -f hosts
6771                 ;;
6772         *) dflt="$mydomain";;
6773         esac;;
6774 esac
6775 echo " "
6776 rp="What is your domain name?"
6777 . ./myread
6778 tans="$ans"
6779 case "$ans" in
6780 '') ;;
6781 .*) ;;
6782 *) tans=".$tans";;
6783 esac
6784 mydomain="$tans"
6785
6786 : translate upper to lower if necessary
6787 case "$mydomain" in
6788 *[A-Z]*)
6789         echo "(Normalizing case in your domain name)"
6790         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6791         ;;
6792 esac
6793
6794 : a little sanity check here
6795 case "$phostname" in
6796 '') ;;
6797 *)
6798         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6799         $myhostname$mydomain|$myhostname) ;;
6800         *)
6801                 case "$phostname" in
6802                 sed*)
6803                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6804                         ;;
6805                 *)
6806                         echo "(That doesn't agree with your $phostname command, by the way.)"
6807                         ;;
6808                 esac
6809         ;;
6810         esac
6811         ;;
6812 esac
6813
6814 $cat <<EOM
6815
6816 I need to get your e-mail address in Internet format if possible, i.e.
6817 something like user@host.domain. Please answer accurately since I have
6818 no easy means to double check it. The default value provided below
6819 is most probably close to reality but may not be valid from outside
6820 your organization...
6821
6822 EOM
6823 cont=x
6824 while test "$cont"; do
6825         case "$cf_email" in
6826         '') dflt="$cf_by@$myhostname$mydomain";;
6827         *) dflt="$cf_email";;
6828         esac
6829         rp='What is your e-mail address?'
6830         . ./myread
6831         cf_email="$ans"
6832         case "$cf_email" in
6833         *@*.*) cont='' ;;
6834         *)
6835                 rp='Address does not look like an Internet one.  Use it anyway?'
6836                 case "$fastread" in
6837                 yes) dflt=y ;;
6838                 *) dflt=n ;;
6839                 esac
6840                 . ./myread
6841                 case "$ans" in
6842                 y*) cont='' ;;
6843                 *) echo " " ;;
6844                 esac
6845                 ;;
6846         esac
6847 done
6848
6849 $cat <<EOM
6850
6851 If you or somebody else will be maintaining perl at your site, please
6852 fill in the correct e-mail address here so that they may be contacted
6853 if necessary. Currently, the "perlbug" program included with perl
6854 will send mail to this address in addition to perlbug@perl.com. You may
6855 enter "none" for no administrator.
6856
6857 EOM
6858 case "$perladmin" in
6859 '') dflt="$cf_email";;
6860 *) dflt="$perladmin";;
6861 esac
6862 rp='Perl administrator e-mail address'
6863 . ./myread
6864 perladmin="$ans"
6865
6866 : figure out how to guarantee perl startup
6867 case "$startperl" in
6868 '')
6869         case "$sharpbang" in
6870         *!)
6871                 $cat <<EOH
6872
6873 I can use the #! construct to start perl on your system. This will
6874 make startup of perl scripts faster, but may cause problems if you
6875 want to share those scripts and perl is not in a standard place
6876 ($binexp/perl) on all your platforms. The alternative is to force
6877 a shell by starting the script with a single ':' character.
6878
6879 EOH
6880                 dflt="$binexp/perl"
6881                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6882                 . ./myread
6883                 case "$ans" in
6884                 none)   startperl=": # use perl";;
6885                 *)      startperl="#!$ans"
6886                         if $test 30 -lt `echo "$ans" | wc -c`; then
6887                                 $cat >&4 <<EOM
6888
6889 WARNING:  Some systems limit the #! command to 32 characters.
6890 If you experience difficulty running Perl scripts with #!, try
6891 installing Perl in a directory with a shorter pathname.
6892
6893 EOM
6894                         fi ;;
6895                 esac
6896                 ;;
6897         *) startperl=": # use perl"
6898                 ;;
6899         esac
6900         ;;
6901 esac
6902 echo "I'll use $startperl to start perl scripts."
6903
6904 : figure best path for perl in scripts
6905 case "$perlpath" in
6906 '')
6907         perlpath="$binexp/perl"
6908         case "$startperl" in
6909         *!*) ;;
6910         *)
6911                 $cat <<EOH
6912
6913 I will use the "eval 'exec'" idiom to start Perl on your system.
6914 I can use the full path of your Perl binary for this purpose, but
6915 doing so may cause problems if you want to share those scripts and
6916 Perl is not always in a standard place ($binexp/perl).
6917
6918 EOH
6919                 dflt="$binexp/perl"
6920                 rp="What path shall I use in \"eval 'exec'\"?"
6921                 . ./myread
6922                 perlpath="$ans"
6923                 ;;
6924         esac
6925         ;;
6926 esac
6927 case "$startperl" in
6928 *!*)    ;;
6929 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6930 esac
6931
6932 : determine where public executable scripts go
6933 set scriptdir scriptdir
6934 eval $prefixit
6935 case "$scriptdir" in
6936 '')
6937         dflt="$bin"
6938         : guess some guesses
6939         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6940         $test -d /usr/share/bin     && dflt=/usr/share/bin
6941         $test -d /usr/local/script  && dflt=/usr/local/script
6942         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6943         $test -d $prefixexp/script  && dflt=$prefixexp/script
6944         set dflt
6945         eval $prefixup
6946         ;;
6947 *)  dflt="$scriptdir"
6948         ;;
6949 esac
6950 $cat <<EOM
6951  
6952 Some installations have a separate directory just for executable scripts so
6953 that they can mount it across multiple architectures but keep the scripts in
6954 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6955 Or you might just lump your scripts in with all your other executables.
6956  
6957 EOM
6958 fn=d~
6959 rp='Where do you keep publicly executable scripts?'
6960 . ./getfile
6961 if $test "X$ansexp" != "X$scriptdirexp"; then
6962         installscript=''
6963 fi
6964 scriptdir="$ans"
6965 scriptdirexp="$ansexp"
6966 : Change installation prefix, if necessary.
6967 if $test X"$prefix" != X"$installprefix"; then
6968         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6969 else
6970         installscript="$scriptdirexp"
6971 fi
6972
6973 : determine where site specific architecture-dependent libraries go.
6974 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6975 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6976 : sitelib may have an optional trailing /share.
6977 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6978 tdflt="$tdflt/$archname"
6979 set sitearch sitearch none
6980 eval $prefixit
6981 case "$sitearch" in
6982 '')     dflt="$tdflt" ;;
6983 *)      dflt="$sitearch" ;;
6984 esac
6985 $cat <<EOM
6986
6987 The installation process will also create a directory for
6988 architecture-dependent site-specific extensions and modules.
6989
6990 EOM
6991 fn=nd~+
6992 rp='Pathname for the site-specific architecture-dependent library files?'
6993 . ./getfile
6994 sitearch="$ans"
6995 sitearchexp="$ansexp"
6996 : Change installation prefix, if necessary.
6997 if $test X"$prefix" != X"$installprefix"; then
6998         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6999 else
7000         installsitearch="$sitearchexp"
7001 fi
7002
7003 : determine where add-on public executables go
7004 case "$sitebin" in
7005 '')     dflt=$siteprefix/bin ;;
7006 *)      dflt=$sitebin ;;
7007 esac
7008 fn=d~
7009 rp='Pathname where the add-on public executables should be installed?'
7010 . ./getfile
7011 sitebin="$ans"
7012 sitebinexp="$ansexp"
7013 : Change installation prefix, if necessary.
7014 if $test X"$prefix" != X"$installprefix"; then
7015         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7016 else
7017         installsitebin="$sitebinexp"
7018 fi
7019
7020 : see if sqrtl exists
7021 set sqrtl d_sqrtl
7022 eval $inlibc
7023
7024 case "$ccflags" in
7025 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7026 esac
7027
7028 case "$uselongdouble" in
7029 $define|true|[yY]*)     dflt='y';;
7030 *) dflt='n';;
7031 esac
7032 cat <<EOM
7033
7034 Perl can be built to take advantage of long doubles which
7035 (if available) may give more accuracy and range for floating point numbers.
7036
7037 If this doesn't make any sense to you, just accept the default '$dflt'.
7038 EOM
7039 rp='Try to use long doubles if available?'
7040 . ./myread
7041 case "$ans" in
7042 y|Y)    val="$define"   ;;
7043 *)      val="$undef"    ;;
7044 esac
7045 set uselongdouble
7046 eval $setvar
7047
7048 case "$uselongdouble" in
7049 true|[yY]*) uselongdouble="$define" ;;
7050 esac
7051
7052 case "$uselongdouble" in
7053 $define)
7054 : Look for a hint-file generated 'call-back-unit'.  If the
7055 : user has specified that long doubles should be used,
7056 : we may need to set or change some other defaults.
7057         if $test -f uselongdouble.cbu; then
7058                 echo "Your platform has some specific hints for long doubles, using them..."
7059                 . ./uselongdouble.cbu
7060         else
7061                 $cat <<EOM
7062 (Your platform doesn't have any specific hints for long doubles.)
7063 EOM
7064         fi
7065         ;;
7066 esac
7067
7068 case "$uselongdouble:$d_sqrtl" in
7069 $define:$undef)
7070                 $cat <<EOM >&4
7071
7072 You requested the use of long doubles but you do not seem to have
7073 the mathematic functions for long doubles.  I'm disabling the use
7074 of long doubles.
7075 EOM
7076         uselongdouble=$undef
7077         ;;
7078 esac
7079
7080 case "$useperlio" in
7081 $define|true|[yY]*)     dflt='y';;
7082 *) dflt='n';;
7083 esac
7084 cat <<EOM
7085
7086 Previous version of $package used the standard IO mechanisms as defined
7087 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7088 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7089 the default.  This abstraction layer can use AT&T's sfio (if you already
7090 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7091 problems with some extension modules.  Using PerlIO with stdio is safe,
7092 but it is slower than plain stdio and therefore is not the default.
7093
7094 If this doesn't make any sense to you, just accept the default '$dflt'.
7095 EOM
7096 rp='Use the experimental PerlIO abstraction layer?'
7097 . ./myread
7098 case "$ans" in
7099 y|Y) 
7100         val="$define"
7101         ;;     
7102 *)      
7103         echo "Ok, doing things the stdio way"
7104         val="$undef"
7105         ;;
7106 esac
7107 set useperlio
7108 eval $setvar 
7109
7110 case "$vendorprefix" in
7111 '')     d_vendorbin="$undef"
7112         vendorbin=''
7113         vendorbinexp=''
7114         ;;
7115 *)      d_vendorbin="$define"
7116         : determine where vendor-supplied executables go.
7117         dflt=$vendorprefix/bin
7118         fn=d~+
7119         rp='Pathname for the vendor-supplied executables directory?'
7120         . ./getfile
7121         vendorbin="$ans"
7122         vendorbinexp="$ansexp"
7123         : Change installation prefix, if necessary.
7124         if $test X"$prefix" != X"$installprefix"; then
7125                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7126         else
7127                 installvendorbin="$vendorbinexp"
7128         fi
7129         ;;
7130 esac
7131
7132 : check for length of double
7133 echo " "
7134 case "$doublesize" in
7135 '')
7136         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7137         $cat >try.c <<'EOCP'
7138 #include <stdio.h>
7139 int main()
7140 {
7141     printf("%d\n", (int)sizeof(double));
7142     exit(0);
7143 }
7144 EOCP
7145         set try
7146         if eval $compile_ok; then
7147                 doublesize=`./try`
7148                 $echo " $doublesize bytes." >&4
7149         else
7150                 dflt='8'
7151                 echo "(I can't seem to compile the test program.  Guessing...)"
7152                 rp="What is the size of a double precision number (in bytes)?"
7153                 . ./myread
7154                 doublesize="$ans"
7155         fi
7156         ;;
7157 esac
7158 $rm -f try.c try
7159
7160 : check for long doubles
7161 echo " "
7162 $echo $n "Checking to see if your system supports long double..." $c >&4
7163 echo 'int main() { long double x = 7.0; }' > try.c
7164 set try
7165 if eval $compile; then
7166         val="$define"
7167         echo " Yes, it does." >&4
7168 else
7169         val="$undef"
7170         echo " No, it doesn't." >&4
7171 fi
7172 $rm try.*
7173 set d_longdbl
7174 eval $setvar
7175
7176 : check for length of long double
7177 case "${d_longdbl}${longdblsize}" in
7178 $define)
7179         echo " "
7180         $echo $n "Checking to see how big your long doubles are..." $c >&4
7181         $cat >try.c <<'EOCP'
7182 #include <stdio.h>
7183 int main()
7184 {
7185         printf("%d\n", sizeof(long double));
7186 }
7187 EOCP
7188         set try
7189         set try
7190         if eval $compile; then
7191                 longdblsize=`./try$exe_ext`
7192                 $echo " $longdblsize bytes." >&4
7193         else
7194                 dflt='8'
7195                 echo " "
7196                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7197                 rp="What is the size of a long double (in bytes)?"
7198                 . ./myread
7199                 longdblsize="$ans"
7200         fi
7201         if $test "X$doublesize" = "X$longdblsize"; then
7202                 echo "(That isn't any different from an ordinary double.)"
7203         fi      
7204         ;;
7205 esac
7206 $rm -f try.* try
7207
7208 : Check how to convert floats to strings.
7209 if test "X$d_Gconvert" = X; then
7210         echo " "
7211         echo "Checking for an efficient way to convert floats to strings."
7212         $cat >try.c <<EOP
7213 #ifdef TRY_gconvert
7214 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7215 char *myname = "gconvert";
7216 #endif
7217 #ifdef TRY_gcvt
7218 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7219 char *myname = "gcvt";
7220 #endif
7221 #ifdef TRY_qgcvt
7222 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7223 char *myname = "qgcvt";
7224 #define DOUBLETYPE long double
7225 #endif
7226 #ifdef TRY_sprintf
7227 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7228 char *myname = "sprintf";
7229 #endif
7230
7231 #ifndef DOUBLETYPE
7232 #define DOUBLETYPE double
7233 #endif
7234
7235 #include <stdio.h>
7236
7237 #define I_STDLIB $i_stdlib
7238 #ifdef I_STDLIB
7239 #include <stdlib.h>
7240 #endif
7241
7242 int
7243 checkit(expect, got)
7244 char *expect;
7245 char *got;
7246 {
7247     if (strcmp(expect, got)) {
7248                 printf("%s oddity:  Expected %s, got %s\n",
7249                         myname, expect, got);
7250                 exit(1);
7251         }
7252 }
7253
7254 int main()
7255
7256         char buf[64]; 
7257         buf[63] = '\0';
7258
7259         /* This must be 1st test on (which?) platform */
7260         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7261         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7262         checkit("0.1", buf);
7263
7264         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7265         checkit("1", buf);
7266
7267         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7268         checkit("0", buf);
7269
7270         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7271         checkit("-1", buf);
7272
7273         /* Some Linux gcvt's give 1.e+5 here. */
7274         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7275         checkit("100000", buf);
7276         
7277         /* Some Linux gcvt's give -1.e+5 here. */
7278         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7279         checkit("-100000", buf);
7280
7281         exit(0);
7282 }
7283 EOP
7284         case "$d_Gconvert" in
7285         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7286         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7287         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7288         *) xxx_list='gconvert gcvt sprintf' ;;
7289         esac
7290
7291         case "$d_longdbl$uselongdouble" in
7292         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7293         esac
7294
7295         for xxx_convert in $xxx_list; do
7296                 echo "Trying $xxx_convert..."
7297                 $rm -f try try$_o
7298                 set try -DTRY_$xxx_convert
7299                 if eval $compile; then
7300                         echo "$xxx_convert() found." >&4
7301                         if ./try; then
7302                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7303                                 break;
7304                         else
7305                                 echo "...But $xxx_convert didn't work as I expected."
7306                         fi
7307                 else
7308                         echo "$xxx_convert NOT found." >&4
7309                 fi
7310         done
7311                 
7312         case "$xxx_convert" in
7313         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7314         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7315         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7316         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7317         esac
7318 fi
7319
7320 echo " "
7321
7322 if $test X"$d_longdbl" = X"$define"; then
7323
7324 echo "Checking how to print long doubles..." >&4
7325
7326 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7327         $cat >try.c <<'EOCP'
7328 #include <sys/types.h>
7329 #include <stdio.h>
7330 int main() {
7331   double d = 123.456;
7332   printf("%.3f\n", d);
7333 }
7334 EOCP
7335         set try
7336         if eval $compile; then
7337                 yyy=`./try$exe_ext`
7338                 case "$yyy" in
7339                 123.456)
7340                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7341                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7342                         echo "We will use %f."
7343                         ;;
7344                 esac
7345         fi
7346 fi
7347
7348 if $test X"$sPRIfldbl" = X; then
7349         $cat >try.c <<'EOCP'
7350 #include <sys/types.h>
7351 #include <stdio.h>
7352 int main() {
7353   long double d = 123.456;
7354   printf("%.3llf\n", d);
7355 }
7356 EOCP
7357         set try
7358         if eval $compile; then
7359                 yyy=`./try$exe_ext`
7360                 case "$yyy" in
7361                 123.456)
7362                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7363                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7364                         echo "We will use %llf."
7365                         ;;
7366                 esac
7367         fi
7368 fi
7369
7370 if $test X"$sPRIfldbl" = X; then
7371         $cat >try.c <<'EOCP'
7372 #include <sys/types.h>
7373 #include <stdio.h>
7374 int main() {
7375   long double d = 123.456;
7376   printf("%.3Lf\n", d);
7377 }
7378 EOCP
7379         set try
7380         if eval $compile; then
7381                 yyy=`./try$exe_ext`
7382                 case "$yyy" in
7383                 123.456)
7384                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7385                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7386                         echo "We will use %Lf."
7387                         ;;
7388                 esac
7389         fi
7390 fi
7391
7392 if $test X"$sPRIfldbl" = X; then
7393         $cat >try.c <<'EOCP'
7394 #include <sys/types.h>
7395 #include <stdio.h>
7396 int main() {
7397   long double d = 123.456;
7398   printf("%.3lf\n", d);
7399 }
7400 EOCP
7401         set try
7402         if eval $compile; then
7403                 yyy=`./try$exe_ext`
7404                 case "$yyy" in
7405                 123.456)
7406                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7407                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7408                         echo "We will use %lf."
7409                         ;;
7410                 esac
7411         fi
7412 fi
7413
7414 if $test X"$sPRIfldbl" = X; then
7415         echo "Cannot figure out how to print long doubles." >&4
7416 fi
7417
7418 $rm -f try try.*
7419
7420 fi # d_longdbl
7421
7422 case "$sPRIfldbl" in
7423 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7424         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7425         ;;
7426 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7427         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7428         ;;
7429 esac
7430
7431 : Initialize h_fcntl
7432 h_fcntl=false
7433
7434 : Initialize h_sysfile
7435 h_sysfile=false
7436
7437 : access call always available on UNIX
7438 set access d_access
7439 eval $inlibc
7440
7441 : locate the flags for 'access()'
7442 case "$d_access" in
7443 "$define")
7444         echo " "
7445         $cat >access.c <<'EOCP'
7446 #include <sys/types.h>
7447 #ifdef I_FCNTL
7448 #include <fcntl.h>
7449 #endif
7450 #ifdef I_SYS_FILE
7451 #include <sys/file.h>
7452 #endif
7453 #ifdef I_UNISTD
7454 #include <unistd.h>
7455 #endif
7456 int main() {
7457         exit(R_OK);
7458 }
7459 EOCP
7460         : check sys/file.h first, no particular reason here
7461         if $test `./findhdr sys/file.h` && \
7462                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7463                 h_sysfile=true;
7464                 echo "<sys/file.h> defines the *_OK access constants." >&4
7465         elif $test `./findhdr fcntl.h` && \
7466                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7467                 h_fcntl=true;
7468                 echo "<fcntl.h> defines the *_OK access constants." >&4
7469         elif $test `./findhdr unistd.h` && \
7470                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7471                 echo "<unistd.h> defines the *_OK access constants." >&4
7472         else
7473                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7474         fi
7475         ;;
7476 esac
7477 $rm -f access*
7478
7479 : see if accessx exists
7480 set accessx d_accessx
7481 eval $inlibc
7482
7483 : see if alarm exists
7484 set alarm d_alarm
7485 eval $inlibc
7486
7487 : see if atolf exists
7488 set atolf d_atolf
7489 eval $inlibc
7490
7491 : see if atoll exists
7492 set atoll d_atoll
7493 eval $inlibc
7494
7495 : Look for GNU-cc style attribute checking
7496 echo " "
7497 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7498 $cat >attrib.c <<'EOCP'
7499 #include <stdio.h>
7500 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7501 EOCP
7502 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7503         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7504                 echo "Your C compiler doesn't fully support __attribute__."
7505                 val="$undef"
7506         else
7507                 echo "Your C compiler supports __attribute__."
7508                 val="$define"
7509         fi
7510 else
7511         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7512         val="$undef"
7513 fi
7514 set d_attribut
7515 eval $setvar
7516 $rm -f attrib*
7517
7518 : see if bcmp exists
7519 set bcmp d_bcmp
7520 eval $inlibc
7521
7522 : see if bcopy exists
7523 set bcopy d_bcopy
7524 eval $inlibc
7525
7526 : see if this is a unistd.h system
7527 set unistd.h i_unistd
7528 eval $inhdr
7529
7530 : see if getpgrp exists
7531 set getpgrp d_getpgrp
7532 eval $inlibc
7533
7534 case "$d_getpgrp" in
7535 "$define")
7536         echo " "
7537         echo "Checking to see which flavor of getpgrp is in use..."
7538         $cat >set.c <<EOP
7539 #$i_unistd I_UNISTD
7540 #include <sys/types.h>
7541 #ifdef I_UNISTD
7542 #  include <unistd.h>
7543 #endif
7544 int main()
7545 {
7546         if (getuid() == 0) {
7547                 printf("(I see you are running Configure as super-user...)\n");
7548                 setuid(1);
7549         }
7550 #ifdef TRY_BSD_PGRP
7551         if (getpgrp(1) == 0)
7552                 exit(0);
7553 #else
7554         if (getpgrp() > 0)
7555                 exit(0);
7556 #endif
7557         exit(1);
7558 }
7559 EOP
7560         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7561                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7562                 val="$define"
7563         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7564                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7565                 val="$undef"
7566         else
7567                 echo "I can't seem to compile and run the test program."
7568                 if ./usg; then
7569                         xxx="a USG one, i.e. you use getpgrp()."
7570                 else
7571                         # SVR4 systems can appear rather BSD-ish.
7572                         case "$i_unistd" in
7573                         $undef)
7574                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7575                                 val="$define"
7576                                 ;;
7577                         $define)
7578                                 xxx="probably a USG one, i.e. you use getpgrp()."
7579                                 val="$undef"
7580                                 ;;
7581                         esac
7582                 fi
7583                 echo "Assuming your getpgrp is $xxx" >&4
7584         fi
7585         ;;
7586 *) val="$undef";;
7587 esac
7588 set d_bsdgetpgrp
7589 eval $setvar
7590 $rm -f set set.c
7591
7592 : see if setpgrp exists
7593 set setpgrp d_setpgrp
7594 eval $inlibc
7595
7596 case "$d_setpgrp" in
7597 "$define")
7598         echo " "
7599         echo "Checking to see which flavor of setpgrp is in use..."
7600         $cat >set.c <<EOP
7601 #$i_unistd I_UNISTD
7602 #include <sys/types.h>
7603 #ifdef I_UNISTD
7604 #  include <unistd.h>
7605 #endif
7606 int main()
7607 {
7608         if (getuid() == 0) {
7609                 printf("(I see you are running Configure as super-user...)\n");
7610                 setuid(1);
7611         }
7612 #ifdef TRY_BSD_PGRP
7613         if (-1 == setpgrp(1, 1))
7614                 exit(0);
7615 #else
7616         if (setpgrp() != -1)
7617                 exit(0);
7618 #endif
7619         exit(1);
7620 }
7621 EOP
7622         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7623                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7624                 val="$define"
7625         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7626                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7627                 val="$undef"
7628         else
7629                 echo "(I can't seem to compile and run the test program.)"
7630                 if ./usg; then
7631                         xxx="a USG one, i.e. you use setpgrp()."
7632                 else
7633                         # SVR4 systems can appear rather BSD-ish.
7634                         case "$i_unistd" in
7635                         $undef)
7636                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7637                                 val="$define"
7638                                 ;;
7639                         $define)
7640                                 xxx="probably a USG one, i.e. you use setpgrp()."
7641                                 val="$undef"
7642                                 ;;
7643                         esac
7644                 fi
7645                 echo "Assuming your setpgrp is $xxx" >&4
7646         fi
7647         ;;
7648 *) val="$undef";;
7649 esac
7650 set d_bsdsetpgrp
7651 eval $setvar
7652 $rm -f set set.c
7653 : see if bzero exists
7654 set bzero d_bzero
7655 eval $inlibc
7656
7657 : see if signal is declared as pointer to function returning int or void
7658 echo " "
7659 xxx=`./findhdr signal.h`
7660 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7661 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7662         echo "You have int (*signal())() instead of void." >&4
7663         val="$undef"
7664 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7665         echo "You have void (*signal())()." >&4
7666         val="$define"
7667 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7668         echo "You have int (*signal())() instead of void." >&4
7669         val="$undef"
7670 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7671         echo "You have void (*signal())()." >&4
7672         val="$define"
7673 else
7674         case "$d_voidsig" in
7675         '')
7676         echo "I can't determine whether signal handler returns void or int..." >&4
7677                 dflt=void
7678                 rp="What type does your signal handler return?"
7679                 . ./myread
7680                 case "$ans" in
7681                 v*) val="$define";;
7682                 *) val="$undef";;
7683                 esac;;
7684         "$define")
7685                 echo "As you already told me, signal handler returns void." >&4
7686                 val="$define"
7687                 ;;
7688         *)      echo "As you already told me, signal handler returns int." >&4
7689                 val="$undef"
7690                 ;;
7691         esac
7692 fi
7693 set d_voidsig
7694 eval $setvar
7695 case "$d_voidsig" in
7696 "$define") signal_t="void";;
7697 *) signal_t="int";;
7698 esac
7699 $rm -f $$.tmp
7700
7701 : check for ability to cast large floats to 32-bit ints.
7702 echo " "
7703 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7704 if $test "$intsize" -ge 4; then
7705         xxx=int
7706 else
7707         xxx=long
7708 fi
7709 $cat >try.c <<EOCP
7710 #include <stdio.h>
7711 #include <sys/types.h>
7712 #include <signal.h>
7713 $signal_t blech(s) int s; { exit(3); }
7714 int main()
7715 {
7716         $xxx i32;
7717         double f, g;
7718         int result = 0;
7719         char str[16];
7720         signal(SIGFPE, blech);
7721
7722         /* Don't let compiler optimize the test away.  Store the number 
7723            in a writable string for gcc to pass to sscanf under HP/UX.
7724         */
7725         sprintf(str, "2147483647");
7726         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7727         g = 10 * f;
7728         i32  = ($xxx) g;
7729
7730         /* x86 processors will probably give 0x8000 0000, which is a
7731        sign change.  We don't want that.  We want to mimic SPARC
7732            behavior here, which is to preserve the sign and give
7733            back 0x7fff ffff.
7734         */
7735         if (i32 != ($xxx) f)
7736                 result |= 1;
7737         exit(result);
7738 }
7739 EOCP
7740 set try
7741 if eval $compile_ok; then
7742         ./try
7743         yyy=$?
7744 else
7745         echo "(I can't seem to compile the test program--assuming it can't)"
7746         yyy=1
7747 fi
7748 case "$yyy" in
7749 0)      val="$define"
7750         echo "Yup, it can."
7751         ;;
7752 *)      val="$undef"
7753         echo "Nope, it can't."
7754         ;;
7755 esac
7756 set d_casti32
7757 eval $setvar
7758 $rm -f try try.*
7759
7760 : check for ability to cast negative floats to unsigned
7761 echo " "
7762 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7763 $cat >try.c <<EOCP
7764 #include <stdio.h>
7765 #include <sys/types.h>
7766 #include <signal.h>
7767 $signal_t blech(s) int s; { exit(7); }
7768 $signal_t blech_in_list(s) int s; { exit(4); }
7769 unsigned long dummy_long(p) unsigned long p; { return p; }
7770 unsigned int dummy_int(p) unsigned int p; { return p; }
7771 unsigned short dummy_short(p) unsigned short p; { return p; }
7772 int main()
7773 {
7774         double f;
7775         unsigned long along;
7776         unsigned int aint;
7777         unsigned short ashort;
7778         int result = 0;
7779         char str[16];
7780         
7781         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7782            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7783            optimized the whole file away
7784         */
7785         /* Store the number in a writable string for gcc to pass to 
7786            sscanf under HP/UX.
7787         */
7788         sprintf(str, "-123");
7789         sscanf(str, "%lf", &f);  /* f = -123.; */
7790
7791         signal(SIGFPE, blech);
7792         along = (unsigned long)f;
7793         aint = (unsigned int)f;
7794         ashort = (unsigned short)f;
7795         if (along != (unsigned long)-123)
7796                 result |= 1;
7797         if (aint != (unsigned int)-123)
7798                 result |= 1;
7799         if (ashort != (unsigned short)-123)
7800                 result |= 1;
7801         sprintf(str, "1073741824.");
7802         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7803         f = f + f;
7804         along = 0;
7805         along = (unsigned long)f;
7806         if (along != 0x80000000)
7807                 result |= 2;
7808         f -= 1.;
7809         along = 0;
7810         along = (unsigned long)f;
7811         if (along != 0x7fffffff)
7812                 result |= 1;
7813         f += 2.;
7814         along = 0;
7815         along = (unsigned long)f;
7816         if (along != 0x80000001)
7817                 result |= 2;
7818         if (result)
7819                 exit(result);
7820         signal(SIGFPE, blech_in_list);
7821         sprintf(str, "123.");
7822         sscanf(str, "%lf", &f);  /* f = 123.; */
7823         along = dummy_long((unsigned long)f);
7824         aint = dummy_int((unsigned int)f);
7825         ashort = dummy_short((unsigned short)f);
7826         if (along != (unsigned long)123)
7827                 result |= 4;
7828         if (aint != (unsigned int)123)
7829                 result |= 4;
7830         if (ashort != (unsigned short)123)
7831                 result |= 4;
7832         exit(result);
7833
7834 }
7835 EOCP
7836 set try
7837 if eval $compile_ok; then
7838         ./try
7839         castflags=$?
7840 else
7841         echo "(I can't seem to compile the test program--assuming it can't)"
7842         castflags=7
7843 fi
7844 case "$castflags" in
7845 0)      val="$define"
7846         echo "Yup, it can."
7847         ;;
7848 *)      val="$undef"
7849         echo "Nope, it can't."
7850         ;;
7851 esac
7852 set d_castneg
7853 eval $setvar
7854 $rm -f try.*
7855
7856 : see if vprintf exists
7857 echo " "
7858 if set vprintf val -f d_vprintf; eval $csym; $val; then
7859         echo 'vprintf() found.' >&4
7860         val="$define"
7861         $cat >vprintf.c <<'EOF'
7862 #include <varargs.h>
7863
7864 int main() { xxx("foo"); }
7865
7866 xxx(va_alist)
7867 va_dcl
7868 {
7869         va_list args;
7870         char buf[10];
7871
7872         va_start(args);
7873         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7874 }
7875 EOF
7876         set vprintf
7877         if eval $compile && ./vprintf; then
7878                 echo "Your vsprintf() returns (int)." >&4
7879                 val2="$undef"
7880         else
7881                 echo "Your vsprintf() returns (char*)." >&4
7882                 val2="$define"
7883         fi
7884 else
7885         echo 'vprintf() NOT found.' >&4
7886                 val="$undef"
7887                 val2="$undef"
7888 fi
7889 set d_vprintf
7890 eval $setvar
7891 val=$val2
7892 set d_charvspr
7893 eval $setvar
7894
7895 : see if chown exists
7896 set chown d_chown
7897 eval $inlibc
7898
7899 : see if chroot exists
7900 set chroot d_chroot
7901 eval $inlibc
7902
7903 : see if chsize exists
7904 set chsize d_chsize
7905 eval $inlibc
7906
7907 : check for const keyword
7908 echo " "
7909 echo 'Checking to see if your C compiler knows about "const"...' >&4
7910 $cat >const.c <<'EOCP'
7911 typedef struct spug { int drokk; } spug;
7912 int main()
7913 {
7914         const char *foo;
7915         const spug y;
7916 }
7917 EOCP
7918 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7919         val="$define"
7920         echo "Yup, it does."
7921 else
7922         val="$undef"
7923         echo "Nope, it doesn't."
7924 fi
7925 set d_const
7926 eval $setvar
7927
7928 : see if crypt exists
7929 echo " "
7930 if set crypt val -f d_crypt; eval $csym; $val; then
7931         echo 'crypt() found.' >&4
7932         val="$define"
7933         cryptlib=''
7934 else
7935         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7936         if $test -z "$cryptlib"; then
7937                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7938         else
7939                 cryptlib=-lcrypt
7940         fi
7941         if $test -z "$cryptlib"; then
7942                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7943         else
7944                 cryptlib=-lcrypt
7945         fi
7946         if $test -z "$cryptlib"; then
7947                 cryptlib=`./loc libcrypt$_a "" $libpth`
7948         else
7949                 cryptlib=-lcrypt
7950         fi
7951         if $test -z "$cryptlib"; then
7952                 echo 'crypt() NOT found.' >&4
7953                 val="$undef"
7954         else
7955                 val="$define"
7956         fi
7957 fi
7958 set d_crypt
7959 eval $setvar
7960
7961 : get csh whereabouts
7962 case "$csh" in
7963 'csh') val="$undef" ;;
7964 *) val="$define" ;;
7965 esac
7966 set d_csh
7967 eval $setvar
7968 : Respect a hint or command line value for full_csh.
7969 case "$full_csh" in
7970 '') full_csh=$csh ;;
7971 esac
7972
7973 : see if cuserid exists
7974 set cuserid d_cuserid
7975 eval $inlibc
7976
7977 : see if this is a limits.h system
7978 set limits.h i_limits
7979 eval $inhdr
7980
7981 : see if this is a float.h system
7982 set float.h i_float
7983 eval $inhdr
7984
7985 : See if number of significant digits in a double precision number is known
7986 echo " "
7987 $cat >dbl_dig.c <<EOM
7988 #$i_limits I_LIMITS
7989 #$i_float I_FLOAT
7990 #ifdef I_LIMITS
7991 #include <limits.h>
7992 #endif
7993 #ifdef I_FLOAT
7994 #include <float.h>
7995 #endif
7996 #ifdef DBL_DIG
7997 printf("Contains DBL_DIG");
7998 #endif
7999 EOM
8000 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8001 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8002         echo "DBL_DIG found." >&4
8003         val="$define"
8004 else
8005         echo "DBL_DIG NOT found." >&4
8006         val="$undef"
8007 fi
8008 $rm -f dbl_dig.?
8009 set d_dbl_dig
8010 eval $setvar
8011
8012 : see if difftime exists
8013 set difftime d_difftime
8014 eval $inlibc
8015
8016 : see if this is a dirent system
8017 echo " "
8018 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8019         val="$define"
8020         echo "<dirent.h> found." >&4
8021 else
8022         val="$undef"
8023         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8024                 echo "<sys/dir.h> found." >&4
8025                 echo " "
8026         else
8027                 xinc=`./findhdr sys/ndir.h`
8028         fi
8029         echo "<dirent.h> NOT found." >&4
8030 fi
8031 set i_dirent
8032 eval $setvar
8033
8034 : Look for type of directory structure.
8035 echo " "
8036 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8037
8038 case "$direntrytype" in
8039 ''|' ')
8040         case "$i_dirent" in
8041         $define) guess1='struct dirent' ;;
8042         *) guess1='struct direct'  ;;
8043         esac
8044         ;;
8045 *)      guess1="$direntrytype"
8046         ;;
8047 esac
8048
8049 case "$guess1" in
8050 'struct dirent') guess2='struct direct' ;;
8051 *) guess2='struct dirent' ;;
8052 esac
8053                 
8054 if $contains "$guess1" try.c >/dev/null 2>&1; then
8055         direntrytype="$guess1"
8056         echo "Your directory entries are $direntrytype." >&4
8057 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8058         direntrytype="$guess2"
8059         echo "Your directory entries seem to be $direntrytype." >&4
8060 else
8061         echo "I don't recognize your system's directory entries." >&4
8062         rp="What type is used for directory entries on this system?"
8063         dflt="$guess1"
8064         . ./myread
8065         direntrytype="$ans"
8066 fi
8067 $rm -f try.c
8068
8069
8070 : see if the directory entry stores field length
8071 echo " "
8072 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8073 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8074         echo "Good, your directory entry keeps length information in d_namlen." >&4
8075         val="$define"
8076 else
8077         echo "Your directory entry does not know about the d_namlen field." >&4
8078         val="$undef"
8079 fi
8080 set d_dirnamlen
8081 eval $setvar
8082 $rm -f try.c
8083
8084 : see if dlerror exists
8085 xxx_runnm="$runnm"
8086 runnm=false
8087 set dlerror d_dlerror
8088 eval $inlibc
8089 runnm="$xxx_runnm"
8090
8091 : see if dlfcn is available
8092 set dlfcn.h i_dlfcn
8093 eval $inhdr
8094
8095 case "$usedl" in
8096 $define|y|true)
8097         $cat << EOM
8098
8099 On a few systems, the dynamically loaded modules that perl generates and uses
8100 will need a different extension than shared libs. The default will probably
8101 be appropriate.
8102
8103 EOM
8104         case "$dlext" in
8105         '')     dflt="$so" ;;
8106         *)      dflt="$dlext" ;;
8107         esac
8108         rp='What is the extension of dynamically loaded modules'
8109         . ./myread
8110         dlext="$ans"
8111         ;;
8112 *)
8113         dlext="none"
8114         ;;
8115 esac
8116
8117 : Check if dlsym need a leading underscore
8118 echo " "
8119 val="$undef"
8120
8121 case "$dlsrc" in
8122 dl_dlopen.xs)
8123         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8124         $cat >dyna.c <<'EOM'
8125 fred () { }
8126 EOM
8127
8128 $cat >fred.c<<EOM
8129
8130 #include <stdio.h>
8131 #$i_dlfcn I_DLFCN
8132 #ifdef I_DLFCN
8133 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8134 #else
8135 #include <sys/types.h>
8136 #include <nlist.h>
8137 #include <link.h>
8138 #endif
8139
8140 extern int fred() ;
8141
8142 int main()
8143 {
8144     void * handle ;
8145     void * symbol ;
8146 #ifndef RTLD_LAZY
8147     int mode = 1 ;
8148 #else
8149     int mode = RTLD_LAZY ;
8150 #endif
8151     handle = dlopen("./dyna.$dlext", mode) ;
8152     if (handle == NULL) {
8153         printf ("1\n") ;
8154         fflush (stdout) ;
8155         exit(0);
8156     }
8157     symbol = dlsym(handle, "fred") ;
8158     if (symbol == NULL) {
8159         /* try putting a leading underscore */
8160         symbol = dlsym(handle, "_fred") ;
8161         if (symbol == NULL) {
8162             printf ("2\n") ;
8163             fflush (stdout) ;
8164             exit(0);
8165         }
8166         printf ("3\n") ;
8167     }
8168     else
8169         printf ("4\n") ;
8170     fflush (stdout) ;
8171     exit(0);
8172 }
8173 EOM
8174         : Call the object file tmp-dyna.o in case dlext=o.
8175         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8176                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8177                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8178                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8179                 xxx=`./fred`
8180                 case $xxx in
8181                 1)      echo "Test program failed using dlopen." >&4
8182                         echo "Perhaps you should not use dynamic loading." >&4;;
8183                 2)      echo "Test program failed using dlsym." >&4
8184                         echo "Perhaps you should not use dynamic loading." >&4;;
8185                 3)      echo "dlsym needs a leading underscore" >&4
8186                         val="$define" ;;
8187                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8188                 esac
8189         else
8190                 echo "I can't compile and run the test program." >&4
8191                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8192         fi
8193         ;;
8194 esac
8195                 
8196 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8197
8198 set d_dlsymun
8199 eval $setvar
8200
8201 hasproto='varname=$1; func=$2; shift; shift;
8202 while $test $# -ge 2; do
8203         case "$1" in
8204         $define) echo "#include <$2>";;
8205         esac ;
8206     shift 2;
8207 done > try.c;
8208 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8209 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8210         echo "$func() prototype found.";
8211         val="$define";
8212 else
8213         echo "$func() prototype NOT found.";
8214         val="$undef";
8215 fi;
8216 set $varname;
8217 eval $setvar;
8218 $rm -f try.c tryout.c'
8219
8220 : see if prototype for drand48 is available
8221 echo " "
8222 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8223 eval $hasproto
8224
8225 : see if dup2 exists
8226 set dup2 d_dup2
8227 eval $inlibc
8228
8229 : see if eaccess exists
8230 set eaccess d_eaccess
8231 eval $inlibc
8232
8233 : see if endgrent exists
8234 set endgrent d_endgrent
8235 eval $inlibc
8236
8237 : see if endhostent exists
8238 set endhostent d_endhent
8239 eval $inlibc
8240
8241 : see if endnetent exists
8242 set endnetent d_endnent
8243 eval $inlibc
8244
8245 : see if endprotoent exists
8246 set endprotoent d_endpent
8247 eval $inlibc
8248
8249 : see if endpwent exists
8250 set endpwent d_endpwent
8251 eval $inlibc
8252
8253 : see if endservent exists
8254 set endservent d_endsent
8255 eval $inlibc
8256
8257 : see if endspent exists
8258 set endspent d_endspent
8259 eval $inlibc
8260
8261 : Locate the flags for 'open()'
8262 echo " "
8263 $cat >open3.c <<'EOCP'
8264 #include <sys/types.h>
8265 #ifdef I_FCNTL
8266 #include <fcntl.h>
8267 #endif
8268 #ifdef I_SYS_FILE
8269 #include <sys/file.h>
8270 #endif
8271 int main() {
8272         if(O_RDONLY);
8273 #ifdef O_TRUNC
8274         exit(0);
8275 #else
8276         exit(1);
8277 #endif
8278 }
8279 EOCP
8280 : check sys/file.h first to get FREAD on Sun
8281 if $test `./findhdr sys/file.h` && \
8282                 set open3 -DI_SYS_FILE && eval $compile; then
8283         h_sysfile=true;
8284         echo "<sys/file.h> defines the O_* constants..." >&4
8285         if ./open3; then
8286                 echo "and you have the 3 argument form of open()." >&4
8287                 val="$define"
8288         else
8289                 echo "but not the 3 argument form of open().  Oh, well." >&4
8290                 val="$undef"
8291         fi
8292 elif $test `./findhdr fcntl.h` && \
8293                 set open3 -DI_FCNTL && eval $compile; then
8294         h_fcntl=true;
8295         echo "<fcntl.h> defines the O_* constants..." >&4
8296         if ./open3; then
8297                 echo "and you have the 3 argument form of open()." >&4
8298                 val="$define"
8299         else
8300                 echo "but not the 3 argument form of open().  Oh, well." >&4
8301                 val="$undef"
8302         fi
8303 else
8304         val="$undef"
8305         echo "I can't find the O_* constant definitions!  You got problems." >&4
8306 fi
8307 set d_open3
8308 eval $setvar
8309 $rm -f open3*
8310
8311 : see which of string.h or strings.h is needed
8312 echo " "
8313 strings=`./findhdr string.h`
8314 if $test "$strings" && $test -r "$strings"; then
8315         echo "Using <string.h> instead of <strings.h>." >&4
8316         val="$define"
8317 else
8318         val="$undef"
8319         strings=`./findhdr strings.h`
8320         if $test "$strings" && $test -r "$strings"; then
8321                 echo "Using <strings.h> instead of <string.h>." >&4
8322         else
8323                 echo "No string header found -- You'll surely have problems." >&4
8324         fi
8325 fi
8326 set i_string
8327 eval $setvar
8328 case "$i_string" in
8329 "$undef") strings=`./findhdr strings.h`;;
8330 *)        strings=`./findhdr string.h`;;
8331 esac
8332
8333 : check for non-blocking I/O stuff
8334 case "$h_sysfile" in
8335 true) echo "#include <sys/file.h>" > head.c;;
8336 *)
8337         case "$h_fcntl" in
8338         true) echo "#include <fcntl.h>" > head.c;;
8339         *) echo "#include <sys/fcntl.h>" > head.c;;
8340         esac
8341         ;;
8342 esac
8343 echo " "
8344 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8345 case "$o_nonblock" in
8346 '')
8347         $cat head.c > try.c
8348         $cat >>try.c <<'EOCP'
8349 #include <stdio.h>
8350 int main() {
8351 #ifdef O_NONBLOCK
8352         printf("O_NONBLOCK\n");
8353         exit(0);
8354 #endif
8355 #ifdef O_NDELAY
8356         printf("O_NDELAY\n");
8357         exit(0);
8358 #endif
8359 #ifdef FNDELAY
8360         printf("FNDELAY\n");
8361         exit(0);
8362 #endif
8363         exit(0);
8364 }
8365 EOCP
8366         set try
8367         if eval $compile_ok; then
8368                 o_nonblock=`./try`
8369                 case "$o_nonblock" in
8370                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8371                 *) echo "Seems like we can use $o_nonblock.";;
8372                 esac
8373         else
8374                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8375         fi
8376         ;;
8377 *) echo "Using $hint value $o_nonblock.";;
8378 esac
8379 $rm -f try try.* .out core
8380
8381 echo " "
8382 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8383 case "$eagain" in
8384 '')
8385         $cat head.c > try.c
8386         $cat >>try.c <<EOCP
8387 #include <errno.h>
8388 #include <sys/types.h>
8389 #include <signal.h>
8390 #include <stdio.h> 
8391 #define MY_O_NONBLOCK $o_nonblock
8392 #ifndef errno  /* XXX need better Configure test */
8393 extern int errno;
8394 #endif
8395 #$i_unistd I_UNISTD
8396 #ifdef I_UNISTD
8397 #include <unistd.h>
8398 #endif
8399 #ifdef $i_string
8400 #include <string.h>
8401 #else
8402 #include <strings.h>
8403 #endif
8404 $signal_t blech(x) int x; { exit(3); }
8405 EOCP
8406         $cat >> try.c <<'EOCP'
8407 int main()
8408 {
8409         int pd[2];
8410         int pu[2];
8411         char buf[1];
8412         char string[100];
8413
8414         pipe(pd);       /* Down: child -> parent */
8415         pipe(pu);       /* Up: parent -> child */
8416         if (0 != fork()) {
8417                 int ret;
8418                 close(pd[1]);   /* Parent reads from pd[0] */
8419                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8420                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8421                         exit(1);
8422                 signal(SIGALRM, blech);
8423                 alarm(5);
8424                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8425                         exit(2);
8426                 sprintf(string, "%d\n", ret);
8427                 write(2, string, strlen(string));
8428                 alarm(0);
8429 #ifdef EAGAIN
8430                 if (errno == EAGAIN) {
8431                         printf("EAGAIN\n");
8432                         goto ok;
8433                 }
8434 #endif
8435 #ifdef EWOULDBLOCK
8436                 if (errno == EWOULDBLOCK)
8437                         printf("EWOULDBLOCK\n");
8438 #endif
8439         ok:
8440                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8441                 sleep(2);                               /* Give it time to close our pipe */
8442                 alarm(5);
8443                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8444                 alarm(0);
8445                 sprintf(string, "%d\n", ret);
8446                 write(3, string, strlen(string));
8447                 exit(0);
8448         }
8449
8450         close(pd[0]);                   /* We write to pd[1] */
8451         close(pu[1]);                   /* We read from pu[0] */
8452         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8453         close(pd[1]);                   /* Pipe pd is now fully closed! */
8454         exit(0);                                /* Bye bye, thank you for playing! */
8455 }
8456 EOCP
8457         set try
8458         if eval $compile_ok; then
8459                 echo "$startsh" >mtry
8460                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8461                 chmod +x mtry
8462                 ./mtry >/dev/null 2>&1
8463                 case $? in
8464                 0) eagain=`$cat try.out`;;
8465                 1) echo "Could not perform non-blocking setting!";;
8466                 2) echo "I did a successful read() for something that was not there!";;
8467                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8468                 *) echo "Something terribly wrong happened during testing.";;
8469                 esac
8470                 rd_nodata=`$cat try.ret`
8471                 echo "A read() system call with no data present returns $rd_nodata."
8472                 case "$rd_nodata" in
8473                 0|-1) ;;
8474                 *)
8475                         echo "(That's peculiar, fixing that to be -1.)"
8476                         rd_nodata=-1
8477                         ;;
8478                 esac
8479                 case "$eagain" in
8480                 '')
8481                         echo "Forcing errno EAGAIN on read() with no data available."
8482                         eagain=EAGAIN
8483                         ;;
8484                 *)
8485                         echo "Your read() sets errno to $eagain when no data is available."
8486                         ;;
8487                 esac
8488                 status=`$cat try.err`
8489                 case "$status" in
8490                 0) echo "And it correctly returns 0 to signal EOF.";;
8491                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8492                 *) echo "However, your read() returns '$status' on EOF??";;
8493                 esac
8494                 val="$define"
8495                 if test "$status" = "$rd_nodata"; then
8496                         echo "WARNING: you can't distinguish between EOF and no data!"
8497                         val="$undef"
8498                 fi
8499         else
8500                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8501                 eagain=EAGAIN
8502         fi
8503         set d_eofnblk
8504         eval $setvar
8505         ;;
8506 *)
8507         echo "Using $hint value $eagain."
8508         echo "Your read() returns $rd_nodata when no data is present."
8509         case "$d_eofnblk" in
8510         "$define") echo "And you can see EOF because read() returns 0.";;
8511         "$undef") echo "But you can't see EOF status from read() returned value.";;
8512         *)
8513                 echo "(Assuming you can't see EOF status from read anyway.)"
8514                 d_eofnblk=$undef
8515                 ;;
8516         esac
8517         ;;
8518 esac
8519 $rm -f try try.* .out core head.c mtry
8520
8521 : see if fchmod exists
8522 set fchmod d_fchmod
8523 eval $inlibc
8524
8525 : see if fchown exists
8526 set fchown d_fchown
8527 eval $inlibc
8528
8529 : see if this is an fcntl system
8530 set fcntl d_fcntl
8531 eval $inlibc
8532
8533 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8534 while $test $# -ge 2; do
8535         case "$1" in
8536         $define) echo "#include <$2>";;
8537         esac ;
8538     shift 2;
8539 done > try.c;
8540 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8541 set try;
8542 if eval $compile; then
8543         val="$define";
8544 else
8545         val="$undef";
8546 fi;
8547 set $varname;
8548 eval $setvar;
8549 $rm -f try.c try.o'
8550
8551 socketlib=''
8552 sockethdr=''
8553 : see whether socket exists
8554 echo " "
8555 $echo $n "Hmm... $c" >&4
8556 if set socket val -f d_socket; eval $csym; $val; then
8557         echo "Looks like you have Berkeley networking support." >&4
8558         d_socket="$define"
8559         if set setsockopt val -f; eval $csym; $val; then
8560                 d_oldsock="$undef"
8561         else
8562                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8563                 d_oldsock="$define"
8564         fi
8565 else
8566         if $contains socklib libc.list >/dev/null 2>&1; then
8567                 echo "Looks like you have Berkeley networking support." >&4
8568                 d_socket="$define"
8569                 : we will have to assume that it supports the 4.2 BSD interface
8570                 d_oldsock="$undef"
8571         else
8572                 echo "You don't have Berkeley networking in libc$_a..." >&4
8573                 if test "X$d_socket" = "X$define"; then
8574                    echo "...but you seem to believe that you have sockets." >&4
8575                 else
8576                         for net in net socket
8577                         do
8578                                 if test -f /usr/lib/lib$net$_a; then
8579                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8580                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8581                                         if $contains socket libc.list >/dev/null 2>&1; then
8582                                                 d_socket="$define"
8583                                                 socketlib="-l$net"
8584                                                 case "$net" in
8585                                                 net)
8586                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8587                                                         sockethdr="-I/usr/netinclude"
8588                                                         ;;
8589                                                 esac
8590                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8591                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8592                                                         d_oldsock="$undef"
8593                                                 else
8594                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8595                                                         d_oldsock="$define"
8596                                                 fi
8597                                                 break
8598                                         fi
8599                                 fi
8600                         done
8601                         if test "X$d_socket" != "X$define"; then
8602                            echo "or anywhere else I see." >&4
8603                            d_socket="$undef"
8604                            d_oldsock="$undef"
8605                         fi
8606                 fi
8607         fi
8608 fi
8609
8610 : see if socketpair exists
8611 set socketpair d_sockpair
8612 eval $inlibc
8613
8614
8615 echo " "
8616 echo "Checking the availability of certain socket constants..." >& 4
8617 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8618         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8619         $cat >try.c <<EOF
8620 #include <sys/types.h>
8621 #include <sys/socket.h>
8622 int main() {
8623     int i = $ENUM;
8624 }
8625 EOF
8626         val="$undef"
8627         set try; if eval $compile; then
8628                 val="$define"
8629         fi
8630         set d_${enum}; eval $setvar
8631         $rm -f try.c try
8632 done
8633
8634 : see if sys/select.h has to be included
8635 set sys/select.h i_sysselct
8636 eval $inhdr
8637
8638 : see if we should include time.h, sys/time.h, or both
8639 echo " "
8640 if test "X$timeincl" = X; then
8641         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8642         $echo $n "I'm now running the test program...$c"
8643         $cat >try.c <<'EOCP'
8644 #include <sys/types.h>
8645 #ifdef I_TIME
8646 #include <time.h>
8647 #endif
8648 #ifdef I_SYSTIME
8649 #ifdef SYSTIMEKERNEL
8650 #define KERNEL
8651 #endif
8652 #include <sys/time.h>
8653 #endif
8654 #ifdef I_SYSSELECT
8655 #include <sys/select.h>
8656 #endif
8657 int main()
8658 {
8659         struct tm foo;
8660 #ifdef S_TIMEVAL
8661         struct timeval bar;
8662 #endif
8663 #ifdef S_TIMEZONE
8664         struct timezone tzp;
8665 #endif
8666         if (foo.tm_sec == foo.tm_sec)
8667                 exit(0);
8668 #ifdef S_TIMEVAL
8669         if (bar.tv_sec == bar.tv_sec)
8670                 exit(0);
8671 #endif
8672         exit(1);
8673 }
8674 EOCP
8675         flags=''
8676         for s_timezone in '-DS_TIMEZONE' ''; do
8677         sysselect=''
8678         for s_timeval in '-DS_TIMEVAL' ''; do
8679         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8680         for i_time in '' '-DI_TIME'; do
8681         for i_systime in '-DI_SYSTIME' ''; do
8682                 case "$flags" in
8683                 '') $echo $n ".$c"
8684                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8685                         if eval $compile; then
8686                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8687                                 shift
8688                                 flags="$*"
8689                                 echo " "
8690                                 $echo $n "Succeeded with $flags$c"
8691                         fi
8692                         ;;
8693                 esac
8694         done
8695         done
8696         done
8697         done
8698         done
8699         timeincl=''
8700         echo " "
8701         case "$flags" in
8702         *SYSTIMEKERNEL*) i_systimek="$define"
8703                 timeincl=`./findhdr sys/time.h`
8704                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8705         *) i_systimek="$undef";;
8706         esac
8707         case "$flags" in
8708         *I_TIME*) i_time="$define"
8709                 timeincl=`./findhdr time.h`" $timeincl"
8710                 echo "We'll include <time.h>." >&4;;
8711         *) i_time="$undef";;
8712         esac
8713         case "$flags" in
8714         *I_SYSTIME*) i_systime="$define"
8715                 timeincl=`./findhdr sys/time.h`" $timeincl"
8716                 echo "We'll include <sys/time.h>." >&4;;
8717         *) i_systime="$undef";;
8718         esac
8719         $rm -f try.c try
8720 fi
8721
8722 : check for fd_set items
8723 $cat <<EOM
8724
8725 Checking to see how well your C compiler handles fd_set and friends ...
8726 EOM
8727 $cat >fd_set.c <<EOCP
8728 #$i_systime I_SYS_TIME
8729 #$i_sysselct I_SYS_SELECT
8730 #$d_socket HAS_SOCKET
8731 #include <sys/types.h>
8732 #ifdef HAS_SOCKET
8733 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8734 #endif
8735 #ifdef I_SYS_TIME
8736 #include <sys/time.h>
8737 #endif
8738 #ifdef I_SYS_SELECT
8739 #include <sys/select.h>
8740 #endif
8741 int main() {
8742         fd_set fds;
8743
8744 #ifdef TRYBITS
8745         if(fds.fds_bits);
8746 #endif
8747
8748 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8749         exit(0);
8750 #else
8751         exit(1);
8752 #endif
8753 }
8754 EOCP
8755 set fd_set -DTRYBITS
8756 if eval $compile; then
8757         d_fds_bits="$define"
8758         d_fd_set="$define"
8759         echo "Well, your system knows about the normal fd_set typedef..." >&4
8760         if ./fd_set; then
8761                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8762                 d_fd_macros="$define"
8763         else
8764                 $cat >&4 <<'EOM'
8765 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8766 EOM
8767                 d_fd_macros="$undef"
8768         fi
8769 else
8770         $cat <<'EOM'
8771 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8772 EOM
8773         set fd_set
8774         if eval $compile; then
8775                 d_fds_bits="$undef"
8776                 d_fd_set="$define"
8777                 echo "Well, your system has some sort of fd_set available..." >&4
8778                 if ./fd_set; then
8779                         echo "and you have the normal fd_set macros." >&4
8780                         d_fd_macros="$define"
8781                 else
8782                         $cat <<'EOM'
8783 but not the normal fd_set macros!  Gross!  More work for me...
8784 EOM
8785                         d_fd_macros="$undef"
8786                 fi
8787         else
8788         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8789                 d_fd_set="$undef"
8790                 d_fds_bits="$undef"
8791                 d_fd_macros="$undef"
8792         fi
8793 fi
8794 $rm -f fd_set*
8795
8796 : see if fgetpos exists
8797 set fgetpos d_fgetpos
8798 eval $inlibc
8799
8800 : see if flock exists
8801 set flock d_flock
8802 eval $inlibc
8803
8804 : see if fork exists
8805 set fork d_fork
8806 eval $inlibc
8807
8808 : see if pathconf exists
8809 set pathconf d_pathconf
8810 eval $inlibc
8811
8812 : see if fpathconf exists
8813 set fpathconf d_fpathconf
8814 eval $inlibc
8815
8816
8817 : check for off64_t
8818 echo " "
8819 echo "Checking to see if your system supports off64_t..." >&4
8820 $cat >try.c <<EOCP
8821 #include <sys/types.h>
8822 #include <unistd.h>
8823 int main() { off64_t x = 7; }'
8824 EOCP
8825 set try
8826 if eval $compile; then
8827         val="$define"
8828         echo "Yes, it does."
8829 else
8830         val="$undef"
8831         echo "No, it doesn't."
8832         case "$lseeksize" in
8833         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8834         esac
8835 fi
8836 $rm -f try.* try
8837 set d_off64_t
8838 eval $setvar
8839
8840 : check for fpos64_t
8841 echo " "
8842 echo "Checking to see if your system supports fpos64_t..." >&4
8843 $cat >try.c <<EOCP
8844 #include <sys/stdio.h>
8845 int main() { fpos64_t x x = 7; }'
8846 EOCP
8847 set try
8848 if eval $compile; then
8849         val="$define"
8850         echo "Yes, it does."
8851 else
8852         val="$undef"
8853         echo "No, it doesn't."
8854         case "$fpossize" in
8855         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8856         esac
8857 fi
8858 $rm -f try.* try
8859 set d_fpos64_t
8860 eval $setvar
8861
8862 hasstruct='varname=$1; struct=$2; shift; shift;
8863 while $test $# -ge 2; do
8864         case "$1" in
8865         $define) echo "#include <$2>";;
8866         esac ;
8867     shift 2;
8868 done > try.c;
8869 echo "int main () { struct $struct foo; }" >> try.c;
8870 set try;
8871 if eval $compile; then
8872         val="$define";
8873 else
8874         val="$undef";
8875 fi;
8876 set $varname;
8877 eval $setvar;
8878 $rm -f try.c try.o'
8879
8880 : see if this is a sys/param system
8881 set sys/param.h i_sysparam
8882 eval $inhdr
8883
8884 : see if this is a sys/mount.h system
8885 set sys/mount.h i_sysmount
8886 eval $inhdr
8887
8888 : see if sys/types.h has to be included
8889 set sys/types.h i_systypes
8890 eval $inhdr
8891
8892
8893 echo " "
8894 echo "Checking to see if your system supports struct fs_data..." >&4
8895 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8896 eval $hasstruct
8897 case "$d_fs_data_s" in
8898 "$define")      echo "Yes, it does."   ;;
8899 *)              echo "No, it doesn't." ;;
8900 esac
8901
8902 : see if fseeko exists
8903 set fseeko d_fseeko
8904 eval $inlibc
8905 case "$longsize" in
8906 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8907 esac
8908
8909 : see if fsetpos exists
8910 set fsetpos d_fsetpos
8911 eval $inlibc
8912
8913
8914 : see if fstatfs exists
8915 set fstatfs d_fstatfs
8916 eval $inlibc
8917
8918
8919 : see if statvfs exists
8920 set statvfs d_statvfs
8921 eval $inlibc
8922
8923 : see if fstatvfs exists
8924 set fstatvfs d_fstatvfs
8925 eval $inlibc
8926
8927
8928 : see if ftello exists
8929 set ftello d_ftello
8930 eval $inlibc
8931 case "$longsize" in
8932 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8933 esac
8934
8935 : see if getcwd exists
8936 set getcwd d_getcwd
8937 eval $inlibc
8938
8939 : see if getgrent exists
8940 set getgrent d_getgrent
8941 eval $inlibc
8942
8943 : see if gethostbyaddr exists
8944 set gethostbyaddr d_gethbyaddr
8945 eval $inlibc
8946
8947 : see if gethostbyname exists
8948 set gethostbyname d_gethbyname
8949 eval $inlibc
8950
8951 : see if gethostent exists
8952 set gethostent d_gethent
8953 eval $inlibc
8954
8955 : see how we will look up host name
8956 echo " "
8957 call=''
8958 if set gethostname val -f d_gethname; eval $csym; $val; then
8959         echo 'gethostname() found.' >&4
8960         d_gethname="$define"
8961         call=gethostname
8962 fi
8963 if set uname val -f d_uname; eval $csym; $val; then
8964         if ./xenix; then
8965                 $cat <<'EOM'
8966 uname() was found, but you're running xenix, and older versions of xenix
8967 have a broken uname(). If you don't really know whether your xenix is old
8968 enough to have a broken system call, use the default answer.
8969
8970 EOM
8971                 dflt=y
8972                 case "$d_uname" in
8973                 "$define") dflt=n;;
8974                 esac
8975                 rp='Is your uname() broken?'
8976                 . ./myread
8977                 case "$ans" in
8978                 n*) d_uname="$define"; call=uname;;
8979                 esac
8980         else
8981                 echo 'uname() found.' >&4
8982                 d_uname="$define"
8983                 case "$call" in
8984                 '') call=uname ;;
8985                 esac
8986         fi
8987 fi
8988 case "$d_gethname" in
8989 '') d_gethname="$undef";;
8990 esac
8991 case "$d_uname" in
8992 '') d_uname="$undef";;
8993 esac
8994 case "$d_uname$d_gethname" in
8995 *define*)
8996         dflt=n
8997         cat <<EOM
8998  
8999 Every now and then someone has a $call() that lies about the hostname
9000 but can't be fixed for political or economic reasons.  If you wish, I can
9001 pretend $call() isn't there and maybe compute hostname at run-time
9002 thanks to the '$phostname' command.
9003
9004 EOM
9005         rp="Shall I ignore $call() from now on?"
9006         . ./myread
9007         case "$ans" in
9008         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9009         esac;;
9010 esac
9011 case "$phostname" in
9012 '') aphostname='';;
9013 *) case "$aphostname" in
9014         /*) ;;
9015         *) set X $phostname
9016                 shift
9017                 file=$1
9018                 shift
9019                 file=`./loc $file $file $pth`
9020                 aphostname=`echo $file $*`
9021                 ;;
9022         esac
9023         ;;
9024 esac
9025 case "$d_uname$d_gethname" in
9026 *define*) ;;
9027 *)
9028         case "$phostname" in
9029         '')
9030                 echo "There will be no way for $package to get your hostname." >&4;;
9031         *)
9032         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9033                 ;;
9034         esac;;
9035 esac
9036 case "$d_phostname" in
9037 '') d_phostname="$undef";;
9038 esac
9039
9040 : see if this is a netdb.h system
9041 set netdb.h i_netdb
9042 eval $inhdr
9043
9044 : see if prototypes for various gethostxxx netdb.h functions are available
9045 echo " "
9046 set d_gethostprotos gethostent $i_netdb netdb.h
9047 eval $hasproto
9048
9049 : see if getlogin exists
9050 set getlogin d_getlogin
9051 eval $inlibc
9052
9053 : see if getmnt exists
9054 set getmnt d_getmnt
9055 eval $inlibc
9056
9057 : see if getmntent exists
9058 set getmntent d_getmntent
9059 eval $inlibc
9060
9061 : see if getnetbyaddr exists
9062 set getnetbyaddr d_getnbyaddr
9063 eval $inlibc
9064
9065 : see if getnetbyname exists
9066 set getnetbyname d_getnbyname
9067 eval $inlibc
9068
9069 : see if getnetent exists
9070 set getnetent d_getnent
9071 eval $inlibc
9072
9073 : see if prototypes for various getnetxxx netdb.h functions are available
9074 echo " "
9075 set d_getnetprotos getnetent $i_netdb netdb.h
9076 eval $hasproto
9077
9078
9079 : see if getprotobyname exists
9080 set getprotobyname d_getpbyname
9081 eval $inlibc
9082
9083 : see if getprotobynumber exists
9084 set getprotobynumber d_getpbynumber
9085 eval $inlibc
9086
9087 : see if getprotoent exists
9088 set getprotoent d_getpent
9089 eval $inlibc
9090
9091 : see if getpgid exists
9092 set getpgid d_getpgid
9093 eval $inlibc
9094
9095 : see if getpgrp2 exists
9096 set getpgrp2 d_getpgrp2
9097 eval $inlibc
9098
9099 : see if getppid exists
9100 set getppid d_getppid
9101 eval $inlibc
9102
9103 : see if getpriority exists
9104 set getpriority d_getprior
9105 eval $inlibc
9106
9107 : see if prototypes for various getprotoxxx netdb.h functions are available
9108 echo " "
9109 set d_getprotoprotos getprotoent $i_netdb netdb.h
9110 eval $hasproto
9111
9112 : see if getpwent exists
9113 set getpwent d_getpwent
9114 eval $inlibc
9115
9116
9117 : see if getservbyname exists
9118 set getservbyname d_getsbyname
9119 eval $inlibc
9120
9121 : see if getservbyport exists
9122 set getservbyport d_getsbyport
9123 eval $inlibc
9124
9125 : see if getservent exists
9126 set getservent d_getsent
9127 eval $inlibc
9128
9129 : see if prototypes for various getservxxx netdb.h functions are available
9130 echo " "
9131 set d_getservprotos getservent $i_netdb netdb.h
9132 eval $hasproto
9133
9134 : see if getspent exists
9135 set getspent d_getspent
9136 eval $inlibc
9137
9138 : see if getspnam exists
9139 set getspnam d_getspnam
9140 eval $inlibc
9141
9142 : see if gettimeofday or ftime exists
9143 set gettimeofday d_gettimeod
9144 eval $inlibc
9145 case "$d_gettimeod" in
9146 "$undef")
9147         set ftime d_ftime 
9148         eval $inlibc
9149         ;;
9150 *)
9151         val="$undef"; set d_ftime; eval $setvar
9152         ;;
9153 esac
9154 case "$d_gettimeod$d_ftime" in
9155 "$undef$undef")
9156         echo " "
9157         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9158         ;;
9159 esac
9160
9161 : see if this is an grp system
9162 set grp.h i_grp
9163 eval $inhdr
9164
9165 case "$i_grp" in
9166 $define)
9167         xxx=`./findhdr grp.h`
9168         $cppstdin $cppflags $cppminus < $xxx >$$.h
9169
9170         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9171                 val="$define"
9172         else
9173                 val="$undef"
9174         fi
9175         set d_grpasswd
9176         eval $setvar
9177
9178         $rm -f $$.h
9179         ;;
9180 *)
9181         val="$undef";
9182         set d_grpasswd; eval $setvar
9183         ;;
9184 esac
9185
9186 : see if hasmntopt exists
9187 set hasmntopt d_hasmntopt
9188 eval $inlibc
9189
9190 : see if this is a netinet/in.h or sys/in.h system
9191 set netinet/in.h i_niin sys/in.h i_sysin
9192 eval $inhdr
9193
9194 : see if arpa/inet.h has to be included
9195 set arpa/inet.h i_arpainet
9196 eval $inhdr
9197
9198 : see if htonl --and friends-- exists
9199 val=''
9200 set htonl val
9201 eval $inlibc
9202
9203 : Maybe they are macros.
9204 case "$val" in
9205 $undef)
9206         $cat >htonl.c <<EOM
9207 #include <stdio.h>
9208 #include <sys/types.h>
9209 #$i_niin I_NETINET_IN
9210 #$i_sysin I_SYS_IN
9211 #$i_arpainet I_ARPA_INET
9212 #ifdef I_NETINET_IN
9213 #include <netinet/in.h>
9214 #endif
9215 #ifdef I_SYS_IN
9216 #include <sys/in.h>
9217 #endif
9218 #ifdef I_ARPA_INET
9219 #include <arpa/inet.h>
9220 #endif
9221 #ifdef htonl
9222 printf("Defined as a macro.");
9223 #endif
9224 EOM
9225         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9226         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9227                 val="$define"
9228                 echo "But it seems to be defined as a macro." >&4
9229         fi
9230         $rm -f htonl.?
9231         ;;
9232 esac
9233 set d_htonl
9234 eval $setvar
9235
9236 : see if iconv exists
9237 set iconv d_iconv
9238 eval $inlibc
9239
9240 : index or strchr
9241 echo " "
9242 if set index val -f; eval $csym; $val; then
9243         if set strchr val -f d_strchr; eval $csym; $val; then
9244                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9245                         val="$define"
9246                         vali="$undef"
9247                         echo "strchr() found." >&4
9248                 else
9249                         val="$undef"
9250                         vali="$define"
9251                         echo "index() found." >&4
9252                 fi
9253         else
9254                 val="$undef"
9255                 vali="$define"
9256                 echo "index() found." >&4
9257         fi
9258 else
9259         if set strchr val -f d_strchr; eval $csym; $val; then
9260                 val="$define"
9261                 vali="$undef"
9262                 echo "strchr() found." >&4
9263         else
9264                 echo "No index() or strchr() found!" >&4
9265                 val="$undef"
9266                 vali="$undef"
9267         fi
9268 fi
9269 set d_strchr; eval $setvar
9270 val="$vali"
9271 set d_index; eval $setvar
9272
9273 : check whether inet_aton exists
9274 set inet_aton d_inetaton
9275 eval $inlibc
9276
9277 : see if inttypes.h is available
9278 : we want a real compile instead of Inhdr because some systems
9279 : have an inttypes.h which includes non-existent headers
9280 echo " "
9281 $cat >try.c <<EOCP
9282 #include <inttypes.h>
9283 int main() {
9284         static int32_t foo32 = 0x12345678;
9285 }
9286 EOCP
9287 set try
9288 if eval $compile; then
9289         echo "<inttypes.h> found." >&4
9290         val="$define"
9291 else
9292         echo "<inttypes.h> NOT found." >&4
9293         val="$undef"
9294 fi
9295 $rm -f try.c try
9296 set i_inttypes
9297 eval $setvar
9298
9299 : check for int64_t
9300 echo " "
9301 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9302 $cat >try.c <<EOCP
9303 #include <sys/types.h>
9304 #$i_inttypes I_INTTYPES
9305 #ifdef I_INTTYPES
9306 #include <inttypes.h>
9307 #endif
9308 int main() { int64_t x = 7; }
9309 EOCP
9310 set try
9311 if eval $compile; then
9312         val="$define"
9313         echo " Yes, it does." >&4
9314 else
9315         val="$undef"
9316         echo " No, it doesn't." >&4
9317 fi
9318 $rm -f try try.*
9319 set d_int64_t
9320 eval $setvar
9321
9322 : Look for isascii
9323 echo " "
9324 $cat >isascii.c <<'EOCP'
9325 #include <stdio.h>
9326 #include <ctype.h>
9327 int main() {
9328         int c = 'A';
9329         if (isascii(c))
9330                 exit(0);
9331         else
9332                 exit(1);
9333 }
9334 EOCP
9335 set isascii
9336 if eval $compile; then
9337         echo "isascii() found." >&4
9338         val="$define"
9339 else
9340         echo "isascii() NOT found." >&4
9341         val="$undef"
9342 fi
9343 set d_isascii
9344 eval $setvar
9345 $rm -f isascii*
9346
9347 : see if killpg exists
9348 set killpg d_killpg
9349 eval $inlibc
9350
9351 : see if lchown exists
9352 echo " "
9353 $cat > try.c <<'EOCP'
9354 /* System header to define __stub macros and hopefully few prototypes,
9355     which can conflict with char lchown(); below.  */
9356 #include <assert.h>
9357 /* Override any gcc2 internal prototype to avoid an error.  */
9358 /* We use char because int might match the return type of a gcc2
9359    builtin and then its argument prototype would still apply.  */
9360 char lchown();
9361 int main() {
9362     /*  The GNU C library defines this for functions which it implements
9363         to always fail with ENOSYS.  Some functions are actually named
9364         something starting with __ and the normal name is an alias.  */
9365 #if defined (__stub_lchown) || defined (__stub___lchown)
9366 choke me
9367 #else
9368 lchown();
9369 #endif
9370 ; return 0; }
9371 EOCP
9372 set try
9373 if eval $compile; then
9374     $echo "lchown() found." >&4
9375     val="$define"
9376 else
9377     $echo "lchown() NOT found." >&4
9378     val="$undef"
9379 fi
9380 set d_lchown
9381 eval $setvar
9382
9383 : See if number of significant digits in a double precision number is known
9384 echo " "
9385 $cat >ldbl_dig.c <<EOM
9386 #$i_limits I_LIMITS
9387 #$i_float I_FLOAT
9388 #ifdef I_LIMITS
9389 #include <limits.h>
9390 #endif
9391 #ifdef I_FLOAT
9392 #include <float.h>
9393 #endif
9394 #ifdef LDBL_DIG
9395 printf("Contains LDBL_DIG");
9396 #endif
9397 EOM
9398 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9399 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9400         echo "LDBL_DIG found." >&4
9401         val="$define"
9402 else
9403         echo "LDBL_DIG NOT found." >&4
9404         val="$undef"
9405 fi
9406 $rm -f ldbl_dig.?
9407 set d_ldbl_dig
9408 eval $setvar
9409
9410 : see if link exists
9411 set link d_link
9412 eval $inlibc
9413
9414 : see if localeconv exists
9415 set localeconv d_locconv
9416 eval $inlibc
9417
9418 : see if lockf exists
9419 set lockf d_lockf
9420 eval $inlibc
9421
9422 : check for long long
9423 echo " "
9424 $echo $n "Checking to see if your system supports long long..." $c >&4
9425 echo 'int main() { long long x = 7; return 0; }' > try.c
9426 set try
9427 if eval $compile; then
9428         val="$define"
9429         echo " Yes, it does." >&4
9430 else
9431         val="$undef"
9432         echo " No, it doesn't." >&4
9433 fi
9434 $rm try.*
9435 set d_longlong
9436 eval $setvar
9437
9438 : check for length of long long
9439 case "${d_longlong}${longlongsize}" in
9440 $define)
9441         echo " "
9442         $echo $n "Checking to see how big your long longs are..." $c >&4
9443         $cat >try.c <<'EOCP'
9444 #include <stdio.h>
9445 int main()
9446 {
9447     printf("%d\n", (int)sizeof(long long));
9448     return(0);
9449 }
9450 EOCP
9451         set try
9452         if eval $compile_ok; then
9453                 longlongsize=`./try$exe_ext`
9454                 $echo " $longlongsize bytes." >&4
9455         else
9456                 dflt='8'
9457                 echo " "
9458                 echo "(I can't seem to compile the test program.  Guessing...)"
9459                 rp="What is the size of a long long (in bytes)?"
9460                 . ./myread
9461                 longlongsize="$ans"
9462         fi
9463         if $test "X$longsize" = "X$longlongsize"; then
9464                 echo "(That isn't any different from an ordinary long.)"
9465         fi      
9466         ;;
9467 esac
9468 $rm -f try.* try
9469
9470 : see if lstat exists
9471 set lstat d_lstat
9472 eval $inlibc
9473
9474 : see if mblen exists
9475 set mblen d_mblen
9476 eval $inlibc
9477
9478 : see if mbstowcs exists
9479 set mbstowcs d_mbstowcs
9480 eval $inlibc
9481
9482 : see if mbtowc exists
9483 set mbtowc d_mbtowc
9484 eval $inlibc
9485
9486 : see if memchr exists
9487 set memchr d_memchr
9488 eval $inlibc
9489
9490 : see if memcmp exists
9491 set memcmp d_memcmp
9492 eval $inlibc
9493
9494 : see if memcpy exists
9495 set memcpy d_memcpy
9496 eval $inlibc
9497
9498 : see if memmove exists
9499 set memmove d_memmove
9500 eval $inlibc
9501
9502 : see if memset exists
9503 set memset d_memset
9504 eval $inlibc
9505
9506 : see if mkdir exists
9507 set mkdir d_mkdir
9508 eval $inlibc
9509
9510 : see if mkdtemp exists
9511 set mkdtemp d_mkdtemp
9512 eval $inlibc
9513
9514 : see if mkfifo exists
9515 set mkfifo d_mkfifo
9516 eval $inlibc
9517
9518 : see if mkstemp exists
9519 set mkstemp d_mkstemp
9520 eval $inlibc
9521
9522 : see if mkstemps exists
9523 set mkstemps d_mkstemps
9524 eval $inlibc
9525
9526 : see if mktime exists
9527 set mktime d_mktime
9528 eval $inlibc
9529
9530 : see if this is a sys/mman.h system
9531 set sys/mman.h i_sysmman
9532 eval $inhdr
9533
9534 : see if mmap exists
9535 set mmap d_mmap
9536 eval $inlibc
9537 : see what shmat returns
9538 : default to something harmless
9539 mmaptype='void *'
9540 case "$i_sysmman$d_mmap" in
9541 "$define$define")
9542         $cat >mmap.c <<'END'
9543 #include <sys/mman.h>
9544 void *mmap();
9545 END
9546         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9547                 mmaptype='void *'
9548         else
9549                 mmaptype='caddr_t'
9550         fi
9551         echo "and it returns ($mmaptype)." >&4
9552         ;;
9553 esac
9554
9555
9556
9557 : see if mprotect exists
9558 set mprotect d_mprotect
9559 eval $inlibc
9560
9561 : see if msgctl exists
9562 set msgctl d_msgctl
9563 eval $inlibc
9564
9565 : see if msgget exists
9566 set msgget d_msgget
9567 eval $inlibc
9568
9569 : see if msgsnd exists
9570 set msgsnd d_msgsnd
9571 eval $inlibc
9572
9573 : see if msgrcv exists
9574 set msgrcv d_msgrcv
9575 eval $inlibc
9576
9577 : see how much of the 'msg*(2)' library is present.
9578 h_msg=true
9579 echo " "
9580 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9581 *"$undef"*) h_msg=false;;
9582 esac
9583 case "$osname" in
9584 freebsd)
9585     case "`ipcs 2>&1`" in
9586     "SVID messages"*"not configured"*)
9587         echo "Your $osname does not have the msg*(2) configured." >&4
9588         h_msg=false
9589         val="$undef"
9590         set msgctl d_msgctl
9591         eval $setvar
9592         set msgget d_msgget
9593         eval $setvar
9594         set msgsnd d_msgsnd
9595         eval $setvar
9596         set msgrcv d_msgrcv
9597         eval $setvar
9598         ;;
9599     esac
9600     ;;
9601 esac
9602 : we could also check for sys/ipc.h ...
9603 if $h_msg && $test `./findhdr sys/msg.h`; then
9604         echo "You have the full msg*(2) library." >&4
9605         val="$define"
9606 else
9607         echo "You don't have the full msg*(2) library." >&4
9608         val="$undef"
9609 fi
9610 set d_msg
9611 eval $setvar
9612
9613 : see if msync exists
9614 set msync d_msync
9615 eval $inlibc
9616
9617 : see if munmap exists
9618 set munmap d_munmap
9619 eval $inlibc
9620
9621 : see if nice exists
9622 set nice d_nice
9623 eval $inlibc
9624
9625
9626 echo " "
9627 echo "Checking which 64-bit integer type we could use..." >&4
9628
9629 case "$intsize" in
9630 8) val=int
9631    set quadtype
9632    eval $setvar
9633    val='"unsigned int"'
9634    set uquadtype
9635    eval $setvar
9636    quadkind=1
9637    ;;
9638 *) case "$longsize" in
9639    8) val=long
9640       set quadtype
9641       eval $setvar
9642       val='"unsigned long"'
9643       set uquadtype
9644       eval $setvar
9645       quadkind=2
9646       ;;
9647    *) case "$d_longlong:$longlongsize" in
9648       define:8)
9649         val='"long long"'
9650         set quadtype
9651         eval $setvar
9652         val='"unsigned long long"'
9653         set uquadtype
9654         eval $setvar
9655         quadkind=3
9656         ;;
9657       *) case "$d_int64_t" in
9658          define)
9659            val=int64_t
9660            set quadtype
9661            eval $setvar
9662            val=uint64_t
9663            set uquadtype
9664            eval $setvar
9665            quadkind=4
9666            ;;
9667          esac
9668          ;;
9669       esac
9670       ;;
9671    esac
9672    ;;
9673 esac
9674
9675 case "$quadtype" in
9676 '')     echo "Alas, no 64-bit integer types in sight." >&4
9677         d_quad="$undef"
9678         ;;
9679 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9680             verb="will"
9681         else
9682             verb="could"
9683         fi
9684         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9685         d_quad="$define"
9686         ;;
9687 esac
9688
9689 : check for length of character
9690 echo " "
9691 case "$charsize" in
9692 '')
9693         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9694         $cat >try.c <<'EOCP'
9695 #include <stdio.h>
9696 int main()
9697 {
9698     printf("%d\n", (int)sizeof(char));
9699     exit(0);
9700 }
9701 EOCP
9702         set try
9703         if eval $compile_ok; then
9704                 dflt=`./try`
9705         else
9706                 dflt='1'
9707                 echo "(I can't seem to compile the test program.  Guessing...)"
9708         fi
9709         ;;
9710 *)
9711         dflt="$charsize"
9712         ;;
9713 esac
9714 rp="What is the size of a character (in bytes)?"
9715 . ./myread
9716 charsize="$ans"
9717 $rm -f try.c try
9718
9719
9720 echo " "
9721 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9722
9723 case "$use64bits:$d_quad:$quadtype" in
9724 define:define:?*)
9725         ivtype="$quadtype"
9726         uvtype="$uquadtype"
9727         ivsize=8
9728         uvsize=8
9729         ;;
9730 *)      ivtype="long"
9731         uvtype="unsigned long"
9732         ivsize=$longsize
9733         uvsize=$longsize
9734         ;;
9735 esac
9736
9737 case "$uselongdouble:$d_longdbl" in
9738 define:define)
9739         nvtype="long double"
9740         nvsize=$longdblsize
9741         ;;
9742 *)      nvtype=double
9743         nvsize=$doublesize
9744         ;;
9745 esac
9746
9747 $echo "(IV will be "$ivtype", $ivsize bytes)"
9748 $echo "(UV will be "$uvtype", $uvsize bytes)"
9749 $echo "(NV will be "$nvtype", $nvsize bytes)"
9750
9751 $cat >try.c <<EOCP
9752 #$i_inttypes I_INTTYPES
9753 #ifdef I_INTTYPES
9754 #include <inttypes.h>
9755 #endif
9756 #include <stdio.h>
9757 int main() {
9758 #ifdef INT8
9759    int8_t i =  INT8_MAX;
9760   uint8_t u = UINT8_MAX;
9761   printf("int8_t\n");
9762 #endif
9763 #ifdef INT16
9764    int16_t i =  INT16_MAX;
9765   uint16_t i = UINT16_MAX;
9766   printf("int16_t\n");
9767 #endif
9768 #ifdef INT32
9769    int32_t i =  INT32_MAX;
9770   uint32_t u = UINT32_MAX;
9771   printf("int32_t\n");
9772 #endif
9773 }
9774 EOCP
9775
9776 case "$i8type" in
9777 '')     case "$charsize" in
9778         1)      i8type=char
9779                 u8type="unsigned char"
9780                 i8size=$charsize
9781                 u8size=$charsize
9782                 ;;
9783         esac
9784         ;;
9785 esac
9786 case "$i8type" in
9787 '')     set try -DINT8
9788         if eval $compile; then
9789                 case "`./try$exe_ext`" in
9790                 int8_t) i8type=int8_t
9791                         u8type=uint8_t
9792                         i8size=1
9793                         u8size=1
9794                         ;;
9795                 esac
9796         fi
9797         ;;
9798 esac
9799 case "$i8type" in
9800 '')     if $test $charsize -ge 1; then
9801                 i8type=char
9802                 u8type="unsigned char"
9803                 i8size=$charsize
9804                 u8size=$charsize
9805         fi
9806         ;;
9807 esac
9808
9809 case "$i16type" in
9810 '')     case "$shortsize" in
9811         2)      i16type=short
9812                 u16type="unsigned short"
9813                 i16size=$shortsize
9814                 u16size=$shortsize
9815                 ;;
9816         esac
9817         ;;
9818 esac
9819 case "$i16type" in
9820 '')     set try -DINT16
9821         if eval $compile; then
9822                 case "`./try$exe_ext`" in
9823                 int16_t)
9824                         i16type=int16_t
9825                         u16type=uint16_t
9826                         i16size=2
9827                         u16size=2
9828                         ;;
9829                 esac
9830         fi
9831         ;;
9832 esac
9833 case "$i16type" in
9834 '')     if $test $shortsize -ge 2; then
9835                 i16type=short
9836                 u16type="unsigned short"
9837                 i16size=$shortsize
9838                 u16size=$shortsize
9839         fi
9840         ;;
9841 esac
9842
9843 case "$i32type" in
9844 '')     case "$longsize" in
9845         4)      i32type=long
9846                 u32type="unsigned long"
9847                 i32size=$longsize
9848                 u32size=$longsize
9849                 ;;
9850         *)      case "$intsize" in
9851                 4)      i32type=int
9852                         u32type="unsigned int"
9853                         i32size=$intsize
9854                         u32size=$intsize
9855                         ;;
9856                 esac
9857                 ;;
9858         esac
9859         ;;
9860 esac
9861 case "$i32type" in
9862 '')     set try -DINT32
9863         if eval $compile; then
9864                 case "`./try$exe_ext`" in
9865                 int32_t)
9866                         i32type=int32_t
9867                         u32type=uint32_t
9868                         i32size=4
9869                         u32size=4
9870                         ;;
9871                 esac
9872         fi
9873         ;;
9874 esac
9875 case "$i32type" in
9876 '')     if $test $intsize -ge 4; then
9877                 i32type=int
9878                 u32type="unsigned int"
9879                 i32size=$intsize
9880                 u32size=$intsize
9881         fi
9882         ;;
9883 esac
9884
9885 case "$i64type" in
9886 '')     case "$d_quad:$quadtype" in
9887         define:?*)
9888                 i64type="$quadtype"
9889                 u64type="$uquadtype"
9890                 i64size=8
9891                 u64size=8
9892                 ;;
9893         esac
9894         ;;
9895 esac
9896
9897 $echo "Checking whether your NVs can preserve your UVs..." >&4
9898 $cat <<EOP >try.c
9899 #include <stdio.h>
9900 int main() {
9901     $uvtype k = ($uvtype)~0, l;
9902     $nvtype d;
9903     l = k;
9904     d = ($nvtype)l;
9905     l = ($uvtype)d;
9906     if (l == k)
9907        printf("preserve\n");
9908     exit(0);
9909 }
9910 EOP
9911 set try
9912 if eval $compile; then
9913         case "`./try$exe_ext`" in
9914         preserve) d_nv_preserves_uv="$define" ;;
9915         esac
9916 fi      
9917 case "$d_nv_preserves_uv" in
9918 $define) $echo "Yes, they can."  2>&1 ;;
9919 *)       $echo "No, they can't." 2>&1
9920          d_nv_preserves_uv="$undef"
9921          ;;
9922 esac
9923
9924 $rm -f try.* try
9925
9926 : see if POSIX threads are available
9927 set pthread.h i_pthread
9928 eval $inhdr
9929
9930
9931
9932
9933 : how to create joinable pthreads
9934 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9935         echo " "
9936         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9937         $cat >try.c <<'EOCP'
9938 #include <pthread.h>
9939 int main() {
9940     int detachstate = JOINABLE;
9941 }
9942 EOCP
9943         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9944         if eval $compile; then
9945                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9946                 val="$undef" # Yes, undef.
9947                 set d_old_pthread_create_joinable
9948                 eval $setvar
9949                 val=""
9950                 set old_pthread_create_joinable
9951                 eval $setvar
9952         else
9953                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9954                 if eval $compile; then
9955                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9956                         val="$define"
9957                         set d_old_pthread_create_joinable
9958                         eval $setvar
9959                         val=PTHREAD_CREATE_UNDETACHED
9960                         set old_pthread_create_joinable
9961                         eval $setvar
9962                 else            
9963                         set try -DJOINABLE=__UNDETACHED
9964                         if eval $compile; then
9965                                 echo "You seem to use __UNDETACHED." >&4
9966                                 val="$define"
9967                                 set d_old_pthread_create_joinable
9968                                 eval $setvar
9969                                 val=__UNDETACHED
9970                                 set old_pthread_create_joinable
9971                                 eval $setvar
9972                         else
9973                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9974                                 val="$define"
9975                                 set d_old_pthread_create_joinable
9976                                 eval $setvar
9977                                 val=0
9978                                 set old_pthread_create_joinable
9979                                 eval $setvar
9980                         fi
9981                 fi
9982         fi
9983         $rm -f try try.*
9984 else
9985     d_old_pthread_create_joinable="$undef"
9986     old_pthread_create_joinable=""
9987 fi
9988
9989 : see if pause exists
9990 set pause d_pause
9991 eval $inlibc
9992
9993 : see if pipe exists
9994 set pipe d_pipe
9995 eval $inlibc
9996
9997 : see if poll exists
9998 set poll d_poll
9999 eval $inlibc
10000
10001
10002 : see whether the various POSIXish _yields exist
10003 $cat >try.c <<EOP
10004 #include <pthread.h>
10005 #include <stdio.h>
10006 int main() {
10007 #ifdef SCHED_YIELD
10008         sched_yield();
10009 #else
10010 #ifdef PTHREAD_YIELD
10011         pthread_yield();
10012 #else
10013 #ifdef PTHREAD_YIELD_NULL
10014         pthread_yield(NULL);
10015 #endif
10016 #endif
10017 #endif
10018 }
10019 EOP
10020 : see if sched_yield exists
10021 set try -DSCHED_YIELD
10022 if eval $compile; then
10023     val="$define"
10024     sched_yield='sched_yield()'
10025 else
10026     val="$undef"
10027 fi
10028 case "$usethreads" in
10029 $define)
10030         case "$val" in
10031         $define) echo 'sched_yield() found.' >&4        ;;
10032         *)       echo 'sched_yield() NOT found.' >&4    ;;
10033         esac
10034 esac
10035 set d_sched_yield
10036 eval $setvar
10037
10038 : see if pthread_yield exists
10039 set try -DPTHREAD_YIELD
10040 if eval $compile; then
10041     val="$define"
10042     case "$sched_yield" in
10043     '') sched_yield='pthread_yield()' ;;
10044     esac
10045 else
10046     set try -DPTHREAD_YIELD_NULL
10047     if eval $compile; then
10048         val="$define"
10049         case "$sched_yield" in
10050         '') sched_yield='pthread_yield(NULL)' ;;
10051         esac
10052     else
10053         val="$undef"
10054     fi
10055 fi
10056 case "$usethreads" in
10057 $define)
10058         case "$val" in
10059         $define) echo 'pthread_yield() found.' >&4      ;;
10060         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10061         esac
10062         ;;
10063 esac
10064 set d_pthread_yield
10065 eval $setvar
10066
10067 case "$sched_yield" in
10068 '') sched_yield=undef ;;
10069 esac
10070
10071 $rm -f try try.*
10072
10073 : see if this is a pwd.h system
10074 set pwd.h i_pwd
10075 eval $inhdr
10076
10077 case "$i_pwd" in
10078 $define)
10079         xxx=`./findhdr pwd.h`
10080         $cppstdin $cppflags $cppminus < $xxx >$$.h
10081
10082         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10083                 val="$define"
10084         else
10085                 val="$undef"
10086         fi
10087         set d_pwquota
10088         eval $setvar
10089
10090         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10091                 val="$define"
10092         else
10093                 val="$undef"
10094         fi
10095         set d_pwage
10096         eval $setvar
10097
10098         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10099                 val="$define"
10100         else
10101                 val="$undef"
10102         fi
10103         set d_pwchange
10104         eval $setvar
10105
10106         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10107                 val="$define"
10108         else
10109                 val="$undef"
10110         fi
10111         set d_pwclass
10112         eval $setvar
10113
10114         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10115                 val="$define"
10116         else
10117                 val="$undef"
10118         fi
10119         set d_pwexpire
10120         eval $setvar
10121
10122         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10123                 val="$define"
10124         else
10125                 val="$undef"
10126         fi
10127         set d_pwcomment
10128         eval $setvar
10129
10130         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10131                 val="$define"
10132         else
10133                 val="$undef"
10134         fi
10135         set d_pwgecos
10136         eval $setvar
10137
10138         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10139                 val="$define"
10140         else
10141                 val="$undef"
10142         fi
10143         set d_pwpasswd
10144         eval $setvar
10145
10146         $rm -f $$.h
10147         ;;
10148 *)
10149         val="$undef"; 
10150         set d_pwquota; eval $setvar
10151         set d_pwage; eval $setvar
10152         set d_pwchange; eval $setvar
10153         set d_pwclass; eval $setvar
10154         set d_pwexpire; eval $setvar
10155         set d_pwcomment; eval $setvar
10156         set d_pwgecos; eval $setvar
10157         set d_pwpasswd; eval $setvar
10158         ;;
10159 esac
10160
10161 : see if readdir and friends exist
10162 set readdir d_readdir
10163 eval $inlibc
10164 set seekdir d_seekdir
10165 eval $inlibc
10166 set telldir d_telldir
10167 eval $inlibc
10168 set rewinddir d_rewinddir
10169 eval $inlibc
10170
10171 : see if readlink exists
10172 set readlink d_readlink
10173 eval $inlibc
10174
10175 : see if rename exists
10176 set rename d_rename
10177 eval $inlibc
10178
10179 : see if rmdir exists
10180 set rmdir d_rmdir
10181 eval $inlibc
10182
10183 : see if memory.h is available.
10184 val=''
10185 set memory.h val
10186 eval $inhdr
10187
10188 : See if it conflicts with string.h
10189 case "$val" in
10190 $define)
10191         case "$strings" in
10192         '') ;;
10193         *)
10194                 $cppstdin $cppflags $cppminus < $strings > mem.h
10195                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10196                         echo " "
10197                         echo "We won't be including <memory.h>."
10198                         val="$undef"
10199                 fi
10200                 $rm -f mem.h
10201                 ;;
10202         esac
10203 esac
10204 set i_memory
10205 eval $setvar
10206
10207 : can bcopy handle overlapping blocks?
10208 val="$undef"
10209 case "$d_bcopy" in
10210 "$define")
10211         echo " "
10212         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10213         $cat >try.c <<EOCP
10214 #$i_memory I_MEMORY
10215 #$i_stdlib I_STDLIB
10216 #$i_string I_STRING
10217 #$i_unistd I_UNISTD
10218 EOCP
10219         $cat >>try.c <<'EOCP'
10220 #include <stdio.h>
10221 #ifdef I_MEMORY
10222 #  include <memory.h>
10223 #endif
10224 #ifdef I_STDLIB
10225 #  include <stdlib.h>
10226 #endif
10227 #ifdef I_STRING
10228 #  include <string.h>
10229 #else
10230 #  include <strings.h>
10231 #endif
10232 #ifdef I_UNISTD
10233 #  include <unistd.h>  /* Needed for NetBSD */
10234 #endif
10235 int main()
10236 {
10237 char buf[128], abc[128];
10238 char *b;
10239 int len;
10240 int off;
10241 int align;
10242
10243 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10244
10245 for (align = 7; align >= 0; align--) {
10246         for (len = 36; len; len--) {
10247                 b = buf+align;
10248                 bcopy(abc, b, len);
10249                 for (off = 1; off <= len; off++) {
10250                         bcopy(b, b+off, len);
10251                         bcopy(b+off, b, len);
10252                         if (bcmp(b, abc, len))
10253                                 exit(1);
10254                 }
10255         }
10256 }
10257 exit(0);
10258 }
10259 EOCP
10260         set try
10261         if eval $compile_ok; then
10262                 if ./try 2>/dev/null; then
10263                         echo "Yes, it can."
10264                         val="$define"
10265                 else
10266                         echo "It can't, sorry."
10267                         case "$d_memmove" in
10268                         "$define") echo "But that's Ok since you have memmove()." ;;
10269                         esac
10270                 fi
10271         else
10272                 echo "(I can't compile the test program, so we'll assume not...)"
10273                 case "$d_memmove" in
10274                 "$define") echo "But that's Ok since you have memmove()." ;;
10275                 esac
10276         fi
10277         ;;
10278 esac
10279 $rm -f try.* try core
10280 set d_safebcpy
10281 eval $setvar
10282
10283 : can memcpy handle overlapping blocks?
10284 val="$undef"
10285 case "$d_memcpy" in
10286 "$define")
10287         echo " "
10288         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10289         $cat >try.c <<EOCP
10290 #$i_memory I_MEMORY
10291 #$i_stdlib I_STDLIB
10292 #$i_string I_STRING
10293 #$i_unistd I_UNISTD
10294 EOCP
10295         $cat >>try.c <<'EOCP'
10296 #include <stdio.h>
10297 #ifdef I_MEMORY
10298 #  include <memory.h>
10299 #endif
10300 #ifdef I_STDLIB
10301 #  include <stdlib.h>
10302 #endif
10303 #ifdef I_STRING
10304 #  include <string.h>
10305 #else
10306 #  include <strings.h>
10307 #endif
10308 #ifdef I_UNISTD
10309 #  include <unistd.h>  /* Needed for NetBSD */
10310 #endif
10311 int main()
10312 {
10313 char buf[128], abc[128];
10314 char *b;
10315 int len;
10316 int off;
10317 int align;
10318
10319 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10320    try to store the string in read-only memory. */
10321 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10322
10323 for (align = 7; align >= 0; align--) {
10324         for (len = 36; len; len--) {
10325                 b = buf+align;
10326                 memcpy(b, abc, len);
10327                 for (off = 1; off <= len; off++) {
10328                         memcpy(b+off, b, len);
10329                         memcpy(b, b+off, len);
10330                         if (memcmp(b, abc, len))
10331                                 exit(1);
10332                 }
10333         }
10334 }
10335 exit(0);
10336 }
10337 EOCP
10338         set try
10339         if eval $compile_ok; then
10340                 if ./try 2>/dev/null; then
10341                         echo "Yes, it can."
10342                         val="$define"
10343                 else
10344                         echo "It can't, sorry."
10345                         case "$d_memmove" in
10346                         "$define") echo "But that's Ok since you have memmove()." ;;
10347                         esac
10348                 fi
10349         else
10350                 echo "(I can't compile the test program, so we'll assume not...)"
10351                 case "$d_memmove" in
10352                 "$define") echo "But that's Ok since you have memmove()." ;;
10353                 esac
10354         fi
10355         ;;
10356 esac
10357 $rm -f try.* try core
10358 set d_safemcpy
10359 eval $setvar
10360
10361 : can memcmp be trusted to compare relative magnitude?
10362 val="$undef"
10363 case "$d_memcmp" in
10364 "$define")
10365         echo " "
10366         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10367         $cat >try.c <<EOCP
10368 #$i_memory I_MEMORY
10369 #$i_stdlib I_STDLIB
10370 #$i_string I_STRING
10371 #$i_unistd I_UNISTD
10372 EOCP
10373         $cat >>try.c <<'EOCP'
10374 #include <stdio.h>
10375 #ifdef I_MEMORY
10376 #  include <memory.h>
10377 #endif
10378 #ifdef I_STDLIB
10379 #  include <stdlib.h>
10380 #endif
10381 #ifdef I_STRING
10382 #  include <string.h>
10383 #else
10384 #  include <strings.h>
10385 #endif
10386 #ifdef I_UNISTD
10387 #  include <unistd.h>  /* Needed for NetBSD */
10388 #endif
10389 int main()
10390 {
10391 char a = -1;
10392 char b = 0;
10393 if ((a < b) && memcmp(&a, &b, 1) < 0)
10394         exit(1);
10395 exit(0);
10396 }
10397 EOCP
10398         set try
10399         if eval $compile_ok; then
10400                 if ./try 2>/dev/null; then
10401                         echo "Yes, it can."
10402                         val="$define"
10403                 else
10404                         echo "No, it can't (it uses signed chars)."
10405                 fi
10406         else
10407                 echo "(I can't compile the test program, so we'll assume not...)"
10408         fi
10409         ;;
10410 esac
10411 $rm -f try.* try core
10412 set d_sanemcmp
10413 eval $setvar
10414
10415 : see if select exists
10416 set select d_select
10417 eval $inlibc
10418
10419 : see if semctl exists
10420 set semctl d_semctl
10421 eval $inlibc
10422
10423 : see if semget exists
10424 set semget d_semget
10425 eval $inlibc
10426
10427 : see if semop exists
10428 set semop d_semop
10429 eval $inlibc
10430
10431 : see how much of the 'sem*(2)' library is present.
10432 h_sem=true
10433 echo " "
10434 case "$d_semctl$d_semget$d_semop" in
10435 *"$undef"*) h_sem=false;;
10436 esac
10437 case "$osname" in
10438 freebsd)
10439     case "`ipcs 2>&1`" in
10440     "SVID messages"*"not configured"*)
10441         echo "Your $osname does not have the sem*(2) configured." >&4
10442         h_sem=false
10443         val="$undef"
10444         set semctl d_semctl
10445         eval $setvar
10446         set semget d_semget
10447         eval $setvar
10448         set semop d_semop
10449         eval $setvar
10450         ;;
10451     esac
10452     ;;
10453 esac
10454 : we could also check for sys/ipc.h ...
10455 if $h_sem && $test `./findhdr sys/sem.h`; then
10456         echo "You have the full sem*(2) library." >&4
10457         val="$define"
10458 else
10459         echo "You don't have the full sem*(2) library." >&4
10460         val="$undef"
10461 fi
10462 set d_sem
10463 eval $setvar
10464
10465 : see whether sys/sem.h defines union semun
10466 echo " "
10467 $cat > try.c <<'END'
10468 #include <sys/types.h>
10469 #include <sys/ipc.h>
10470 #include <sys/sem.h>
10471 int main () { union semun semun; semun.buf = 0; }
10472 END
10473 set try
10474 if eval $compile; then
10475     echo "You have union semun in <sys/sem.h>." >&4
10476     val="$define"
10477 else
10478     echo "You do not have union semun in <sys/sem.h>." >&4
10479     val="$undef"
10480 fi
10481 $rm -f try try.c try.h
10482 set d_union_semun
10483 eval $setvar
10484
10485 : see how to do semctl IPC_STAT
10486 case "$d_sem" in
10487 $define)
10488     : see whether semctl IPC_STAT can use union semun
10489     echo " "
10490     $cat > try.h <<END
10491 #ifndef S_IRUSR
10492 #   ifdef S_IREAD
10493 #       define S_IRUSR S_IREAD
10494 #       define S_IWUSR S_IWRITE
10495 #       define S_IXUSR S_IEXEC
10496 #   else
10497 #       define S_IRUSR 0400
10498 #       define S_IWUSR 0200
10499 #       define S_IXUSR 0100
10500 #   endif
10501 #   define S_IRGRP (S_IRUSR>>3)
10502 #   define S_IWGRP (S_IWUSR>>3)
10503 #   define S_IXGRP (S_IXUSR>>3)
10504 #   define S_IROTH (S_IRUSR>>6)
10505 #   define S_IWOTH (S_IWUSR>>6)
10506 #   define S_IXOTH (S_IXUSR>>6)
10507 #endif
10508 #ifndef S_IRWXU
10509 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10510 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10511 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10512 #endif
10513 END
10514
10515     $cat > try.c <<END
10516 #include <sys/types.h>
10517 #include <sys/ipc.h>
10518 #include <sys/sem.h>
10519 #include <sys/stat.h>
10520 #include <stdio.h>
10521 #include <errno.h>
10522 #include "try.h"
10523 #ifndef errno
10524 extern int errno;
10525 #endif
10526 #$d_union_semun HAS_UNION_SEMUN
10527 int main() {
10528     union semun
10529 #ifndef HAS_UNION_SEMUN
10530     {
10531         int val;
10532         struct semid_ds *buf;
10533         unsigned short *array;
10534     }
10535 #endif
10536     arg;
10537     int sem, st;
10538
10539 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10540     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10541     if (sem > -1) {
10542         struct semid_ds argbuf;
10543         arg.buf = &argbuf;
10544 #       ifdef IPC_STAT
10545         st = semctl(sem, 0, IPC_STAT, arg);
10546         if (st == 0)
10547             printf("semun\n");
10548         else
10549 #       endif /* IPC_STAT */
10550             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10551 #       ifdef IPC_RMID
10552         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10553 #       endif /* IPC_RMID */
10554             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10555     } else
10556 #endif /* IPC_PRIVATE && ... */
10557         printf("semget failed: errno = %d\n", errno);
10558   return 0;
10559 }
10560 END
10561     val="$undef"
10562     set try
10563     if eval $compile; then
10564         xxx=`./try`
10565         case "$xxx" in
10566         semun) val="$define" ;;
10567         esac
10568     fi
10569     $rm -f try try.c
10570     set d_semctl_semun
10571     eval $setvar
10572     case "$d_semctl_semun" in
10573     $define)
10574         echo "You can use union semun for semctl IPC_STAT." >&4
10575         also='also'
10576         ;;
10577     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10578         also=''
10579         ;;
10580     esac
10581
10582     : see whether semctl IPC_STAT can use struct semid_ds pointer
10583     $cat > try.c <<'END'
10584 #include <sys/types.h>
10585 #include <sys/ipc.h>
10586 #include <sys/sem.h>
10587 #include <sys/stat.h>
10588 #include "try.h"
10589 #include <stdio.h>
10590 #include <errno.h>
10591 #ifndef errno
10592 extern int errno;
10593 #endif
10594 int main() {
10595     struct semid_ds arg;
10596     int sem, st;
10597
10598 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10599     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10600     if (sem > -1) {
10601 #       ifdef IPC_STAT
10602         st = semctl(sem, 0, IPC_STAT, &arg);
10603         if (st == 0)
10604             printf("semid_ds\n");
10605         else
10606 #       endif /* IPC_STAT */
10607             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10608 #       ifdef IPC_RMID
10609         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10610 #       endif /* IPC_RMID */
10611             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10612     } else
10613 #endif /* IPC_PRIVATE && ... */
10614         printf("semget failed: errno = %d\n", errno);
10615
10616     return 0;
10617 }
10618 END
10619     val="$undef"
10620     set try
10621     if eval $compile; then
10622         xxx=`./try`
10623         case "$xxx" in
10624         semid_ds) val="$define" ;;
10625         esac
10626     fi
10627     $rm -f try try.c
10628     set d_semctl_semid_ds
10629     eval $setvar
10630     case "$d_semctl_semid_ds" in
10631     $define)
10632         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10633         ;;
10634     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10635         ;;
10636     esac
10637     $rm -f try.h
10638     ;;
10639 *)  val="$undef"
10640
10641     # We do not have the full sem*(2) library, so assume we can not
10642     # use either.
10643
10644     set d_semctl_semun
10645     eval $setvar
10646
10647     set d_semctl_semid_ds
10648     eval $setvar
10649     ;;
10650 esac
10651
10652 : see if setegid exists
10653 set setegid d_setegid
10654 eval $inlibc
10655
10656 : see if seteuid exists
10657 set seteuid d_seteuid
10658 eval $inlibc
10659
10660 : see if setgrent exists
10661 set setgrent d_setgrent
10662 eval $inlibc
10663
10664 : see if sethostent exists
10665 set sethostent d_sethent
10666 eval $inlibc
10667
10668 : see if setlinebuf exists
10669 set setlinebuf d_setlinebuf
10670 eval $inlibc
10671
10672 : see if setlocale exists
10673 set setlocale d_setlocale
10674 eval $inlibc
10675
10676 : see if setnetent exists
10677 set setnetent d_setnent
10678 eval $inlibc
10679
10680 : see if setprotoent exists
10681 set setprotoent d_setpent
10682 eval $inlibc
10683
10684 : see if setpgid exists
10685 set setpgid d_setpgid
10686 eval $inlibc
10687
10688 : see if setpgrp2 exists
10689 set setpgrp2 d_setpgrp2
10690 eval $inlibc
10691
10692 : see if setpriority exists
10693 set setpriority d_setprior
10694 eval $inlibc
10695
10696 : see if setpwent exists
10697 set setpwent d_setpwent
10698 eval $inlibc
10699
10700 : see if setregid exists
10701 set setregid d_setregid
10702 eval $inlibc
10703 set setresgid d_setresgid
10704 eval $inlibc
10705
10706 : see if setreuid exists
10707 set setreuid d_setreuid
10708 eval $inlibc
10709 set setresuid d_setresuid
10710 eval $inlibc
10711
10712 : see if setrgid exists
10713 set setrgid d_setrgid
10714 eval $inlibc
10715
10716 : see if setruid exists
10717 set setruid d_setruid
10718 eval $inlibc
10719
10720 : see if setservent exists
10721 set setservent d_setsent
10722 eval $inlibc
10723
10724 : see if setsid exists
10725 set setsid d_setsid
10726 eval $inlibc
10727
10728 : see if setspent exists
10729 set setspent d_setspent
10730 eval $inlibc
10731
10732 : see if setvbuf exists
10733 set setvbuf d_setvbuf
10734 eval $inlibc
10735
10736 : see if sfio.h is available
10737 set sfio.h i_sfio
10738 eval $inhdr
10739
10740
10741 : see if sfio library is available
10742 case "$i_sfio" in
10743 $define)
10744         val=''
10745         set sfreserve val
10746         eval $inlibc
10747         ;;
10748 *)
10749         val="$undef"
10750         ;;
10751 esac
10752 : Ok, but do we want to use it.
10753 case "$val" in
10754 $define)
10755         case "$usesfio" in
10756         true|$define|[yY]*) dflt='y';;
10757         *) dflt='n';;
10758         esac
10759         echo "$package can use the sfio library, but it is experimental."
10760         rp="You seem to have sfio available, do you want to try using it?"
10761         . ./myread
10762         case "$ans" in
10763         y|Y) ;;
10764         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10765                 val="$undef"
10766                 : Remove sfio from list of libraries to use
10767                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10768                 shift
10769                 libs="$*"
10770                 echo "libs = $libs" >&4
10771                 ;;
10772         esac
10773         ;;
10774 *)      case "$usesfio" in
10775         true|$define|[yY]*)
10776                 echo "Sorry, cannot find sfio on this machine" >&4
10777                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10778                 ;;
10779         esac
10780         ;;
10781 esac
10782 set d_sfio
10783 eval $setvar
10784 case "$d_sfio" in
10785 $define) usesfio='true';;
10786 *) usesfio='false';;
10787 esac
10788
10789 : see if shmctl exists
10790 set shmctl d_shmctl
10791 eval $inlibc
10792
10793 : see if shmget exists
10794 set shmget d_shmget
10795 eval $inlibc
10796
10797 : see if shmat exists
10798 set shmat d_shmat
10799 eval $inlibc
10800 : see what shmat returns
10801 case "$d_shmat" in
10802 "$define")
10803         $cat >shmat.c <<'END'
10804 #include <sys/shm.h>
10805 void *shmat();
10806 END
10807         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10808                 shmattype='void *'
10809         else
10810                 shmattype='char *'
10811         fi
10812         echo "and it returns ($shmattype)." >&4
10813         : see if a prototype for shmat is available
10814         xxx=`./findhdr sys/shm.h`
10815         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10816         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10817                 val="$define"
10818         else
10819                 val="$undef"
10820         fi
10821         $rm -f shmat.[co]
10822         ;;
10823 *)
10824         val="$undef"
10825         ;;
10826 esac
10827 set d_shmatprototype
10828 eval $setvar
10829
10830 : see if shmdt exists
10831 set shmdt d_shmdt
10832 eval $inlibc
10833
10834 : see how much of the 'shm*(2)' library is present.
10835 h_shm=true
10836 echo " "
10837 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10838 *"$undef"*) h_shm=false;;
10839 esac
10840 case "$osname" in
10841 freebsd)
10842     case "`ipcs 2>&1`" in
10843     "SVID shared memory"*"not configured"*)
10844         echo "Your $osname does not have the shm*(2) configured." >&4
10845         h_shm=false
10846         val="$undef"
10847         set shmctl d_shmctl
10848         evat $setvar
10849         set shmget d_shmget
10850         evat $setvar
10851         set shmat d_shmat
10852         evat $setvar
10853         set shmdt d_shmdt
10854         evat $setvar
10855         ;;
10856     esac
10857     ;;
10858 esac
10859 : we could also check for sys/ipc.h ...
10860 if $h_shm && $test `./findhdr sys/shm.h`; then
10861         echo "You have the full shm*(2) library." >&4
10862         val="$define"
10863 else
10864         echo "You don't have the full shm*(2) library." >&4
10865         val="$undef"
10866 fi
10867 set d_shm
10868 eval $setvar
10869
10870 echo " "
10871 : see if we have sigaction
10872 if set sigaction val -f d_sigaction; eval $csym; $val; then
10873         echo 'sigaction() found.' >&4
10874         $cat > try.c <<'EOP'
10875 #include <stdio.h>
10876 #include <sys/types.h>
10877 #include <signal.h>
10878 int main()
10879 {
10880     struct sigaction act, oact;
10881     act.sa_flags = 0;
10882     oact.sa_handler = 0;
10883     /* so that act and oact are used */
10884     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10885 }
10886 EOP
10887         set try
10888         if eval $compile_ok; then
10889                 val="$define"
10890         else
10891                 echo "But you don't seem to have a useable struct sigaction." >&4
10892                 val="$undef"
10893         fi
10894 else
10895         echo 'sigaction NOT found.' >&4
10896         val="$undef"
10897 fi
10898 set d_sigaction; eval $setvar
10899 $rm -f try try$_o try.c
10900
10901 : see if sigsetjmp exists
10902 echo " "
10903 case "$d_sigsetjmp" in
10904 '')
10905         $cat >try.c <<'EOP'
10906 #include <setjmp.h>
10907 sigjmp_buf env;
10908 int set = 1;
10909 int main()
10910 {
10911         if (sigsetjmp(env,1))
10912                 exit(set);
10913         set = 0;
10914         siglongjmp(env, 1);
10915         exit(1);
10916 }
10917 EOP
10918         set try
10919         if eval $compile; then
10920                 if ./try >/dev/null 2>&1; then
10921                         echo "POSIX sigsetjmp found." >&4
10922                         val="$define"
10923                 else
10924                         $cat >&4 <<EOM
10925 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10926 I'll ignore them.
10927 EOM
10928                         val="$undef"
10929                 fi
10930         else
10931                 echo "sigsetjmp not found." >&4
10932                 val="$undef"
10933         fi
10934         ;;
10935 *) val="$d_sigsetjmp"
10936         case "$d_sigsetjmp" in
10937         $define) echo "POSIX sigsetjmp found." >&4;;
10938         $undef) echo "sigsetjmp not found." >&4;;
10939         esac
10940         ;;
10941 esac
10942 set d_sigsetjmp
10943 eval $setvar
10944 $rm -f try.c try
10945
10946 : check for socklen_t
10947 echo " "
10948 $echo $n "Checking to see if your system supports socklen_t...$c" >&4
10949 $cat >try.c <<EOCP
10950 #include <sys/types.h>
10951 #$d_socket HAS_SOCKET
10952 #ifdef HAS_SOCKET
10953 #include <sys/socket.h>
10954 #endif
10955 int main() { socklen_t x = 16; }
10956 EOCP
10957 set try
10958 if eval $compile; then
10959         val="$define"
10960         echo " Yes, it does." >&4
10961 else
10962         val="$undef"
10963         echo " No, it doesn't." >&4
10964 fi
10965 $rm -f try try.*
10966 set d_socklen_t
10967 eval $setvar
10968
10969 : see if sys/stat.h is available
10970 set sys/stat.h i_sysstat
10971 eval $inhdr
10972
10973
10974 : see if stat knows about block sizes
10975 echo " "
10976 echo "Checking to see if your struct stat has st_blocks field..." >&4
10977 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10978 eval $hasfield
10979
10980
10981 : see if this is a sys/vfs.h system
10982 set sys/vfs.h i_sysvfs
10983 eval $inhdr
10984
10985
10986 : see if this is a sys/statfs.h system
10987 set sys/statfs.h i_sysstatfs
10988 eval $inhdr
10989
10990
10991 echo " "
10992 echo "Checking to see if your system supports struct statfs..." >&4
10993 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
10994 eval $hasstruct
10995 case "$d_statfs_s" in
10996 "$define")      echo "Yes, it does."   ;;
10997 *)              echo "No, it doesn't." ;;
10998 esac
10999
11000
11001
11002 : see if struct statfs knows about f_flags
11003 case "$d_statfs_s" in
11004 define) 
11005         echo " "
11006         echo "Checking to see if your struct statfs has f_flags field..." >&4
11007         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
11008         eval $hasfield
11009         ;;
11010 *)      val="$undef"
11011         set d_statfs_f_flags
11012         eval $setvar
11013         ;;
11014 esac
11015 case "$d_statfs_f_flags" in
11016 "$define")      echo "Yes, it does."   ;;
11017 *)              echo "No, it doesn't." ;;
11018 esac
11019
11020 : see if _ptr and _cnt from stdio act std
11021 echo " "
11022 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11023         echo "(Looks like you have stdio.h from Linux.)"
11024         case "$stdio_ptr" in
11025         '') stdio_ptr='((fp)->_IO_read_ptr)'
11026                 ptr_lval=$define
11027                 ;;
11028         *)      ptr_lval=$d_stdio_ptr_lval;;
11029         esac
11030         case "$stdio_cnt" in
11031         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11032                 cnt_lval=$undef
11033                 ;;
11034         *)      cnt_lval=$d_stdio_cnt_lval;;
11035         esac
11036         case "$stdio_base" in
11037         '') stdio_base='((fp)->_IO_read_base)';;
11038         esac
11039         case "$stdio_bufsiz" in
11040         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11041         esac
11042 else
11043         case "$stdio_ptr" in
11044         '') stdio_ptr='((fp)->_ptr)'
11045                 ptr_lval=$define
11046                 ;;
11047         *)      ptr_lval=$d_stdio_ptr_lval;;
11048         esac
11049         case "$stdio_cnt" in
11050         '') stdio_cnt='((fp)->_cnt)'
11051                 cnt_lval=$define
11052                 ;;
11053         *)      cnt_lval=$d_stdio_cnt_lval;;
11054         esac
11055         case "$stdio_base" in
11056         '') stdio_base='((fp)->_base)';;
11057         esac
11058         case "$stdio_bufsiz" in
11059         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11060         esac
11061 fi
11062 : test whether _ptr and _cnt really work
11063 echo "Checking how std your stdio is..." >&4
11064 $cat >try.c <<EOP
11065 #include <stdio.h>
11066 #define FILE_ptr(fp)    $stdio_ptr
11067 #define FILE_cnt(fp)    $stdio_cnt
11068 int main() {
11069         FILE *fp = fopen("try.c", "r");
11070         char c = getc(fp);
11071         if (
11072                 18 <= FILE_cnt(fp) &&
11073                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11074         )
11075                 exit(0);
11076         exit(1);
11077 }
11078 EOP
11079 val="$undef"
11080 set try
11081 if eval $compile; then
11082         if ./try; then
11083                 echo "Your stdio acts pretty std."
11084                 val="$define"
11085         else
11086                 echo "Your stdio isn't very std."
11087         fi
11088 else
11089         echo "Your stdio doesn't appear very std."
11090 fi
11091 $rm -f try.c try
11092 set d_stdstdio
11093 eval $setvar
11094
11095 : Can _ptr be used as an lvalue?
11096 case "$d_stdstdio$ptr_lval" in
11097 $define$define) val=$define ;;
11098 *) val=$undef ;;
11099 esac
11100 set d_stdio_ptr_lval
11101 eval $setvar
11102
11103 : Can _cnt be used as an lvalue?
11104 case "$d_stdstdio$cnt_lval" in
11105 $define$define) val=$define ;;
11106 *) val=$undef ;;
11107 esac
11108 set d_stdio_cnt_lval
11109 eval $setvar
11110
11111 : see if _base is also standard
11112 val="$undef"
11113 case "$d_stdstdio" in
11114 $define)
11115         $cat >try.c <<EOP
11116 #include <stdio.h>
11117 #define FILE_base(fp)   $stdio_base
11118 #define FILE_bufsiz(fp) $stdio_bufsiz
11119 int main() {
11120         FILE *fp = fopen("try.c", "r");
11121         char c = getc(fp);
11122         if (
11123                 19 <= FILE_bufsiz(fp) &&
11124                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11125         )
11126                 exit(0);
11127         exit(1);
11128 }
11129 EOP
11130         set try
11131         if eval $compile; then
11132                 if ./try; then
11133                         echo "And its _base field acts std."
11134                         val="$define"
11135                 else
11136                         echo "But its _base field isn't std."
11137                 fi
11138         else
11139                 echo "However, it seems to be lacking the _base field."
11140         fi
11141         $rm -f try.c try
11142         ;;
11143 esac
11144 set d_stdiobase
11145 eval $setvar
11146
11147 $cat >&4 <<EOM
11148 Checking how to access stdio streams by file descriptor number...
11149 EOM
11150 case "$stdio_stream_array" in
11151 '')     $cat >try.c <<EOCP
11152 #include <stdio.h>
11153 int main() {
11154   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11155     printf("yes\n");
11156 }
11157 EOCP
11158         for s in _iob __iob __sF
11159         do
11160                 set try -DSTDIO_STREAM_ARRAY=$s
11161                 if eval $compile; then
11162                         case "`./try$exe_ext`" in
11163                         yes)    stdio_stream_array=$s; break ;;
11164                         esac
11165                 fi
11166         done
11167         $rm -f try.* try$exe_ext
11168 esac
11169 case "$stdio_stream_array" in
11170 '')     $cat >&4 <<EOM
11171 I can't figure out how to access stdio streams by file descriptor number.
11172 EOM
11173         d_stdio_stream_array="$undef"
11174         ;;
11175 *)      $cat >&4 <<EOM
11176 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11177 EOM
11178         d_stdio_stream_array="$define"
11179         ;;
11180 esac
11181
11182 : see if strcoll exists
11183 set strcoll d_strcoll
11184 eval $inlibc
11185
11186 : check for structure copying
11187 echo " "
11188 echo "Checking to see if your C compiler can copy structs..." >&4
11189 $cat >try.c <<'EOCP'
11190 int main()
11191 {
11192         struct blurfl {
11193                 int dyick;
11194         } foo, bar;
11195
11196         foo = bar;
11197 }
11198 EOCP
11199 if $cc -c try.c >/dev/null 2>&1 ; then
11200         val="$define"
11201         echo "Yup, it can."
11202 else
11203         val="$undef"
11204         echo "Nope, it can't."
11205 fi
11206 set d_strctcpy
11207 eval $setvar
11208 $rm -f try.*
11209
11210 : see if strerror and/or sys_errlist[] exist
11211 echo " "
11212 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11213     if set strerror val -f d_strerror; eval $csym; $val; then
11214                 echo 'strerror() found.' >&4
11215                 d_strerror="$define"
11216                 d_strerrm='strerror(e)'
11217                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11218                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11219                         d_syserrlst="$define"
11220                 else
11221                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11222                         d_syserrlst="$undef"
11223                 fi
11224     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11225                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11226                 echo 'strerror() found in string header.' >&4
11227                 d_strerror="$define"
11228                 d_strerrm='strerror(e)'
11229                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11230                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11231                                 d_syserrlst="$define"
11232                 else
11233                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11234                         d_syserrlst="$undef"
11235                 fi
11236     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11237                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11238                 d_strerror="$undef"
11239                 d_syserrlst="$define"
11240                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11241     else
11242                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11243                 d_strerror="$undef"
11244                 d_syserrlst="$undef"
11245                 d_strerrm='"unknown"'
11246     fi
11247 fi
11248
11249 : see if strtod exists
11250 set strtod d_strtod
11251 eval $inlibc
11252
11253 : see if strtol exists
11254 set strtol d_strtol
11255 eval $inlibc
11256
11257 : see if strtold exists
11258 set strtold d_strtold
11259 eval $inlibc
11260
11261 : see if strtoll exists
11262 set strtoll d_strtoll
11263 eval $inlibc
11264
11265 : see if strtoul exists
11266 set strtoul d_strtoul
11267 eval $inlibc
11268
11269 : see if strtoull exists
11270 set strtoull d_strtoull
11271 eval $inlibc
11272
11273 : see if strtouq exists
11274 set strtouq d_strtouq
11275 eval $inlibc
11276
11277 : see if strxfrm exists
11278 set strxfrm d_strxfrm
11279 eval $inlibc
11280
11281 : see if symlink exists
11282 set symlink d_symlink
11283 eval $inlibc
11284
11285 : see if syscall exists
11286 set syscall d_syscall
11287 eval $inlibc
11288
11289 : see if sysconf exists
11290 set sysconf d_sysconf
11291 eval $inlibc
11292
11293 : see if system exists
11294 set system d_system
11295 eval $inlibc
11296
11297 : see if tcgetpgrp exists
11298 set tcgetpgrp d_tcgetpgrp
11299 eval $inlibc
11300
11301 : see if tcsetpgrp exists
11302 set tcsetpgrp d_tcsetpgrp
11303 eval $inlibc
11304
11305 : see if prototype for telldir is available
11306 echo " "
11307 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11308 eval $hasproto
11309
11310 : see if this is a sys/times.h system
11311 set sys/times.h i_systimes
11312 eval $inhdr
11313
11314 : see if times exists
11315 echo " "
11316 if set times val -f d_times; eval $csym; $val; then
11317         echo 'times() found.' >&4
11318         d_times="$define"
11319         inc=''
11320         case "$i_systimes" in
11321         "$define") inc='sys/times.h';;
11322         esac
11323         rp="What is the type returned by times() on this system?"
11324         set clock_t clocktype long stdio.h sys/types.h $inc
11325         eval $typedef_ask
11326 else
11327         echo 'times() NOT found, hope that will do.' >&4
11328         d_times="$undef"
11329         clocktype='int'
11330 fi
11331
11332 : see if truncate exists
11333 set truncate d_truncate
11334 eval $inlibc
11335
11336 : see if tzname[] exists
11337 echo " "
11338 if set tzname val -a d_tzname; eval $csym; $val; then
11339         val="$define"
11340         echo 'tzname[] found.' >&4
11341 else
11342         val="$undef"
11343         echo 'tzname[] NOT found.' >&4
11344 fi
11345 set d_tzname
11346 eval $setvar
11347
11348 : see if umask exists
11349 set umask d_umask
11350 eval $inlibc
11351
11352 : see if ustat exists
11353 set ustat d_ustat
11354 eval $inlibc
11355
11356 : backward compatibility for d_hvfork
11357 if test X$d_hvfork != X; then
11358         d_vfork="$d_hvfork"
11359         d_hvfork=''
11360 fi
11361 : see if there is a vfork
11362 val=''
11363 set vfork val
11364 eval $inlibc
11365
11366 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11367 : perl on Solaris 2.x, and probably elsewhere.
11368 case "$val" in
11369 $define)
11370         echo " "
11371         case "$usevfork" in
11372         false) dflt='n';;
11373         *) dflt='y';;
11374         esac
11375         cat <<'EOM'
11376  
11377 Perl can only use a vfork() that doesn't suffer from strict
11378 restrictions on calling functions or modifying global data in
11379 the child.  For example, glibc-2.1 contains such a vfork()
11380 that is unsuitable.  If your system provides a proper fork()
11381 call, chances are that you do NOT want perl to use vfork().
11382
11383 EOM
11384         rp="Do you still want to use vfork()?"
11385         . ./myread
11386         case "$ans" in
11387         y|Y) ;;
11388         *)
11389                 echo "Ok, we won't use vfork()."
11390                 val="$undef"
11391                 ;;
11392         esac
11393         ;;
11394 esac
11395 set d_vfork
11396 eval $setvar
11397 case "$d_vfork" in
11398 $define) usevfork='true';;
11399 *) usevfork='false';;
11400 esac
11401
11402 : see if this is an sysdir system
11403 set sys/dir.h i_sysdir
11404 eval $inhdr
11405
11406 : see if this is an sysndir system
11407 set sys/ndir.h i_sysndir
11408 eval $inhdr
11409
11410 : see if closedir exists
11411 set closedir d_closedir
11412 eval $inlibc
11413
11414 case "$d_closedir" in
11415 "$define")
11416         echo " "
11417         echo "Checking whether closedir() returns a status..." >&4
11418         cat > closedir.c <<EOM
11419 #$i_dirent I_DIRENT             /**/
11420 #$i_sysdir I_SYS_DIR            /**/
11421 #$i_sysndir I_SYS_NDIR          /**/
11422 #$i_systypes I_SYS_TYPES        /**/
11423
11424 #if defined(I_SYS_TYPES)
11425 #include <sys/types.h>
11426 #endif
11427 #if defined(I_DIRENT)
11428 #include <dirent.h>
11429 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11430 #include <sys/dir.h>
11431 #endif
11432 #else
11433 #ifdef I_SYS_NDIR
11434 #include <sys/ndir.h>
11435 #else
11436 #ifdef I_SYS_DIR
11437 #ifdef hp9000s500
11438 #include <ndir.h>       /* may be wrong in the future */
11439 #else
11440 #include <sys/dir.h>
11441 #endif
11442 #endif
11443 #endif
11444 #endif 
11445 int main() { return closedir(opendir(".")); }
11446 EOM
11447         set closedir
11448         if eval $compile_ok; then
11449                 if ./closedir > /dev/null 2>&1 ; then
11450                         echo "Yes, it does."
11451                         val="$undef"
11452                 else
11453                         echo "No, it doesn't."
11454                         val="$define"
11455                 fi
11456         else
11457                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11458                 val="$define"
11459         fi
11460         ;;
11461 *)
11462         val="$undef";
11463         ;;
11464 esac
11465 set d_void_closedir
11466 eval $setvar
11467 $rm -f closedir*
11468 : check for volatile keyword
11469 echo " "
11470 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11471 $cat >try.c <<'EOCP'
11472 int main()
11473 {
11474         typedef struct _goo_struct goo_struct;
11475         goo_struct * volatile goo = ((goo_struct *)0);
11476         struct _goo_struct {
11477                 long long_int;
11478                 int reg_int;
11479                 char char_var;
11480         };
11481         typedef unsigned short foo_t;
11482         char *volatile foo;
11483         volatile int bar;
11484         volatile foo_t blech;
11485         foo = foo;
11486 }
11487 EOCP
11488 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11489         val="$define"
11490         echo "Yup, it does."
11491 else
11492         val="$undef"
11493         echo "Nope, it doesn't."
11494 fi
11495 set d_volatile
11496 eval $setvar
11497 $rm -f try.*
11498
11499 : see if there is a wait4
11500 set wait4 d_wait4
11501 eval $inlibc
11502
11503 : see if waitpid exists
11504 set waitpid d_waitpid
11505 eval $inlibc
11506
11507 : see if wcstombs exists
11508 set wcstombs d_wcstombs
11509 eval $inlibc
11510
11511 : see if wctomb exists
11512 set wctomb d_wctomb
11513 eval $inlibc
11514
11515 : preserve RCS keywords in files with variable substitution, grrr
11516 Date='$Date'
11517 Id='$Id'
11518 Log='$Log'
11519 RCSfile='$RCSfile'
11520 Revision='$Revision'
11521
11522 case "$crosscompile" in
11523 ''|[nN]*) crosscompile="$undef" ;;
11524 esac
11525
11526 case "$osname" in
11527 next|rhapsody) multiarch="$define" ;;
11528 esac
11529 case "$multiarch" in
11530 ''|[nN]*) multiarch="$undef" ;;
11531 esac
11532
11533 : check for alignment requirements
11534 echo " "
11535 case "$crosscompile$multiarch" in
11536 *$define*)
11537         $cat <<EOM
11538 You seem to be either cross-compiling or doing a multiarchitecture build,
11539 skipping the memory alignment check.
11540
11541 EOM
11542         case "$alignbytes" in
11543         '') alignbytes=8 ;;
11544         esac
11545         ;;
11546 *)
11547         case "$alignbytes" in
11548         '') echo "Checking alignment constraints..." >&4
11549                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11550                         $cat >try.c <<'EOCP'
11551 typedef long double NV;
11552 EOCP
11553                 else
11554                         $cat >try.c <<'EOCP'
11555 typedef double NV;
11556 EOCP
11557                 fi
11558                 $cat >>try.c <<'EOCP'
11559 #include <stdio.h>
11560 struct foobar {
11561         char foo;
11562         NV bar;
11563 } try_algn;
11564 int main()
11565 {
11566     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11567     return(0);
11568 }
11569 EOCP
11570                 set try
11571                 if eval $compile_ok; then
11572                         dflt=`./try`
11573                 else
11574                         dflt='8'
11575                         echo "(I can't seem to compile the test program...)"
11576                 fi
11577                 ;;
11578         *) dflt="$alignbytes"
11579                 ;;
11580         esac
11581         rp="Doubles must be aligned on a how-many-byte boundary?"
11582         . ./myread
11583         alignbytes="$ans"
11584         $rm -f try.c try
11585         ;;
11586 esac
11587
11588
11589 : check for ordering of bytes in a long
11590 echo " "
11591 case "$crosscompile$multiarch" in
11592 *$define*)
11593         $cat <<EOM
11594 You seem to be either cross-compiling or doing a multiarchitecture build,
11595 skipping the byteorder check.
11596
11597 EOM
11598         byteorder='0xffff'
11599         ;;
11600 *)
11601         case "$byteorder" in
11602         '')
11603                 $cat <<'EOM'
11604 In the following, larger digits indicate more significance.  A big-endian
11605 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11606 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11607 machines may have weird orders like 3412.  A Cray will report 87654321,
11608 an Alpha will report 12345678. If the test program works the default is
11609 probably right.
11610 I'm now running the test program...
11611 EOM
11612                 $cat >try.c <<'EOCP'
11613 #include <stdio.h>
11614 int main()
11615 {
11616         int i;
11617         union {
11618                 unsigned long l;
11619                 char c[sizeof(long)];
11620         } u;
11621
11622         if (sizeof(long) > 4)
11623                 u.l = (0x08070605L << 32) | 0x04030201L;
11624         else
11625                 u.l = 0x04030201L;
11626         for (i = 0; i < sizeof(long); i++)
11627                 printf("%c", u.c[i]+'0');
11628         printf("\n");
11629         exit(0);
11630 }
11631 EOCP
11632                 xxx_prompt=y
11633                 set try
11634                 if eval $compile && ./try > /dev/null; then
11635                         dflt=`./try`
11636                         case "$dflt" in
11637                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11638                                 echo "(The test program ran ok.)"
11639                                 echo "byteorder=$dflt"
11640                                 xxx_prompt=n
11641                         ;;
11642                         ????|????????) echo "(The test program ran ok.)" ;;
11643                         *) echo "(The test program didn't run right for some reason.)" ;;
11644                         esac
11645                 else
11646                         dflt='4321'
11647                         cat <<'EOM'
11648 (I can't seem to compile the test program.  Guessing big-endian...)
11649 EOM
11650                 fi
11651                 case "$xxx_prompt" in
11652                 y)
11653                         rp="What is the order of bytes in a long?"
11654                         . ./myread
11655                         byteorder="$ans"
11656                         ;;
11657                 *)      byteorder=$dflt
11658                         ;;
11659                 esac
11660                 ;;
11661         esac
11662         $rm -f try.c try
11663         ;;
11664 esac
11665
11666
11667 : how do we catenate cpp tokens here?
11668 echo " "
11669 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11670 $cat >cpp_stuff.c <<'EOCP'
11671 #define RCAT(a,b)a/**/b
11672 #define ACAT(a,b)a ## b
11673 RCAT(Rei,ser)
11674 ACAT(Cir,cus)
11675 EOCP
11676 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11677 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11678         echo "Oh!  Smells like ANSI's been here." >&4
11679         echo "We can catify or stringify, separately or together!"
11680         cpp_stuff=42
11681 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11682         echo "Ah, yes!  The good old days!" >&4
11683         echo "However, in the good old days we don't know how to stringify and"
11684         echo "catify at the same time."
11685         cpp_stuff=1
11686 else
11687         $cat >&4 <<EOM
11688 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11689 to have to edit the values of CAT[2-5] in config.h...
11690 EOM
11691         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11692 fi
11693 $rm -f cpp_stuff.*
11694
11695 : see if this is a db.h system
11696 set db.h i_db
11697 eval $inhdr
11698
11699 case "$i_db" in
11700 $define)
11701         : Check db version.
11702         echo " "
11703         echo "Checking Berkeley DB version ..." >&4
11704         $cat >try.c <<EOCP
11705 #$d_const HASCONST
11706 #ifndef HASCONST
11707 #define const
11708 #endif
11709 #include <sys/types.h>
11710 #include <stdio.h>
11711 #include <db.h>
11712 int main()
11713 {
11714 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11715     int Major, Minor, Patch ;
11716     unsigned long Version ;
11717     (void)db_version(&Major, &Minor, &Patch) ;
11718     printf("You have Berkeley DB Version 2 or greater\n");
11719
11720     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11721                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11722     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11723                 Major, Minor, Patch) ;
11724
11725     /* check that db.h & libdb are compatible */
11726     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11727         printf("db.h and libdb are incompatible\n") ;
11728         exit(3);        
11729     }
11730
11731     printf("db.h and libdb are compatible\n") ;
11732
11733     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11734                 + DB_VERSION_PATCH ;
11735
11736     /* needs to be >= 2.3.4 */
11737     if (Version < 2003004) {
11738     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11739         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11740         exit(2);        
11741     }
11742
11743     exit(0);
11744 #else
11745 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11746     printf("You have Berkeley DB Version 1\n");
11747     exit(0);    /* DB version < 2: the coast is clear. */
11748 #else
11749     exit(1);    /* <db.h> not Berkeley DB? */
11750 #endif
11751 #endif
11752 }
11753 EOCP
11754         set try
11755         if eval $compile_ok && ./try; then
11756                 echo 'Looks OK.' >&4
11757         else
11758                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11759                 i_db=$undef
11760                 case " $libs " in
11761                 *"-ldb "*)
11762                         : Remove db from list of libraries to use
11763                         echo "Removing unusable -ldb from library list" >&4
11764                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11765                         shift
11766                         libs="$*"
11767                         echo "libs = $libs" >&4
11768                         ;;
11769                 esac
11770         fi
11771         $rm -f try.*
11772         ;;
11773 esac
11774
11775 case "$i_db" in
11776 define)
11777         : Check the return type needed for hash 
11778         echo " "
11779         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11780         $cat >try.c <<EOCP
11781 #$d_const HASCONST
11782 #ifndef HASCONST
11783 #define const
11784 #endif
11785 #include <sys/types.h>
11786 #include <db.h>
11787
11788 #ifndef DB_VERSION_MAJOR
11789 u_int32_t hash_cb (ptr, size)
11790 const void *ptr;
11791 size_t size;
11792 {
11793 }
11794 HASHINFO info;
11795 int main()
11796 {
11797         info.hash = hash_cb;
11798 }
11799 #endif
11800 EOCP
11801         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11802                 if $contains warning try.out >>/dev/null 2>&1 ; then
11803                         db_hashtype='int'
11804                 else
11805                         db_hashtype='u_int32_t'
11806                 fi
11807         else
11808                 : XXX Maybe we should just give up here.
11809                 db_hashtype=u_int32_t
11810                 $cat try.out >&4
11811                 echo "Help:  I can't seem to compile the db test program." >&4
11812                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11813         fi
11814         $rm -f try.*
11815         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11816         ;;
11817 *)      db_hashtype=u_int32_t
11818         ;;
11819 esac
11820 case "$i_db" in
11821 define)
11822         : Check the return type needed for prefix 
11823         echo " "
11824         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11825         cat >try.c <<EOCP
11826 #$d_const HASCONST
11827 #ifndef HASCONST
11828 #define const
11829 #endif
11830 #include <sys/types.h>
11831 #include <db.h>
11832
11833 #ifndef DB_VERSION_MAJOR
11834 size_t prefix_cb (key1, key2)
11835 const DBT *key1;
11836 const DBT *key2;
11837 {
11838 }
11839 BTREEINFO info;
11840 int main()
11841 {
11842         info.prefix = prefix_cb;
11843 }
11844 #endif
11845 EOCP
11846         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11847                 if $contains warning try.out >>/dev/null 2>&1 ; then
11848                         db_prefixtype='int'
11849                 else
11850                         db_prefixtype='size_t'
11851                 fi
11852         else
11853                 db_prefixtype='size_t'
11854                 : XXX Maybe we should just give up here.
11855                 $cat try.out >&4
11856                 echo "Help:  I can't seem to compile the db test program." >&4
11857                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11858         fi
11859         $rm -f try.*
11860         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11861         ;;
11862 *)      db_prefixtype='size_t'
11863         ;;
11864 esac
11865
11866 : check for void type
11867 echo " "
11868 echo "Checking to see how well your C compiler groks the void type..." >&4
11869 case "$voidflags" in
11870 '')
11871         $cat >try.c <<'EOCP'
11872 #if TRY & 1
11873 void sub() {
11874 #else
11875 sub() {
11876 #endif
11877         extern void moo();      /* function returning void */
11878         void (*goo)();          /* ptr to func returning void */
11879 #if TRY & 8
11880         void *hue;              /* generic ptr */
11881 #endif
11882 #if TRY & 2
11883         void (*foo[10])();
11884 #endif
11885
11886 #if TRY & 4
11887         if(goo == moo) {
11888                 exit(0);
11889         }
11890 #endif
11891         exit(0);
11892 }
11893 int main() { sub(); }
11894 EOCP
11895         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11896                 voidflags=$defvoidused
11897         echo "Good.  It appears to support void to the level $package wants.">&4
11898                 if $contains warning .out >/dev/null 2>&1; then
11899                         echo "However, you might get some warnings that look like this:"
11900                         $cat .out
11901                 fi
11902         else
11903 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11904                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11905                         echo "It supports 1..."
11906                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11907                                 echo "It also supports 2..."
11908                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11909                                         voidflags=7
11910                                         echo "And it supports 4 but not 8 definitely."
11911                                 else
11912                                         echo "It doesn't support 4..."
11913                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11914                                                 voidflags=11
11915                                                 echo "But it supports 8."
11916                                         else
11917                                                 voidflags=3
11918                                                 echo "Neither does it support 8."
11919                                         fi
11920                                 fi
11921                         else
11922                                 echo "It does not support 2..."
11923                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11924                                         voidflags=13
11925                                         echo "But it supports 4 and 8."
11926                                 else
11927                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11928                                                 voidflags=5
11929                                                 echo "And it supports 4 but has not heard about 8."
11930                                         else
11931                                                 echo "However it supports 8 but not 4."
11932                                         fi
11933                                 fi
11934                         fi
11935                 else
11936                         echo "There is no support at all for void."
11937                         voidflags=0
11938                 fi
11939         fi
11940 esac
11941 case "$voidflags" in
11942 "$defvoidused") ;;
11943 *)      $cat >&4 <<'EOM'
11944   Support flag bits are:
11945     1: basic void declarations.
11946     2: arrays of pointers to functions returning void.
11947     4: operations between pointers to and addresses of void functions.
11948     8: generic void pointers.
11949 EOM
11950         dflt="$voidflags";
11951         rp="Your void support flags add up to what?"
11952         . ./myread
11953         voidflags="$ans"
11954         ;;
11955 esac
11956 $rm -f try.* .out
11957
11958
11959 : How can we generate normalized random numbers ?
11960 echo " "
11961 echo "Looking for a random number function..." >&4
11962 case "$randfunc" in
11963 '')
11964         if set drand48 val -f; eval $csym; $val; then
11965                 dflt="drand48"
11966                 echo "Good, found drand48()." >&4
11967         elif set random val -f; eval $csym; $val; then
11968                 dflt="random"
11969                 echo "OK, found random()." >&4
11970         else
11971                 dflt="rand"
11972                 echo "Yick, looks like I have to use rand()." >&4
11973         fi
11974         echo " "
11975         ;;
11976 *)
11977         dflt="$randfunc"
11978         ;;
11979 esac
11980 cont=true
11981
11982 case "$ccflags" in
11983 *-Dmy_rand=*|*-Dmy_srand=*)
11984         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11985         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11986         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11987         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11988         ;;
11989 esac
11990
11991 while $test "$cont"; do
11992         rp="Use which function to generate random numbers?"
11993         . ./myread
11994         if $test "$ans" = "$dflt"; then
11995                 : null
11996         else
11997                 randbits=''
11998         fi
11999         randfunc="$ans"
12000         if set $ans val -f; eval $csym; $val; then
12001                 cont=''
12002         else
12003                 dflt=y
12004                 rp="I cannot find function $ans. Use that name anyway?"
12005                 . ./myread
12006                 dflt=rand
12007                 case "$ans" in
12008                         [yY]*) cont='';;
12009                 esac
12010         fi
12011         case "$cont" in
12012         '')
12013                 case "$randfunc" in
12014                 drand48)
12015                         drand01="drand48()"
12016                         seedfunc="srand48"
12017                         randbits=48
12018                         randseedtype=long
12019                         ;;
12020                 rand|random)
12021                         case "$randbits" in
12022                         '')
12023 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12024                                 $cat >try.c <<EOCP
12025 #$i_unistd I_UNISTD
12026 #$i_stdlib I_STDLIB
12027 #include <stdio.h>
12028 #ifdef I_UNISTD
12029 #  include <unistd.h>
12030 #endif
12031 #ifdef I_STDLIB
12032 #  include <stdlib.h>
12033 #endif
12034 int main()
12035 {
12036         register int i;
12037         register unsigned long tmp;
12038         register unsigned long max = 0L;
12039
12040         for (i = 1000; i; i--) {
12041                 tmp = (unsigned long) $randfunc();
12042                 if (tmp > max) max = tmp;
12043         }
12044         for (i = 0; max; i++)
12045                 max /= 2;
12046         printf("%d\n",i);
12047 }
12048 EOCP
12049                                 set try
12050                                 if eval $compile_ok; then
12051                                         dflt=`try`
12052                                 else
12053                                         dflt='?'
12054                                         echo "(I can't seem to compile the test program...)"
12055                                 fi
12056                                 ;;
12057                         *)
12058                                 dflt="$randbits"
12059                                 ;;
12060                         esac
12061                         rp="How many bits does your $randfunc() function produce?"
12062                         . ./myread
12063                         randbits="$ans"
12064                         $rm -f try.c try
12065                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12066                         seedfunc="s$randfunc"
12067                         randseedtype=unsigned
12068                         ;;
12069                 *)
12070                         dflt="31"
12071                         rp="How many bits does your $randfunc() function produce?"
12072                         . ./myread
12073                         randbits="$ans"
12074                         seedfunc="s$randfunc"
12075                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12076                         if set $seedfunc val -f; eval $csym; $val; then
12077                                 echo "(Using $seedfunc() to seed random generator)"
12078                         else
12079                                 echo "(Warning: no $seedfunc() to seed random generator)"
12080                                 seedfunc=rand
12081                         fi
12082                         randseedtype=unsigned
12083                         ;;
12084                 esac
12085                 ;;
12086         esac
12087 done
12088
12089 echo " "
12090 echo "Determining whether or not we are on an EBCDIC system..." >&4
12091 $cat >tebcdic.c <<'EOM'
12092 int main()
12093 {
12094   if ('M'==0xd4) return 0;
12095   return 1;
12096 }
12097 EOM
12098
12099 val=$undef
12100 set tebcdic
12101 if eval $compile_ok; then
12102         if ./tebcdic; then
12103                 echo "You have EBCDIC." >&4
12104                 val="$define"
12105         else
12106                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12107         fi
12108 else
12109         echo "I'm unable to compile the test program." >&4
12110         echo "I'll assume ASCII or some ISO Latin." >&4
12111 fi
12112 $rm -f tebcdic.c tebcdic
12113 set ebcdic
12114 eval $setvar
12115
12116 echo " "
12117 $cat >&4 <<EOM
12118 Checking how to flush all pending stdio output...
12119 EOM
12120 # I only know how to find the first 32 possibly open files on SunOS.
12121 # See also hints/sunos_4_1.sh and util.c  --AD
12122 case "$osname" in
12123 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12124 esac
12125 $cat >>try.c <<EOCP
12126 #include <stdio.h>
12127 #$i_unistd I_UNISTD
12128 #ifdef I_UNISTD
12129 # include <unistd.h>
12130 #endif
12131 #$d_sysconf HAS_SYSCONF
12132 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12133 #ifdef HAS_STDIO_STREAM_ARRAY
12134 # define STDIO_STREAM_ARRAY $stdio_stream_array
12135 #endif
12136 int main() {
12137   FILE* p = fopen("try.out", "w");
12138 #ifdef TRY_FPUTC
12139   fputc('x', p);
12140 #else
12141 # ifdef TRY_FPRINTF
12142   fprintf(p, "x");
12143 # endif
12144 #endif
12145 #ifdef TRY_FFLUSH_NULL
12146   fflush(NULL);
12147 #endif
12148 #ifdef TRY_FFLUSH_ALL
12149   {
12150     long open_max = -1;
12151 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12152     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12153 # else
12154 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12155     open_max = sysconf(_SC_OPEN_MAX);
12156 #  else
12157 #   ifdef FOPEN_MAX
12158     open_max = FOPEN_MAX;
12159 #   else
12160 #    ifdef OPEN_MAX
12161     open_max = OPEN_MAX;
12162 #    else
12163 #     ifdef _NFILE
12164     open_max = _NFILE;
12165 #     endif
12166 #    endif
12167 #   endif
12168 #  endif
12169 # endif 
12170 # ifdef HAS_STDIO_STREAM_ARRAY
12171     if (open_max > 0) {
12172       long i;
12173       for (i = 0; i < open_max; i++)
12174             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12175                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12176                 STDIO_STREAM_ARRAY[i]._flag)
12177                 fflush(&STDIO_STREAM_ARRAY[i]);
12178     }   
12179   }
12180 # endif
12181 #endif
12182   _exit(42);
12183 }
12184 EOCP
12185 : first we have to find out how _not_ to flush
12186 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12187     output=''
12188     set try -DTRY_FPUTC
12189     if eval $compile; then
12190             $rm -f try.out
12191             ./try$exe_ext 2>/dev/null
12192             if $test ! -s try.out -a "X$?" = X42; then
12193                 output=-DTRY_FPUTC
12194             fi
12195     fi
12196     case "$output" in
12197     '')
12198             set try -DTRY_FPRINTF
12199             $rm -f try.out
12200             if eval $compile; then
12201                     $rm -f try.out
12202                     ./try$exe_ext 2>/dev/null
12203                     if $test ! -s try.out -a "X$?" = X42; then
12204                         output=-DTRY_FPRINTF
12205                     fi
12206             fi
12207         ;;
12208     esac
12209 fi
12210 : check for fflush NULL behaviour
12211 case "$fflushNULL" in
12212 '')     set try -DTRY_FFLUSH_NULL $output
12213         if eval $compile; then
12214                 $rm -f try.out
12215                 ./try$exe_ext 2>/dev/null
12216                 code="$?"
12217                 if $test -s try.out -a "X$code" = X42; then
12218                         fflushNULL="`$cat try.out`"
12219                 else
12220                         if $test "X$code" != X42; then
12221                                 $cat >&4 <<EOM
12222 (If this test failed, don't worry, we'll try another method shortly.)
12223 EOM
12224                         fi
12225                 fi
12226         fi
12227         $rm -f core try.core core.try.*
12228         case "$fflushNULL" in
12229         x)      $cat >&4 <<EOM
12230 Your fflush(NULL) works okay.
12231 EOM
12232                 fflushNULL="$define"
12233                 ;;
12234         '')     $cat >&4 <<EOM
12235 Your fflush(NULL) isn't working (contrary to ANSI C).
12236 EOM
12237                 fflushNULL="$undef"
12238                 ;;
12239         *)      $cat >&4 <<EOM
12240 Cannot figure out whether your fflush(NULL) works or not.
12241 I'm assuming it doesn't (contrary to ANSI C).
12242 EOM
12243                 fflushNULL="$undef"
12244                 ;;
12245         esac
12246         ;;
12247 $define|true|[yY]*)
12248         fflushNULL="$define"
12249         ;;
12250 *)
12251         fflushNULL="$undef"
12252         ;;
12253 esac
12254 : check explicit looping only if NULL did not work
12255 case "$fflushNULL" in
12256 "$undef")
12257         : check for fflush all behaviour
12258         case "$fflushall" in
12259         '')     set try -DTRY_FFLUSH_ALL $output
12260                 if eval $compile; then
12261                         $cat >&4 <<EOM
12262 (Now testing the other method--but note that also this may fail.)
12263 EOM
12264                         $rm -f try.out
12265                         ./try$exe_ext 2>/dev/null
12266                         if $test -s try.out -a "X$?" = X42; then
12267                                 fflushall="`$cat try.out`"
12268                         fi
12269                 fi
12270                 $rm -f core try.core core.try.*
12271                 case "$fflushall" in
12272                 x)      $cat >&4 <<EOM
12273 Whew. Flushing explicitly all the stdio streams works.
12274 EOM
12275                         fflushall="$define"
12276                         ;;
12277                 '')     $cat >&4 <<EOM
12278 Sigh. Flushing explicitly all the stdio streams doesn't work.
12279 EOM
12280                         fflushall="$undef"
12281                         ;;
12282                 *)      $cat >&4 <<EOM
12283 Cannot figure out whether flushing stdio streams explicitly works or not.
12284 I'm assuming it doesn't.
12285 EOM
12286                         fflushall="$undef"
12287                         ;;
12288                 esac
12289                 ;;
12290         "$define"|true|[yY]*)
12291                 fflushall="$define"
12292                 ;;
12293         *)
12294                 fflushall="$undef"
12295                 ;;
12296         esac
12297         ;;
12298 *)      fflushall="$undef"      
12299         ;;
12300 esac
12301 case "$fflushNULL$fflushall" in
12302 undefundef)
12303         $cat <<EOM
12304 I cannot figure out how to flush pending stdio output.
12305 EOM
12306         ;;
12307 esac
12308 $rm -f try.* try$exe_ext
12309
12310 : Store the full pathname to the ar program for use in the C program
12311 : Respect a hint or command line value for full_ar.
12312 case "$full_ar" in
12313 '') full_ar=$ar ;;
12314 esac
12315
12316 : Store the full pathname to the sed program for use in the C program
12317 full_sed=$sed
12318
12319 : see what type gids are declared as in the kernel
12320 echo " "
12321 echo "Looking for the type for group ids returned by getgid()."
12322 set gid_t gidtype xxx stdio.h sys/types.h
12323 eval $typedef
12324 case "$gidtype" in
12325 xxx)
12326         xxx=`./findhdr sys/user.h`
12327         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12328         case $1 in
12329         unsigned) dflt="$1 $2" ;;
12330         *) dflt="$1" ;;
12331         esac
12332         ;;
12333 *) dflt="$gidtype";;
12334 esac
12335 case "$gidtype" in
12336 gid_t) echo "gid_t found." ;;
12337 *)      rp="What is the type for group ids returned by getgid()?"
12338         . ./myread
12339         gidtype="$ans"
12340         ;;
12341 esac
12342
12343 echo " "
12344 case "$gidtype" in
12345 *_t) zzz="$gidtype"     ;;
12346 *)   zzz="gid"          ;;
12347 esac
12348 echo "Checking the size of $zzz..." >&4 
12349 cat > try.c <<EOCP
12350 #include <sys/types.h>
12351 #include <stdio.h>
12352 int main() {
12353     printf("%d\n", (int)sizeof($gidtype));
12354     exit(0);
12355 }
12356 EOCP
12357 set try
12358 if eval $compile_ok; then
12359         yyy=`./try`
12360         case "$yyy" in
12361         '')     gidsize=4
12362                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12363                 ;;
12364         *)      gidsize=$yyy
12365                 echo "Your $zzz size is $gidsize bytes."
12366                 ;;
12367         esac
12368 else
12369         gidsize=4
12370         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12371 fi
12372
12373
12374 echo " "
12375 case "$gidtype" in
12376 *_t) zzz="$gidtype"     ;;
12377 *)   zzz="gid"          ;;
12378 esac
12379 echo "Checking the sign of $zzz..." >&4 
12380 cat > try.c <<EOCP
12381 #include <sys/types.h>
12382 #include <stdio.h>
12383 int main() {
12384         $gidtype foo = -1;
12385         if (foo < 0)
12386                 printf("-1\n");
12387         else
12388                 printf("1\n");
12389 }
12390 EOCP
12391 set try
12392 if eval $compile; then
12393         yyy=`./try`
12394         case "$yyy" in
12395         '')     gidsign=1
12396                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12397                 ;;
12398         *)      gidsign=$yyy
12399                 case "$gidsign" in
12400                  1) echo "Your $zzz is unsigned." ;;
12401                 -1) echo "Your $zzz is signed."   ;;
12402                 esac
12403                 ;;
12404         esac
12405 else
12406         gidsign=1
12407         echo "(I can't compile the test program--guessing unsigned.)" >&4
12408 fi
12409
12410
12411 echo " "
12412
12413 if $test X"$quadtype" != X; then
12414
12415 echo "Checking how to print 64-bit integers..." >&4
12416
12417 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12418         $cat >try.c <<'EOCP'
12419 #include <sys/types.h>
12420 #include <stdio.h>
12421 int main() {
12422   int q = 12345678901;
12423   printf("%ld\n", q);
12424 }
12425 EOCP
12426         set try
12427         if eval $compile; then
12428                 yyy=`./try$exe_ext`
12429                 case "$yyy" in
12430                 12345678901)
12431                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12432                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12433                         echo "We will use %d."
12434                         ;;
12435                 esac
12436         fi
12437 fi
12438
12439 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12440         $cat >try.c <<'EOCP'
12441 #include <sys/types.h>
12442 #include <stdio.h>
12443 int main() {
12444   long q = 12345678901;
12445   printf("%ld\n", q);
12446 }
12447 EOCP
12448         set try
12449         if eval $compile; then
12450                 yyy=`./try$exe_ext`
12451                 case "$yyy" in
12452                 12345678901)
12453                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12454                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12455                         echo "We will use %ld."
12456                         ;;
12457                 esac
12458         fi
12459 fi
12460
12461 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12462         $cat >try.c <<'EOCP'
12463 #include <sys/types.h>
12464 #include <inttypes.h>
12465 #include <stdio.h>
12466 int main() {
12467   int64_t q = 12345678901;
12468   printf("%" PRId64 "\n", q);
12469 }
12470 EOCP
12471         set try
12472         if eval $compile; then
12473                 yyy=`./try$exe_ext`
12474                 case "$yyy" in
12475                 12345678901)
12476                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12477                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12478                         echo "We will use the C9X style."
12479                         ;;
12480                 esac
12481         fi
12482 fi
12483
12484 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12485         $cat >try.c <<'EOCP'
12486 #include <sys/types.h>
12487 #include <stdio.h>
12488 int main() {
12489   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12490   printf("%lld\n", q);
12491 }
12492 EOCP
12493         set try
12494         if eval $compile; then
12495                 yyy=`./try$exe_ext`
12496                 case "$yyy" in
12497                 12345678901)
12498                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12499                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12500                         echo "We will use the %lld style."
12501                         ;;
12502                 esac
12503         fi
12504 fi
12505
12506 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12507         $cat >try.c <<EOCP
12508 #include <sys/types.h>
12509 #include <stdio.h>
12510 int main() {
12511   $quadtype q = 12345678901;
12512   printf("%Ld\n", q);
12513 }
12514 EOCP
12515         set try
12516         if eval $compile; then
12517                 yyy=`./try$exe_ext`
12518                 case "$yyy" in
12519                 12345678901)
12520                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12521                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12522                         echo "We will use %Ld."
12523                         ;;
12524                 esac
12525         fi
12526 fi
12527
12528 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12529         $cat >try.c <<EOCP
12530 #include <sys/types.h>
12531 #include <stdio.h>
12532 int main() {
12533   $quadtype q = 12345678901;
12534   printf("%qd\n", q);
12535 }
12536 EOCP
12537         set try
12538         if eval $compile; then
12539                 yyy=`./try$exe_ext`
12540                 case "$yyy" in
12541                 12345678901)
12542                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12543                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12544                         echo "We will use %qd."
12545                         ;;
12546                 esac
12547         fi
12548 fi
12549
12550 if $test X"$sPRId64" = X; then
12551         echo "Cannot figure out how to print 64-bit integers." >&4
12552 fi
12553
12554 $rm -f try try.*
12555
12556 fi
12557
12558 case "$sPRId64" in
12559 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12560         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12561         ;;
12562 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12563         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12564         ;;
12565 esac
12566
12567
12568 echo " "
12569 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12570
12571 if $test X"$ivsize" = X8; then
12572         ivdformat="$sPRId64"
12573         uvuformat="$sPRIu64"
12574         uvoformat="$sPRIo64"
12575         uvxformat="$sPRIx64"
12576 else
12577         if $test X"$ivsize" = X"$longsize"; then
12578                 ivdformat='"ld"'
12579                 uvuformat='"lu"'
12580                 uvoformat='"lo"'
12581                 uvxformat='"lx"'
12582         else
12583                 if $test X"$ivsize" = X"$intsize"; then
12584                         ivdformat='"d"'
12585                         uvuformat='"u"'
12586                         uvoformat='"o"'
12587                         uvxformat='"x"'
12588                 else
12589                         : far out
12590                         if $test X"$ivsize" = X"$shortsize"; then
12591                                 ivdformat='"hd"'
12592                                 uvuformat='"hu"'
12593                                 uvoformat='"ho"'
12594                                 uvxformat='"hx"'
12595                         fi
12596                 fi
12597         fi
12598 fi
12599
12600 case "$ivdformat" in
12601 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12602     exit 1
12603     ;;
12604 esac
12605
12606
12607 echo " "
12608 $echo "Checking the format string to be used for gids..." >&4
12609
12610 case "$gidsign" in
12611 -1)     if $test X"$gidsize" = X"$ivsize"; then
12612                 gidformat="$ivdformat"
12613         else
12614                 if $test X"$gidsize" = X"$longsize"; then
12615                         gidformat='"ld"'
12616                 else
12617                         if $test X"$gidsize" = X"$intsize"; then
12618                                 gidformat='"d"'
12619                         else
12620                                 if $test X"$gidsize" = X"$shortsize"; then
12621                                         gidformat='"hd"'
12622                                 fi
12623                         fi
12624                 fi
12625         fi
12626         ;;
12627 *)      if $test X"$gidsize" = X"$uvsize"; then
12628                 gidformat="$uvuformat"
12629         else
12630                 if $test X"$gidsize" = X"$longsize"; then
12631                         gidformat='"lu"'
12632                 else
12633                         if $test X"$gidsize" = X"$intsize"; then
12634                                 gidformat='"u"'
12635                         else
12636                                 if $test X"$gidsize" = X"$shortsize"; then
12637                                         gidformat='"hu"'
12638                                 fi
12639                         fi
12640                 fi
12641         fi
12642         ;;
12643 esac
12644
12645 : see if getgroups exists
12646 set getgroups d_getgrps
12647 eval $inlibc
12648
12649 : see if setgroups exists
12650 set setgroups d_setgrps
12651 eval $inlibc
12652
12653
12654 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12655 echo " "
12656 case "$d_getgrps$d_setgrps" in
12657 *define*)
12658         case "$groupstype" in
12659         '') dflt="$gidtype" ;;
12660         *)  dflt="$groupstype" ;;
12661         esac
12662         $cat <<EOM
12663 What type of pointer is the second argument to getgroups() and setgroups()?
12664 Usually this is the same as group ids, $gidtype, but not always.
12665
12666 EOM
12667         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12668         . ./myread
12669         groupstype="$ans"
12670         ;;
12671 *)  groupstype="$gidtype";;
12672 esac
12673
12674 echo " "
12675 echo "Checking if your $make program sets \$(MAKE)..." >&4
12676 case "$make_set_make" in
12677 '')
12678         $sed 's/^X //' > testmake.mak << 'EOF'
12679 Xall:
12680 X       @echo 'maketemp="$(MAKE)"'
12681 EOF
12682         case "`$make -f testmake.mak 2>/dev/null`" in
12683         *maketemp=*) make_set_make='#' ;;
12684         *)      make_set_make="MAKE=$make" ;;
12685         esac
12686         $rm -f testmake.mak
12687         ;;
12688 esac
12689 case "$make_set_make" in
12690 '#') echo "Yup, it does.";;
12691 *) echo "Nope, it doesn't.";;
12692 esac
12693
12694 : see what type is used for mode_t
12695 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12696 set mode_t modetype int stdio.h sys/types.h
12697 eval $typedef_ask
12698
12699 : define a fucntion to check prototypes
12700 $cat > protochk <<EOSH
12701 $startsh
12702 cc="$cc"
12703 optimize="$optimize"
12704 ccflags="$ccflags"
12705 prototype="$prototype"
12706 define="$define"
12707 rm=$rm
12708 EOSH
12709
12710 $cat >> protochk <<'EOSH'
12711
12712 $rm -f try.c
12713 foo="$1"
12714 shift
12715 while test $# -ge 2; do
12716         case "$1" in
12717                 $define) echo "#include <$2>" >> try.c ;;
12718                 literal) echo "$2" >> try.c ;;
12719         esac
12720     shift 2
12721 done
12722 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12723 cat >> try.c <<'EOCP'
12724 #ifdef CAN_PROTOTYPE
12725 #define _(args) args
12726 #else
12727 #define _(args) ()
12728 #endif
12729 EOCP
12730 echo "$foo" >> try.c
12731 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12732 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12733 status=$?
12734 $rm -f try.[co]
12735 exit $status
12736 EOSH
12737 chmod +x protochk
12738 $eunicefix protochk
12739
12740 : see what type is used for size_t
12741 rp="What is the type used for the length parameter for string functions?"
12742 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12743 eval $typedef_ask
12744
12745 : check for type of arguments to gethostbyaddr. 
12746 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12747         case "$d_gethbyaddr" in
12748         $define)
12749                 $cat <<EOM
12750
12751 Checking to see what type of arguments are accepted by gethostbyaddr().
12752 EOM
12753                 hdrs="$define sys/types.h
12754                         $d_socket sys/socket.h 
12755                         $i_niin netinet/in.h 
12756                         $i_netdb netdb.h
12757                         $i_unistd unistd.h"
12758                 : The first arg can 'char *' or 'void *'
12759                 : The second arg is some of integral type
12760                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12761                         for yyy in size_t long int; do
12762                                 case "$netdb_host_type" in
12763                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12764                                         if ./protochk "$try" $hdrs; then
12765                                                 echo "Your system accepts $xxx for the first arg."
12766                                                 echo "...and $yyy for the second arg."
12767                                                 netdb_host_type="$xxx"
12768                                                 netdb_hlen_type="$yyy"
12769                                         fi
12770                                         ;;
12771                                 esac
12772                         done
12773                 done
12774                 : In case none of those worked, prompt the user.
12775                 case "$netdb_host_type" in
12776                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12777                         dflt='char *'
12778                         . ./myread
12779                         netdb_host_type=$ans
12780                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12781                         dflt="$sizetype"
12782                         . ./myread
12783                         netdb_hlen_type=$ans
12784                         ;;
12785                 esac
12786                 ;;
12787         *)      : no gethostbyaddr, so pick harmless defaults
12788                 netdb_host_type='char *'
12789                 netdb_hlen_type="$sizetype"
12790                 ;;
12791         esac
12792         # Remove the "const" if needed. -- but then we'll have a 
12793         # prototype clash!
12794         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12795 fi
12796
12797 : check for type of argument to gethostbyname. 
12798 if test "X$netdb_name_type" = X ; then
12799         case "$d_gethbyname" in
12800         $define)
12801                 $cat <<EOM
12802
12803 Checking to see what type of argument is accepted by gethostbyname().
12804 EOM
12805                 hdrs="$define sys/types.h
12806                         $d_socket sys/socket.h 
12807                         $i_niin netinet/in.h 
12808                         $i_netdb netdb.h
12809                         $i_unistd unistd.h"
12810                 for xxx in "const char *" "char *"; do
12811                         case "$netdb_name_type" in
12812                         '')     try="extern struct hostent *gethostbyname($xxx);"
12813                                 if ./protochk "$try" $hdrs; then
12814                                         echo "Your system accepts $xxx."
12815                                         netdb_name_type="$xxx"
12816                                 fi
12817                                 ;;
12818                         esac
12819                 done
12820                 : In case none of those worked, prompt the user.
12821                 case "$netdb_name_type" in
12822                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12823                         dflt='char *'
12824                         . ./myread
12825                         netdb_name_type=$ans
12826                         ;;
12827                 esac
12828                 ;;
12829         *)      : no gethostbyname, so pick harmless default
12830                 netdb_name_type='char *'
12831                 ;;
12832         esac
12833 fi
12834
12835 : check for type of 1st argument to getnetbyaddr. 
12836 if test "X$netdb_net_type" = X ; then
12837         case "$d_getnbyaddr" in
12838         $define)
12839                 $cat <<EOM
12840
12841 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12842 EOM
12843                 hdrs="$define sys/types.h
12844                         $d_socket sys/socket.h 
12845                         $i_niin netinet/in.h 
12846                         $i_netdb netdb.h
12847                         $i_unistd unistd.h"
12848                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12849                         case "$netdb_net_type" in
12850                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12851                                 if ./protochk "$try" $hdrs; then
12852                                         echo "Your system accepts $xxx."
12853                                         netdb_net_type="$xxx"
12854                                 fi
12855                                 ;;
12856                         esac
12857                 done
12858                 : In case none of those worked, prompt the user.
12859                 case "$netdb_net_type" in
12860                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12861                         dflt='long'
12862                         . ./myread
12863                         netdb_net_type=$ans
12864                         ;;
12865                 esac
12866                 ;;
12867         *)      : no getnetbyaddr, so pick harmless default
12868                 netdb_net_type='long'
12869                 ;;
12870         esac
12871 fi
12872 : locate the preferred pager for this system
12873 case "$pager" in
12874 '')
12875         dflt=''
12876         case "$pg" in
12877         /*) dflt=$pg;;
12878         esac
12879         case "$more" in
12880         /*) dflt=$more;;
12881         esac
12882         case "$less" in
12883         /*) dflt=$less;;
12884         esac
12885         case "$dflt" in
12886         '') dflt=/usr/ucb/more;;
12887         esac
12888         ;;
12889 *) dflt="$pager";;
12890 esac
12891 echo " "
12892 fn=f/
12893 rp='What pager is used on your system?'
12894 . ./getfile
12895 pager="$ans"
12896
12897 : see what type pids are declared as in the kernel
12898 rp="What is the type of process ids on this system?"
12899 set pid_t pidtype int stdio.h sys/types.h
12900 eval $typedef_ask
12901
12902 : Find earliest binary compatible site_perl subdirectory perl can use.
12903 case "$bincompat5005" in
12904 "$define") xs_apiversion='5.005' ;;
12905 *) xs_apiversion=$version ;;   # The current site_perl version.
12906 esac
12907 : Find earliest pure perl site_perl subdirectory perl can use.
12908 : The versioned directories started at 5.005.
12909 pm_apiversion='5.005'
12910
12911 : check for length of pointer
12912 echo " "
12913 case "$ptrsize" in
12914 '')
12915         $echo $n "Checking to see how big your pointers are...$c" >&4
12916         if test "$voidflags" -gt 7; then
12917                 echo '#define VOID_PTR char *' > try.c
12918         else
12919                 echo '#define VOID_PTR void *' > try.c
12920         fi
12921         $cat >>try.c <<'EOCP'
12922 #include <stdio.h>
12923 int main()
12924 {
12925     printf("%d\n", (int)sizeof(VOID_PTR));
12926     exit(0);
12927 }
12928 EOCP
12929         set try
12930         if eval $compile_ok; then
12931                 ptrsize=`./try`
12932                 $echo " $ptrsize bytes." >&4
12933         else
12934                 dflt='4'
12935                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12936                 rp="What is the size of a pointer (in bytes)?"
12937                 . ./myread
12938                 ptrsize="$ans"
12939         fi
12940         ;;
12941 esac
12942 $rm -f try.c try
12943
12944 : see if ar generates random libraries by itself
12945 echo " "
12946 echo "Checking how to generate random libraries on your machine..." >&4
12947 echo 'int bar1() { return bar2(); }' > bar1.c
12948 echo 'int bar2() { return 2; }' > bar2.c
12949 $cat > foo.c <<'EOP'
12950 int main() { printf("%d\n", bar1()); exit(0); }
12951 EOP
12952 $cc $ccflags -c bar1.c >/dev/null 2>&1
12953 $cc $ccflags -c bar2.c >/dev/null 2>&1
12954 $cc $ccflags -c foo.c >/dev/null 2>&1
12955 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12956 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12957         ./foobar >/dev/null 2>&1; then
12958         echo "$ar appears to generate random libraries itself."
12959         orderlib=false
12960         ranlib=":"
12961 elif $ar ts bar$_a >/dev/null 2>&1 &&
12962         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12963         ./foobar >/dev/null 2>&1; then
12964                 echo "a table of contents needs to be added with '$ar ts'."
12965                 orderlib=false
12966                 ranlib="$ar ts"
12967 else
12968         case "$ranlib" in
12969         :) ranlib='';;
12970         '')
12971                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12972                 $test -f $ranlib || ranlib=''
12973                 ;;
12974         esac
12975         if $test -n "$ranlib"; then
12976                 echo "your system has '$ranlib'; we'll use that."
12977                 orderlib=false
12978         else
12979                 echo "your system doesn't seem to support random libraries"
12980                 echo "so we'll use lorder and tsort to order the libraries."
12981                 orderlib=true
12982                 ranlib=":"
12983         fi
12984 fi
12985 $rm -f foo* bar* 
12986
12987 : check for type of arguments to select. 
12988 case "$selecttype" in
12989 '') case "$d_select" in
12990         $define)
12991                 echo " "
12992                 $cat <<EOM
12993 Checking to see what type of arguments are accepted by select().
12994 EOM
12995                 hdrs="$define sys/types.h
12996                         $i_systime sys/time.h 
12997                         $i_sysselct sys/select.h
12998                         $d_socket sys/socket.h"
12999                 : The first arg can be int, unsigned, or size_t
13000                 : The last arg may or may not be 'const'
13001                 val=''
13002                 : void pointer has been seen but using that
13003                 : breaks the selectminbits test
13004                 for xxx in 'fd_set *' 'int *'; do
13005                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13006                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13007                                         case "$val" in
13008                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13009                                                 if ./protochk "$try" $hdrs; then
13010                                                         echo "Your system accepts $xxx."
13011                                                         val="$xxx"
13012                                                 fi
13013                                                 ;;
13014                                         esac
13015                                 done
13016                         done
13017                 done
13018                 case "$val" in
13019                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13020                         case "$d_fd_set" in
13021                                 $define) dflt="fd_set *" ;;
13022                                 *)              dflt="int *" ;;
13023                         esac
13024                         . ./myread
13025                         val=$ans
13026                         ;;
13027                 esac
13028                 selecttype="$val"
13029                 ;;
13030         *)      : no select, so pick a harmless default
13031                 selecttype='int *'
13032                 ;;
13033         esac
13034         ;;
13035 esac
13036
13037 : check for the select 'width'
13038 case "$selectminbits" in
13039 '') case "$d_select" in
13040         $define)
13041                 $cat <<EOM
13042
13043 Checking to see on how many bits at a time your select() operates...
13044 EOM
13045                 $cat >try.c <<EOCP
13046 #include <sys/types.h>
13047 #$i_time I_TIME
13048 #$i_systime I_SYS_TIME
13049 #$i_systimek I_SYS_TIME_KERNEL
13050 #ifdef I_TIME
13051 #   include <time.h>
13052 #endif
13053 #ifdef I_SYS_TIME
13054 #   ifdef I_SYS_TIME_KERNEL
13055 #       define KERNEL
13056 #   endif
13057 #   include <sys/time.h>
13058 #   ifdef I_SYS_TIME_KERNEL
13059 #       undef KERNEL
13060 #   endif
13061 #endif
13062 #$i_sysselct I_SYS_SELECT
13063 #ifdef I_SYS_SELECT
13064 #include <sys/select.h>
13065 #endif
13066 #$d_socket HAS_SOCKET
13067 #ifdef HAS_SOCKET
13068 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13069 #endif
13070 #include <stdio.h>
13071 $selecttype b;
13072 #define S sizeof(*(b))
13073 #define MINBITS 64
13074 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13075 #define NBITS  (NBYTES * 8)
13076 int main() {
13077     char s[NBYTES];
13078     struct timeval t;
13079     int i;
13080     FILE* fp;
13081     int fd;
13082
13083     fclose(stdin);
13084     fp = fopen("try.c", "r");
13085     if (fp == 0)
13086       exit(1);
13087     fd = fileno(fp);
13088     if (fd < 0)
13089       exit(2);
13090     b = ($selecttype)s;
13091     for (i = 0; i < NBITS; i++)
13092         FD_SET(i, b);
13093     t.tv_sec  = 0;
13094     t.tv_usec = 0;
13095     select(fd + 1, b, 0, 0, &t);
13096     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13097     printf("%d\n", i + 1);
13098     return 0;
13099 }
13100 EOCP
13101                 set try
13102                 if eval $compile_ok; then
13103                         selectminbits=`./try`
13104                         case "$selectminbits" in
13105                         '')     cat >&4 <<EOM
13106 Cannot figure out on how many bits at a time your select() operates.
13107 I'll play safe and guess it is 32 bits.
13108 EOM
13109                                 selectminbits=32
13110                                 bits="32 bits"
13111                                 ;;
13112                         1)      bits="1 bit" ;;
13113                         *)      bits="$selectminbits bits" ;;
13114                         esac
13115                         echo "Your select() operates on $bits at a time." >&4
13116                 else
13117                         rp='What is the minimum number of bits your select() operates on?'
13118                         case "$byteorder" in
13119                         1234|12345678)  dflt=32 ;;
13120                         *)              dflt=1  ;;
13121                         esac
13122                         . ./myread
13123                         val=$ans
13124                         selectminbits="$val"
13125                 fi
13126                 $rm -f try.* try
13127                 ;;
13128         *)      : no select, so pick a harmless default
13129                 selectminbits='32'
13130                 ;;
13131         esac
13132         ;;
13133 esac
13134
13135 : Trace out the files included by signal.h, then look for SIGxxx names.
13136 : Remove SIGARRAYSIZE used by HPUX.
13137 : Remove SIGSTKSIZE used by Linux.
13138 : Remove SIGSTKSZ used by Posix.
13139 : Remove SIGTYP void lines used by OS2.
13140 : Some cpps, like os390, dont give the file name anywhere
13141 if [ "X$fieldn" = X ]; then
13142         : Just make some guesses.  We check them later.
13143         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13144 else
13145         xxx=`echo '#include <signal.h>' |
13146         $cppstdin $cppminus $cppflags 2>/dev/null |
13147         $grep '^[       ]*#.*include' | 
13148         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13149 fi
13150 : Check this list of files to be sure we have parsed the cpp output ok.
13151 : This will also avoid potentially non-existent files, such 
13152 : as ../foo/bar.h
13153 xxxfiles=''
13154 for xx in $xxx /dev/null ; do
13155         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13156 done
13157 : If we have found no files, at least try signal.h
13158 case "$xxxfiles" in
13159 '')     xxxfiles=`./findhdr signal.h` ;;
13160 esac
13161 xxx=`awk '
13162 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13163         print substr($2, 4, 20)
13164 }
13165 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13166         print substr($3, 4, 20)
13167 }' $xxxfiles`
13168 : Append some common names just in case the awk scan failed.
13169 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13170 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13171 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13172 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13173 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13174
13175 : generate a few handy files for later
13176 $cat > signal.c <<'EOCP'
13177 #include <sys/types.h>
13178 #include <signal.h>
13179 #include <stdio.h>
13180 int main() {
13181
13182 /* Strange style to avoid deeply-nested #if/#else/#endif */
13183 #ifndef NSIG
13184 #  ifdef _NSIG
13185 #    define NSIG (_NSIG)
13186 #  endif
13187 #endif
13188
13189 #ifndef NSIG
13190 #  ifdef SIGMAX
13191 #    define NSIG (SIGMAX+1)
13192 #  endif
13193 #endif
13194
13195 #ifndef NSIG
13196 #  ifdef SIG_MAX
13197 #    define NSIG (SIG_MAX+1)
13198 #  endif
13199 #endif
13200
13201 #ifndef NSIG
13202 #  ifdef MAXSIG
13203 #    define NSIG (MAXSIG+1)
13204 #  endif
13205 #endif
13206
13207 #ifndef NSIG
13208 #  ifdef MAX_SIG
13209 #    define NSIG (MAX_SIG+1)
13210 #  endif
13211 #endif
13212
13213 #ifndef NSIG
13214 #  ifdef SIGARRAYSIZE
13215 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13216 #  endif
13217 #endif
13218
13219 #ifndef NSIG
13220 #  ifdef _sys_nsig
13221 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13222 #  endif
13223 #endif
13224
13225 /* Default to some arbitrary number that's big enough to get most
13226    of the common signals.
13227 */
13228 #ifndef NSIG
13229 #    define NSIG 50
13230 #endif
13231
13232 printf("NSIG %d\n", NSIG);
13233
13234 #ifndef JUST_NSIG
13235
13236 EOCP
13237
13238 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13239 {
13240         printf "#ifdef SIG"; printf $1; printf "\n"
13241         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13242         printf $1; printf ");\n"
13243         printf "#endif\n"
13244 }
13245 END {
13246         printf "#endif /* JUST_NSIG */\n";
13247         printf "exit(0);\n}\n";
13248 }
13249 ' >>signal.c
13250 $cat >signal.awk <<'EOP'
13251 BEGIN { ndups = 0 }
13252 $1 ~ /^NSIG$/ { nsig = $2 }
13253 ($1 !~ /^NSIG$/) && (NF == 2) {
13254     if ($2 > maxsig) { maxsig = $2 }
13255     if (sig_name[$2]) {
13256         dup_name[ndups] = $1
13257         dup_num[ndups] = $2
13258         ndups++ 
13259     }
13260     else {
13261         sig_name[$2] = $1
13262         sig_num[$2] = $2
13263     }
13264 }
13265 END { 
13266     if (nsig == 0) {
13267         nsig = maxsig + 1
13268     }
13269     printf("NSIG %d\n", nsig);
13270     for (n = 1; n < nsig; n++) {
13271         if (sig_name[n]) {
13272             printf("%s %d\n", sig_name[n], sig_num[n])
13273         }
13274         else {
13275             printf("NUM%d %d\n", n, n) 
13276         }
13277     }
13278     for (n = 0; n < ndups; n++) {
13279         printf("%s %d\n", dup_name[n], dup_num[n])
13280     }
13281 }
13282 EOP
13283 $cat >signal_cmd <<EOS
13284 $startsh
13285 if $test -s signal.lst; then
13286     echo "Using your existing signal.lst file"
13287         exit 0
13288 fi
13289 xxx="$xxx"
13290 EOS
13291 $cat >>signal_cmd <<'EOS'
13292
13293 set signal
13294 if eval $compile_ok; then
13295         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13296 else
13297         echo "(I can't seem be able to compile the whole test program)" >&4
13298         echo "(I'll try it in little pieces.)" >&4
13299         set signal -DJUST_NSIG
13300         if eval $compile_ok; then
13301                 ./signal$_exe > signal.nsg
13302                 $cat signal.nsg
13303         else
13304                 echo "I can't seem to figure out how many signals you have." >&4
13305                 echo "Guessing 50." >&4
13306                 echo 'NSIG 50' > signal.nsg
13307         fi
13308         : Now look at all the signal names, one at a time.
13309         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13310                 $cat > signal.c <<EOCP
13311 #include <sys/types.h>
13312 #include <signal.h>
13313 #include <stdio.h>
13314 int main() {
13315 printf("$xx %d\n", SIG${xx});
13316 return 0;
13317 }
13318 EOCP
13319                 set signal
13320                 if eval $compile; then
13321                         echo "SIG${xx} found."
13322                         ./signal$_exe  >> signal.ls1
13323                 else
13324                         echo "SIG${xx} NOT found."
13325                 fi
13326         done
13327         if $test -s signal.ls1; then
13328                 $cat signal.nsg signal.ls1 |
13329                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13330         fi
13331
13332 fi
13333 if $test -s signal.lst; then
13334         :
13335 else
13336         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13337         echo 'kill -l' >signal
13338         set X `csh -f <signal`
13339         $rm -f signal
13340         shift
13341         case $# in
13342         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13343         esac
13344         echo $@ | $tr ' ' $trnl | \
13345             $awk '{ printf "%s %d\n", $1, ++s; }
13346                   END { printf "NSIG %d\n", ++s }' >signal.lst
13347 fi
13348 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13349 EOS
13350 chmod a+x signal_cmd
13351 $eunicefix signal_cmd
13352
13353 : generate list of signal names
13354 echo " "
13355 case "$sig_name_init" in
13356 '') doinit=yes ;;
13357 *)  case "$sig_num_init" in
13358     ''|*,*) doinit=yes ;;
13359     esac ;;
13360 esac
13361 case "$doinit" in
13362 yes)
13363         echo "Generating a list of signal names and numbers..." >&4
13364         . ./signal_cmd
13365         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13366         sig_name=`$awk 'BEGIN { printf "ZERO " }
13367                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13368         sig_num=`$awk  'BEGIN { printf "0 " }
13369                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13370         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13371                              !/^NSIG/   { printf "\"%s\", ", $1 }
13372                              END        { printf "0\n" }' signal.lst`
13373         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13374                              !/^NSIG/   { printf "%d, ", $2}
13375                              END        { printf "0\n"}' signal.lst`
13376         ;;
13377 esac
13378 echo "The following $sig_count signals are available:"
13379 echo " "
13380 echo $sig_name | $awk \
13381 'BEGIN { linelen = 0 }
13382 {
13383         for (i = 1; i <= NF; i++) {
13384                 name = "SIG" $i " "
13385                 linelen = linelen + length(name)
13386                 if (linelen > 70) {
13387                         printf "\n"
13388                         linelen = length(name)
13389                 }
13390                 printf "%s", name
13391         }
13392         printf "\n"
13393 }'
13394 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13395
13396 : see what type is used for signed size_t
13397 set ssize_t ssizetype int stdio.h sys/types.h
13398 eval $typedef
13399 dflt="$ssizetype"
13400 $cat > ssize.c <<EOM
13401 #include <stdio.h>
13402 #include <sys/types.h>
13403 #define Size_t $sizetype
13404 #define SSize_t $dflt
13405 int main()
13406 {
13407         if (sizeof(Size_t) == sizeof(SSize_t))
13408                 printf("$dflt\n");
13409         else if (sizeof(Size_t) == sizeof(int))
13410                 printf("int\n");
13411         else 
13412                 printf("long\n");
13413         exit(0);
13414 }
13415 EOM
13416 echo " "
13417 set ssize
13418 if eval $compile_ok && ./ssize > /dev/null; then
13419         ssizetype=`./ssize`
13420         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13421 else
13422         $cat >&4 <<EOM
13423 Help! I can't compile and run the ssize_t test program: please enlighten me!
13424 (This is probably a misconfiguration in your system or libraries, and
13425 you really ought to fix it.  Still, I'll try anyway.)
13426
13427 I need a type that is the same size as $sizetype, but is guaranteed to
13428 be signed.  Common values are ssize_t, int and long.
13429
13430 EOM
13431         rp="What signed type is the same size as $sizetype?"
13432         . ./myread
13433         ssizetype="$ans"
13434 fi
13435 $rm -f ssize ssize.*
13436
13437 : see what type of char stdio uses.
13438 echo " "
13439 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13440         echo "Your stdio uses unsigned chars." >&4
13441         stdchar="unsigned char"
13442 else
13443         echo "Your stdio uses signed chars." >&4
13444         stdchar="char"
13445 fi
13446
13447 : see if time exists
13448 echo " "
13449 if test "X$d_time" = X -o X"$timetype" = X; then
13450     if set time val -f d_time; eval $csym; $val; then
13451                 echo 'time() found.' >&4
13452                 val="$define"
13453                 rp="What is the type returned by time() on this system?"
13454                 set time_t timetype long stdio.h sys/types.h
13455                 eval $typedef_ask
13456     else
13457                 echo 'time() not found, hope that will do.' >&4
13458                 val="$undef"
13459                 timetype='int';
13460     fi
13461     set d_time
13462     eval $setvar
13463 fi
13464
13465 : see what type uids are declared as in the kernel
13466 echo " "
13467 echo "Looking for the type for user ids returned by getuid()."
13468 set uid_t uidtype xxx stdio.h sys/types.h
13469 eval $typedef
13470 case "$uidtype" in
13471 xxx)
13472         xxx=`./findhdr sys/user.h`
13473         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13474         case $1 in
13475         unsigned) dflt="$1 $2" ;;
13476         *) dflt="$1" ;;
13477         esac
13478         ;;
13479 *) dflt="$uidtype";;
13480 esac
13481 case "$uidtype" in
13482 uid_t)  echo "uid_t found." ;;
13483 *)      rp="What is the type for user ids returned by getuid()?"
13484         . ./myread
13485         uidtype="$ans"
13486         ;;
13487 esac
13488
13489 echo " "
13490 case "$uidtype" in
13491 *_t) zzz="$uidtype"     ;;
13492 *)   zzz="uid"          ;;
13493 esac
13494 echo "Checking the size of $zzz..." >&4 
13495 cat > try.c <<EOCP
13496 #include <sys/types.h>
13497 #include <stdio.h>
13498 int main() {
13499     printf("%d\n", (int)sizeof($uidtype));
13500     exit(0);
13501 }
13502 EOCP
13503 set try
13504 if eval $compile_ok; then
13505         yyy=`./try`
13506         case "$yyy" in
13507         '')     uidsize=4
13508                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13509                 ;;
13510         *)      uidsize=$yyy
13511                 echo "Your $zzz size is $uidsize bytes."
13512                 ;;
13513         esac
13514 else
13515         uidsize=4
13516         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13517 fi
13518
13519 echo " "
13520 case "$uidtype" in
13521 *_t) zzz="$uidtype"     ;;
13522 *)   zzz="uid"          ;;
13523 esac
13524 echo "Checking the sign of $zzz..." >&4
13525 cat > try.c <<EOCP
13526 #include <sys/types.h>
13527 #include <stdio.h>
13528 int main() {
13529         $uidtype foo = -1;
13530         if (foo < 0)
13531                 printf("-1\n");
13532         else
13533                 printf("1\n");
13534 }
13535 EOCP
13536 set try
13537 if eval $compile; then
13538         yyy=`./try`
13539         case "$yyy" in
13540         '')     uidsign=1
13541                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13542                 ;;
13543         *)      uidsign=$yyy
13544                 case "$uidsign" in
13545                  1) echo "Your $zzz is unsigned." ;;
13546                 -1) echo "Your $zzz is signed."   ;;
13547                 esac
13548                 ;;
13549         esac
13550 else
13551         uidsign=1
13552         echo "(I can't compile the test program--guessing unsigned.)" >&4
13553 fi
13554
13555
13556
13557 echo " "
13558 $echo "Checking the format string to be used for uids..." >&4
13559
13560 case "$uidsign" in
13561 -1)     if $test X"$uidsize" = X"$ivsize"; then
13562                 uidformat="$ivdformat"
13563         else
13564                 if $test X"$uidsize" = X"$longsize"; then
13565                         uidformat='"ld"'
13566                 else
13567                         if $test X"$uidsize" = X"$intsize"; then
13568                                 uidformat='"d"'
13569                         else
13570                                 if $test X"$uidsize" = X"$shortsize"; then
13571                                         uidformat='"hd"'
13572                                 fi
13573                         fi
13574                 fi
13575         fi
13576         ;;
13577 *)      if $test X"$uidsize" = X"$uvsize"; then
13578                 uidformat="$uvuformat"
13579         else
13580                 if $test X"$uidsize" = X"$longsize"; then
13581                         uidformat='"lu"'
13582                 else
13583                         if $test X"$uidsize" = X"$intsize"; then
13584                                 uidformat='"u"'
13585                         else
13586                                 if $test X"$uidsize" = X"$shortsize"; then
13587                                         uidformat='"hu"'
13588                                 fi
13589                         fi
13590                 fi
13591         fi
13592         ;;
13593 esac
13594
13595 : see if dbm.h is available
13596 : see if dbmclose exists
13597 set dbmclose d_dbmclose
13598 eval $inlibc
13599
13600 case "$d_dbmclose" in
13601 $define)
13602         set dbm.h i_dbm
13603         eval $inhdr
13604         case "$i_dbm" in
13605         $define)
13606                 val="$undef"
13607                 set i_rpcsvcdbm
13608                 eval $setvar
13609                 ;;
13610         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13611                 eval $inhdr
13612                 ;;
13613         esac
13614         ;;
13615 *)      echo "We won't be including <dbm.h>"
13616         val="$undef"
13617         set i_dbm
13618         eval $setvar
13619         val="$undef"
13620         set i_rpcsvcdbm
13621         eval $setvar
13622         ;;
13623 esac
13624
13625 : see if this is a sys/file.h system
13626 val=''
13627 set sys/file.h val
13628 eval $inhdr
13629
13630 : do we need to include sys/file.h ?
13631 case "$val" in
13632 "$define")
13633         echo " "
13634         if $h_sysfile; then
13635                 val="$define"
13636                 echo "We'll be including <sys/file.h>." >&4
13637         else
13638                 val="$undef"
13639                 echo "We won't be including <sys/file.h>." >&4
13640         fi
13641         ;;
13642 *)
13643         h_sysfile=false
13644         ;;
13645 esac
13646 set i_sysfile
13647 eval $setvar
13648
13649 : see if fcntl.h is there
13650 val=''
13651 set fcntl.h val
13652 eval $inhdr
13653
13654 : see if we can include fcntl.h
13655 case "$val" in
13656 "$define")
13657         echo " "
13658         if $h_fcntl; then
13659                 val="$define"
13660                 echo "We'll be including <fcntl.h>." >&4
13661         else
13662                 val="$undef"
13663                 if $h_sysfile; then
13664         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13665                 else
13666                         echo "We won't be including <fcntl.h>." >&4
13667                 fi
13668         fi
13669         ;;
13670 *)
13671         h_fcntl=false
13672         val="$undef"
13673         ;;
13674 esac
13675 set i_fcntl
13676 eval $setvar
13677
13678 : see if this is a iconv.h system
13679 set iconv.h i_iconv
13680 eval $inhdr
13681
13682 : see if locale.h is available
13683 set locale.h i_locale
13684 eval $inhdr
13685
13686 : see if mach cthreads are available
13687 if test "X$usethreads" = "X$define"; then
13688         set mach/cthreads.h i_machcthr
13689         eval $inhdr
13690 else
13691         i_machcthr="$undef"
13692 fi
13693
13694
13695
13696 : see if this is a math.h system
13697 set math.h i_math
13698 eval $inhdr
13699
13700 : see if this is a mntent.h system
13701 set mntent.h i_mntent
13702 eval $inhdr
13703
13704 : see if ndbm.h is available
13705 set ndbm.h t_ndbm
13706 eval $inhdr
13707 case "$t_ndbm" in
13708 $define)
13709         : see if dbm_open exists
13710         set dbm_open d_dbm_open
13711         eval $inlibc
13712         case "$d_dbm_open" in
13713         $undef)
13714                 t_ndbm="$undef"
13715                 echo "We won't be including <ndbm.h>"
13716                 ;;
13717         esac
13718         ;;
13719 esac
13720 val="$t_ndbm"
13721 set i_ndbm
13722 eval $setvar
13723
13724 : see if net/errno.h is available
13725 val=''
13726 set net/errno.h val
13727 eval $inhdr
13728
13729 : Unfortunately, it causes problems on some systems.  Arrgh.
13730 case "$val" in
13731 $define)
13732         cat > try.c <<'EOM'
13733 #include <stdio.h>
13734 #include <errno.h>
13735 #include <net/errno.h>
13736 int func()
13737 {
13738         return ENOTSOCK;
13739 }
13740 EOM
13741         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13742                 echo "We'll be including <net/errno.h>." >&4
13743         else
13744                 echo "We won't be including <net/errno.h>." >&4
13745                 val="$undef"
13746         fi
13747         $rm -f try.* try
13748         ;;
13749 esac
13750 set i_neterrno
13751 eval $setvar
13752
13753 : see if netinet/tcp.h is available
13754 set netinet/tcp.h i_netinettcp
13755 eval $inhdr
13756
13757 : see if this is a poll.h system
13758 set poll.h i_poll
13759 eval $inhdr
13760
13761 echo " "
13762 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13763 $cat <<'EOSH' > Cppsym.know
13764 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13765 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13766 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13767 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13768 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13769 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13770 bull c cadmus clipper CMU COFF COMPILER_VERSION
13771 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13772 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13773 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13774 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13775 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13776 H3050R H3050RX hbullx20 hcx host_mips
13777 hp200 hp300 hp700 HP700 hp800 hp9000
13778 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13779 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13780 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13781 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13782 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13783 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13784 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13785 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13786 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13787 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13788 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13789 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13790 MATH_HAS_NO_SIDE_EFFECTS
13791 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13792 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13793 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13794 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13795 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13796 NetBSD news1500 news1700 news1800 news1900 news3700
13797 news700 news800 news900 NeXT NLS ns16000 ns32000
13798 ns32016 ns32332 ns32k nsc32000
13799 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13800 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13801 pc532 pdp11 PGC PIC plexus PORTAR posix
13802 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13803 POSIX_C_SOURCE POSIX_SOURCE POWER
13804 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13805 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13806 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13807 sony sony_news sonyrisc sparc sparclite spectrum
13808 stardent stdc STDC_EXT stratos sun sun3 sun386
13809 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13810 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13811 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13812 sysV68 sysV88 Tek4132 Tek4300 titan
13813 tower tower32 tower32_200 tower32_600 tower32_700
13814 tower32_800 tower32_850 tss
13815 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13816 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13817 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13818 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13819 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13820 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13821 z8000
13822 EOSH
13823 # Maybe put other stuff here too.
13824 cat <<EOSH >>Cppsym.know
13825 $osname
13826 EOSH
13827 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13828 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13829 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13830 $rm -f Cppsym.a Cppsym.b
13831 cat <<EOSH > Cppsym
13832 $startsh
13833 if $test \$# -gt 0; then
13834     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13835     if $test -s Cppsym.got; then
13836         $rm -f Cppsym.got
13837         exit 0
13838     fi
13839     $rm -f Cppsym.got
13840     exit 1
13841 else
13842     $tr " " "$trnl" | ./Cppsym.try
13843     exit 0
13844 fi
13845 EOSH
13846 chmod +x Cppsym
13847 $eunicefix Cppsym
13848 cat <<EOSH > Cppsym.try
13849 $startsh
13850 cat <<'EOCP' > try.c
13851 #include <stdio.h>
13852 int main() {
13853 EOCP
13854 $awk \\
13855 EOSH
13856 cat <<'EOSH' >> Cppsym.try
13857 'length($1) > 0 {
13858     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
13859     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
13860     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
13861     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
13862 }'       >> try.c
13863 echo '}' >> try.c
13864 EOSH
13865 cat <<EOSH >> Cppsym.try
13866 cc="$cc"
13867 optimize="$optimize"
13868 ccflags="$ccflags"
13869 ldflags="$ldflags"
13870 libs="$libs"
13871 exe_ext="$exe_ext"
13872 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
13873 EOSH
13874 chmod +x Cppsym.try
13875 $eunicefix Cppsym.try
13876 ./Cppsym < Cppsym.know > Cppsym.true
13877 : now check the C compiler for additional symbols
13878 postprocess_cc_v=''
13879 case "$osname" in
13880 aix) postprocess_cc_v="|$tr , ' '" ;;
13881 esac
13882 $cat >ccsym <<EOS
13883 $startsh
13884 $cat >tmp.c <<EOF
13885 extern int foo;
13886 EOF
13887 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13888 do
13889         case "\$i" in
13890         -D*) echo "\$i" | $sed 's/^-D//';;
13891         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13892         esac
13893 done
13894 $rm -f try.c
13895 EOS
13896 postprocess_cc_v=''
13897 chmod +x ccsym
13898 $eunicefix ccsym
13899 ./ccsym > ccsym1.raw
13900 if $test -s ccsym1.raw; then
13901        $sort ccsym1.raw | $uniq >ccsym.raw
13902 else
13903        mv ccsym1.raw ccsym.raw
13904 fi
13905
13906 $awk '/\=/ { print $0; next }
13907         { print $0"=1" }' ccsym.raw >ccsym.list
13908 $awk '/\=/ { print $0; next }
13909         { print $0"=1" }' Cppsym.true >ccsym.true
13910 $comm -13 ccsym.true ccsym.list >ccsym.own
13911 $comm -12 ccsym.true ccsym.list >ccsym.com
13912 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13913 also=''
13914 if $test -z ccsym.raw; then
13915         echo "Your C compiler doesn't seem to define any symbols!" >&4
13916         echo " "
13917         echo "However, your C preprocessor defines the following symbols:"
13918         $cat Cppsym.true
13919         ccsymbols=''
13920         cppsymbols=`$cat Cppsym.true`
13921         cppsymbols=`echo $cppsymbols`
13922         cppccsymbols="$cppsymbols"
13923 else
13924         if $test -s ccsym.com; then
13925                 echo "Your C compiler and pre-processor define these symbols:"
13926                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13927                 also='also '
13928                 symbols='ones'
13929                 cppccsymbols=`$cat ccsym.com`
13930                 cppccsymbols=`echo $cppccsymbols`
13931                 $test "$silent" || sleep 1
13932         fi
13933         if $test -s ccsym.cpp; then
13934                 $test "$also" && echo " "
13935                 echo "Your C pre-processor ${also}defines the following symbols:"
13936                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13937                 also='further '
13938                 cppsymbols=`$cat ccsym.cpp`
13939                 cppsymbols=`echo $cppsymbols`
13940                 $test "$silent" || sleep 1
13941         fi
13942         if $test -s ccsym.own; then
13943                 $test "$also" && echo " "
13944                 echo "Your C compiler ${also}defines the following cpp symbols:"
13945                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13946                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13947                 ccsymbols=`$cat ccsym.own`
13948                 ccsymbols=`echo $ccsymbols`
13949                 $test "$silent" || sleep 1
13950         fi
13951 fi
13952 $rm -f ccsym*
13953
13954 : see if this is a termio system
13955 val="$undef"
13956 val2="$undef"
13957 val3="$undef"
13958 if $test `./findhdr termios.h`; then
13959         set tcsetattr i_termios
13960         eval $inlibc
13961         val3="$i_termios"
13962 fi
13963 echo " "
13964 case "$val3" in
13965 "$define") echo "You have POSIX termios.h... good!" >&4;;
13966 *) if ./Cppsym pyr; then
13967                 case "`/bin/universe`" in
13968                 ucb) if $test `./findhdr sgtty.h`; then
13969                                 val2="$define"
13970                                 echo "<sgtty.h> found." >&4
13971                         else
13972                                 echo "System is pyramid with BSD universe."
13973                                 echo "<sgtty.h> not found--you could have problems." >&4
13974                         fi;;
13975                 *) if $test `./findhdr termio.h`; then
13976                                 val="$define"
13977                                 echo "<termio.h> found." >&4
13978                         else
13979                                 echo "System is pyramid with USG universe."
13980                                 echo "<termio.h> not found--you could have problems." >&4
13981                         fi;;
13982                 esac
13983         elif ./usg; then
13984                 if $test `./findhdr termio.h`; then
13985                         echo "<termio.h> found." >&4
13986                         val="$define"
13987                 elif $test `./findhdr sgtty.h`; then
13988                         echo "<sgtty.h> found." >&4
13989                         val2="$define"
13990                 else
13991 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13992                 fi
13993         else
13994                 if $test `./findhdr sgtty.h`; then
13995                         echo "<sgtty.h> found." >&4
13996                         val2="$define"
13997                 elif $test `./findhdr termio.h`; then
13998                         echo "<termio.h> found." >&4
13999                         val="$define"
14000                 else
14001 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14002                 fi
14003         fi;;
14004 esac
14005 set i_termio; eval $setvar
14006 val=$val2; set i_sgtty; eval $setvar
14007 val=$val3; set i_termios; eval $setvar
14008
14009 : see if this is a shadow.h system
14010 set shadow.h i_shadow
14011 eval $inhdr
14012
14013 : see if this is a socks.h system
14014 set socks.h i_socks
14015 eval $inhdr
14016
14017 : see if stdarg is available
14018 echo " "
14019 if $test `./findhdr stdarg.h`; then
14020         echo "<stdarg.h> found." >&4
14021         valstd="$define"
14022 else
14023         echo "<stdarg.h> NOT found." >&4
14024         valstd="$undef"
14025 fi
14026
14027 : see if varags is available
14028 echo " "
14029 if $test `./findhdr varargs.h`; then
14030         echo "<varargs.h> found." >&4
14031 else
14032         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14033 fi
14034
14035 : set up the varargs testing programs
14036 $cat > varargs.c <<EOP
14037 #ifdef I_STDARG
14038 #include <stdarg.h>
14039 #endif
14040 #ifdef I_VARARGS
14041 #include <varargs.h>
14042 #endif
14043
14044 #ifdef I_STDARG
14045 int f(char *p, ...)
14046 #else
14047 int f(va_alist)
14048 va_dcl
14049 #endif
14050 {
14051         va_list ap;
14052 #ifndef I_STDARG
14053         char *p;
14054 #endif
14055 #ifdef I_STDARG
14056         va_start(ap,p);
14057 #else
14058         va_start(ap);
14059         p = va_arg(ap, char *);
14060 #endif
14061         va_end(ap);
14062 }
14063 EOP
14064 $cat > varargs <<EOP
14065 $startsh
14066 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14067         echo "true"
14068 else
14069         echo "false"
14070 fi
14071 $rm -f varargs$_o
14072 EOP
14073 chmod +x varargs
14074
14075 : now check which varargs header should be included
14076 echo " "
14077 i_varhdr=''
14078 case "$valstd" in
14079 "$define")
14080         if `./varargs I_STDARG`; then
14081                 val='stdarg.h'
14082         elif `./varargs I_VARARGS`; then
14083                 val='varargs.h'
14084         fi
14085         ;;
14086 *)
14087         if `./varargs I_VARARGS`; then
14088                 val='varargs.h'
14089         fi
14090         ;;
14091 esac
14092 case "$val" in
14093 '')
14094 echo "I could not find the definition for va_dcl... You have problems..." >&4
14095         val="$undef"; set i_stdarg; eval $setvar
14096         val="$undef"; set i_varargs; eval $setvar
14097         ;;
14098 *) 
14099         set i_varhdr
14100         eval $setvar
14101         case "$i_varhdr" in
14102         stdarg.h)
14103                 val="$define"; set i_stdarg; eval $setvar
14104                 val="$undef"; set i_varargs; eval $setvar
14105                 ;;
14106         varargs.h)
14107                 val="$undef"; set i_stdarg; eval $setvar
14108                 val="$define"; set i_varargs; eval $setvar
14109                 ;;
14110         esac
14111         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14112 esac
14113 $rm -f varargs*
14114
14115 : see if stddef is available
14116 set stddef.h i_stddef
14117 eval $inhdr
14118
14119 : see if sys/access.h is available
14120 set sys/access.h i_sysaccess
14121 eval $inhdr
14122
14123 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14124 set sys/filio.h i_sysfilio
14125 eval $inhdr
14126 echo " "
14127 if $test `./findhdr sys/ioctl.h`; then
14128         val="$define"
14129         echo '<sys/ioctl.h> found.' >&4
14130 else
14131         val="$undef"
14132         if $test $i_sysfilio = "$define"; then
14133             echo '<sys/ioctl.h> NOT found.' >&4
14134         else
14135                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14136                 $test $i_termio = "$define" && xxx="termio.h"
14137                 $test $i_termios = "$define" && xxx="termios.h"
14138 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14139         fi
14140 fi
14141 set i_sysioctl
14142 eval $setvar
14143
14144
14145 : see if this is a syslog.h system
14146 set syslog.h i_syslog
14147 eval $inhdr
14148
14149
14150 : see if this is a sys/mode.h system
14151 set sys/mode.h i_sysmode
14152 eval $inhdr
14153
14154 : see if sys/resource.h has to be included
14155 set sys/resource.h i_sysresrc
14156 eval $inhdr
14157
14158 : see if sys/security.h is available
14159 set sys/security.h i_syssecrt
14160 eval $inhdr
14161
14162 : see if this is a sys/statvfs.h system
14163 set sys/statvfs.h i_sysstatvfs
14164 eval $inhdr
14165
14166 : see if this is a sys/uio.h system
14167 set sys/uio.h i_sysuio
14168 eval $inhdr
14169
14170 : see if this is a sys/un.h system
14171 set sys/un.h i_sysun
14172 eval $inhdr
14173
14174
14175 : see if this is a sys/utsname.h system
14176 set sys/utsname.h i_sysutsname
14177 eval $inhdr
14178
14179 : see if this is a syswait system
14180 set sys/wait.h i_syswait
14181 eval $inhdr
14182
14183 : see if this is a ustat.h system
14184 set ustat.h i_ustat
14185 eval $inhdr
14186
14187 : see if this is an utime system
14188 set utime.h i_utime
14189 eval $inhdr
14190
14191 : see if this is a values.h system
14192 set values.h i_values
14193 eval $inhdr
14194
14195 : see if this is a vfork system
14196 case "$d_vfork" in
14197 "$define")
14198         set vfork.h i_vfork
14199         eval $inhdr
14200         ;;
14201 *)
14202         i_vfork="$undef"
14203         ;;
14204 esac
14205
14206 : see if gdbm.h is available
14207 set gdbm.h t_gdbm
14208 eval $inhdr
14209 case "$t_gdbm" in
14210 $define)
14211         : see if gdbm_open exists
14212         set gdbm_open d_gdbm_open
14213         eval $inlibc
14214         case "$d_gdbm_open" in
14215         $undef)
14216                 t_gdbm="$undef"
14217                 echo "We won't be including <gdbm.h>"
14218                 ;;
14219         esac
14220         ;;
14221 esac
14222 val="$t_gdbm"
14223 set i_gdbm
14224 eval $setvar
14225
14226 echo " "
14227 echo "Looking for extensions..." >&4
14228 : If we are using the old config.sh, known_extensions may contain
14229 : old or inaccurate or duplicate values.
14230 known_extensions=''
14231 nonxs_extensions=''
14232 : We do not use find because it might not be available.
14233 : We do not just use MANIFEST because the user may have dropped
14234 : some additional extensions into the source tree and expect them
14235 : to be built.
14236
14237 : Function to recursively find available extensions, ignoring DynaLoader
14238 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14239 find_extensions='
14240     for xxx in *; do
14241        case "$xxx" in
14242            DynaLoader|dynaload) ;;
14243            *)
14244            if $test -f $xxx/$xxx.xs; then
14245                known_extensions="$known_extensions $1$xxx";
14246            elif $test -f $xxx/Makefile.PL; then
14247                nonxs_extensions="$nonxs_extensions $1$xxx";
14248            else
14249                if $test -d $xxx -a $# -lt 10; then
14250                    set $1$xxx/ $*;
14251                    cd $xxx;
14252                    eval $find_extensions;
14253                    cd ..;
14254                    shift;
14255                fi;
14256            fi
14257            ;;
14258        esac;
14259     done'
14260 tdir=`pwd`
14261 cd $rsrc/ext
14262 set X
14263 shift
14264 eval $find_extensions
14265 set X $nonxs_extensions
14266 shift
14267 nonxs_extensions="$*"
14268 set X $known_extensions
14269 shift
14270 known_extensions="$*"
14271 cd $tdir
14272
14273 : Now see which are supported on this system.
14274 avail_ext=''
14275 for xxx in $known_extensions ; do
14276         case "$xxx" in
14277         DB_File|db_file)
14278                 case "$i_db" in
14279                 $define) avail_ext="$avail_ext $xxx" ;;
14280                 esac
14281                 ;;
14282         GDBM_File|gdbm_fil)
14283                 case "$i_gdbm" in 
14284                 $define) avail_ext="$avail_ext $xxx" ;;
14285                 esac
14286                 ;;
14287         NDBM_File|ndbm_fil)
14288                 case "$i_ndbm" in
14289                 $define)
14290                     case "$osname-$use64bits" in
14291                     hpux-define)
14292                         case "$libs" in
14293                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14294                         esac
14295                         ;;
14296                     *) avail_ext="$avail_ext $xxx" ;;
14297                     esac
14298                     ;;
14299                 esac
14300                 ;;
14301         ODBM_File|odbm_fil) 
14302                 case "${i_dbm}${i_rpcsvcdbm}" in
14303                 *"${define}"*)
14304                     case "$osname-$use64bits" in
14305                     hpux-define)
14306                         case "$libs" in
14307                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14308                         esac
14309                         ;;
14310                     *) avail_ext="$avail_ext $xxx" ;;
14311                     esac
14312                     ;;
14313                 esac
14314                 ;;
14315         POSIX|posix)
14316                 case "$useposix" in
14317                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14318                 esac
14319                 ;;
14320         Opcode|opcode)
14321                 case "$useopcode" in
14322                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14323                 esac
14324                 ;;
14325         Socket|socket)
14326                 case "$d_socket" in 
14327                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14328                 esac
14329                 ;;
14330         Thread|thread)
14331                 case "$usethreads" in 
14332                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14333                 esac
14334                 ;;
14335         IPC/SysV|ipc/sysv)
14336                 : XXX Do we need a useipcsysv variable here
14337                 case "${d_msg}${d_sem}${d_shm}" in 
14338                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14339                 esac
14340                 ;;
14341         *)      avail_ext="$avail_ext $xxx"
14342                 ;;
14343         esac
14344 done
14345
14346 set X $avail_ext
14347 shift
14348 avail_ext="$*"
14349
14350 : Now see which nonxs extensions are supported on this system.
14351 : For now assume all are.
14352 nonxs_ext=''
14353 for xxx in $nonxs_extensions ; do
14354         case "$xxx" in
14355         *)      nonxs_ext="$nonxs_ext $xxx"
14356                 ;;
14357         esac
14358 done
14359
14360 set X $nonxs_ext
14361 shift
14362 nonxs_ext="$*"
14363
14364 case $usedl in
14365 $define)
14366         $cat <<EOM
14367 A number of extensions are supplied with $package.  You may choose to
14368 compile these extensions for dynamic loading (the default), compile
14369 them into the $package executable (static loading), or not include
14370 them at all.  Answer "none" to include no extensions.
14371 Note that DynaLoader is always built and need not be mentioned here.
14372
14373 EOM
14374         case "$dynamic_ext" in
14375         '') dflt="$avail_ext" ;;
14376         *)      dflt="$dynamic_ext"
14377                 # Perhaps we are reusing an old out-of-date config.sh.
14378                 case "$hint" in
14379                 previous)
14380                         if test X"$dynamic_ext" != X"$avail_ext"; then
14381                                 $cat <<EOM
14382 NOTICE:  Your previous config.sh list may be incorrect. 
14383 The extensions now available to you are 
14384         ${avail_ext}
14385 but the default list from your previous config.sh is
14386         ${dynamic_ext} 
14387
14388 EOM
14389                         fi
14390                         ;;
14391                 esac
14392                 ;;
14393         esac
14394         case "$dflt" in
14395         '')     dflt=none;;
14396         esac
14397         rp="What extensions do you wish to load dynamically?"
14398         . ./myread
14399         case "$ans" in
14400         none) dynamic_ext=' ' ;;
14401         *) dynamic_ext="$ans" ;;
14402         esac
14403
14404         case "$static_ext" in
14405         '')
14406                 : Exclude those already listed in dynamic linking
14407                 dflt=''
14408                 for xxx in $avail_ext; do
14409                         case " $dynamic_ext " in
14410                         *" $xxx "*) ;;
14411                         *) dflt="$dflt $xxx" ;;
14412                         esac
14413                 done
14414                 set X $dflt
14415                 shift
14416                 dflt="$*"
14417                 ;;
14418         *)  dflt="$static_ext" 
14419                 ;;
14420         esac
14421
14422         case "$dflt" in
14423         '')     dflt=none;;
14424         esac
14425         rp="What extensions do you wish to load statically?"
14426         . ./myread
14427         case "$ans" in
14428         none) static_ext=' ' ;;
14429         *) static_ext="$ans" ;;
14430         esac
14431         ;;
14432 *)
14433         $cat <<EOM
14434 A number of extensions are supplied with $package.  Answer "none" 
14435 to include no extensions. 
14436 Note that DynaLoader is always built and need not be mentioned here.
14437
14438 EOM
14439         case "$static_ext" in
14440         '') dflt="$avail_ext" ;;
14441         *)      dflt="$static_ext"
14442                 # Perhaps we are reusing an old out-of-date config.sh.
14443                 case "$hint" in
14444                 previous)
14445                         if test X"$static_ext" != X"$avail_ext"; then
14446                                 $cat <<EOM
14447 NOTICE:  Your previous config.sh list may be incorrect. 
14448 The extensions now available to you are 
14449         ${avail_ext}
14450 but the default list from your previous config.sh is
14451         ${static_ext} 
14452
14453 EOM
14454                         fi
14455                         ;;
14456                 esac
14457                 ;;
14458         esac
14459         : Exclude those that are not xs extensions
14460         case "$dflt" in
14461         '')     dflt=none;;
14462         esac
14463         rp="What extensions do you wish to include?"
14464         . ./myread
14465         case "$ans" in
14466         none) static_ext=' ' ;;
14467         *) static_ext="$ans" ;;
14468         esac
14469         ;;
14470 esac
14471
14472 set X $dynamic_ext $static_ext $nonxs_ext
14473 shift
14474 extensions="$*"
14475
14476 : Remove build directory name from cppstdin so it can be used from
14477 : either the present location or the final installed location.
14478 echo " "
14479 : Get out of the UU directory to get correct path name.
14480 cd ..
14481 case "$cppstdin" in
14482 `pwd`/cppstdin)
14483         echo "Stripping down cppstdin path name"
14484         cppstdin=cppstdin
14485         ;;
14486 esac
14487 cd UU
14488
14489 : end of configuration questions
14490 echo " "
14491 echo "End of configuration questions."
14492 echo " "
14493
14494 : back to where it started
14495 if test -d ../UU; then
14496         cd ..
14497 fi
14498
14499 : configuration may be patched via a 'config.over' file
14500 if $test -f config.over; then
14501         echo " "
14502         dflt=y
14503         rp='I see a config.over file.  Do you wish to load it?'
14504         . UU/myread
14505         case "$ans" in
14506         n*) echo "OK, I'll ignore it.";;
14507         *)      . ./config.over
14508                 echo "Configuration override changes have been loaded."
14509                 ;;
14510         esac
14511 fi
14512
14513 : in case they want portability, strip down executable paths
14514 case "$d_portable" in
14515 "$define")
14516         echo " "
14517         echo "Stripping down executable paths..." >&4
14518         for file in $loclist $trylist; do
14519                 eval temp=\$$file
14520                 eval $file=`basename $temp`
14521         done
14522         ;;
14523 esac
14524
14525 : create config.sh file
14526 echo " "
14527 echo "Creating config.sh..." >&4
14528 $spitshell <<EOT >config.sh
14529 $startsh
14530 #
14531 # This file was produced by running the Configure script. It holds all the
14532 # definitions figured out by Configure. Should you modify one of these values,
14533 # do not forget to propagate your changes by running "Configure -der". You may
14534 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14535 #
14536
14537 # Package name      : $package
14538 # Source directory  : $src
14539 # Configuration time: $cf_time
14540 # Configured by     : $cf_by
14541 # Target system     : $myuname
14542
14543 Author='$Author'
14544 Date='$Date'
14545 Header='$Header'
14546 Id='$Id'
14547 Locker='$Locker'
14548 Log='$Log'
14549 Mcc='$Mcc'
14550 RCSfile='$RCSfile'
14551 Revision='$Revision'
14552 Source='$Source'
14553 State='$State'
14554 _a='$_a'
14555 _exe='$_exe'
14556 _o='$_o'
14557 afs='$afs'
14558 alignbytes='$alignbytes'
14559 ansi2knr='$ansi2knr'
14560 aphostname='$aphostname'
14561 api_revision='$api_revision'
14562 api_subversion='$api_subversion'
14563 api_version='$api_version'
14564 api_versionstring='$api_versionstring'
14565 ar='$ar'
14566 archlib='$archlib'
14567 archlibexp='$archlibexp'
14568 archname64='$archname64'
14569 archname='$archname'
14570 archobjs='$archobjs'
14571 awk='$awk'
14572 baserev='$baserev'
14573 bash='$bash'
14574 bin='$bin'
14575 bincompat5005='$bincompat5005'
14576 binexp='$binexp'
14577 bison='$bison'
14578 byacc='$byacc'
14579 byteorder='$byteorder'
14580 c='$c'
14581 castflags='$castflags'
14582 cat='$cat'
14583 cc='$cc'
14584 cccdlflags='$cccdlflags'
14585 ccdlflags='$ccdlflags'
14586 ccflags='$ccflags'
14587 ccsymbols='$ccsymbols'
14588 cf_by='$cf_by'
14589 cf_email='$cf_email'
14590 cf_time='$cf_time'
14591 charsize='$charsize'
14592 chgrp='$chgrp'
14593 chmod='$chmod'
14594 chown='$chown'
14595 clocktype='$clocktype'
14596 comm='$comm'
14597 compress='$compress'
14598 contains='$contains'
14599 cp='$cp'
14600 cpio='$cpio'
14601 cpp='$cpp'
14602 cpp_stuff='$cpp_stuff'
14603 cppccsymbols='$cppccsymbols'
14604 cppflags='$cppflags'
14605 cpplast='$cpplast'
14606 cppminus='$cppminus'
14607 cpprun='$cpprun'
14608 cppstdin='$cppstdin'
14609 cppsymbols='$cppsymbols'
14610 crosscompile='$crosscompile'
14611 cryptlib='$cryptlib'
14612 csh='$csh'
14613 d_Gconvert='$d_Gconvert'
14614 d_PRIEldbl='$d_PRIEldbl'
14615 d_PRIFldbl='$d_PRIFldbl'
14616 d_PRIGldbl='$d_PRIGldbl'
14617 d_PRIX64='$d_PRIX64'
14618 d_PRId64='$d_PRId64'
14619 d_PRIeldbl='$d_PRIeldbl'
14620 d_PRIfldbl='$d_PRIfldbl'
14621 d_PRIgldbl='$d_PRIgldbl'
14622 d_PRIi64='$d_PRIi64'
14623 d_PRIo64='$d_PRIo64'
14624 d_PRIu64='$d_PRIu64'
14625 d_PRIx64='$d_PRIx64'
14626 d_access='$d_access'
14627 d_accessx='$d_accessx'
14628 d_alarm='$d_alarm'
14629 d_archlib='$d_archlib'
14630 d_atolf='$d_atolf'
14631 d_atoll='$d_atoll'
14632 d_attribut='$d_attribut'
14633 d_bcmp='$d_bcmp'
14634 d_bcopy='$d_bcopy'
14635 d_bincompat5005='$d_bincompat5005'
14636 d_bsd='$d_bsd'
14637 d_bsdgetpgrp='$d_bsdgetpgrp'
14638 d_bsdsetpgrp='$d_bsdsetpgrp'
14639 d_bzero='$d_bzero'
14640 d_casti32='$d_casti32'
14641 d_castneg='$d_castneg'
14642 d_charvspr='$d_charvspr'
14643 d_chown='$d_chown'
14644 d_chroot='$d_chroot'
14645 d_chsize='$d_chsize'
14646 d_closedir='$d_closedir'
14647 d_const='$d_const'
14648 d_crypt='$d_crypt'
14649 d_csh='$d_csh'
14650 d_cuserid='$d_cuserid'
14651 d_dbl_dig='$d_dbl_dig'
14652 d_difftime='$d_difftime'
14653 d_dirnamlen='$d_dirnamlen'
14654 d_dlerror='$d_dlerror'
14655 d_dlopen='$d_dlopen'
14656 d_dlsymun='$d_dlsymun'
14657 d_dosuid='$d_dosuid'
14658 d_drand48proto='$d_drand48proto'
14659 d_dup2='$d_dup2'
14660 d_eaccess='$d_eaccess'
14661 d_endgrent='$d_endgrent'
14662 d_endhent='$d_endhent'
14663 d_endnent='$d_endnent'
14664 d_endpent='$d_endpent'
14665 d_endpwent='$d_endpwent'
14666 d_endsent='$d_endsent'
14667 d_endspent='$d_endspent'
14668 d_eofnblk='$d_eofnblk'
14669 d_eunice='$d_eunice'
14670 d_fchmod='$d_fchmod'
14671 d_fchown='$d_fchown'
14672 d_fcntl='$d_fcntl'
14673 d_fd_macros='$d_fd_macros'
14674 d_fd_set='$d_fd_set'
14675 d_fds_bits='$d_fds_bits'
14676 d_fgetpos='$d_fgetpos'
14677 d_flexfnam='$d_flexfnam'
14678 d_flock='$d_flock'
14679 d_fork='$d_fork'
14680 d_fpathconf='$d_fpathconf'
14681 d_fpos64_t='$d_fpos64_t'
14682 d_fs_data_s='$d_fs_data_s'
14683 d_fseeko='$d_fseeko'
14684 d_fsetpos='$d_fsetpos'
14685 d_fstatfs='$d_fstatfs'
14686 d_fstatvfs='$d_fstatvfs'
14687 d_ftello='$d_ftello'
14688 d_ftime='$d_ftime'
14689 d_getcwd='$d_getcwd'
14690 d_getgrent='$d_getgrent'
14691 d_getgrps='$d_getgrps'
14692 d_gethbyaddr='$d_gethbyaddr'
14693 d_gethbyname='$d_gethbyname'
14694 d_gethent='$d_gethent'
14695 d_gethname='$d_gethname'
14696 d_gethostprotos='$d_gethostprotos'
14697 d_getlogin='$d_getlogin'
14698 d_getmnt='$d_getmnt'
14699 d_getmntent='$d_getmntent'
14700 d_getnbyaddr='$d_getnbyaddr'
14701 d_getnbyname='$d_getnbyname'
14702 d_getnent='$d_getnent'
14703 d_getnetprotos='$d_getnetprotos'
14704 d_getpbyname='$d_getpbyname'
14705 d_getpbynumber='$d_getpbynumber'
14706 d_getpent='$d_getpent'
14707 d_getpgid='$d_getpgid'
14708 d_getpgrp2='$d_getpgrp2'
14709 d_getpgrp='$d_getpgrp'
14710 d_getppid='$d_getppid'
14711 d_getprior='$d_getprior'
14712 d_getprotoprotos='$d_getprotoprotos'
14713 d_getpwent='$d_getpwent'
14714 d_getsbyname='$d_getsbyname'
14715 d_getsbyport='$d_getsbyport'
14716 d_getsent='$d_getsent'
14717 d_getservprotos='$d_getservprotos'
14718 d_getspent='$d_getspent'
14719 d_getspnam='$d_getspnam'
14720 d_gettimeod='$d_gettimeod'
14721 d_gnulibc='$d_gnulibc'
14722 d_grpasswd='$d_grpasswd'
14723 d_hasmntopt='$d_hasmntopt'
14724 d_htonl='$d_htonl'
14725 d_iconv='$d_iconv'
14726 d_index='$d_index'
14727 d_inetaton='$d_inetaton'
14728 d_int64_t='$d_int64_t'
14729 d_isascii='$d_isascii'
14730 d_killpg='$d_killpg'
14731 d_lchown='$d_lchown'
14732 d_ldbl_dig='$d_ldbl_dig'
14733 d_link='$d_link'
14734 d_locconv='$d_locconv'
14735 d_lockf='$d_lockf'
14736 d_longdbl='$d_longdbl'
14737 d_longlong='$d_longlong'
14738 d_lstat='$d_lstat'
14739 d_mblen='$d_mblen'
14740 d_mbstowcs='$d_mbstowcs'
14741 d_mbtowc='$d_mbtowc'
14742 d_memchr='$d_memchr'
14743 d_memcmp='$d_memcmp'
14744 d_memcpy='$d_memcpy'
14745 d_memmove='$d_memmove'
14746 d_memset='$d_memset'
14747 d_mkdir='$d_mkdir'
14748 d_mkdtemp='$d_mkdtemp'
14749 d_mkfifo='$d_mkfifo'
14750 d_mkstemp='$d_mkstemp'
14751 d_mkstemps='$d_mkstemps'
14752 d_mktime='$d_mktime'
14753 d_mmap='$d_mmap'
14754 d_mprotect='$d_mprotect'
14755 d_msg='$d_msg'
14756 d_msg_ctrunc='$d_msg_ctrunc'
14757 d_msg_dontroute='$d_msg_dontroute'
14758 d_msg_oob='$d_msg_oob'
14759 d_msg_peek='$d_msg_peek'
14760 d_msg_proxy='$d_msg_proxy'
14761 d_msgctl='$d_msgctl'
14762 d_msgget='$d_msgget'
14763 d_msgrcv='$d_msgrcv'
14764 d_msgsnd='$d_msgsnd'
14765 d_msync='$d_msync'
14766 d_munmap='$d_munmap'
14767 d_mymalloc='$d_mymalloc'
14768 d_nice='$d_nice'
14769 d_nv_preserves_uv='$d_nv_preserves_uv'
14770 d_off64_t='$d_off64_t'
14771 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14772 d_oldpthreads='$d_oldpthreads'
14773 d_oldsock='$d_oldsock'
14774 d_open3='$d_open3'
14775 d_pathconf='$d_pathconf'
14776 d_pause='$d_pause'
14777 d_phostname='$d_phostname'
14778 d_pipe='$d_pipe'
14779 d_poll='$d_poll'
14780 d_portable='$d_portable'
14781 d_pthread_yield='$d_pthread_yield'
14782 d_pwage='$d_pwage'
14783 d_pwchange='$d_pwchange'
14784 d_pwclass='$d_pwclass'
14785 d_pwcomment='$d_pwcomment'
14786 d_pwexpire='$d_pwexpire'
14787 d_pwgecos='$d_pwgecos'
14788 d_pwpasswd='$d_pwpasswd'
14789 d_pwquota='$d_pwquota'
14790 d_quad='$d_quad'
14791 d_readdir='$d_readdir'
14792 d_readlink='$d_readlink'
14793 d_rename='$d_rename'
14794 d_rewinddir='$d_rewinddir'
14795 d_rmdir='$d_rmdir'
14796 d_safebcpy='$d_safebcpy'
14797 d_safemcpy='$d_safemcpy'
14798 d_sanemcmp='$d_sanemcmp'
14799 d_sched_yield='$d_sched_yield'
14800 d_scm_rights='$d_scm_rights'
14801 d_seekdir='$d_seekdir'
14802 d_select='$d_select'
14803 d_sem='$d_sem'
14804 d_semctl='$d_semctl'
14805 d_semctl_semid_ds='$d_semctl_semid_ds'
14806 d_semctl_semun='$d_semctl_semun'
14807 d_semget='$d_semget'
14808 d_semop='$d_semop'
14809 d_setegid='$d_setegid'
14810 d_seteuid='$d_seteuid'
14811 d_setgrent='$d_setgrent'
14812 d_setgrps='$d_setgrps'
14813 d_sethent='$d_sethent'
14814 d_setlinebuf='$d_setlinebuf'
14815 d_setlocale='$d_setlocale'
14816 d_setnent='$d_setnent'
14817 d_setpent='$d_setpent'
14818 d_setpgid='$d_setpgid'
14819 d_setpgrp2='$d_setpgrp2'
14820 d_setpgrp='$d_setpgrp'
14821 d_setprior='$d_setprior'
14822 d_setpwent='$d_setpwent'
14823 d_setregid='$d_setregid'
14824 d_setresgid='$d_setresgid'
14825 d_setresuid='$d_setresuid'
14826 d_setreuid='$d_setreuid'
14827 d_setrgid='$d_setrgid'
14828 d_setruid='$d_setruid'
14829 d_setsent='$d_setsent'
14830 d_setsid='$d_setsid'
14831 d_setspent='$d_setspent'
14832 d_setvbuf='$d_setvbuf'
14833 d_sfio='$d_sfio'
14834 d_shm='$d_shm'
14835 d_shmat='$d_shmat'
14836 d_shmatprototype='$d_shmatprototype'
14837 d_shmctl='$d_shmctl'
14838 d_shmdt='$d_shmdt'
14839 d_shmget='$d_shmget'
14840 d_sigaction='$d_sigaction'
14841 d_sigsetjmp='$d_sigsetjmp'
14842 d_socket='$d_socket'
14843 d_socklen_t='$d_socklen_t'
14844 d_sockpair='$d_sockpair'
14845 d_sqrtl='$d_sqrtl'
14846 d_statblks='$d_statblks'
14847 d_statfs_f_flags='$d_statfs_f_flags'
14848 d_statfs_s='$d_statfs_s'
14849 d_statvfs='$d_statvfs'
14850 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14851 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14852 d_stdio_stream_array='$d_stdio_stream_array'
14853 d_stdiobase='$d_stdiobase'
14854 d_stdstdio='$d_stdstdio'
14855 d_strchr='$d_strchr'
14856 d_strcoll='$d_strcoll'
14857 d_strctcpy='$d_strctcpy'
14858 d_strerrm='$d_strerrm'
14859 d_strerror='$d_strerror'
14860 d_strtod='$d_strtod'
14861 d_strtol='$d_strtol'
14862 d_strtold='$d_strtold'
14863 d_strtoll='$d_strtoll'
14864 d_strtoul='$d_strtoul'
14865 d_strtoull='$d_strtoull'
14866 d_strtouq='$d_strtouq'
14867 d_strxfrm='$d_strxfrm'
14868 d_suidsafe='$d_suidsafe'
14869 d_symlink='$d_symlink'
14870 d_syscall='$d_syscall'
14871 d_sysconf='$d_sysconf'
14872 d_sysernlst='$d_sysernlst'
14873 d_syserrlst='$d_syserrlst'
14874 d_system='$d_system'
14875 d_tcgetpgrp='$d_tcgetpgrp'
14876 d_tcsetpgrp='$d_tcsetpgrp'
14877 d_telldir='$d_telldir'
14878 d_telldirproto='$d_telldirproto'
14879 d_time='$d_time'
14880 d_times='$d_times'
14881 d_truncate='$d_truncate'
14882 d_tzname='$d_tzname'
14883 d_umask='$d_umask'
14884 d_uname='$d_uname'
14885 d_union_semun='$d_union_semun'
14886 d_ustat='$d_ustat'
14887 d_vendorbin='$d_vendorbin'
14888 d_vendorlib='$d_vendorlib'
14889 d_vfork='$d_vfork'
14890 d_void_closedir='$d_void_closedir'
14891 d_voidsig='$d_voidsig'
14892 d_voidtty='$d_voidtty'
14893 d_volatile='$d_volatile'
14894 d_vprintf='$d_vprintf'
14895 d_wait4='$d_wait4'
14896 d_waitpid='$d_waitpid'
14897 d_wcstombs='$d_wcstombs'
14898 d_wctomb='$d_wctomb'
14899 d_xenix='$d_xenix'
14900 date='$date'
14901 db_hashtype='$db_hashtype'
14902 db_prefixtype='$db_prefixtype'
14903 defvoidused='$defvoidused'
14904 direntrytype='$direntrytype'
14905 dlext='$dlext'
14906 dlsrc='$dlsrc'
14907 doublesize='$doublesize'
14908 drand01='$drand01'
14909 dynamic_ext='$dynamic_ext'
14910 eagain='$eagain'
14911 ebcdic='$ebcdic'
14912 echo='$echo'
14913 egrep='$egrep'
14914 emacs='$emacs'
14915 eunicefix='$eunicefix'
14916 exe_ext='$exe_ext'
14917 expr='$expr'
14918 extensions='$extensions'
14919 fflushNULL='$fflushNULL'
14920 fflushall='$fflushall'
14921 find='$find'
14922 firstmakefile='$firstmakefile'
14923 flex='$flex'
14924 fpossize='$fpossize'
14925 fpostype='$fpostype'
14926 freetype='$freetype'
14927 full_ar='$full_ar'
14928 full_csh='$full_csh'
14929 full_sed='$full_sed'
14930 gccversion='$gccversion'
14931 gidformat='$gidformat'
14932 gidsign='$gidsign'
14933 gidsize='$gidsize'
14934 gidtype='$gidtype'
14935 glibpth='$glibpth'
14936 grep='$grep'
14937 groupcat='$groupcat'
14938 groupstype='$groupstype'
14939 gzip='$gzip'
14940 h_fcntl='$h_fcntl'
14941 h_sysfile='$h_sysfile'
14942 hint='$hint'
14943 hostcat='$hostcat'
14944 huge='$huge'
14945 i16size='$i16size'
14946 i16type='$i16type'
14947 i32size='$i32size'
14948 i32type='$i32type'
14949 i64size='$i64size'
14950 i64type='$i64type'
14951 i8size='$i8size'
14952 i8type='$i8type'
14953 i_arpainet='$i_arpainet'
14954 i_bsdioctl='$i_bsdioctl'
14955 i_db='$i_db'
14956 i_dbm='$i_dbm'
14957 i_dirent='$i_dirent'
14958 i_dld='$i_dld'
14959 i_dlfcn='$i_dlfcn'
14960 i_fcntl='$i_fcntl'
14961 i_float='$i_float'
14962 i_gdbm='$i_gdbm'
14963 i_grp='$i_grp'
14964 i_iconv='$i_iconv'
14965 i_inttypes='$i_inttypes'
14966 i_limits='$i_limits'
14967 i_locale='$i_locale'
14968 i_machcthr='$i_machcthr'
14969 i_malloc='$i_malloc'
14970 i_math='$i_math'
14971 i_memory='$i_memory'
14972 i_mntent='$i_mntent'
14973 i_ndbm='$i_ndbm'
14974 i_netdb='$i_netdb'
14975 i_neterrno='$i_neterrno'
14976 i_netinettcp='$i_netinettcp'
14977 i_niin='$i_niin'
14978 i_poll='$i_poll'
14979 i_pthread='$i_pthread'
14980 i_pwd='$i_pwd'
14981 i_rpcsvcdbm='$i_rpcsvcdbm'
14982 i_sfio='$i_sfio'
14983 i_sgtty='$i_sgtty'
14984 i_shadow='$i_shadow'
14985 i_socks='$i_socks'
14986 i_stdarg='$i_stdarg'
14987 i_stddef='$i_stddef'
14988 i_stdlib='$i_stdlib'
14989 i_string='$i_string'
14990 i_sysaccess='$i_sysaccess'
14991 i_sysdir='$i_sysdir'
14992 i_sysfile='$i_sysfile'
14993 i_sysfilio='$i_sysfilio'
14994 i_sysin='$i_sysin'
14995 i_sysioctl='$i_sysioctl'
14996 i_syslog='$i_syslog'
14997 i_sysmman='$i_sysmman'
14998 i_sysmode='$i_sysmode'
14999 i_sysmount='$i_sysmount'
15000 i_sysndir='$i_sysndir'
15001 i_sysparam='$i_sysparam'
15002 i_sysresrc='$i_sysresrc'
15003 i_syssecrt='$i_syssecrt'
15004 i_sysselct='$i_sysselct'
15005 i_syssockio='$i_syssockio'
15006 i_sysstat='$i_sysstat'
15007 i_sysstatfs='$i_sysstatfs'
15008 i_sysstatvfs='$i_sysstatvfs'
15009 i_systime='$i_systime'
15010 i_systimek='$i_systimek'
15011 i_systimes='$i_systimes'
15012 i_systypes='$i_systypes'
15013 i_sysuio='$i_sysuio'
15014 i_sysun='$i_sysun'
15015 i_sysutsname='$i_sysutsname'
15016 i_sysvfs='$i_sysvfs'
15017 i_syswait='$i_syswait'
15018 i_termio='$i_termio'
15019 i_termios='$i_termios'
15020 i_time='$i_time'
15021 i_unistd='$i_unistd'
15022 i_ustat='$i_ustat'
15023 i_utime='$i_utime'
15024 i_values='$i_values'
15025 i_varargs='$i_varargs'
15026 i_varhdr='$i_varhdr'
15027 i_vfork='$i_vfork'
15028 ignore_versioned_solibs='$ignore_versioned_solibs'
15029 inc_version_list='$inc_version_list'
15030 inc_version_list_init='$inc_version_list_init'
15031 incpath='$incpath'
15032 inews='$inews'
15033 installarchlib='$installarchlib'
15034 installbin='$installbin'
15035 installman1dir='$installman1dir'
15036 installman3dir='$installman3dir'
15037 installprefix='$installprefix'
15038 installprefixexp='$installprefixexp'
15039 installprivlib='$installprivlib'
15040 installscript='$installscript'
15041 installsitearch='$installsitearch'
15042 installsitebin='$installsitebin'
15043 installsitelib='$installsitelib'
15044 installstyle='$installstyle'
15045 installusrbinperl='$installusrbinperl'
15046 installvendorbin='$installvendorbin'
15047 installvendorlib='$installvendorlib'
15048 intsize='$intsize'
15049 ivdformat='$ivdformat'
15050 ivsize='$ivsize'
15051 ivtype='$ivtype'
15052 known_extensions='$known_extensions'
15053 ksh='$ksh'
15054 large='$large'
15055 ld='$ld'
15056 lddlflags='$lddlflags'
15057 ldflags='$ldflags'
15058 ldlibpthname='$ldlibpthname'
15059 less='$less'
15060 lib_ext='$lib_ext'
15061 libc='$libc'
15062 libperl='$libperl'
15063 libpth='$libpth'
15064 libs='$libs'
15065 libsdirs='$libsdirs'
15066 libsfiles='$libsfiles'
15067 libsfound='$libsfound'
15068 libspath='$libspath'
15069 libswanted='$libswanted'
15070 line='$line'
15071 lint='$lint'
15072 lkflags='$lkflags'
15073 ln='$ln'
15074 lns='$lns'
15075 locincpth='$locincpth'
15076 loclibpth='$loclibpth'
15077 longdblsize='$longdblsize'
15078 longlongsize='$longlongsize'
15079 longsize='$longsize'
15080 lp='$lp'
15081 lpr='$lpr'
15082 ls='$ls'
15083 lseeksize='$lseeksize'
15084 lseektype='$lseektype'
15085 mail='$mail'
15086 mailx='$mailx'
15087 make='$make'
15088 make_set_make='$make_set_make'
15089 mallocobj='$mallocobj'
15090 mallocsrc='$mallocsrc'
15091 malloctype='$malloctype'
15092 man1dir='$man1dir'
15093 man1direxp='$man1direxp'
15094 man1ext='$man1ext'
15095 man3dir='$man3dir'
15096 man3direxp='$man3direxp'
15097 man3ext='$man3ext'
15098 medium='$medium'
15099 mips_type='$mips_type'
15100 mkdir='$mkdir'
15101 mmaptype='$mmaptype'
15102 models='$models'
15103 modetype='$modetype'
15104 more='$more'
15105 multiarch='$multiarch'
15106 mv='$mv'
15107 myarchname='$myarchname'
15108 mydomain='$mydomain'
15109 myhostname='$myhostname'
15110 myuname='$myuname'
15111 n='$n'
15112 netdb_hlen_type='$netdb_hlen_type'
15113 netdb_host_type='$netdb_host_type'
15114 netdb_name_type='$netdb_name_type'
15115 netdb_net_type='$netdb_net_type'
15116 nm='$nm'
15117 nm_opt='$nm_opt'
15118 nm_so_opt='$nm_so_opt'
15119 nonxs_ext='$nonxs_ext'
15120 nroff='$nroff'
15121 nvsize='$nvsize'
15122 nvtype='$nvtype'
15123 o_nonblock='$o_nonblock'
15124 obj_ext='$obj_ext'
15125 old_pthread_create_joinable='$old_pthread_create_joinable'
15126 optimize='$optimize'
15127 orderlib='$orderlib'
15128 osname='$osname'
15129 osvers='$osvers'
15130 package='$package'
15131 pager='$pager'
15132 passcat='$passcat'
15133 patchlevel='$patchlevel'
15134 path_sep='$path_sep'
15135 perl='$perl'
15136 perladmin='$perladmin'
15137 perlpath='$perlpath'
15138 pg='$pg'
15139 phostname='$phostname'
15140 pidtype='$pidtype'
15141 plibpth='$plibpth'
15142 pm_apiversion='$pm_apiversion'
15143 pmake='$pmake'
15144 pr='$pr'
15145 prefix='$prefix'
15146 prefixexp='$prefixexp'
15147 privlib='$privlib'
15148 privlibexp='$privlibexp'
15149 prototype='$prototype'
15150 ptrsize='$ptrsize'
15151 quadkind='$quadkind'
15152 quadtype='$quadtype'
15153 randbits='$randbits'
15154 randfunc='$randfunc'
15155 randseedtype='$randseedtype'
15156 ranlib='$ranlib'
15157 rd_nodata='$rd_nodata'
15158 rm='$rm'
15159 rmail='$rmail'
15160 runnm='$runnm'
15161 sPRIEldbl='$sPRIEldbl'
15162 sPRIFldbl='$sPRIFldbl'
15163 sPRIGldbl='$sPRIGldbl'
15164 sPRIX64='$sPRIX64'
15165 sPRId64='$sPRId64'
15166 sPRIeldbl='$sPRIeldbl'
15167 sPRIfldbl='$sPRIfldbl'
15168 sPRIgldbl='$sPRIgldbl'
15169 sPRIi64='$sPRIi64'
15170 sPRIo64='$sPRIo64'
15171 sPRIu64='$sPRIu64'
15172 sPRIx64='$sPRIx64'
15173 sched_yield='$sched_yield'
15174 scriptdir='$scriptdir'
15175 scriptdirexp='$scriptdirexp'
15176 sed='$sed'
15177 seedfunc='$seedfunc'
15178 selectminbits='$selectminbits'
15179 selecttype='$selecttype'
15180 sendmail='$sendmail'
15181 sh='$sh'
15182 shar='$shar'
15183 sharpbang='$sharpbang'
15184 shmattype='$shmattype'
15185 shortsize='$shortsize'
15186 shrpenv='$shrpenv'
15187 shsharp='$shsharp'
15188 sig_count='$sig_count'
15189 sig_name='$sig_name'
15190 sig_name_init='$sig_name_init'
15191 sig_num='$sig_num'
15192 sig_num_init='$sig_num_init'
15193 signal_t='$signal_t'
15194 sitearch='$sitearch'
15195 sitearchexp='$sitearchexp'
15196 sitebin='$sitebin'
15197 sitebinexp='$sitebinexp'
15198 sitelib='$sitelib'
15199 sitelibexp='$sitelibexp'
15200 siteprefix='$siteprefix'
15201 siteprefixexp='$siteprefixexp'
15202 sizetype='$sizetype'
15203 sleep='$sleep'
15204 smail='$smail'
15205 small='$small'
15206 so='$so'
15207 sockethdr='$sockethdr'
15208 socketlib='$socketlib'
15209 sort='$sort'
15210 spackage='$spackage'
15211 spitshell='$spitshell'
15212 split='$split'
15213 src='$src'
15214 ssizetype='$ssizetype'
15215 startperl='$startperl'
15216 startsh='$startsh'
15217 static_ext='$static_ext'
15218 stdchar='$stdchar'
15219 stdio_base='$stdio_base'
15220 stdio_bufsiz='$stdio_bufsiz'
15221 stdio_cnt='$stdio_cnt'
15222 stdio_filbuf='$stdio_filbuf'
15223 stdio_ptr='$stdio_ptr'
15224 stdio_stream_array='$stdio_stream_array'
15225 strings='$strings'
15226 submit='$submit'
15227 subversion='$subversion'
15228 sysman='$sysman'
15229 tail='$tail'
15230 tar='$tar'
15231 tbl='$tbl'
15232 tee='$tee'
15233 test='$test'
15234 timeincl='$timeincl'
15235 timetype='$timetype'
15236 touch='$touch'
15237 tr='$tr'
15238 trnl='$trnl'
15239 troff='$troff'
15240 u16size='$u16size'
15241 u16type='$u16type'
15242 u32size='$u32size'
15243 u32type='$u32type'
15244 u64size='$u64size'
15245 u64type='$u64type'
15246 u8size='$u8size'
15247 u8type='$u8type'
15248 uidformat='$uidformat'
15249 uidsign='$uidsign'
15250 uidsize='$uidsize'
15251 uidtype='$uidtype'
15252 uname='$uname'
15253 uniq='$uniq'
15254 uquadtype='$uquadtype'
15255 use5005threads='$use5005threads'
15256 use64bits='$use64bits'
15257 usedl='$usedl'
15258 useithreads='$useithreads'
15259 uselargefiles='$uselargefiles'
15260 uselongdouble='$uselongdouble'
15261 usemorebits='$usemorebits'
15262 usemultiplicity='$usemultiplicity'
15263 usemymalloc='$usemymalloc'
15264 usenm='$usenm'
15265 useopcode='$useopcode'
15266 useperlio='$useperlio'
15267 useposix='$useposix'
15268 usesfio='$usesfio'
15269 useshrplib='$useshrplib'
15270 usesocks='$usesocks'
15271 usethreads='$usethreads'
15272 usevendorprefix='$usevendorprefix'
15273 usevfork='$usevfork'
15274 usrinc='$usrinc'
15275 uuname='$uuname'
15276 uvoformat='$uvoformat'
15277 uvsize='$uvsize'
15278 uvtype='$uvtype'
15279 uvuformat='$uvuformat'
15280 uvxformat='$uvxformat'
15281 vendorbin='$vendorbin'
15282 vendorbinexp='$vendorbinexp'
15283 vendorlib='$vendorlib'
15284 vendorlibexp='$vendorlibexp'
15285 vendorprefix='$vendorprefix'
15286 vendorprefixexp='$vendorprefixexp'
15287 version='$version'
15288 vi='$vi'
15289 voidflags='$voidflags'
15290 xlibpth='$xlibpth'
15291 xs_apiversion='$xs_apiversion'
15292 zcat='$zcat'
15293 zip='$zip'
15294 EOT
15295
15296 : Add in command line options if available
15297 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15298
15299 : add special variables
15300 $test -f $src/patchlevel.h && \
15301 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15302 echo "CONFIGDOTSH=true" >>config.sh
15303
15304 : propagate old symbols
15305 if $test -f UU/config.sh; then
15306         <UU/config.sh sort | uniq >UU/oldconfig.sh
15307         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15308         sort | uniq -u >UU/oldsyms
15309         set X `cat UU/oldsyms`
15310         shift
15311         case $# in
15312         0) ;;
15313         *)
15314                 cat <<EOM
15315 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15316 EOM
15317                 echo "# Variables propagated from previous config.sh file." >>config.sh
15318                 for sym in `cat UU/oldsyms`; do
15319                         echo "    Propagating $hint variable "'$'"$sym..."
15320                         eval 'tmp="$'"${sym}"'"'
15321                         echo "$tmp" | \
15322                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15323                 done
15324                 ;;
15325         esac
15326 fi
15327
15328 : Finish up by extracting the .SH files
15329 case "$alldone" in
15330 exit)
15331         $rm -rf UU
15332         echo "Done."
15333         exit 0
15334         ;;
15335 cont)
15336         ;;
15337 '')
15338         dflt=''
15339         nostick=true
15340         $cat <<EOM
15341
15342 If you'd like to make any changes to the config.sh file before I begin
15343 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15344
15345 EOM
15346         rp="Press return or use a shell escape to edit config.sh:"
15347         . UU/myread
15348         nostick=''
15349         case "$ans" in
15350         '') ;;
15351         *) : in case they cannot read
15352                 sh 1>&4 -c "$ans";;
15353         esac
15354         ;;
15355 esac
15356
15357 : if this fails, just run all the .SH files by hand
15358 . ./config.sh
15359
15360 echo " "
15361 exec 1>&4
15362 . ./UU/extract
15363
15364 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15365         dflt=y
15366         case "$silent" in
15367         true) ;;
15368         *)
15369                 $cat <<EOM
15370
15371 Now you need to generate make dependencies by running "$make depend".
15372 You might prefer to run it in background: "$make depend > makedepend.out &"
15373 It can take a while, so you might not want to run it right now.
15374
15375 EOM
15376                 ;;
15377         esac
15378         rp="Run $make depend now?"
15379         . UU/myread
15380         case "$ans" in
15381         y*)
15382                 $make depend && echo "Now you must run a $make."
15383                 ;;
15384         *)
15385                 echo "You must run '$make depend' then '$make'."
15386                 ;;
15387         esac
15388 elif test -f [Mm]akefile; then
15389         echo " "
15390         echo "Now you must run a $make."
15391 else
15392         echo "Done."
15393 fi
15394
15395 if $test -f Policy.sh; then
15396     $cat <<EOM
15397
15398 If you compile $package on a different machine or from a different object
15399 directory, copy the Policy.sh file from this object directory to the
15400 new one before you run Configure -- this will help you with most of
15401 the policy defaults.
15402
15403 EOM
15404 fi
15405 if $test -f config.msg; then
15406     echo "Hmm.  I also noted the following information while running:"
15407     echo " "
15408     $cat config.msg >&4
15409     $rm -f config.msg
15410 fi
15411 $rm -f kit*isdone ark*isdone
15412 $rm -rf UU
15413
15414 : End of Configure
15415