5de329572c80f5d725046ede623335a5c3445df1
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Feb 26 00:48:15 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_fpos64_t=''
358 d_fs_data_s=''
359 d_fseeko=''
360 d_fsetpos=''
361 d_fstatfs=''
362 d_ftello=''
363 d_ftime=''
364 d_gettimeod=''
365 d_Gconvert=''
366 d_getcwd=''
367 d_getfsstat=''
368 d_getgrent=''
369 d_getgrps=''
370 d_gethbyaddr=''
371 d_gethbyname=''
372 d_gethent=''
373 aphostname=''
374 d_gethname=''
375 d_phostname=''
376 d_uname=''
377 d_gethostprotos=''
378 d_getlogin=''
379 d_getmnt=''
380 d_getmntent=''
381 d_getnbyaddr=''
382 d_getnbyname=''
383 d_getnent=''
384 d_getnetprotos=''
385 d_getpent=''
386 d_getpgid=''
387 d_getpgrp2=''
388 d_bsdgetpgrp=''
389 d_getpgrp=''
390 d_getppid=''
391 d_getprior=''
392 d_getpbyname=''
393 d_getpbynumber=''
394 d_getprotoprotos=''
395 d_getpwent=''
396 d_getsent=''
397 d_getservprotos=''
398 d_getspent=''
399 d_getspnam=''
400 d_getsbyname=''
401 d_getsbyport=''
402 d_gnulibc=''
403 d_hasmntopt=''
404 d_htonl=''
405 d_iconv=''
406 d_inetaton=''
407 d_int64_t=''
408 d_isascii=''
409 d_killpg=''
410 d_lchown=''
411 d_ldbl_dig=''
412 d_link=''
413 d_locconv=''
414 d_lockf=''
415 d_longdbl=''
416 longdblsize=''
417 d_longlong=''
418 longlongsize=''
419 d_lseekproto=''
420 d_lstat=''
421 d_mblen=''
422 d_mbstowcs=''
423 d_mbtowc=''
424 d_memchr=''
425 d_memcmp=''
426 d_memcpy=''
427 d_memmove=''
428 d_memset=''
429 d_mkdir=''
430 d_mkdtemp=''
431 d_mkfifo=''
432 d_mkstemp=''
433 d_mkstemps=''
434 d_mktime=''
435 d_mmap=''
436 mmaptype=''
437 d_mprotect=''
438 d_msg=''
439 d_msgctl=''
440 d_msgget=''
441 d_msgrcv=''
442 d_msgsnd=''
443 d_msync=''
444 d_munmap=''
445 d_nice=''
446 d_off64_t=''
447 d_open3=''
448 d_fpathconf=''
449 d_pathconf=''
450 d_pause=''
451 d_pipe=''
452 d_poll=''
453 d_portable=''
454 d_old_pthread_create_joinable=''
455 old_pthread_create_joinable=''
456 d_pthread_yield=''
457 d_sched_yield=''
458 sched_yield=''
459 d_readdir=''
460 d_rewinddir=''
461 d_seekdir=''
462 d_telldir=''
463 d_readlink=''
464 d_rename=''
465 d_rmdir=''
466 d_safebcpy=''
467 d_safemcpy=''
468 d_sanemcmp=''
469 d_select=''
470 d_sem=''
471 d_semctl=''
472 d_semget=''
473 d_semop=''
474 d_setegid=''
475 d_seteuid=''
476 d_setgrent=''
477 d_setgrps=''
478 d_sethent=''
479 d_setlinebuf=''
480 d_setlocale=''
481 d_setnent=''
482 d_setpent=''
483 d_setpgid=''
484 d_setpgrp2=''
485 d_bsdsetpgrp=''
486 d_setpgrp=''
487 d_setprior=''
488 d_setpwent=''
489 d_setregid=''
490 d_setresgid=''
491 d_setresuid=''
492 d_setreuid=''
493 d_setrgid=''
494 d_setruid=''
495 d_setsent=''
496 d_setsid=''
497 d_setspent=''
498 d_setvbuf=''
499 d_sfio=''
500 usesfio=''
501 d_shm=''
502 d_shmat=''
503 d_shmatprototype=''
504 shmattype=''
505 d_shmctl=''
506 d_shmdt=''
507 d_shmget=''
508 d_sigaction=''
509 d_sigsetjmp=''
510 d_msg_ctrunc=''
511 d_msg_dontroute=''
512 d_msg_oob=''
513 d_msg_peek=''
514 d_msg_proxy=''
515 d_oldsock=''
516 d_scm_rights=''
517 d_socket=''
518 d_sockpair=''
519 sockethdr=''
520 socketlib=''
521 d_socklen_t=''
522 d_sqrtl=''
523 d_statblks=''
524 d_statfs_f_flags=''
525 d_statfs_s=''
526 d_fstatvfs=''
527 d_statvfs=''
528 d_stdio_cnt_lval=''
529 d_stdio_ptr_lval=''
530 d_stdiobase=''
531 d_stdstdio=''
532 stdio_base=''
533 stdio_bufsiz=''
534 stdio_cnt=''
535 stdio_filbuf=''
536 stdio_ptr=''
537 d_index=''
538 d_strchr=''
539 d_strcoll=''
540 d_strctcpy=''
541 d_strerrm=''
542 d_strerror=''
543 d_sysernlst=''
544 d_syserrlst=''
545 d_strtod=''
546 d_strtol=''
547 d_strtold=''
548 d_strtoll=''
549 d_strtoul=''
550 d_strtoull=''
551 d_strtouq=''
552 d_strxfrm=''
553 d_symlink=''
554 d_syscall=''
555 d_sysconf=''
556 d_system=''
557 d_tcgetpgrp=''
558 d_tcsetpgrp=''
559 d_telldirproto=''
560 d_time=''
561 timetype=''
562 clocktype=''
563 d_times=''
564 d_truncate=''
565 d_tzname=''
566 d_umask=''
567 d_semctl_semid_ds=''
568 d_semctl_semun=''
569 d_union_semun=''
570 d_ustat=''
571 d_vfork=''
572 usevfork=''
573 d_voidsig=''
574 signal_t=''
575 d_volatile=''
576 d_charvspr=''
577 d_vprintf=''
578 d_wait4=''
579 d_waitpid=''
580 d_wcstombs=''
581 d_wctomb=''
582 dlext=''
583 cccdlflags=''
584 ccdlflags=''
585 dlsrc=''
586 ld=''
587 lddlflags=''
588 usedl=''
589 doublesize=''
590 ebcdic=''
591 fflushNULL=''
592 fflushall=''
593 fpossize=''
594 fpostype=''
595 gidformat=''
596 gidsign=''
597 gidsize=''
598 gidtype=''
599 groupstype=''
600 h_fcntl=''
601 h_sysfile=''
602 i_arpainet=''
603 db_hashtype=''
604 db_prefixtype=''
605 i_db=''
606 i_dbm=''
607 i_rpcsvcdbm=''
608 d_dirnamlen=''
609 direntrytype=''
610 i_dirent=''
611 i_dld=''
612 i_dlfcn=''
613 i_fcntl=''
614 i_float=''
615 i_gdbm=''
616 d_grpasswd=''
617 i_grp=''
618 i_iconv=''
619 i_inttypes=''
620 i_limits=''
621 i_locale=''
622 i_machcthr=''
623 i_malloc=''
624 i_math=''
625 i_memory=''
626 i_mntent=''
627 i_ndbm=''
628 i_netdb=''
629 i_neterrno=''
630 i_netinettcp=''
631 i_niin=''
632 i_sysin=''
633 i_poll=''
634 i_pthread=''
635 d_pwage=''
636 d_pwchange=''
637 d_pwclass=''
638 d_pwcomment=''
639 d_pwexpire=''
640 d_pwgecos=''
641 d_pwpasswd=''
642 d_pwquota=''
643 i_pwd=''
644 i_sfio=''
645 i_shadow=''
646 i_socks=''
647 i_stddef=''
648 i_stdlib=''
649 i_string=''
650 strings=''
651 i_sysaccess=''
652 i_sysdir=''
653 i_sysfile=''
654 d_voidtty=''
655 i_bsdioctl=''
656 i_sysfilio=''
657 i_sysioctl=''
658 i_syssockio=''
659 i_syslog=''
660 i_sysmman=''
661 i_sysmode=''
662 i_sysmount=''
663 i_sysndir=''
664 i_sysparam=''
665 i_sysresrc=''
666 i_syssecrt=''
667 i_sysselct=''
668 i_sysstat=''
669 i_sysstatfs=''
670 i_sysstatvfs=''
671 i_systimes=''
672 i_systypes=''
673 i_sysuio=''
674 i_sysun=''
675 i_sysutsname=''
676 i_sysvfs=''
677 i_syswait=''
678 i_sgtty=''
679 i_termio=''
680 i_termios=''
681 i_systime=''
682 i_systimek=''
683 i_time=''
684 timeincl=''
685 i_unistd=''
686 i_ustat=''
687 i_utime=''
688 i_values=''
689 i_stdarg=''
690 i_varargs=''
691 i_varhdr=''
692 i_vfork=''
693 inc_version_list=''
694 inc_version_list_init=''
695 installprefix=''
696 installprefixexp=''
697 installstyle=''
698 installusrbinperl=''
699 intsize=''
700 longsize=''
701 shortsize=''
702 libc=''
703 ldlibpthname=''
704 libperl=''
705 shrpenv=''
706 useshrplib=''
707 glibpth=''
708 libpth=''
709 loclibpth=''
710 plibpth=''
711 xlibpth=''
712 ignore_versioned_solibs=''
713 libs=''
714 libsdirs=''
715 libsfiles=''
716 libsfound=''
717 libspath=''
718 lns=''
719 d_PRIEldbl=''
720 d_PRIFldbl=''
721 d_PRIGldbl=''
722 d_PRIeldbl=''
723 d_PRIfldbl=''
724 d_PRIgldbl=''
725 sPRIEldbl=''
726 sPRIFldbl=''
727 sPRIGldbl=''
728 sPRIeldbl=''
729 sPRIfldbl=''
730 sPRIgldbl=''
731 lseeksize=''
732 lseektype=''
733 make_set_make=''
734 d_mymalloc=''
735 freetype=''
736 mallocobj=''
737 mallocsrc=''
738 malloctype=''
739 usemymalloc=''
740 installman1dir=''
741 man1dir=''
742 man1direxp=''
743 man1ext=''
744 installman3dir=''
745 man3dir=''
746 man3direxp=''
747 man3ext=''
748 huge=''
749 large=''
750 medium=''
751 models=''
752 small=''
753 split=''
754 modetype=''
755 multiarch=''
756 mydomain=''
757 myhostname=''
758 phostname=''
759 c=''
760 n=''
761 d_eofnblk=''
762 eagain=''
763 o_nonblock=''
764 rd_nodata=''
765 netdb_hlen_type=''
766 netdb_host_type=''
767 netdb_name_type=''
768 netdb_net_type=''
769 groupcat=''
770 hostcat=''
771 passcat=''
772 orderlib=''
773 ranlib=''
774 package=''
775 spackage=''
776 pager=''
777 api_revision=''
778 api_subversion=''
779 api_version=''
780 api_versionstring=''
781 patchlevel=''
782 revision=''
783 subversion=''
784 version=''
785 perl5=''
786 perladmin=''
787 perlpath=''
788 d_nv_preserves_uv=''
789 i16size=''
790 i16type=''
791 i32size=''
792 i32type=''
793 i64size=''
794 i64type=''
795 i8size=''
796 i8type=''
797 ivsize=''
798 ivtype=''
799 nvsize=''
800 nvtype=''
801 u16size=''
802 u16type=''
803 u32size=''
804 u32type=''
805 u64size=''
806 u64type=''
807 u8size=''
808 u8type=''
809 uvsize=''
810 uvtype=''
811 ivdformat=''
812 uvoformat=''
813 uvuformat=''
814 uvxformat=''
815 pidtype=''
816 prefix=''
817 prefixexp=''
818 installprivlib=''
819 privlib=''
820 privlibexp=''
821 prototype=''
822 ptrsize=''
823 d_PRIX64=''
824 d_PRId64=''
825 d_PRIi64=''
826 d_PRIo64=''
827 d_PRIu64=''
828 d_PRIx64=''
829 sPRIX64=''
830 sPRId64=''
831 sPRIi64=''
832 sPRIo64=''
833 sPRIu64=''
834 sPRIx64=''
835 d_quad=''
836 quadkind=''
837 quadtype=''
838 uquadtype=''
839 drand01=''
840 randbits=''
841 randfunc=''
842 randseedtype=''
843 seedfunc=''
844 installscript=''
845 scriptdir=''
846 scriptdirexp=''
847 selectminbits=''
848 selecttype=''
849 sh=''
850 sig_count=''
851 sig_name=''
852 sig_name_init=''
853 sig_num=''
854 sig_num_init=''
855 installsitearch=''
856 sitearch=''
857 sitearchexp=''
858 installsitebin=''
859 sitebin=''
860 sitebinexp=''
861 installsitelib=''
862 sitelib=''
863 sitelibexp=''
864 siteprefix=''
865 siteprefixexp=''
866 sizetype=''
867 so=''
868 socksizetype=''
869 sharpbang=''
870 shsharp=''
871 spitshell=''
872 src=''
873 ssizetype=''
874 startperl=''
875 startsh=''
876 stdchar=''
877 d_stdio_stream_array=''
878 stdio_stream_array=''
879 sysman=''
880 trnl=''
881 uidformat=''
882 uidsign=''
883 uidsize=''
884 uidtype=''
885 archname64=''
886 use64bits=''
887 usefull64bits=''
888 uselargefiles=''
889 uselongdouble=''
890 usemorebits=''
891 usemultiplicity=''
892 nm_opt=''
893 nm_so_opt=''
894 runnm=''
895 usenm=''
896 useperlio=''
897 usesocks=''
898 d_oldpthreads=''
899 use5005threads=''
900 useithreads=''
901 usethreads=''
902 incpath=''
903 mips_type=''
904 usrinc=''
905 d_vendorbin=''
906 installvendorbin=''
907 vendorbin=''
908 vendorbinexp=''
909 d_vendorlib=''
910 installvendorlib=''
911 vendorlib=''
912 vendorlibexp=''
913 usevendorprefix=''
914 vendorprefix=''
915 vendorprefixexp=''
916 defvoidused=''
917 voidflags=''
918 pm_apiversion=''
919 xs_apiversion=''
920 CONFIG=''
921
922 define='define'
923 undef='undef'
924 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
925 rmlist=''
926
927 : We must find out about Eunice early
928 eunicefix=':'
929 if test -f /etc/unixtovms; then
930         eunicefix=/etc/unixtovms
931 fi
932 if test -f /etc/unixtovms.exe; then
933         eunicefix=/etc/unixtovms.exe
934 fi
935
936 i_whoami=''
937 : set useposix=false in your hint file to disable the POSIX extension.
938 useposix=true
939 : set useopcode=false in your hint file to disable the Opcode extension.
940 useopcode=true
941 : Trailing extension.  Override this in a hint file, if needed.
942 _exe=''
943 : Extra object files, if any, needed on this platform.
944 archobjs=''
945 : Possible local include directories to search.
946 : Set locincpth to "" in a hint file to defeat local include searches.
947 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
948 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
949 :
950 : no include file wanted by default
951 inclwanted=''
952
953 groupstype=''
954 : change the next line if compiling for Xenix/286 on Xenix/386
955 xlibpth='/usr/lib/386 /lib/386'
956 : Possible local library directories to search.
957 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
958 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
959
960 : general looking path for locating libraries
961 glibpth="/usr/lib/large /lib /usr/lib $xlibpth"
962 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
963 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
964 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
965 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
966
967 : Private path used by Configure to find libraries.  Its value
968 : is prepended to libpth. This variable takes care of special
969 : machines, like the mips.  Usually, it should be empty.
970 plibpth=''
971
972 : default library list
973 libswanted=''
974 : some systems want to use only the non-versioned libso:s
975 ignore_versioned_solibs=''
976 : set usemultiplicity on the Configure command line to enable multiplicity.
977 : set usesocks on the Configure command line to enable socks.
978 : set usethreads on the Configure command line to enable threads.
979 : full support for void wanted by default
980 defvoidused=15
981
982 : List of libraries we want.
983 : If anyone needs -lnet, put it in a hint file.
984 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
985 libswanted="$libswanted dld ld sun m c cposix posix"
986 libswanted="$libswanted ndir dir crypt sec"
987 libswanted="$libswanted ucb bsd BSD PW x"
988 : We probably want to search /usr/shlib before most other libraries.
989 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
990 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
991 glibpth="/usr/shlib $glibpth"
992 : Do not use vfork unless overridden by a hint file.
993 usevfork=false
994
995 : Find the basic shell for Bourne shell scripts
996 case "$sh" in
997 '')
998         case "$SYSTYPE" in
999         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1000         *) xxx='/bin/sh';;
1001         esac
1002         if test -f "$xxx"; then
1003                 sh="$xxx"
1004         else
1005                 : Build up a list and do a single loop so we can 'break' out.
1006                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1007                 for xxx in sh bash ksh pdksh ash; do
1008                         for p in $pth; do
1009                                 try="$try ${p}/${xxx}"
1010                         done
1011                 done
1012                 for xxx in $try; do
1013                         if test -f "$xxx"; then
1014                                 sh="$xxx";
1015                                 break
1016                         elif test -f "$xxx.exe"; then
1017                                 sh="$xxx";
1018                                 break
1019                         fi
1020                 done
1021         fi
1022         ;;
1023 esac
1024
1025 case "$sh" in
1026 '')     cat <<EOM >&2
1027 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1028
1029 Usually it's in /bin/sh.  How did you even get this far?
1030 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1031 we'll try to straighten this all out.
1032 EOM
1033         exit 1
1034         ;;
1035 esac
1036
1037 : see if sh knows # comments
1038 if `$sh -c '#' >/dev/null 2>&1`; then
1039         shsharp=true
1040         spitshell=cat
1041         xcat=/bin/cat
1042         test -f $xcat || xcat=/usr/bin/cat
1043         echo "#!$xcat" >try
1044         $eunicefix try
1045         chmod +x try
1046         ./try > today
1047         if test -s today; then
1048                 sharpbang='#!'
1049         else
1050                 echo "#! $xcat" > try
1051                 $eunicefix try
1052                 chmod +x try
1053                 ./try > today
1054                 if test -s today; then
1055                         sharpbang='#! '
1056                 else
1057                         sharpbang=': use '
1058                 fi
1059         fi
1060 else
1061         echo " "
1062         echo "Your $sh doesn't grok # comments--I will strip them later on."
1063         shsharp=false
1064         cd ..
1065         echo "exec grep -v '^[  ]*#'" >spitshell
1066         chmod +x spitshell
1067         $eunicefix spitshell
1068         spitshell=`pwd`/spitshell
1069         cd UU
1070         echo "I presume that if # doesn't work, #! won't work either!"
1071         sharpbang=': use '
1072 fi
1073 rm -f try today
1074
1075 : figure out how to guarantee sh startup
1076 case "$startsh" in
1077 '') startsh=${sharpbang}${sh} ;;
1078 *)
1079 esac
1080 cat >try <<EOSS
1081 $startsh
1082 set abc
1083 test "$?abc" != 1
1084 EOSS
1085
1086 chmod +x try
1087 $eunicefix try
1088 if ./try; then
1089         : echo "Yup, it does."
1090 else
1091         echo "Hmm... '$startsh' does not guarantee sh startup..."
1092         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1093 fi
1094 rm -f try
1095
1096
1097 : Save command line options in file UU/cmdline.opt for later use in
1098 : generating config.sh.
1099 cat > cmdline.opt <<EOSH
1100 # Configure command line arguments.
1101 config_arg0='$0'
1102 config_args='$*'
1103 config_argc=$#
1104 EOSH
1105 argn=1
1106 for arg in "$@"; do
1107         cat >>cmdline.opt <<EOSH
1108 config_arg$argn='$arg'
1109 EOSH
1110         argn=`expr $argn + 1`
1111 done
1112
1113 : produce awk script to parse command line options
1114 cat >options.awk <<'EOF'
1115 BEGIN {
1116         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1117
1118         len = length(optstr);
1119         for (i = 1; i <= len; i++) {
1120                 c = substr(optstr, i, 1);
1121                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1122                 if (a == ":") {
1123                         arg[c] = 1;
1124                         i++;
1125                 }
1126                 opt[c] = 1;
1127         }
1128 }
1129 {
1130         expect = 0;
1131         str = $0;
1132         if (substr(str, 1, 1) != "-") {
1133                 printf("'%s'\n", str);
1134                 next;
1135         }
1136         len = length($0);
1137         for (i = 2; i <= len; i++) {
1138                 c = substr(str, i, 1);
1139                 if (!opt[c]) {
1140                         printf("-%s\n", substr(str, i));
1141                         next;
1142                 }
1143                 printf("-%s\n", c);
1144                 if (arg[c]) {
1145                         if (i < len)
1146                                 printf("'%s'\n", substr(str, i + 1));
1147                         else
1148                                 expect = 1;
1149                         next;
1150                 }
1151         }
1152 }
1153 END {
1154         if (expect)
1155                 print "?";
1156 }
1157 EOF
1158
1159 : process the command line options
1160 set X `for arg in "$@"; do echo "X$arg"; done |
1161         sed -e s/X// | awk -f options.awk`
1162 eval "set $*"
1163 shift
1164 rm -f options.awk
1165
1166 : set up default values
1167 fastread=''
1168 reuseval=false
1169 config_sh=''
1170 alldone=''
1171 error=''
1172 silent=''
1173 extractsh=''
1174 override=''
1175 knowitall=''
1176 rm -f optdef.sh posthint.sh
1177 cat >optdef.sh <<EOS
1178 $startsh
1179 EOS
1180
1181
1182 : option parsing
1183 while test $# -gt 0; do
1184         case "$1" in
1185         -d) shift; fastread=yes;;
1186         -e) shift; alldone=cont;;
1187         -f)
1188                 shift
1189                 cd ..
1190                 if test -r "$1"; then
1191                         config_sh="$1"
1192                 else
1193                         echo "$me: cannot read config file $1." >&2
1194                         error=true
1195                 fi
1196                 cd UU
1197                 shift;;
1198         -h) shift; error=true;;
1199         -r) shift; reuseval=true;;
1200         -s) shift; silent=true; realsilent=true;;
1201         -E) shift; alldone=exit;;
1202         -K) shift; knowitall=true;;
1203         -O) shift; override=true;;
1204         -S) shift; silent=true; extractsh=true;;
1205         -D)
1206                 shift
1207                 case "$1" in
1208                 *=)
1209                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1210                         echo "$me: ignoring -D $1" >&2
1211                         ;;
1212                 *=*) echo "$1" | \
1213                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1214                 *) echo "$1='define'" >> optdef.sh;;
1215                 esac
1216                 shift
1217                 ;;
1218         -U)
1219                 shift
1220                 case "$1" in
1221                 *=) echo "$1" >> optdef.sh;;
1222                 *=*)
1223                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1224                         echo "$me: ignoring -U $1" >&2
1225                         ;;
1226                 *) echo "$1='undef'" >> optdef.sh;;
1227                 esac
1228                 shift
1229                 ;;
1230         -A)
1231             shift
1232             xxx=''
1233             yyy="$1"
1234             zzz=''
1235             uuu=undef
1236             case "$yyy" in
1237             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1238                  case "$zzz" in
1239                  *:*) zzz='' ;;
1240                  *)   xxx=append
1241                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1242                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1243                  esac
1244                  ;;
1245             esac
1246             case "$xxx" in
1247             '')  case "$yyy" in
1248                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1249                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1250                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1251                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1252                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1253                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1254                  esac
1255                  ;;       
1256             esac
1257             case "$xxx" in
1258             append)
1259                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1260             clear)
1261                 echo "$yyy=''"                  >> posthint.sh ;;
1262             define)
1263                 case "$zzz" in
1264                 '') zzz=define ;;
1265                 esac
1266                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1267             eval)
1268                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1269             prepend)
1270                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1271             undef)
1272                 case "$zzz" in
1273                 '') zzz="$uuu" ;;
1274                 esac
1275                 echo "$yyy=$zzz"                >> posthint.sh ;;
1276             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1277             esac
1278             shift
1279             ;;
1280         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1281             exit 0;;
1282         --) break;;
1283         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1284         *) break;;
1285         esac
1286 done
1287
1288 case "$error" in
1289 true)
1290         cat >&2 <<EOM
1291 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1292                  [-U symbol] [-U symbol=] [-A command:symbol...]
1293   -d : use defaults for all answers.
1294   -e : go on without questioning past the production of config.sh.
1295   -f : specify an alternate default configuration file.
1296   -h : print this help message and exit (with an error status).
1297   -r : reuse C symbols value if possible (skips costly nm extraction).
1298   -s : silent mode, only echoes questions and essential information.
1299   -D : define symbol to have some value:
1300          -D symbol         symbol gets the value 'define'
1301          -D symbol=value   symbol gets the value 'value'
1302   -E : stop at the end of questions, after having produced config.sh.
1303   -K : do not use unless you know what you are doing.
1304   -O : let -D and -U override definitions from loaded configuration file.
1305   -S : perform variable substitutions on all .SH files (can mix with -f)
1306   -U : undefine symbol:
1307          -U symbol    symbol gets the value 'undef'
1308          -U symbol=   symbol gets completely empty
1309   -A : manipulate symbol after the platform specific hints have been applied:
1310          -A symbol=value                append " "value to symbol
1311          -A append:symbol=value         append value to symbol
1312          -A define:symbol=value         define symbol to have value
1313          -A clear:symbol                define symbol to be ''
1314          -A define:symbol               define symbol to be 'define'
1315          -A eval:symbol=value           define symbol to be eval of value
1316          -A prepend:symbol=value        prepend value to symbol
1317          -A undef:symbol                define symbol to be 'undef'
1318          -A undef:symbol=               define symbol to be ''
1319   -V : print version number and exit (with a zero status).
1320 EOM
1321         exit 1
1322         ;;
1323 esac
1324
1325 : Sanity checks
1326 case "$fastread$alldone" in
1327 yescont|yesexit) ;;
1328 *)
1329         if test ! -t 0; then
1330                 echo "Say 'sh Configure', not 'sh <Configure'"
1331                 exit 1
1332         fi
1333         ;;
1334 esac
1335
1336 exec 4>&1
1337 case "$silent" in
1338 true) exec 1>/dev/null;;
1339 esac
1340
1341 : run the defines and the undefines, if any, but leave the file out there...
1342 touch optdef.sh
1343 . ./optdef.sh
1344 : create the posthint manipulation script and leave the file out there...
1345 touch posthint.sh
1346
1347 : set package name
1348 package=perl5
1349 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1350 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1351 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1352 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1353 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1354 esac
1355
1356 : Some greps do not return status, grrr.
1357 echo "grimblepritz" >grimble
1358 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1359         contains=contains
1360 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1361         contains=grep
1362 else
1363         contains=contains
1364 fi
1365 rm -f grimble
1366 : the following should work in any shell
1367 case "$contains" in
1368 contains*)
1369         echo " "
1370         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1371         cat >contains <<'EOSS'
1372 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1373 EOSS
1374 chmod +x contains
1375 esac
1376
1377 : Find the path to the source tree
1378 case "$src" in
1379 '') case "$0" in
1380     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1381          case "$src" in
1382          /*)    ;;
1383          *)     src=`cd ../$src && pwd` ;;
1384          esac
1385          ;;
1386     *)   src='.';;
1387     esac;;
1388 esac
1389 case "$src" in
1390 '')     src=/
1391         rsrc=/
1392         ;;
1393 /*) rsrc="$src";;
1394 *) rsrc="../$src";;
1395 esac
1396 if test -f $rsrc/Configure && \
1397         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1398 then
1399    : found it, so we are ok.
1400 else
1401         rsrc=''
1402         for src in . .. ../.. ../../.. ../../../..; do
1403                 if test -f ../$src/Configure && \
1404                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1405                 then
1406                         rsrc=../$src
1407                         break
1408                 fi
1409         done
1410 fi
1411 case "$rsrc" in
1412 '')
1413         cat <<EOM >&4
1414
1415 Sorry, I can't seem to locate the source dir for $package.  Please start
1416 Configure with an explicit path -- i.e. /some/path/Configure.
1417
1418 EOM
1419         exit 1
1420         ;;
1421 ../.)   rsrc='..';;
1422 *)
1423         echo " "
1424         echo "Sources for $package found in \"$src\"." >&4
1425         ;;
1426 esac
1427
1428 : script used to extract .SH files with variable substitutions
1429 cat >extract <<'EOS'
1430 CONFIGDOTSH=true
1431 echo "Doing variable substitutions on .SH files..."
1432 if test -f $src/MANIFEST; then
1433         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1434 else
1435         echo "(Looking for .SH files under the source directory.)"
1436         set x `(cd $src; find . -name "*.SH" -print)`
1437 fi
1438 shift
1439 case $# in
1440 0) set x `(cd $src; echo *.SH)`; shift;;
1441 esac
1442 if test ! -f $src/$1; then
1443         shift
1444 fi
1445 mkdir_p='
1446 name=$1;
1447 create="";
1448 while test $name; do
1449         if test ! -d "$name"; then
1450                 create="$name $create";
1451                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1452                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1453         else
1454                 name="";
1455         fi;
1456 done;
1457 for file in $create; do
1458         mkdir $file;
1459 done
1460 '
1461 for file in $*; do
1462         case "$src" in
1463         ".")
1464                 case "$file" in
1465                 */*)
1466                         dir=`expr X$file : 'X\(.*\)/'`
1467                         file=`expr X$file : 'X.*/\(.*\)'`
1468                         (cd $dir && . ./$file)
1469                         ;;
1470                 *)
1471                         . ./$file
1472                         ;;
1473                 esac
1474                 ;;
1475         *)
1476                 case "$file" in
1477                 */*)
1478                         dir=`expr X$file : 'X\(.*\)/'`
1479                         file=`expr X$file : 'X.*/\(.*\)'`
1480                         (set x $dir; shift; eval $mkdir_p)
1481                         sh <$src/$dir/$file
1482                         ;;
1483                 *)
1484                         sh <$src/$file
1485                         ;;
1486                 esac
1487                 ;;
1488         esac
1489 done
1490 if test -f $src/config_h.SH; then
1491         if test ! -f config.h; then
1492         : oops, they left it out of MANIFEST, probably, so do it anyway.
1493         . $src/config_h.SH
1494         fi
1495 fi
1496 EOS
1497
1498 : extract files and exit if asked to do so
1499 case "$extractsh" in
1500 true)
1501         case "$realsilent" in
1502         true) ;;
1503         *) exec 1>&4;;
1504         esac
1505         case "$config_sh" in
1506         '') config_sh='config.sh';;
1507         esac
1508         echo " "
1509         echo "Fetching answers from $config_sh..."
1510         cd ..
1511         . $config_sh
1512         test "$override" && . ./optdef.sh
1513         echo " "
1514         . UU/extract
1515         rm -rf UU
1516         echo "Done."
1517         exit 0
1518         ;;
1519 esac
1520
1521 : Eunice requires " " instead of "", can you believe it
1522 echo " "
1523 : Here we go...
1524 echo "Beginning of configuration questions for $package."
1525
1526 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1527
1528 : first determine how to suppress newline on echo command
1529 echo " "
1530 echo "Checking echo to see how to suppress newlines..."
1531 (echo "hi there\c" ; echo " ") >.echotmp
1532 if $contains c .echotmp >/dev/null 2>&1 ; then
1533         echo "...using -n."
1534         n='-n'
1535         c=''
1536 else
1537         cat <<'EOM'
1538 ...using \c
1539 EOM
1540         n=''
1541         c='\c'
1542 fi
1543 echo $n "The star should be here-->$c"
1544 echo '*'
1545 rm -f .echotmp
1546
1547 : Now test for existence of everything in MANIFEST
1548 echo " "
1549 if test -f $rsrc/MANIFEST; then
1550         echo "First let's make sure your kit is complete.  Checking..." >&4
1551         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1552         rm -f missing
1553         tmppwd=`pwd`
1554         for filelist in x??; do
1555                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1556         done
1557         if test -s missing; then
1558                 cat missing >&4
1559                 cat >&4 <<'EOM'
1560
1561 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1562
1563 You have the option of continuing the configuration process, despite the
1564 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1565 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1566 and contact the author (perlbug@perl.com).
1567
1568 EOM
1569                 echo $n "Continue? [n] $c" >&4
1570                 read ans
1571                 case "$ans" in
1572                 y*)
1573                         echo "Continuing..." >&4
1574                         rm -f missing
1575                         ;;
1576                 *)
1577                         echo "ABORTING..." >&4
1578                         kill $$
1579                         ;;
1580                 esac
1581         else
1582                 echo "Looks good..."
1583         fi
1584 else
1585         echo "There is no MANIFEST file.  I hope your kit is complete !"
1586 fi
1587 rm -f missing x??
1588
1589 echo " "
1590 : Find the appropriate value for a newline for tr
1591 if test -n "$DJGPP"; then
1592        trnl='\012'
1593 fi
1594 if test X"$trnl" = X; then
1595         case "`echo foo|tr '\n' x 2>/dev/null`" in
1596         foox) trnl='\n' ;;
1597         esac
1598 fi
1599 if test X"$trnl" = X; then
1600         case "`echo foo|tr '\012' x 2>/dev/null`" in
1601         foox) trnl='\012' ;;
1602         esac
1603 fi
1604 if test X"$trnl" = X; then
1605         cat <<EOM >&2
1606
1607 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1608
1609 EOM
1610         exit 1
1611 fi
1612
1613 : compute the number of columns on the terminal for proper question formatting
1614 case "$COLUMNS" in
1615 '') COLUMNS='80';;
1616 esac
1617
1618 : set up the echo used in my read
1619 myecho="case \"\$xxxm\" in
1620 '') echo $n \"\$rp $c\" >&4;;
1621 *) case \"\$rp\" in
1622         '') echo $n \"[\$xxxm] $c\";;
1623         *)
1624                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1625                         echo \"\$rp\" >&4
1626                         echo $n \"[\$xxxm] $c\" >&4
1627                 else
1628                         echo $n \"\$rp [\$xxxm] $c\" >&4
1629                 fi
1630                 ;;
1631         esac;;
1632 esac"
1633
1634 : now set up to do reads with possible shell escape and default assignment
1635 cat <<EOSC >myread
1636 $startsh
1637 xxxm=\$dflt
1638 $myecho
1639 ans='!'
1640 case "\$fastread" in
1641 yes) case "\$dflt" in
1642         '') ;;
1643         *) ans='';
1644                 case "\$silent-\$rp" in
1645                 true-) ;;
1646                 *) echo " " >&4;;
1647                 esac;;
1648         esac;;
1649 *) case "\$silent" in
1650         true) case "\$rp" in
1651                 '') ans='';;
1652                 esac;;
1653         esac;;
1654 esac
1655 while expr "X\$ans" : "X!" >/dev/null; do
1656         read answ
1657         set x \$xxxm
1658         shift
1659         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1660         case  "\$answ" in
1661         "!")
1662                 sh 1>&4
1663                 echo " "
1664                 $myecho
1665                 ;;
1666         !*)
1667                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1668                 shift
1669                 sh 1>&4 -c "\$*"
1670                 echo " "
1671                 $myecho
1672                 ;;
1673         "\$ans")
1674                 case "\$ans" in
1675                 \\&*)
1676                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1677                         shift
1678                         case "\$1" in
1679                         -d)
1680                                 fastread=yes
1681                                 echo "(OK, I'll run with -d after this question.)" >&4
1682                                 ;;
1683                         -*)
1684                                 echo "*** Sorry, \$1 not supported yet." >&4
1685                                 ;;
1686                         esac
1687                         $myecho
1688                         ans=!
1689                         ;;
1690                 esac;;
1691         *)
1692                 case "\$aok" in
1693                 y)
1694                         echo "*** Substitution done -- please confirm."
1695                         xxxm="\$ans"
1696                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1697                         xxxm="\$ans"
1698                         ans=!
1699                         ;;
1700                 *)
1701                         echo "*** Error -- try again."
1702                         ans=!
1703                         ;;
1704                 esac
1705                 $myecho
1706                 ;;
1707         esac
1708         case "\$ans\$xxxm\$nostick" in
1709         '')
1710                 ans=!
1711                 $myecho
1712                 ;;
1713         esac
1714 done
1715 case "\$ans" in
1716 '') ans="\$xxxm";;
1717 esac
1718 EOSC
1719
1720 : create .config dir to save info across Configure sessions
1721 test -d ../.config || mkdir ../.config
1722 cat >../.config/README <<EOF
1723 This directory created by Configure to save information that should
1724 persist across sessions for $package.
1725
1726 You may safely delete it if you wish.
1727 EOF
1728
1729 : general instructions
1730 needman=true
1731 firsttime=true
1732 user=`(logname) 2>/dev/null`
1733 case "$user" in
1734 '') user=`whoami 2>&1`;;
1735 esac
1736 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1737         firsttime=false
1738         echo " "
1739         rp='Would you like to see the instructions?'
1740         dflt=n
1741         . ./myread
1742         case "$ans" in
1743         [yY]*) ;;
1744         *) needman=false;;
1745         esac
1746 fi
1747 if $needman; then
1748         cat <<EOH
1749
1750 This installation shell script will examine your system and ask you questions
1751 to determine how the perl5 package should be installed. If you get
1752 stuck on a question, you may use a ! shell escape to start a subshell or
1753 execute a command.  Many of the questions will have default answers in square
1754 brackets; typing carriage return will give you the default.
1755
1756 On some of the questions which ask for file or directory names you are allowed
1757 to use the ~name construct to specify the login directory belonging to "name",
1758 even if you don't have a shell which knows about that.  Questions where this is
1759 allowed will be marked "(~name ok)".
1760
1761 EOH
1762         rp=''
1763         dflt='Type carriage return to continue'
1764         . ./myread
1765         cat <<'EOH'
1766
1767 The prompter used in this script allows you to use shell variables and
1768 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1769 in the default answer, as if the default line was a set of arguments given to a
1770 script shell.  This means you may also use $* to repeat the whole default line,
1771 so you do not have to re-type everything to add something to the default.
1772
1773 Everytime there is a substitution, you will have to confirm.  If there is an
1774 error (e.g. an unmatched backtick), the default answer will remain unchanged
1775 and you will be prompted again.
1776
1777 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1778 the questions and use the computed defaults (or the previous answers if there
1779 was already a config.sh file). Type 'Configure -h' for a list of options.
1780 You may also start interactively and then answer '& -d' at any prompt to turn
1781 on the non-interactive behaviour for the remainder of the execution.
1782
1783 EOH
1784         . ./myread
1785         cat <<EOH
1786
1787 Much effort has been expended to ensure that this shell script will run on any
1788 Unix system.  If despite that it blows up on yours, your best bet is to edit
1789 Configure and run it again.  If you can't run Configure for some reason,
1790 you'll have to generate a config.sh file by hand.  Whatever problems you
1791 have, let me (perlbug@perl.com) know how I blew it.
1792
1793 This installation script affects things in two ways:
1794
1795 1) it may do direct variable substitutions on some of the files included
1796    in this kit.
1797 2) it builds a config.h file for inclusion in C programs.  You may edit
1798    any of these files as the need arises after running this script.
1799
1800 If you make a mistake on a question, there is no easy way to back up to it
1801 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1802 files.  Configure will offer to let you do this before it runs the SH files.
1803
1804 EOH
1805         dflt='Type carriage return to continue'
1806         . ./myread
1807         case "$firsttime" in
1808         true) echo $user >>../.config/instruct;;
1809         esac
1810 fi
1811
1812 : find out where common programs are
1813 echo " "
1814 echo "Locating common programs..." >&4
1815 cat <<EOSC >loc
1816 $startsh
1817 case \$# in
1818 0) exit 1;;
1819 esac
1820 thing=\$1
1821 shift
1822 dflt=\$1
1823 shift
1824 for dir in \$*; do
1825         case "\$thing" in
1826         .)
1827         if test -d \$dir/\$thing; then
1828                 echo \$dir
1829                 exit 0
1830         fi
1831         ;;
1832         *)
1833         for thisthing in \$dir/\$thing; do
1834                 : just loop through to pick last item
1835         done
1836         if test -f \$thisthing; then
1837                 echo \$thisthing
1838                 exit 0
1839         elif test -f \$dir/\$thing.exe; then
1840                 if test -n "$DJGPP"; then
1841                         echo \$dir/\$thing.exe
1842                 else
1843                         : on Eunice apparently
1844                         echo \$dir/\$thing
1845                 fi
1846                 exit 0
1847         fi
1848         ;;
1849         esac
1850 done
1851 echo \$dflt
1852 exit 1
1853 EOSC
1854 chmod +x loc
1855 $eunicefix loc
1856 loclist="
1857 awk
1858 cat
1859 comm
1860 cp
1861 echo
1862 expr
1863 grep
1864 ls
1865 make
1866 mkdir
1867 rm
1868 sed
1869 sort
1870 touch
1871 tr
1872 uniq
1873 "
1874 trylist="
1875 Mcc
1876 ar
1877 byacc
1878 cpp
1879 csh
1880 date
1881 egrep
1882 gzip
1883 less
1884 ln
1885 more
1886 nm
1887 nroff
1888 pg
1889 test
1890 uname
1891 zip
1892 "
1893 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1894 pth="$pth /lib /usr/lib"
1895 for file in $loclist; do
1896         eval xxx=\$$file
1897         case "$xxx" in
1898         /*|?:[\\/]*)
1899                 if test -f "$xxx"; then
1900                         : ok
1901                 else
1902                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1903                         xxx=`./loc $file $file $pth`
1904                 fi
1905                 ;;
1906         '') xxx=`./loc $file $file $pth`;;
1907         *) xxx=`./loc $xxx $xxx $pth`;;
1908         esac
1909         eval $file=$xxx
1910         eval _$file=$xxx
1911         case "$xxx" in
1912         /*)
1913                 echo $file is in $xxx.
1914                 ;;
1915         ?:[\\/]*)
1916                 echo $file is in $xxx.
1917                 ;;
1918         *)
1919                 echo "I don't know where '$file' is, and my life depends on it." >&4
1920                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1921                 exit 1
1922                 ;;
1923         esac
1924 done
1925 echo " "
1926 echo "Don't worry if any of the following aren't found..."
1927 say=offhand
1928 for file in $trylist; do
1929         eval xxx=\$$file
1930         case "$xxx" in
1931         /*|?:[\\/]*)
1932                 if test -f "$xxx"; then
1933                         : ok
1934                 else
1935                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1936                         xxx=`./loc $file $file $pth`
1937                 fi
1938                 ;;
1939         '') xxx=`./loc $file $file $pth`;;
1940         *) xxx=`./loc $xxx $xxx $pth`;;
1941         esac
1942         eval $file=$xxx
1943         eval _$file=$xxx
1944         case "$xxx" in
1945         /*)
1946                 echo $file is in $xxx.
1947                 ;;
1948         ?:[\\/]*)
1949                 echo $file is in $xxx.
1950                 ;;
1951         *)
1952                 echo "I don't see $file out there, $say."
1953                 say=either
1954                 ;;
1955         esac
1956 done
1957 case "$egrep" in
1958 egrep)
1959         echo "Substituting grep for egrep."
1960         egrep=$grep
1961         ;;
1962 esac
1963 case "$ln" in
1964 ln)
1965         echo "Substituting cp for ln."
1966         ln=$cp
1967         ;;
1968 esac
1969 case "$test" in
1970 test)
1971         echo "Hopefully test is built into your sh."
1972         ;;
1973 *)
1974         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1975                 echo "Using the test built into your sh."
1976                 test=test
1977                 _test=test
1978         fi
1979         ;;
1980 esac
1981 case "$echo" in
1982 echo)
1983         echo "Hopefully echo is built into your sh."
1984         ;;
1985 '') ;;
1986 *)
1987         echo " "
1988 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1989         $echo $n "hi there$c" >foo1
1990         echo $n "hi there$c" >foo2
1991         if cmp foo1 foo2 >/dev/null 2>&1; then
1992                 echo "They are compatible.  In fact, they may be identical."
1993         else
1994                 case "$n" in
1995                 '-n') n='' c='\c';;
1996                 *) n='-n' c='';;
1997                 esac
1998                 cat <<FOO
1999 They are not compatible!  You are probably running ksh on a non-USG system.
2000 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2001 have echo built in and we may have to run some Bourne shell scripts.  That
2002 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2003
2004 FOO
2005                 $echo $n "The star should be here-->$c"
2006                 $echo "*"
2007         fi
2008         $rm -f foo1 foo2
2009         ;;
2010 esac
2011
2012 : determine whether symbolic links are supported
2013 echo " "
2014 $touch blurfl
2015 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2016         echo "Symbolic links are supported." >&4
2017         lns="$ln -s"
2018 else
2019         echo "Symbolic links are NOT supported." >&4
2020         lns="$ln"
2021 fi
2022 $rm -f blurfl sym
2023
2024 : see whether [:lower:] and [:upper:] are supported character classes
2025 echo " "
2026 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2027 ABYZ)
2028         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2029         up='[:upper:]'
2030         low='[:lower:]'
2031         ;;
2032 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2033         # (0xc9 and 0xd1), therefore that is a nice testing point.
2034         if test "X$up" = X -o "X$low" = X; then
2035             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2036             ij) up='[A-Z]'
2037                 low='[a-z]'
2038                 ;;
2039             esac
2040         fi
2041         if test "X$up" = X -o "X$low" = X; then
2042             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2043             ij) up='A-Z'
2044                 low='a-z'
2045                 ;;
2046             esac
2047         fi
2048         if test "X$up" = X -o "X$low" = X; then
2049             case "`echo IJ | od -x 2>/dev/null`" in
2050             *C9D1*|*c9d1*)
2051                 echo "Hey, this might be EBCDIC." >&4
2052                 if test "X$up" = X -o "X$low" = X; then
2053                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2054                     ij) up='[A-IJ-RS-Z]'
2055                         low='[a-ij-rs-z]'
2056                         ;;
2057                     esac
2058                 fi
2059                 if test "X$up" = X -o "X$low" = X; then
2060                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2061                     ij) up='A-IJ-RS-Z'
2062                         low='a-ij-rs-z'
2063                         ;;
2064                     esac
2065                 fi
2066                 ;;
2067             esac
2068         fi
2069 esac
2070 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2071 ij)
2072     echo "Using $up and $low to convert case." >&4
2073     ;;
2074 *)
2075     echo "I don't know how to translate letters from upper to lower case." >&4
2076     echo "Your tr is not acting any way I know of." >&4
2077     exit 1
2078     ;;
2079 esac
2080 : set up the translation script tr, must be called with ./tr of course
2081 cat >tr <<EOSC
2082 $startsh
2083 case "\$1\$2" in
2084 '[A-Z][a-z]') exec $tr '$up' '$low';;
2085 '[a-z][A-Z]') exec $tr '$low' '$up';;
2086 esac
2087 exec $tr "\$@"
2088 EOSC
2089 chmod +x tr
2090 $eunicefix tr
2091
2092 : Try to determine whether config.sh was made on this system
2093 case "$config_sh" in
2094 '')
2095 myuname=`$uname -a 2>/dev/null`
2096 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2097 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2098 # because the A-Z/a-z are not consecutive.
2099 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2100         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2101 newmyuname="$myuname"
2102 dflt=n
2103 case "$knowitall" in
2104 '')
2105         if test -f ../config.sh; then
2106                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2107                         eval "`grep myuname= ../config.sh`"
2108                 fi
2109                 if test "X$myuname" = "X$newmyuname"; then
2110                         dflt=y
2111                 fi
2112         fi
2113         ;;
2114 *) dflt=y;;
2115 esac
2116
2117 : Get old answers from old config file if Configure was run on the
2118 : same system, otherwise use the hints.
2119 hint=default
2120 cd ..
2121 if test -f config.sh; then
2122         echo " "
2123         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2124         . UU/myread
2125         case "$ans" in
2126         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2127         *)  echo "Fetching default answers from your old config.sh file..." >&4
2128                 tmp_n="$n"
2129                 tmp_c="$c"
2130                 tmp_sh="$sh"
2131                 . ./config.sh
2132                 cp config.sh UU
2133                 n="$tmp_n"
2134                 c="$tmp_c"
2135                 : Older versions did not always set $sh.  Catch re-use of such
2136                 : an old config.sh.
2137                 case "$sh" in
2138                 '') sh="$tmp_sh" ;;
2139                 esac
2140                 hint=previous
2141                 ;;
2142         esac
2143 fi
2144 if test ! -f config.sh; then
2145         $cat <<EOM
2146
2147 First time through, eh?  I have some defaults handy for some systems
2148 that need some extra help getting the Configure answers right:
2149
2150 EOM
2151         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2152         dflt=''
2153         : Half the following guesses are probably wrong... If you have better
2154         : tests or hints, please send them to perlbug@perl.com
2155         : The metaconfig authors would also appreciate a copy...
2156         $test -f /irix && osname=irix
2157         $test -f /xenix && osname=sco_xenix
2158         $test -f /dynix && osname=dynix
2159         $test -f /dnix && osname=dnix
2160         $test -f /lynx.os && osname=lynxos
2161         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2162         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2163         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2164         $test -f /bin/mips && /bin/mips && osname=mips
2165         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2166                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2167         $test -d /usr/apollo/bin && osname=apollo
2168         $test -f /etc/saf/_sactab && osname=svr4
2169         $test -d /usr/include/minix && osname=minix
2170         if $test -d /MachTen -o -d /MachTen_Folder; then
2171                 osname=machten
2172                 if $test -x /sbin/version; then
2173                         osvers=`/sbin/version | $awk '{print $2}' |
2174                         $sed -e 's/[A-Za-z]$//'`
2175                 elif $test -x /usr/etc/version; then
2176                         osvers=`/usr/etc/version | $awk '{print $2}' |
2177                         $sed -e 's/[A-Za-z]$//'`
2178                 else
2179                         osvers="$2.$3"
2180                 fi
2181         fi
2182
2183         $test -f /sys/posix.dll &&
2184                 $test -f /usr/bin/what &&
2185                 set X `/usr/bin/what /sys/posix.dll` &&
2186                 $test "$3" = UWIN &&
2187                 osname=uwin &&
2188                 osvers="$5"
2189
2190         if $test -f $uname; then
2191                 set X $myuname
2192                 shift
2193
2194                 case "$5" in
2195                 fps*) osname=fps ;;
2196                 mips*)
2197                         case "$4" in
2198                         umips) osname=umips ;;
2199                         *) osname=mips ;;
2200                         esac;;
2201                 [23]100) osname=mips ;;
2202                 next*) osname=next ;;
2203                 i386*)
2204                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2205                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2206                                 osname='sco'
2207                                 osvers=$tmp
2208                         elif $test -f /etc/kconfig; then
2209                                 osname=isc
2210                                 if test "$lns" = "$ln -s"; then
2211                                         osvers=4
2212                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2213                                         osvers=3
2214                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2215                                         osvers=2
2216                                 fi
2217                         fi
2218                         tmp=''
2219                         ;;
2220                 pc*)
2221                         if test -n "$DJGPP"; then
2222                                 osname=dos
2223                                 osvers=djgpp
2224                         fi
2225                         ;;
2226                 esac
2227
2228                 case "$1" in
2229                 aix) osname=aix
2230                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2231                         case "$tmp" in
2232                         'not found') osvers="$4"."$3" ;;
2233                         '<3240'|'<>3240') osvers=3.2.0 ;;
2234                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2235                         '=3250'|'>3250') osvers=3.2.5 ;;
2236                         *) osvers=$tmp;;
2237                         esac
2238                         ;;
2239                 bsd386) osname=bsd386
2240                         osvers=`$uname -r`
2241                         ;;
2242                 cygwin*) osname=cygwin
2243                         osvers="$3"
2244                         ;;
2245                 *dc.osx) osname=dcosx
2246                         osvers="$3"
2247                         ;;
2248                 dnix) osname=dnix
2249                         osvers="$3"
2250                         ;;
2251                 domainos) osname=apollo
2252                         osvers="$3"
2253                         ;;
2254                 dgux) osname=dgux 
2255                         osvers="$3"
2256                         ;;
2257                 dynixptx*) osname=dynixptx
2258                         osvers=`echo "$4"|sed 's/^v//'`
2259                         ;;
2260                 freebsd) osname=freebsd 
2261                         osvers="$3" ;;
2262                 genix) osname=genix ;;
2263                 hp*) osname=hpux 
2264                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2265                         ;;
2266                 irix*) osname=irix
2267                         case "$3" in
2268                         4*) osvers=4 ;;
2269                         5*) osvers=5 ;;
2270                         *)      osvers="$3" ;;
2271                         esac
2272                         ;;
2273                 linux) osname=linux
2274                         case "$3" in
2275                         *)      osvers="$3" ;;
2276                         esac
2277                         ;;
2278                 MiNT) osname=mint
2279                         ;;
2280                 netbsd*) osname=netbsd
2281                         osvers="$3"
2282                         ;;
2283                 news-os) osvers="$3"
2284                         case "$3" in
2285                         4*) osname=newsos4 ;;
2286                         *) osname=newsos ;;
2287                         esac
2288                         ;;
2289                 next*) osname=next ;;
2290                 POSIX-BC | posix-bc ) osname=posix-bc
2291                         osvers="$3"
2292                         ;;
2293                 powerux | power_ux | powermax_os | powermaxos | \
2294                 powerunix | power_unix) osname=powerux
2295                         osvers="$3"
2296                         ;;
2297                 qnx) osname=qnx
2298                         osvers="$4"
2299                         ;;
2300                 solaris) osname=solaris
2301                         case "$3" in
2302                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2303                         *)      osvers="$3" ;;
2304                         esac
2305                         ;;
2306                 sunos) osname=sunos
2307                         case "$3" in
2308                         5*) osname=solaris
2309                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2310                         *)      osvers="$3" ;;
2311                         esac
2312                         ;;
2313                 titanos) osname=titanos
2314                         case "$3" in
2315                         1*) osvers=1 ;;
2316                         2*) osvers=2 ;;
2317                         3*) osvers=3 ;;
2318                         4*) osvers=4 ;;
2319                         *)      osvers="$3" ;;
2320                         esac
2321                         ;;
2322                 ultrix) osname=ultrix
2323                         osvers="$3"
2324                         ;;
2325                 osf1|mls+)      case "$5" in
2326                                 alpha)
2327                                         osname=dec_osf
2328                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2329                                         ;;
2330                         hp*)    osname=hp_osf1  ;;
2331                         mips)   osname=mips_osf1 ;;
2332                         esac
2333                         ;;
2334                 unixware) osname=svr5
2335                         osvers="$4"
2336                         ;;
2337                 uts) osname=uts
2338                         osvers="$3"
2339                         ;;
2340                 $2) case "$osname" in
2341                         *isc*) ;;
2342                         *freebsd*) ;;
2343                         svr*)
2344                                 : svr4.x or possibly later
2345                                 case "svr$3" in 
2346                                 ${osname}*)
2347                                         osname=svr$3
2348                                         osvers=$4
2349                                         ;;
2350                                 esac
2351                                 case "$osname" in
2352                                 svr4.0)
2353                                         : Check for ESIX
2354                                         if test -f /stand/boot ; then
2355                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2356                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2357                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2358                                                         if test -n "$isesix"; then
2359                                                                 osname=esix4
2360                                                         fi
2361                                                 fi
2362                                         fi
2363                                         ;;
2364                                 esac
2365                                 ;;
2366                         *)      if test -f /etc/systemid; then
2367                                         osname=sco
2368                                         set `echo $3 | $sed 's/\./ /g'` $4
2369                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2370                                                 osvers=$1.$2.$3
2371                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2372                                                 osvers=$1.$2
2373                                         elif $test -f $src/hints/sco_$1.sh; then
2374                                                 osvers=$1
2375                                         fi
2376                                 else
2377                                         case "$osname" in
2378                                         '') : Still unknown.  Probably a generic Sys V.
2379                                                 osname="sysv"
2380                                                 osvers="$3"
2381                                                 ;;
2382                                         esac
2383                                 fi
2384                                 ;;
2385                         esac
2386                         ;;
2387                 *)      case "$osname" in
2388                         '') : Still unknown.  Probably a generic BSD.
2389                                 osname="$1"
2390                                 osvers="$3"
2391                                 ;;
2392                         esac
2393                         ;;
2394                 esac
2395         else
2396                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2397                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2398                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2399                                 osname=news_os
2400                         fi
2401                         $rm -f UU/kernel.what
2402                 elif test -d c:/.; then
2403                         set X $myuname
2404                         osname=os2
2405                         osvers="$5"
2406                 fi
2407         fi
2408         
2409         : Now look for a hint file osname_osvers, unless one has been
2410         : specified already.
2411         case "$hintfile" in
2412         ''|' ')
2413                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2414                 : Also try without trailing minor version numbers.
2415                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2416                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2417                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2418                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2419                 case "$file" in
2420                 '') dflt=none ;;
2421                 *)  case "$osvers" in
2422                         '') dflt=$file
2423                                 ;;
2424                         *)  if $test -f $src/hints/$file.sh ; then
2425                                         dflt=$file
2426                                 elif $test -f $src/hints/$xfile.sh ; then
2427                                         dflt=$xfile
2428                                 elif $test -f $src/hints/$xxfile.sh ; then
2429                                         dflt=$xxfile
2430                                 elif $test -f $src/hints/$xxxfile.sh ; then
2431                                         dflt=$xxxfile
2432                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2433                                         dflt=$xxxxfile
2434                                 elif $test -f "$src/hints/${osname}.sh" ; then
2435                                         dflt="${osname}"
2436                                 else
2437                                         dflt=none
2438                                 fi
2439                                 ;;
2440                         esac
2441                         ;;
2442                 esac
2443                 if $test -f Policy.sh ; then
2444                         case "$dflt" in
2445                         *Policy*) ;;
2446                         none) dflt="Policy" ;;
2447                         *) dflt="Policy $dflt" ;;
2448                         esac
2449                 fi
2450                 ;;
2451         *)
2452                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2453                 ;;
2454         esac
2455
2456         if $test -f Policy.sh ; then
2457                 $cat <<EOM
2458
2459 There's also a Policy hint file available, which should make the
2460 site-specific (policy) questions easier to answer.
2461 EOM
2462
2463         fi
2464
2465         $cat <<EOM
2466
2467 You may give one or more space-separated answers, or "none" if appropriate.
2468 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2469 is a good thing.  DO NOT give a wrong version or a wrong OS.
2470
2471 EOM
2472
2473         rp="Which of these apply, if any?"
2474         . UU/myread
2475         tans=$ans
2476         for file in $tans; do
2477                 if $test X$file = XPolicy -a -f Policy.sh; then
2478                         . Policy.sh
2479                         $cat Policy.sh >> UU/config.sh
2480                 elif $test -f $src/hints/$file.sh; then
2481                         . $src/hints/$file.sh
2482                         $cat $src/hints/$file.sh >> UU/config.sh
2483                 elif $test X$tans = X -o X$tans = Xnone ; then
2484                         : nothing
2485                 else
2486                         : Give one chance to correct a possible typo.
2487                         echo "$file.sh does not exist"
2488                         dflt=$file
2489                         rp="hint to use instead?"
2490                         . UU/myread
2491                         for file in $ans; do
2492                                 if $test -f "$src/hints/$file.sh"; then
2493                                         . $src/hints/$file.sh
2494                                         $cat $src/hints/$file.sh >> UU/config.sh
2495                                 elif $test X$ans = X -o X$ans = Xnone ; then
2496                                         : nothing
2497                                 else
2498                                         echo "$file.sh does not exist -- ignored."
2499                                 fi
2500                         done
2501                 fi
2502         done
2503
2504         hint=recommended
2505         : Remember our hint file for later.
2506         if $test -f "$src/hints/$file.sh" ; then
2507                 hintfile="$file"
2508         else
2509                 hintfile=''
2510         fi
2511 fi
2512 cd UU
2513 ;;
2514 *)
2515         echo " "
2516         echo "Fetching default answers from $config_sh..." >&4
2517         tmp_n="$n"
2518         tmp_c="$c"
2519         cd ..
2520         cp $config_sh config.sh 2>/dev/null
2521         chmod +w config.sh
2522         . ./config.sh
2523         cd UU
2524         cp ../config.sh .
2525         n="$tmp_n"
2526         c="$tmp_c"
2527         hint=previous
2528         ;;
2529 esac
2530 test "$override" && . ./optdef.sh
2531 myuname="$newmyuname"
2532
2533 : Restore computed paths
2534 for file in $loclist $trylist; do
2535         eval $file="\$_$file"
2536 done
2537
2538 cat << EOM
2539
2540 Configure uses the operating system name and version to set some defaults.
2541 The default value is probably right if the name rings a bell. Otherwise,
2542 since spelling matters for me, either accept the default or answer "none"
2543 to leave it blank.
2544
2545 EOM
2546 case "$osname" in
2547         ''|' ')
2548                 case "$hintfile" in
2549                 ''|' '|none) dflt=none ;;
2550                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2551                 esac
2552                 ;;
2553         *) dflt="$osname" ;;
2554 esac
2555 rp="Operating system name?"
2556 . ./myread
2557 case "$ans" in
2558 none)  osname='' ;;
2559 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2560 esac
2561 echo " "
2562 case "$osvers" in
2563         ''|' ')
2564                 case "$hintfile" in
2565                 ''|' '|none) dflt=none ;;
2566                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2567                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2568                         case "$dflt" in
2569                         ''|' ') dflt=none ;;
2570                         esac
2571                         ;;
2572                 esac
2573                 ;;
2574         *) dflt="$osvers" ;;
2575 esac
2576 rp="Operating system version?"
2577 . ./myread
2578 case "$ans" in
2579 none)  osvers='' ;;
2580 *) osvers="$ans" ;;
2581 esac
2582
2583
2584 . ./posthint.sh
2585
2586 : who configured the system
2587 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2588 cf_by=`(logname) 2>/dev/null`
2589 case "$cf_by" in
2590 "")
2591         cf_by=`(whoami) 2>/dev/null`
2592         case "$cf_by" in
2593         "") cf_by=unknown ;;
2594         esac ;;
2595 esac
2596
2597 : set up the script used to warn in case of inconsistency
2598 cat <<EOS >whoa
2599 $startsh
2600 EOS
2601 cat <<'EOSC' >>whoa
2602 dflt=y
2603 echo " "
2604 echo "*** WHOA THERE!!! ***" >&4
2605 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2606 rp="    Keep the $hint value?"
2607 . ./myread
2608 case "$ans" in
2609 y) td=$was; tu=$was;;
2610 esac
2611 EOSC
2612
2613 : function used to set $1 to $val
2614 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2615 case "$val$was" in
2616 $define$undef) . ./whoa; eval "$var=\$td";;
2617 $undef$define) . ./whoa; eval "$var=\$tu";;
2618 *) eval "$var=$val";;
2619 esac'
2620
2621 case "$usethreads" in
2622 $define|true|[yY]*)     dflt='y';;
2623 *) dflt='n';;
2624 esac
2625 cat <<EOM
2626
2627 Perl can be built to take advantage of threads on some systems.
2628 To do so, Configure can be run with -Dusethreads.
2629
2630 Note that threading is a highly experimental feature, and
2631 some known race conditions still remain.  If you choose to try
2632 it, be very sure to not actually deploy it for production
2633 purposes.  README.threads has more details, and is required
2634 reading if you enable threads.
2635
2636 If this doesn't make any sense to you, just accept the default '$dflt'.
2637 EOM
2638 rp='Build a threading Perl?'
2639 . ./myread
2640 case "$ans" in
2641 y|Y)    val="$define" ;;
2642 *)      val="$undef" ;;
2643 esac
2644 set usethreads
2645 eval $setvar
2646
2647 case "$usethreads" in
2648 $define)
2649         $cat <<EOM
2650
2651 As of 5.5.640, Perl has two different internal threading implementations,
2652 the 5.005 version (5005threads) and an interpreter-based version
2653 (ithreads) that has one interpreter per thread.  Both are very 
2654 experimental.  This arrangement exists to help developers work out
2655 which one is better.
2656
2657 If you're a casual user, you probably don't want interpreter-threads
2658 at this time.  There doesn't yet exist a way to create threads from
2659 within Perl in this model, i.e., "use Thread;" will NOT work.
2660 EOM
2661         : Default to ithreads unless overridden on command line or with
2662         : old config.sh
2663         dflt='y'
2664         case "$use5005threads" in
2665                 $define|true|[yY]*) dflt='n';;
2666         esac
2667         case "$useithreads" in
2668                 $undef|false|[nN]*) dflt='n';;
2669         esac
2670         rp='Use interpreter-based ithreads?'
2671         . ./myread
2672         case "$ans" in
2673         y|Y)    val="$define" ;;
2674         *)      val="$undef" ;;
2675         esac
2676         set useithreads
2677         eval $setvar
2678         : Now set use5005threads to the opposite value.
2679         case "$useithreads" in
2680         $define) val="$undef" ;;
2681         *) val="$define" ;;
2682         esac
2683         set use5005threads
2684         eval $setvar
2685         ;;
2686 *)
2687         useithreads="$undef"
2688         use5005threads="$undef"
2689         ;;
2690 esac
2691
2692 case "$d_oldpthreads" in
2693 '')     : Configure tests would be welcome here.  For now, assume undef.
2694         val="$undef" ;;
2695 *)      val="$d_oldpthreads" ;;
2696 esac
2697 set d_oldpthreads
2698 eval $setvar
2699
2700
2701 case "$usethreads" in
2702 "$define"|true|[yY]*)
2703 : Look for a hint-file generated 'call-back-unit'.  If the
2704 : user has specified that a threading perl is to be built,
2705 : we may need to set or change some other defaults.
2706         if $test -f usethreads.cbu; then
2707                 echo "Your platform has some specific hints for threaded builds, using them..."
2708                 . ./usethreads.cbu
2709         else
2710                 $cat <<EOM
2711 (Your platform doesn't have any specific hints for threaded builds.
2712  Assuming POSIX threads, then.)
2713 EOM
2714         fi
2715         ;;
2716 esac
2717
2718 cat <<EOM
2719
2720 Perl can be built so that multiple Perl interpreters can coexist
2721 within the same Perl executable.
2722 EOM
2723
2724 case "$useithreads" in
2725 $define)
2726         cat <<EOM
2727 This multiple interpreter support is required for interpreter-based threads.
2728 EOM
2729         val="$define"
2730         ;;
2731 *)      case "$usemultiplicity" in
2732         $define|true|[yY]*)     dflt='y';;
2733         *) dflt='n';;
2734         esac
2735         echo " "
2736         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2737         rp='Build Perl for multiplicity?'
2738         . ./myread
2739         case "$ans" in
2740         y|Y)    val="$define" ;;
2741         *)      val="$undef" ;;
2742         esac
2743         ;;
2744 esac
2745 set usemultiplicity
2746 eval $setvar
2747
2748 : determine where manual pages are on this system
2749 echo " "
2750 case "$sysman" in
2751 '') 
2752         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2753         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2754         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2755         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2756         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2757         sysman=`./loc . /usr/man/man1 $syspath`
2758         ;;
2759 esac
2760 if $test -d "$sysman"; then
2761         echo "System manual is in $sysman." >&4
2762 else
2763         echo "Could not find manual pages in source form." >&4
2764 fi
2765
2766 : see what memory models we can support
2767 case "$models" in
2768 '')
2769         $cat >pdp11.c <<'EOP'
2770 int main() {
2771 #ifdef pdp11
2772         exit(0);
2773 #else
2774         exit(1);
2775 #endif
2776 }
2777 EOP
2778         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2779         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2780                 dflt='unsplit split'
2781         else
2782                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2783                 case "$tans" in
2784                 X) dflt='none';;
2785                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2786                                 dflt='small'
2787                         else
2788                                 dflt=''
2789                         fi
2790                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2791                                 dflt="$dflt medium"
2792                         fi
2793                         if $test -d /lib/large || $test -d /usr/lib/large; then
2794                                 dflt="$dflt large"
2795                         fi
2796                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2797                                 dflt="$dflt huge"
2798                         fi
2799                 esac
2800         fi;;
2801 *) dflt="$models";;
2802 esac
2803 $cat <<EOM
2804  
2805 Some systems have different model sizes.  On most systems they are called
2806 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2807 split.  If your system doesn't support different memory models, say "none".
2808 If you wish to force everything to one memory model, say "none" here and
2809 put the appropriate flags later when it asks you for other cc and ld flags.
2810 Venix systems may wish to put "none" and let the compiler figure things out.
2811 (In the following question multiple model names should be space separated.)
2812
2813 The default for most systems is "none".
2814
2815 EOM
2816 rp="Which memory models are supported?"
2817 . ./myread
2818 models="$ans"
2819
2820 case "$models" in
2821 none)
2822         small=''
2823         medium=''
2824         large=''
2825         huge=''
2826         unsplit=''
2827         split=''
2828         ;;
2829 *split)
2830         case "$split" in
2831         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2832                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2833                         dflt='-i'
2834                 else
2835                         dflt='none'
2836                 fi;;
2837         *) dflt="$split";;
2838         esac
2839         rp="What flag indicates separate I and D space?"
2840         . ./myread
2841         tans="$ans"
2842         case "$tans" in
2843         none) tans='';;
2844         esac
2845         split="$tans"
2846         unsplit='';;
2847 *large*|*small*|*medium*|*huge*)
2848         case "$models" in
2849         *large*)
2850                 case "$large" in
2851                 '') dflt='-Ml';;
2852                 *) dflt="$large";;
2853                 esac
2854         rp="What flag indicates large model?"
2855         . ./myread
2856         tans="$ans"
2857         case "$tans" in
2858         none) tans='';
2859         esac
2860         large="$tans";;
2861         *) large='';;
2862         esac
2863         case "$models" in
2864         *huge*) case "$huge" in
2865                 '') dflt='-Mh';;
2866                 *) dflt="$huge";;
2867                 esac
2868                 rp="What flag indicates huge model?"
2869                 . ./myread
2870                 tans="$ans"
2871                 case "$tans" in
2872                 none) tans='';
2873                 esac
2874                 huge="$tans";;
2875         *) huge="$large";;
2876         esac
2877         case "$models" in
2878         *medium*) case "$medium" in
2879                 '') dflt='-Mm';;
2880                 *) dflt="$medium";;
2881                 esac
2882                 rp="What flag indicates medium model?"
2883                 . ./myread
2884                 tans="$ans"
2885                 case "$tans" in
2886                 none) tans='';
2887                 esac
2888                 medium="$tans";;
2889         *) medium="$large";;
2890         esac
2891         case "$models" in
2892         *small*) case "$small" in
2893                 '') dflt='none';;
2894                 *) dflt="$small";;
2895                 esac
2896                 rp="What flag indicates small model?"
2897                 . ./myread
2898                 tans="$ans"
2899                 case "$tans" in
2900                 none) tans='';
2901                 esac
2902                 small="$tans";;
2903         *) small='';;
2904         esac
2905         ;;
2906 *)
2907         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2908         ;;
2909 esac
2910 $rm -f pdp11.* pdp11
2911
2912 : make some quick guesses about what we are up against
2913 echo " "
2914 $echo $n "Hmm...  $c"
2915 echo exit 1 >bsd
2916 echo exit 1 >usg
2917 echo exit 1 >v7
2918 echo exit 1 >osf1
2919 echo exit 1 >eunice
2920 echo exit 1 >xenix
2921 echo exit 1 >venix
2922 echo exit 1 >os2
2923 d_bsd="$undef"
2924 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2925 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2926 then
2927         echo "Looks kind of like an OSF/1 system, but we'll see..."
2928         echo exit 0 >osf1
2929 elif test `echo abc | tr a-z A-Z` = Abc ; then
2930         xxx=`./loc addbib blurfl $pth`
2931         if $test -f $xxx; then
2932         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2933                 echo exit 0 >bsd
2934                 echo exit 0 >usg
2935         else
2936                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2937                         echo "Looks kind of like an extended USG system, but we'll see..."
2938                 else
2939                         echo "Looks kind of like a USG system, but we'll see..."
2940                 fi
2941                 echo exit 0 >usg
2942         fi
2943 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2944         echo "Looks kind of like a BSD system, but we'll see..."
2945         d_bsd="$define"
2946         echo exit 0 >bsd
2947 else
2948         echo "Looks kind of like a Version 7 system, but we'll see..."
2949         echo exit 0 >v7
2950 fi
2951 case "$eunicefix" in
2952 *unixtovms*)
2953         $cat <<'EOI'
2954 There is, however, a strange, musty smell in the air that reminds me of
2955 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2956 EOI
2957         echo exit 0 >eunice
2958         d_eunice="$define"
2959 : it so happens the Eunice I know will not run shell scripts in Unix format
2960         ;;
2961 *)
2962         echo " "
2963         echo "Congratulations.  You aren't running Eunice."
2964         d_eunice="$undef"
2965         ;;
2966 esac
2967 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2968 case "$p_" in
2969 :) ;;
2970 *)
2971         $cat <<'EOI'
2972 I have the feeling something is not exactly right, however...don't tell me...
2973 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2974 EOI
2975         echo exit 0 >os2
2976         ;;
2977 esac
2978 if test -f /xenix; then
2979         echo "Actually, this looks more like a XENIX system..."
2980         echo exit 0 >xenix
2981         d_xenix="$define"
2982 else
2983         echo " "
2984         echo "It's not Xenix..."
2985         d_xenix="$undef"
2986 fi
2987 chmod +x xenix
2988 $eunicefix xenix
2989 if test -f /venix; then
2990         echo "Actually, this looks more like a VENIX system..."
2991         echo exit 0 >venix
2992 else
2993         echo " "
2994         if ./xenix; then
2995                 : null
2996         else
2997                 echo "Nor is it Venix..."
2998         fi
2999 fi
3000 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3001 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3002 $rm -f foo
3003
3004 : see if we need a special compiler
3005 echo " "
3006 if ./usg; then
3007         case "$cc" in
3008         '') case "$Mcc" in
3009                 /*) dflt='Mcc';;
3010                 *) case "$large" in
3011                         -M*) dflt='cc';;
3012                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3013                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3014                                                 dflt='cc'
3015                                         else
3016                                                 dflt='cc -M'
3017                                         fi
3018                                 else
3019                                         dflt='cc'
3020                                 fi;;
3021                         esac;;
3022                 esac;;
3023         *)  dflt="$cc";;
3024         esac
3025         case "$dflt" in
3026         *M*)    $cat <<'EOM'
3027 On some older systems the default C compiler will not resolve multiple global
3028 references that happen to have the same name.  On some such systems the "Mcc"
3029 command may be used to force these to be resolved.  On other systems a "cc -M"
3030 command is required.  (Note that the -M flag on other systems indicates a
3031 memory model to use!) If you have the Gnu C compiler, you might wish to use
3032 that instead.
3033
3034 EOM
3035         ;;
3036         esac
3037         rp="Use which C compiler?"
3038         . ./myread
3039         cc="$ans"
3040 else
3041         case "$cc" in
3042         '') dflt=cc;;
3043         *) dflt="$cc";;
3044         esac
3045         rp="Use which C compiler?"
3046         . ./myread
3047         cc="$ans"
3048 fi
3049 : Look for a hint-file generated 'call-back-unit'.  Now that the
3050 : user has specified the compiler, we may need to set or change some
3051 : other defaults.
3052 if $test -f cc.cbu; then
3053     . ./cc.cbu
3054 fi
3055 echo " "
3056 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3057 $cat >gccvers.c <<EOM
3058 #include <stdio.h>
3059 int main() {
3060 #ifdef __GNUC__
3061 #ifdef __VERSION__
3062         printf("%s\n", __VERSION__);
3063 #else
3064         printf("%s\n", "1");
3065 #endif
3066 #endif
3067         exit(0);
3068 }
3069 EOM
3070 if $cc $ldflags -o gccvers gccvers.c; then
3071         gccversion=`./gccvers`
3072         case "$gccversion" in
3073         '') echo "You are not using GNU cc." ;;
3074         *)  echo "You are using GNU cc $gccversion."
3075             ;;
3076         esac
3077 else
3078         echo " "
3079         echo "*** WHOA THERE!!! ***" >&4
3080         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3081         case "$knowitall" in
3082         '')
3083         echo "    You'd better start hunting for one and let me know about it." >&4
3084                 exit 1
3085                 ;;
3086         esac
3087 fi
3088 $rm -f gccvers*
3089 case "$gccversion" in
3090 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3091 esac
3092
3093 : decide how portable to be.  Allow command line overrides.
3094 case "$d_portable" in
3095 "$undef") ;;
3096 *)      d_portable="$define" ;;
3097 esac
3098
3099 : set up shell script to do ~ expansion
3100 cat >filexp <<EOSS
3101 $startsh
3102 : expand filename
3103 case "\$1" in
3104  ~/*|~)
3105         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3106         ;;
3107  ~*)
3108         if $test -f /bin/csh; then
3109                 /bin/csh -f -c "glob \$1"
3110                 failed=\$?
3111                 echo ""
3112                 exit \$failed
3113         else
3114                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3115                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3116                 if $test ! -d "\$dir"; then
3117                         me=\`basename \$0\`
3118                         echo "\$me: can't locate home directory for: \$name" >&2
3119                         exit 1
3120                 fi
3121                 case "\$1" in
3122                 */*)
3123                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3124                         ;;
3125                 *)
3126                         echo \$dir
3127                         ;;
3128                 esac
3129         fi
3130         ;;
3131 *)
3132         echo \$1
3133         ;;
3134 esac
3135 EOSS
3136 chmod +x filexp
3137 $eunicefix filexp
3138
3139 : now set up to get a file name
3140 cat <<EOS >getfile
3141 $startsh
3142 EOS
3143 cat <<'EOSC' >>getfile
3144 tilde=''
3145 fullpath=''
3146 already=''
3147 skip=''
3148 none_ok=''
3149 exp_file=''
3150 nopath_ok=''
3151 orig_rp="$rp"
3152 orig_dflt="$dflt"
3153 case "$gfpth" in
3154 '') gfpth='.' ;;
3155 esac
3156
3157 case "$fn" in
3158 *\(*)
3159         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3160         fn=`echo $fn | sed 's/(.*)//'`
3161         ;;
3162 esac
3163
3164 case "$fn" in
3165 *:*)
3166         loc_file=`expr $fn : '.*:\(.*\)'`
3167         fn=`expr $fn : '\(.*\):.*'`
3168         ;;
3169 esac
3170
3171 case "$fn" in
3172 *~*) tilde=true;;
3173 esac
3174 case "$fn" in
3175 */*) fullpath=true;;
3176 esac
3177 case "$fn" in
3178 *+*) skip=true;;
3179 esac
3180 case "$fn" in
3181 *n*) none_ok=true;;
3182 esac
3183 case "$fn" in
3184 *e*) exp_file=true;;
3185 esac
3186 case "$fn" in
3187 *p*) nopath_ok=true;;
3188 esac
3189
3190 case "$fn" in
3191 *f*) type='File';;
3192 *d*) type='Directory';;
3193 *l*) type='Locate';;
3194 esac
3195
3196 what="$type"
3197 case "$what" in
3198 Locate) what='File';;
3199 esac
3200
3201 case "$exp_file" in
3202 '')
3203         case "$d_portable" in
3204         "$define") ;;
3205         *) exp_file=true;;
3206         esac
3207         ;;
3208 esac
3209
3210 cd ..
3211 while test "$type"; do
3212         redo=''
3213         rp="$orig_rp"
3214         dflt="$orig_dflt"
3215         case "$tilde" in
3216         true) rp="$rp (~name ok)";;
3217         esac
3218         . UU/myread
3219         if test -f UU/getfile.ok && \
3220                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3221         then
3222                 value="$ans"
3223                 ansexp="$ans"
3224                 break
3225         fi
3226         case "$ans" in
3227         none)
3228                 value=''
3229                 ansexp=''
3230                 case "$none_ok" in
3231                 true) type='';;
3232                 esac
3233                 ;;
3234         *)
3235                 case "$tilde" in
3236                 '') value="$ans"
3237                         ansexp="$ans";;
3238                 *)
3239                         value=`UU/filexp $ans`
3240                         case $? in
3241                         0)
3242                                 if test "$ans" != "$value"; then
3243                                         echo "(That expands to $value on this system.)"
3244                                 fi
3245                                 ;;
3246                         *) value="$ans";;
3247                         esac
3248                         ansexp="$value"
3249                         case "$exp_file" in
3250                         '') value="$ans";;
3251                         esac
3252                         ;;
3253                 esac
3254                 case "$fullpath" in
3255                 true)
3256                         case "$ansexp" in
3257                         /*) value="$ansexp" ;;
3258                         *)
3259                                 redo=true
3260                                 case "$already" in
3261                                 true)
3262                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3263                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3264                                         ;;
3265                                 *)
3266                                 echo "Please give a full path name, starting with slash." >&4
3267                                         case "$tilde" in
3268                                         true)
3269                                 echo "Note that using ~name is ok provided it expands well." >&4
3270                                                 already=true
3271                                                 ;;
3272                                         esac
3273                                 esac
3274                                 ;;
3275                         esac
3276                         ;;
3277                 esac
3278                 case "$redo" in
3279                 '')
3280                         case "$type" in
3281                         File)
3282                                 for fp in $gfpth; do
3283                                         if test "X$fp" = X.; then
3284                                             pf="$ansexp"
3285                                         else    
3286                                             pf="$fp/$ansexp"
3287                                         fi
3288                                         if test -f "$pf"; then
3289                                                 type=''
3290                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3291                                         then
3292                                                 echo "($value is not a plain file, but that's ok.)"
3293                                                 type=''
3294                                         fi
3295                                         if test X"$type" = X; then
3296                                             value="$pf"
3297                                             break
3298                                         fi
3299                                 done
3300                                 ;;
3301                         Directory)
3302                                 for fp in $gfpth; do
3303                                         if test "X$fp" = X.; then
3304                                             pf="$ansexp"
3305                                         else    
3306                                             pf="$fp/$ansexp"
3307                                         fi
3308                                         if test -d "$pf"; then
3309                                                 type=''
3310                                                 value="$pf"
3311                                                 break
3312                                         fi
3313                                 done
3314                                 ;;
3315                         Locate)
3316                                 if test -d "$ansexp"; then
3317                                         echo "(Looking for $loc_file in directory $value.)"
3318                                         value="$value/$loc_file"
3319                                         ansexp="$ansexp/$loc_file"
3320                                 fi
3321                                 if test -f "$ansexp"; then
3322                                         type=''
3323                                 fi
3324                                 case "$nopath_ok" in
3325                                 true)   case "$value" in
3326                                         */*) ;;
3327                                         *)      echo "Assuming $value will be in people's path."
3328                                                 type=''
3329                                                 ;;
3330                                         esac
3331                                         ;;
3332                                 esac
3333                                 ;;
3334                         esac
3335
3336                         case "$skip" in
3337                         true) type='';
3338                         esac
3339
3340                         case "$type" in
3341                         '') ;;
3342                         *)
3343                                 if test "$fastread" = yes; then
3344                                         dflt=y
3345                                 else
3346                                         dflt=n
3347                                 fi
3348                                 rp="$what $value doesn't exist.  Use that name anyway?"
3349                                 . UU/myread
3350                                 dflt=''
3351                                 case "$ans" in
3352                                 y*) type='';;
3353                                 *) echo " ";;
3354                                 esac
3355                                 ;;
3356                         esac
3357                         ;;
3358                 esac
3359                 ;;
3360         esac
3361 done
3362 cd UU
3363 ans="$value"
3364 rp="$orig_rp"
3365 dflt="$orig_dflt"
3366 rm -f getfile.ok
3367 test "X$gfpthkeep" != Xy && gfpth=""
3368 EOSC
3369
3370 : What should the include directory be ?
3371 echo " "
3372 $echo $n "Hmm...  $c"
3373 dflt='/usr/include'
3374 incpath=''
3375 mips_type=''
3376 if $test -f /bin/mips && /bin/mips; then
3377         echo "Looks like a MIPS system..."
3378         $cat >usr.c <<'EOCP'
3379 #ifdef SYSTYPE_BSD43
3380 /bsd43
3381 #endif
3382 EOCP
3383         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3384                 dflt='/bsd43/usr/include'
3385                 incpath='/bsd43'
3386                 mips_type='BSD 4.3'
3387         else
3388                 mips_type='System V'
3389         fi
3390         $rm -f usr.c usr.out
3391         echo "and you're compiling with the $mips_type compiler and libraries."
3392         xxx_prompt=y
3393         echo "exit 0" >mips
3394 else
3395         echo "Doesn't look like a MIPS system."
3396         xxx_prompt=n
3397         echo "exit 1" >mips
3398 fi
3399 chmod +x mips
3400 $eunicefix mips
3401 case "$usrinc" in
3402 '') ;;
3403 *) dflt="$usrinc";;
3404 esac
3405 case "$xxx_prompt" in
3406 y)      fn=d/
3407         echo " "
3408         rp='Where are the include files you want to use?'
3409         . ./getfile
3410         usrinc="$ans"
3411         ;;
3412 *)      usrinc="$dflt"
3413         ;;
3414 esac
3415
3416 : see how we invoke the C preprocessor
3417 echo " "
3418 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3419 cat <<'EOT' >testcpp.c
3420 #define ABC abc
3421 #define XYZ xyz
3422 ABC.XYZ
3423 EOT
3424 cd ..
3425 if test ! -f cppstdin; then
3426         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3427                 # AIX cc -E doesn't show the absolute headerfile
3428                 # locations but we'll cheat by using the -M flag.
3429                 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
3430         else
3431                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3432         fi
3433 else
3434         echo "Keeping your $hint cppstdin wrapper."
3435 fi
3436 chmod 755 cppstdin
3437 wrapper=`pwd`/cppstdin
3438 ok='false'
3439 cd UU
3440
3441 if $test "X$cppstdin" != "X" && \
3442         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3443         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3444 then
3445         echo "You used to use $cppstdin $cppminus so we'll use that again."
3446         case "$cpprun" in
3447         '') echo "But let's see if we can live without a wrapper..." ;;
3448         *)
3449                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3450                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3451                 then
3452                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3453                         ok='true'
3454                 else
3455                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3456                 fi
3457                 ;;
3458         esac
3459 else
3460         case "$cppstdin" in
3461         '') ;;
3462         *)
3463                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3464                 ;;
3465         esac
3466 fi
3467
3468 if $ok; then
3469         : nothing
3470 elif echo '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"' -E -" will work...'; \
3477         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "Yup, it does."
3480         x_cpp="$cc -E"
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 "Yipee, that works!"
3486         x_cpp="$cc -P"
3487         x_minus='';
3488 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3489         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3490         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3491         echo "At long last!"
3492         x_cpp="$cc -P"
3493         x_minus='-';
3494 elif echo 'No such luck, 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 "It works!"
3498         x_cpp="$cpp"
3499         x_minus='';
3500 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3501         $cpp - <testcpp.c >testcpp.out 2>&1; \
3502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3503         echo "Hooray, it works!  I was beginning to wonder."
3504         x_cpp="$cpp"
3505         x_minus='-';
3506 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3507         $wrapper <testcpp.c >testcpp.out 2>&1; \
3508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3509         x_cpp="$wrapper"
3510         x_minus=''
3511         echo "Eureka!"
3512 else
3513         dflt=''
3514         rp="No dice.  I can't find a C preprocessor.  Name one:"
3515         . ./myread
3516         x_cpp="$ans"
3517         x_minus=''
3518         $x_cpp <testcpp.c >testcpp.out 2>&1
3519         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3520                 echo "OK, that will do." >&4
3521         else
3522 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3523                 exit 1
3524         fi
3525 fi
3526
3527 case "$ok" in
3528 false)
3529         cppstdin="$x_cpp"
3530         cppminus="$x_minus"
3531         cpprun="$x_cpp"
3532         cpplast="$x_minus"
3533         set X $x_cpp
3534         shift
3535         case "$1" in
3536         "$cpp")
3537                 echo "Perhaps can we force $cc -E using a wrapper..."
3538                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3539                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3540                 then
3541                         echo "Yup, we can."
3542                         cppstdin="$wrapper"
3543                         cppminus='';
3544                 else
3545                         echo "Nope, we'll have to live without it..."
3546                 fi
3547                 ;;
3548         esac
3549         case "$cpprun" in
3550         "$wrapper")
3551                 cpprun=''
3552                 cpplast=''
3553                 ;;
3554         esac
3555         ;;
3556 esac
3557
3558 case "$cppstdin" in
3559 "$wrapper"|'cppstdin') ;;
3560 *) $rm -f $wrapper;;
3561 esac
3562 $rm -f testcpp.c testcpp.out
3563
3564 : Set private lib path
3565 case "$plibpth" in
3566 '') if ./mips; then
3567                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3568         fi;;
3569 esac
3570 case "$libpth" in
3571 ' ') dlist='';;
3572 '') dlist="$loclibpth $plibpth $glibpth";;
3573 *) dlist="$libpth";;
3574 esac
3575
3576 : Now check and see which directories actually exist, avoiding duplicates
3577 libpth=''
3578 for xxx in $dlist
3579 do
3580     if $test -d $xxx; then
3581                 case " $libpth " in
3582                 *" $xxx "*) ;;
3583                 *) libpth="$libpth $xxx";;
3584                 esac
3585     fi
3586 done
3587 $cat <<'EOM'
3588
3589 Some systems have incompatible or broken versions of libraries.  Among
3590 the directories listed in the question below, please remove any you
3591 know not to be holding relevant libraries, and add any that are needed.
3592 Say "none" for none.
3593
3594 EOM
3595 case "$libpth" in
3596 '') dflt='none';;
3597 *)
3598         set X $libpth
3599         shift
3600         dflt=${1+"$@"}
3601         ;;
3602 esac
3603 rp="Directories to use for library searches?"
3604 . ./myread
3605 case "$ans" in
3606 none) libpth=' ';;
3607 *) libpth="$ans";;
3608 esac
3609
3610 : compute shared library extension
3611 case "$so" in
3612 '')
3613         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3614                 dflt='sl'
3615         else
3616                 dflt='so'
3617         fi
3618         ;;
3619 *) dflt="$so";;
3620 esac
3621 $cat <<EOM
3622
3623 On some systems, shared libraries may be available.  Answer 'none' if
3624 you want to suppress searching of shared libraries for the remainder
3625 of this configuration.
3626
3627 EOM
3628 rp='What is the file extension used for shared libraries?'
3629 . ./myread
3630 so="$ans"
3631
3632 : Define several unixisms.
3633 : Hints files or command line option can be used to override them.
3634 : The convoluted testing is in case hints files set either the old
3635 : or the new name.
3636 case "$_exe" in
3637 '')     case "$exe_ext" in
3638     '') ;;
3639         *)      _exe="$exe_ext" ;;
3640         esac
3641         ;;
3642 esac
3643 case "$_a" in
3644 '')     case "$lib_ext" in
3645     '') _a='.a';;
3646         *)      _a="$lib_ext" ;;
3647         esac
3648         ;;
3649 esac
3650 case "$_o" in
3651 '') case "$obj_ext" in
3652         '')     _o='.o';;
3653         *)      _o="$obj_ext";;
3654         esac
3655         ;;
3656 esac
3657 case "$p_" in
3658 '') case "$path_sep" in
3659         '')     p_=':';;
3660         *)      p_="$path_sep";;
3661         esac
3662         ;;
3663 esac
3664 exe_ext=$_exe
3665 lib_ext=$_a
3666 obj_ext=$_o
3667 path_sep=$p_
3668
3669 : Which makefile gets called first.  This is used by make depend.
3670 case "$firstmakefile" in
3671 '') firstmakefile='makefile';;
3672 esac
3673
3674 case "$usesocks" in
3675 $define|true|[yY]*)     dflt='y';;
3676 *) dflt='n';;
3677 esac
3678 cat <<EOM
3679
3680 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3681 Configure must be run with -Dusesocks.
3682
3683 If this doesn't make any sense to you, just accept the default '$dflt'.
3684 EOM
3685 rp='Build Perl for SOCKS?'
3686 . ./myread
3687 case "$ans" in
3688 y|Y)    val="$define" ;;     
3689 *)      val="$undef" ;;
3690 esac
3691 set usesocks
3692 eval $setvar
3693
3694 : Looking for optional libraries
3695 echo " "
3696 echo "Checking for optional libraries..." >&4
3697 case "$libs" in
3698 ' '|'') dflt='';;
3699 *) dflt="$libs";;
3700 esac
3701 case "$libswanted" in
3702 '') libswanted='c_s';;
3703 esac
3704 case "$usesocks" in
3705 $define)
3706         libswanted="$libswanted socks5 socks5_sh"
3707         ;;
3708 esac
3709 libsfound=''
3710 libsfiles=''
3711 libsdirs=''
3712 libspath=''
3713 for thisdir in $libpth $xlibpth; do
3714   test -d $thisdir && libspath="$libspath $thisdir"
3715 done
3716 for thislib in $libswanted; do
3717         for thisdir in $libspath; do
3718             xxx=''
3719             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3720                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3721                 $test -f "$xxx" && eval $libscheck
3722                 $test -f "$xxx" && libstyle=shared
3723             fi
3724             if test ! -f "$xxx"; then
3725                 xxx=$thisdir/lib$thislib.$so
3726                 $test -f "$xxx" && eval $libscheck
3727                 $test -f "$xxx" && libstyle=shared
3728             fi  
3729             if test ! -f "$xxx"; then
3730                 xxx=$thisdir/lib$thislib$_a
3731                 $test -f "$xxx" && eval $libscheck
3732                 $test -f "$xxx" && libstyle=static
3733             fi
3734             if test ! -f "$xxx"; then
3735                 xxx=$thisdir/$thislib$_a
3736                 $test -f "$xxx" && eval $libscheck
3737                 $test -f "$xxx" && libstyle=static
3738             fi
3739             if test ! -f "$xxx"; then
3740                 xxx=$thisdir/lib${thislib}_s$_a
3741                 $test -f "$xxx" && eval $libscheck
3742                 $test -f "$xxx" && libstyle=static
3743             fi
3744             if test ! -f "$xxx"; then
3745                 xxx=$thisdir/Slib$thislib$_a
3746                 $test -f "$xxx" && eval $libscheck
3747                 $test -f "$xxx" && libstyle=static
3748             fi
3749             if $test -f "$xxx"; then
3750                 case "$libstyle" in
3751                 shared) echo "Found -l$thislib (shared)." ;;
3752                 static) echo "Found -l$thislib." ;;
3753                 *)      echo "Found -l$thislib ($libstyle)." ;;
3754                 esac
3755                 case " $dflt " in
3756                 *"-l$thislib "*);;
3757                 *) dflt="$dflt -l$thislib"
3758                    libsfound="$libsfound $xxx"
3759                    yyy=`basename $xxx`
3760                    libsfiles="$libsfiles $yyy"
3761                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3762                    case " $libsdirs " in
3763                    *" $yyy "*) ;;
3764                    *) libsdirs="$libsdirs $yyy" ;;
3765                    esac
3766                    ;;
3767                 esac
3768                 break
3769             fi  
3770         done
3771         if $test ! -f "$xxx"; then
3772             echo "No -l$thislib."
3773         fi
3774 done
3775 set X $dflt
3776 shift
3777 dflt="$*"
3778 case "$libs" in
3779 '') dflt="$dflt";;
3780 *) dflt="$libs";;
3781 esac
3782 case "$dflt" in
3783 ' '|'') dflt='none';;
3784 esac
3785
3786 $cat <<EOM
3787
3788 In order to compile $package on your machine, a number of libraries
3789 are usually needed.  Include any other special libraries here as well.
3790 Say "none" for none.  The default list is almost always right.
3791 EOM
3792
3793 echo " "
3794 rp="What libraries to use?"
3795 . ./myread
3796 case "$ans" in
3797 none) libs=' ';;
3798 *) libs="$ans";;
3799 esac
3800
3801 : determine optimization, if desired, or use for debug flag also
3802 case "$optimize" in
3803 ' '|$undef) dflt='none';;
3804 '') dflt='-O';;
3805 *) dflt="$optimize";;
3806 esac
3807 $cat <<EOH
3808
3809 By default, $package compiles with the -O flag to use the optimizer.
3810 Alternately, you might want to use the symbolic debugger, which uses
3811 the -g flag (on traditional Unix systems).  Either flag can be
3812 specified here.  To use neither flag, specify the word "none".
3813
3814 EOH
3815 rp="What optimizer/debugger flag should be used?"
3816 . ./myread
3817 optimize="$ans"
3818 case "$optimize" in
3819 'none') optimize=" ";;
3820 esac
3821
3822 dflt=''
3823 : We will not override a previous value, but we might want to
3824 : augment a hint file
3825 case "$hint" in
3826 default|recommended)
3827         case "$gccversion" in
3828         1*) dflt='-fpcc-struct-return' ;;
3829         esac
3830         case "$optimize" in
3831         *-g*) dflt="$dflt -DDEBUGGING";;
3832         esac
3833         case "$gccversion" in
3834         2*) if test -d /etc/conf/kconfig.d &&
3835                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3836                 then
3837                         dflt="$dflt -posix"
3838                 fi
3839                 ;;
3840         esac
3841         case "$gccversion" in
3842         1*) ;;
3843         2.[0-8]*) ;;
3844         ?*)     echo " "
3845                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3846                 echo 'int main(void) { return 0; }' > gcctest.c
3847                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3848                         echo "Yes, it does." 2>&1
3849                         case "$ccflags" in
3850                         *strict-aliasing*) 
3851                                 echo "Leaving current flags $ccflags alone." 2>&1
3852                                 ;;
3853                         *) dflt="$dflt -fno-strict-aliasing" ;;
3854                         esac
3855                 else
3856                         echo "Nope, it doesn't, but that's ok." 2>&1
3857                 fi
3858                 ;;
3859         esac
3860         ;;
3861 esac
3862
3863 case "$mips_type" in
3864 *BSD*|'') inclwanted="$locincpth $usrinc";;
3865 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3866 esac
3867 for thisincl in $inclwanted; do
3868         if $test -d $thisincl; then
3869                 if $test x$thisincl != x$usrinc; then
3870                         case "$dflt" in
3871                         *$thisincl*);;
3872                         *) dflt="$dflt -I$thisincl";;
3873                         esac
3874                 fi
3875         fi
3876 done
3877
3878 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3879         xxx=true;
3880 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3881         xxx=true;
3882 else
3883         xxx=false;
3884 fi;
3885 if $xxx; then
3886         case "$dflt" in
3887         *$2*);;
3888         *) dflt="$dflt -D$2";;
3889         esac;
3890 fi'
3891
3892 set signal.h LANGUAGE_C; eval $inctest
3893
3894 case "$usesocks" in
3895 $define)
3896         ccflags="$ccflags -DSOCKS"
3897         ;;
3898 esac
3899
3900 case "$hint" in
3901 default|recommended) dflt="$ccflags $dflt" ;;
3902 *) dflt="$ccflags";;
3903 esac
3904
3905 case "$dflt" in
3906 ''|' ') dflt=none;;
3907 esac
3908 $cat <<EOH
3909
3910 Your C compiler may want other flags.  For this question you should include
3911 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3912 but you should NOT include libraries or ld flags like -lwhatever.  If you
3913 want $package to honor its debug switch, you should include -DDEBUGGING here.
3914 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3915
3916 To use no flags, specify the word "none".
3917
3918 EOH
3919 set X $dflt
3920 shift
3921 dflt=${1+"$@"}
3922 rp="Any additional cc flags?"
3923 . ./myread
3924 case "$ans" in
3925 none) ccflags='';;
3926 *) ccflags="$ans";;
3927 esac
3928
3929 : the following weeds options from ccflags that are of no interest to cpp
3930 cppflags="$ccflags"
3931 case "$gccversion" in
3932 1*) cppflags="$cppflags -D__GNUC__"
3933 esac
3934 case "$mips_type" in
3935 '');;
3936 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3937 esac
3938 case "$cppflags" in
3939 '');;
3940 *)
3941         echo " "
3942         echo "Let me guess what the preprocessor flags are..." >&4
3943         set X $cppflags
3944         shift
3945         cppflags=''
3946         $cat >cpp.c <<'EOM'
3947 #define BLURFL foo
3948
3949 BLURFL xx LFRULB
3950 EOM
3951         previous=''
3952         for flag in $*
3953         do
3954                 case "$flag" in
3955                 -*) ftry="$flag";;
3956                 *) ftry="$previous $flag";;
3957                 esac
3958                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3959                         >cpp1.out 2>/dev/null && \
3960                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3961                         >cpp2.out 2>/dev/null && \
3962                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3963                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3964                 then
3965                         cppflags="$cppflags $ftry"
3966                         previous=''
3967                 else
3968                         previous="$flag"
3969                 fi
3970         done
3971         set X $cppflags
3972         shift
3973         cppflags=${1+"$@"}
3974         case "$cppflags" in
3975         *-*)  echo "They appear to be: $cppflags";;
3976         esac
3977         $rm -f cpp.c cpp?.out
3978         ;;
3979 esac
3980
3981 : flags used in final linking phase
3982 case "$ldflags" in
3983 '') if ./venix; then
3984                 dflt='-i -z'
3985         else
3986                 dflt=''
3987         fi
3988         case "$ccflags" in
3989         *-posix*) dflt="$dflt -posix" ;;
3990         esac
3991         ;;
3992 *) dflt="$ldflags";;
3993 esac
3994
3995 : Try to guess additional flags to pick up local libraries.
3996 for thislibdir in $libpth; do
3997         case " $loclibpth " in
3998         *" $thislibdir "*)
3999                 case "$dflt " in 
4000                 *"-L$thislibdir "*) ;;
4001                 *)  dflt="$dflt -L$thislibdir" ;;
4002                 esac
4003                 ;;
4004         esac
4005 done
4006
4007 case "$dflt" in
4008 '') dflt='none' ;;
4009 esac
4010
4011 $cat <<EOH
4012
4013 Your C linker may need flags.  For this question you should
4014 include -L/whatever and any other flags used by the C linker, but you
4015 should NOT include libraries like -lwhatever.
4016
4017 Make sure you include the appropriate -L/path flags if your C linker
4018 does not normally search all of the directories you specified above,
4019 namely
4020         $libpth
4021 To use no flags, specify the word "none".
4022
4023 EOH
4024
4025 rp="Any additional ld flags (NOT including libraries)?"
4026 . ./myread
4027 case "$ans" in
4028 none) ldflags='';;
4029 *) ldflags="$ans";;
4030 esac
4031 rmlist="$rmlist pdp11"
4032
4033 : coherency check
4034 echo " "
4035 echo "Checking your choice of C compiler and flags for coherency..." >&4
4036 $cat > try.c <<'EOF'
4037 #include <stdio.h>
4038 int main() { printf("Ok\n"); exit(0); }
4039 EOF
4040 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4041 shift
4042 $cat >try.msg <<'EOM'
4043 I've tried to compile and run the following simple program:
4044
4045 EOM
4046 $cat try.c >> try.msg
4047
4048 $cat >> try.msg <<EOM
4049
4050 I used the command:
4051
4052         $*
4053         ./try
4054
4055 and I got the following output:
4056
4057 EOM
4058 dflt=y
4059 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4060         if sh -c './try' >>try.msg 2>&1; then
4061                 xxx=`./try`
4062                 case "$xxx" in
4063                 "Ok") dflt=n ;;
4064                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4065                         case " $libs " in
4066                         *" -lsfio "*)
4067                                 cat >> try.msg <<'EOQS'
4068 If $libs contains -lsfio, and sfio is mis-configured, then it
4069 sometimes (apparently) runs and exits with a 0 status, but with no
4070 output!  It may have to do with sfio's use of _exit vs. exit.
4071
4072 EOQS
4073                                 rp="You have a big problem.  Shall I abort Configure"
4074                                 dflt=y
4075                                 ;;
4076                         esac
4077                         ;;
4078                 esac
4079         else
4080                 echo "The program compiled OK, but exited with status $?." >>try.msg
4081                 rp="You have a problem.  Shall I abort Configure"
4082                 dflt=y
4083         fi
4084 else
4085         echo "I can't compile the test program." >>try.msg
4086         rp="You have a BIG problem.  Shall I abort Configure"
4087         dflt=y
4088 fi
4089 case "$dflt" in
4090 y)
4091         $cat try.msg >&4
4092         case "$knowitall" in
4093         '')
4094                 echo "(The supplied flags or libraries might be incorrect.)"
4095                 ;;
4096         *) dflt=n;;
4097         esac
4098         echo " "
4099         . ./myread
4100         case "$ans" in
4101         n*|N*) ;;
4102         *)      echo "Ok.  Stopping Configure." >&4
4103                 exit 1
4104                 ;;
4105         esac
4106         ;;
4107 n) echo "OK, that should do.";;
4108 esac
4109 $rm -f try try.* core
4110
4111 : define an is-a-typedef? function
4112 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4113 case "$inclist" in
4114 "") inclist="sys/types.h";;
4115 esac;
4116 eval "varval=\$$var";
4117 case "$varval" in
4118 "")
4119         $rm -f temp.c;
4120         for inc in $inclist; do
4121                 echo "#include <$inc>" >>temp.c;
4122         done;
4123         echo "#ifdef $type" >> temp.c;
4124         echo "printf(\"We have $type\");" >> temp.c;
4125         echo "#endif" >> temp.c;
4126         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4127         if $contains $type temp.E >/dev/null 2>&1; then
4128                 eval "$var=\$type";
4129         else
4130                 eval "$var=\$def";
4131         fi;
4132         $rm -f temp.?;;
4133 *) eval "$var=\$varval";;
4134 esac'
4135
4136 : define an is-a-typedef? function that prompts if the type is not available.
4137 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4138 case "$inclist" in
4139 "") inclist="sys/types.h";;
4140 esac;
4141 eval "varval=\$$var";
4142 case "$varval" in
4143 "")
4144         $rm -f temp.c;
4145         for inc in $inclist; do
4146                 echo "#include <$inc>" >>temp.c;
4147         done;
4148         echo "#ifdef $type" >> temp.c;
4149         echo "printf(\"We have $type\");" >> temp.c;
4150         echo "#endif" >> temp.c;
4151         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4152         echo " " ;
4153         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4154         if $contains $type temp.E >/dev/null 2>&1; then
4155                 echo "$type found." >&4;
4156                 eval "$var=\$type";
4157         else
4158                 echo "$type NOT found." >&4;
4159                 dflt="$def";
4160                 . ./myread ;
4161                 eval "$var=\$ans";
4162         fi;
4163         $rm -f temp.?;;
4164 *) eval "$var=\$varval";;
4165 esac'
4166
4167 : define a shorthand compile call
4168 compile='
4169 mc_file=$1;
4170 shift;
4171 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4172 : define a shorthand compile call for compilations that should be ok.
4173 compile_ok='
4174 mc_file=$1;
4175 shift;
4176 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4177
4178 : check for lengths of integral types
4179 echo " "
4180 case "$intsize" in
4181 '')
4182         echo "Checking to see how big your integers are..." >&4
4183         $cat >intsize.c <<'EOCP'
4184 #include <stdio.h>
4185 int main()
4186 {
4187         printf("intsize=%d;\n", (int)sizeof(int));
4188         printf("longsize=%d;\n", (int)sizeof(long));
4189         printf("shortsize=%d;\n", (int)sizeof(short));
4190         exit(0);
4191 }
4192 EOCP
4193         set intsize
4194         if eval $compile_ok && ./intsize > /dev/null; then
4195                 eval `./intsize`
4196                 echo "Your integers are $intsize bytes long."
4197                 echo "Your long integers are $longsize bytes long."
4198                 echo "Your short integers are $shortsize bytes long."
4199         else
4200                 $cat >&4 <<EOM
4201 !
4202 Help! I can't compile and run the intsize test program: please enlighten me!
4203 (This is probably a misconfiguration in your system or libraries, and
4204 you really ought to fix it.  Still, I'll try anyway.)
4205 !
4206 EOM
4207                 dflt=4
4208                 rp="What is the size of an integer (in bytes)?"
4209                 . ./myread
4210                 intsize="$ans"
4211                 dflt=$intsize
4212                 rp="What is the size of a long integer (in bytes)?"
4213                 . ./myread
4214                 longsize="$ans"
4215                 dflt=2
4216                 rp="What is the size of a short integer (in bytes)?"
4217                 . ./myread
4218                 shortsize="$ans"
4219         fi
4220         ;;
4221 esac
4222 $rm -f intsize intsize.*
4223
4224 : see what type lseek is declared as in the kernel
4225 rp="What is the type used for lseek's offset on this system?"
4226 set off_t lseektype long stdio.h sys/types.h
4227 eval $typedef_ask
4228
4229 echo " "
4230 echo "Checking to see how big your file offsets are..." >&4
4231 $cat >try.c <<EOCP
4232 #include <sys/types.h>
4233 #include <stdio.h>
4234 int main()
4235 {
4236     printf("%d\n", (int)sizeof($lseektype));
4237     return(0); 
4238 }
4239 EOCP
4240 set try
4241 if eval $compile_ok; then
4242         lseeksize=`./try`
4243         echo "Your file offsets are $lseeksize bytes long."
4244 else
4245         dflt=$longsize
4246         echo " "
4247         echo "(I can't seem to compile the test program.  Guessing...)"
4248         rp="What is the size of your file offsets (in bytes)?"
4249         . ./myread
4250         lseeksize="$ans"
4251 fi
4252 $rm -f try.c try
4253
4254 : see what type file positions are declared as in the library
4255 rp="What is the type for file position used by fsetpos()?"
4256 set fpos_t fpostype long stdio.h sys/types.h
4257 eval $typedef_ask
4258
4259 echo " "
4260 case "$fpostype" in
4261 *_t) zzz="$fpostype"    ;;
4262 *)   zzz="fpos_t"       ;;
4263 esac
4264 echo "Checking the size of $zzz..." >&4 
4265 cat > try.c <<EOCP
4266 #include <sys/types.h>
4267 #include <stdio.h>
4268 int main() {
4269     printf("%d\n", (int)sizeof($fpostype));
4270     exit(0);
4271 }
4272 EOCP
4273 set try
4274 if eval $compile_ok; then
4275         yyy=`./try`
4276         case "$yyy" in
4277         '')     fpossize=4
4278                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4279                 ;;
4280         *)      fpossize=$yyy
4281                 echo "Your $zzz is $fpossize bytes long."
4282                 ;;
4283         esac
4284 else
4285         dflt="$longsize"
4286         echo " " >&4
4287         echo "(I can't compile the test program.  Guessing...)" >&4
4288         rp="What is the size of your file positions (in bytes)?"
4289         . ./myread
4290         fpossize="$ans"
4291 fi
4292
4293
4294
4295 case "$lseeksize:$fpossize" in
4296 8:8) cat <<EOM
4297
4298 You can have files larger than 2 gigabytes.
4299 EOM
4300    val="$define" ;;
4301 *)    case "$uselargefiles" in
4302    "$undef"|false|[nN]*) dflt='n' ;;
4303    *)   dflt='y' ;;
4304    esac
4305    cat <<EOM
4306
4307 Perl can be built to understand large files (files larger than 2 gigabytes)
4308 on some systems.  To do so, Configure can be run with -Duselargefiles.
4309
4310 If this doesn't make any sense to you, just accept the default '$dflt'.
4311 EOM
4312    rp='Try to understand large files, if available?'
4313    . ./myread
4314    case "$ans" in
4315    y|Y)         val="$define" ;;
4316    *)           val="$undef"  ;;
4317    esac
4318    ;;
4319 esac
4320 set uselargefiles
4321 eval $setvar
4322 case "$uselargefiles" in
4323 "$define")
4324 : Look for a hint-file generated 'call-back-unit'.  If the
4325 : user has specified that a large files perl is to be built,
4326 : we may need to set or change some other defaults.
4327         if $test -f uselfs.cbu; then
4328                 echo "Your platform has some specific hints for large file builds, using them..."
4329                 . ./uselfs.cbu
4330                 echo " "
4331                 echo "Rechecking to see how big your file offsets are..." >&4
4332                 $cat >try.c <<EOCP
4333 #include <sys/types.h>
4334 #include <stdio.h>
4335 int main()
4336 {
4337     printf("%d\n", (int)sizeof($lseektype));
4338     return(0); 
4339 }
4340 EOCP
4341                 set try
4342                 if eval $compile_ok; then
4343                         lseeksize=`./try`
4344                         $echo "Your file offsets are now $lseeksize bytes long."
4345                 else
4346                         dflt="$lseeksize"
4347                         echo " "
4348                         echo "(I can't seem to compile the test program.  Guessing...)"
4349                         rp="What is the size of your file offsets (in bytes)?"
4350                         . ./myread
4351                         lseeksize="$ans"
4352                 fi
4353                 case "$fpostype" in
4354                 *_t) zzz="$fpostype"    ;;
4355                 *)   zzz="fpos_t"       ;;
4356                 esac
4357                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4358                 $cat > try.c <<EOCP
4359 #include <sys/types.h>
4360 #include <stdio.h>
4361 int main() {
4362     printf("%d\n", (int)sizeof($fpostype));
4363     exit(0);
4364 }
4365 EOCP
4366                 set try
4367                 if eval $compile_ok; then
4368                         yyy=`./try`
4369                         dflt="$lseeksize"
4370                         case "$yyy" in
4371                         '')     echo " "
4372                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4373                                 ;;
4374                         *)      fpossize=$yyy
4375                                 echo " $fpossize bytes." >&4
4376                                 ;;
4377                         esac
4378                 else
4379                         dflt="$fpossize"
4380                         echo " "
4381                         echo "(I can't compile the test program.  Guessing...)" >&4
4382                         rp="What is the size of your file positions (in bytes)?"
4383                         . ./myread
4384                         fpossize="$ans"
4385                 fi
4386                 $rm -f try.c try
4387         fi
4388         ;;
4389 esac
4390
4391
4392 case "$usemorebits" in
4393 "$define"|true|[yY]*)
4394         use64bits="$define"
4395         uselongdouble="$define"
4396         usemorebits="$define"
4397         ;;
4398 *)      usemorebits="$undef"
4399         ;;
4400 esac
4401
4402
4403 # Backward compatibility (uselonglong is deprecated).
4404 case "$uselonglong" in
4405 "$define"|true|[yY]*)
4406         cat <<EOM >&4
4407
4408 *** Configure -Duselonglong is deprecated, using the -Duse64bits instead.
4409
4410 EOM
4411         use64bits="$define"
4412         ;;
4413 esac                          
4414 case "$ccflags" in
4415 *-DUSE_LONG_LONG*|*-DUSE_64_BITS*|*-DUSE_FULL_64_BITS*) use64bits="$define";;
4416 esac
4417 case "$usefull64bits" in
4418 "$define"|true|[yY]*) use64bits="$define" ;;
4419 esac
4420
4421 case "$longsize" in
4422 8) cat <<EOM
4423
4424 You have natively 64-bit long integers.
4425 EOM
4426    val="$define"
4427    ;;
4428 *) case "$use64bits" in
4429    "$define"|true|[yY]*) dflt='y';;
4430    *) dflt='n';;
4431    esac
4432    cat <<EOM
4433
4434 Perl can be built to take advantage of 64-bit integer types
4435 on some systems.  To do so, Configure can be run with -Duse64bits.
4436 Choosing this option will most probably introduce binary incompatibilities.
4437
4438 If this doesn't make any sense to you, just accept the default '$dflt'.
4439 EOM
4440    rp='Try to use 64-bit integers, if available?'
4441    . ./myread
4442    case "$ans" in
4443    [yY]*) val="$define" ;;
4444    *)     val="$undef"  ;;
4445    esac
4446    ;;
4447 esac
4448 set use64bits
4449 eval $setvar
4450
4451 case "$usefull64bits" in
4452 "$define"|true|[yY]*) val="$define" ;;
4453 *)      case "$use64bits" in
4454         "$define")      case "$longsize" in
4455                         4)      dflt='n'
4456                                 cat <<EOM
4457
4458 Since you chose 64-bitness you may want to try maximal 64-bitness.
4459 What you have chosen is minimal 64-bitness which means just enough
4460 to get 64-bit integers.  The maximal means using as much 64-bitness
4461 as is possible on the platform.  This in turn means even more binary
4462 incompatibilities.  On the other hand, your platform may not have
4463 any more maximal 64-bitness than what you already have chosen.
4464
4465 If this doesn't make any sense to you, just accept the default '$dflt'.
4466 EOM
4467                                 rp='Try to use full 64-bit support, if available?'
4468                                 . ./myread
4469                                 case "$ans" in
4470                                 [yY]*) val="$define" ;;
4471                                 *)     val="$undef"  ;;
4472                                 esac
4473                                 ;;
4474                         8) val="$define" ;;
4475                         *) val="$undef" ;;
4476                         esac
4477                         ;;
4478         *)      val="$undef" ;;
4479         esac
4480         ;;
4481 esac 
4482 set usefull64bits
4483 eval $setvar
4484
4485 case "$use64bits" in
4486 "$define"|true|[yY]*)
4487 : Look for a hint-file generated 'call-back-unit'.  If the
4488 : user has specified that a 64-bit perl is to be built,
4489 : we may need to set or change some other defaults.
4490         if $test -f use64bits.cbu; then
4491                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4492                 . ./use64bits.cbu
4493         fi
4494         case "$longsize" in
4495         4) case "$ccflags" in
4496            *-DUSE_64_BITS*) ;;
4497            *) ccflags="$ccflags -DUSE_64_BITS";;
4498            esac
4499            case "$archname64" in
4500            '') archname64=64 ;;
4501            esac
4502            ;;
4503         esac
4504         ;;
4505 esac
4506
4507 case "$usefull64bits" in
4508 "$define"|true|[yY]*)
4509 : Look for a hint-file generated 'call-back-unit'.  If the
4510 : user has specified that a full 64-bit perl is to be built,
4511 : we may need to set or change some other defaults.
4512         if $test -f usefull64bits.cbu; then
4513                 echo "Your platform has some specific hints for full 64-bit builds, using them..."
4514                 . ./usefull64bits.cbu
4515         fi
4516         case "$longsize" in
4517         4) case "$ccflags" in
4518            *-DUSE_FULL_64_BITS*) ;;
4519            *) ccflags="$ccflags -DUSE_FULL_64_BITS";;
4520            esac
4521            case "$archname64" in
4522            ''|64) archname64=full64 ;;
4523            esac
4524            ;;
4525         esac
4526         ;;
4527 esac
4528
4529 : determine the architecture name
4530 echo " "
4531 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4532         tarch=`arch`"-$osname"
4533 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4534         if uname -m > tmparch 2>&1 ; then
4535                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4536                         -e 's/$/'"-$osname/" tmparch`
4537         else
4538                 tarch="$osname"
4539         fi
4540         $rm -f tmparch
4541 else
4542         tarch="$osname"
4543 fi
4544 case "$myarchname" in
4545 ''|"$tarch") ;;
4546 *)
4547         echo "(Your architecture name used to be $myarchname.)"
4548         archname=''
4549         ;;
4550 esac
4551 myarchname="$tarch"
4552 case "$archname" in
4553 '') dflt="$tarch";;
4554 *) dflt="$archname";;
4555 esac
4556 rp='What is your architecture name'
4557 . ./myread
4558 archname="$ans"
4559 case "$usethreads" in
4560 $define)
4561         echo "Threads selected." >&4
4562         case "$archname" in
4563         *-thread*) echo "...and architecture name already has -thread." >&4
4564                 ;;
4565         *)      archname="$archname-thread"
4566                 echo "...setting architecture name to $archname." >&4
4567                 ;;
4568         esac
4569         ;;
4570 esac
4571 case "$usemultiplicity" in
4572 $define)
4573         echo "Multiplicity selected." >&4
4574         case "$archname" in
4575         *-multi*) echo "...and architecture name already has -multi." >&4
4576                 ;;
4577         *)      archname="$archname-multi"
4578                 echo "...setting architecture name to $archname." >&4
4579                 ;;
4580         esac
4581         ;;
4582 esac
4583 case "$use64bits" in
4584 $define)
4585         case "$archname64" in
4586         '')
4587                 ;;
4588         *)
4589                 case "$archname" in
4590                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4591                         ;;
4592                 *)      archname="$archname-$archname64"
4593                         echo "...setting architecture name to $archname." >&4
4594                         ;;
4595                 esac
4596                 ;;
4597         esac
4598 esac
4599
4600 : determine root of directory hierarchy where package will be installed.
4601 case "$prefix" in
4602 '')
4603         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4604         ;;
4605 *)
4606         dflt="$prefix"
4607         ;;
4608 esac
4609 $cat <<EOM
4610
4611 By default, $package will be installed in $dflt/bin, manual pages
4612 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4613 installation directories. Typically this is something like /usr/local.
4614 If you wish to have binaries under /usr/bin but other parts of the
4615 installation under /usr/local, that's ok: you will be prompted
4616 separately for each of the installation directories, the prefix being
4617 only used to set the defaults.
4618
4619 EOM
4620 fn=d~
4621 rp='Installation prefix to use?'
4622 . ./getfile
4623 oldprefix=''
4624 case "$prefix" in
4625 '') ;;
4626 *)
4627         case "$ans" in
4628         "$prefix") ;;
4629         *) oldprefix="$prefix";;
4630         esac
4631         ;;
4632 esac
4633 prefix="$ans"
4634 prefixexp="$ansexp"
4635
4636 : is AFS running?
4637 echo " "
4638 case "$afs" in
4639 $define|true)   afs=true ;;
4640 $undef|false)   afs=false ;;
4641 *)      if test -d /afs; then
4642                 afs=true
4643         else
4644                 afs=false
4645         fi
4646         ;;
4647 esac
4648 if $afs; then
4649         echo "AFS may be running... I'll be extra cautious then..." >&4
4650 else
4651         echo "AFS does not seem to be running..." >&4
4652 fi
4653
4654 : determine installation prefix for where package is to be installed.
4655 if $afs; then 
4656 $cat <<EOM
4657
4658 Since you are running AFS, I need to distinguish the directory in which
4659 files will reside from the directory in which they are installed (and from
4660 which they are presumably copied to the former directory by occult means).
4661
4662 EOM
4663         case "$installprefix" in
4664         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4665         *) dflt="$installprefix";;
4666         esac
4667 else
4668 $cat <<EOM
4669
4670 In some special cases, particularly when building $package for distribution,
4671 it is convenient to distinguish between the directory in which files should 
4672 be installed from the directory ($prefix) in which they 
4673 will eventually reside.  For most users, these two directories are the same.
4674
4675 EOM
4676         case "$installprefix" in
4677         '') dflt=$prefix ;;
4678         *) dflt=$installprefix;;
4679         esac
4680 fi
4681 fn=d~
4682 rp='What installation prefix should I use for installing files?'
4683 . ./getfile
4684 installprefix="$ans"
4685 installprefixexp="$ansexp"
4686
4687 : set the prefixit variable, to compute a suitable default value
4688 prefixit='case "$3" in
4689 ""|none)
4690         case "$oldprefix" in
4691         "") eval "$1=\"\$$2\"";;
4692         *)
4693                 case "$3" in
4694                 "") eval "$1=";;
4695                 none)
4696                         eval "tp=\"\$$2\"";
4697                         case "$tp" in
4698                         ""|" ") eval "$1=\"\$$2\"";;
4699                         *) eval "$1=";;
4700                         esac;;
4701                 esac;;
4702         esac;;
4703 *)
4704         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4705         case "$tp" in
4706         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4707         /*-$oldprefix/*|\~*-$oldprefix/*)
4708                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4709         *) eval "$1=\"\$$2\"";;
4710         esac;;
4711 esac'
4712
4713
4714 : get the patchlevel
4715 echo " "
4716 echo "Getting the current patchlevel..." >&4
4717 if $test -r $rsrc/patchlevel.h;then
4718         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4719         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4720         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4721         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4722         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4723         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4724 else
4725         revision=0
4726         patchlevel=0
4727         subversion=0
4728         api_revision=0
4729         api_version=0
4730         api_subversion=0
4731 fi
4732 $echo $n "(You have $package revision $revision" $c
4733 $echo $n " patchlevel $patchlevel" $c
4734 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4735 echo ".)"
4736 case "$osname" in
4737 dos|vms)
4738         : XXX Should be a Configure test for double-dots in filenames.
4739         version=`echo $revision $patchlevel $subversion | \
4740                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4741         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4742                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4743         ;;
4744 *)
4745         version=`echo $revision $patchlevel $subversion | \
4746                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4747         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4748                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4749         ;;
4750 esac
4751 : Special case the 5.005_xx maintenance series, which used 5.005
4752 : without any subversion label as a subdirectory in $sitelib
4753 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4754         api_versionstring='5.005'
4755 fi
4756
4757 : determine installation style
4758 : For now, try to deduce it from prefix unless it is already set.
4759 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4760 case "$installstyle" in
4761 '')     case "$prefix" in
4762                 *perl*) dflt='lib';;
4763                 *) dflt='lib/perl5' ;;
4764         esac
4765         ;;
4766 *)      dflt='lib/perl5' ;;
4767 esac
4768 : Probably not worth prompting for this since we prompt for all
4769 : the directories individually, and the prompt would be too long and
4770 : confusing anyway.
4771 installstyle=$dflt
4772
4773 : determine where private library files go
4774 : Usual default is /usr/local/lib/perl5/$version.
4775 : Also allow things like /opt/perl/lib/$version, since 
4776 : /opt/perl/lib/perl5... would be redundant.
4777 : The default "style" setting is made in installstyle.U
4778 case "$installstyle" in
4779 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4780 *)       set dflt privlib lib/$version ;;
4781 esac
4782 eval $prefixit
4783 $cat <<EOM
4784
4785 There are some auxiliary files for $package that need to be put into a
4786 private library directory that is accessible by everyone.
4787
4788 EOM
4789 fn=d~+
4790 rp='Pathname where the private library files will reside?'
4791 . ./getfile
4792 privlib="$ans"
4793 privlibexp="$ansexp"
4794 : Change installation prefix, if necessary.
4795 if $test X"$prefix" != X"$installprefix"; then
4796         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4797 else
4798         installprivlib="$privlibexp"
4799 fi
4800
4801 : set the prefixup variable, to restore leading tilda escape
4802 prefixup='case "$prefixexp" in
4803 "$prefix") ;;
4804 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4805 esac'
4806
4807 : determine where public architecture dependent libraries go
4808 set archlib archlib
4809 eval $prefixit
4810 : privlib default is /usr/local/lib/$package/$version
4811 : archlib default is /usr/local/lib/$package/$version/$archname
4812 : privlib may have an optional trailing /share.
4813 tdflt=`echo $privlib | $sed 's,/share$,,'`
4814 tdflt=$tdflt/$archname
4815 case "$archlib" in
4816 '')     dflt=$tdflt
4817         ;;
4818 *)      dflt="$archlib"
4819     ;;
4820 esac
4821 $cat <<EOM
4822
4823 $spackage contains architecture-dependent library files.  If you are
4824 sharing libraries in a heterogeneous environment, you might store
4825 these files in a separate location.  Otherwise, you can just include
4826 them with the rest of the public library files.
4827
4828 EOM
4829 fn=d+~
4830 rp='Where do you want to put the public architecture-dependent libraries?'
4831 . ./getfile
4832 archlib="$ans"
4833 archlibexp="$ansexp"
4834 if $test X"$archlib" = X"$privlib"; then
4835         d_archlib="$undef"
4836 else
4837         d_archlib="$define"
4838 fi
4839 : Change installation prefix, if necessary.
4840 if $test X"$prefix" != X"$installprefix"; then
4841         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4842 else
4843         installarchlib="$archlibexp"
4844 fi
4845
4846
4847 : Binary compatibility with 5.005 is not possible for builds
4848 : with advanced features
4849 case "$usethreads$usemultiplicity" in
4850 *define*)
4851         bincompat5005="$undef"
4852         d_bincompat5005="$undef"
4853         ;;
4854 *)      $cat <<EOM
4855
4856 Perl 5.006 can be compiled for binary compatibility with 5.005.
4857 If you decide to do so, you will be able to continue using most
4858 of the extensions that were compiled for Perl 5.005.
4859
4860 EOM
4861         case "$bincompat5005$d_bincompat5005" in
4862         *"$undef"*) dflt=n ;;
4863         *) dflt=y ;;
4864         esac
4865         rp='Binary compatibility with Perl 5.005?'
4866         . ./myread
4867         case "$ans" in
4868         y*) val="$define" ;;
4869         *)  val="$undef" ;;
4870         esac
4871         set d_bincompat5005
4872         eval $setvar
4873         case "$d_bincompat5005" in
4874         "$define")
4875                 bincompat5005="$define"
4876                 ;;
4877         *)      bincompat5005="$undef"
4878                 d_bincompat5005="$undef"
4879                 ;;
4880         esac
4881         ;;
4882 esac
4883
4884
4885 : see if setuid scripts can be secure
4886 $cat <<EOM
4887
4888 Some kernels have a bug that prevents setuid #! scripts from being
4889 secure.  Some sites have disabled setuid #! scripts because of this.
4890
4891 First let's decide if your kernel supports secure setuid #! scripts.
4892 (If setuid #! scripts would be secure but have been disabled anyway,
4893 don't say that they are secure if asked.)
4894
4895 EOM
4896
4897 val="$undef"
4898 if $test -d /dev/fd; then
4899         echo "#!$ls" >reflect
4900         chmod +x,u+s reflect
4901         ./reflect >flect 2>&1
4902         if $contains "/dev/fd" flect >/dev/null; then
4903                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4904                 val="$define"
4905         else
4906                 $cat <<EOM
4907 If you are not sure if they are secure, I can check but I'll need a
4908 username and password different from the one you are using right now.
4909 If you don't have such a username or don't want me to test, simply
4910 enter 'none'.
4911
4912 EOM
4913                 rp='Other username to test security of setuid scripts with?'
4914                 dflt='none'
4915                 . ./myread
4916                 case "$ans" in
4917                 n|none)
4918                         case "$d_suidsafe" in
4919                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4920                                 dflt=n;;
4921                         "$undef")
4922                                 echo "Well, the $hint value is *not* secure." >&4
4923                                 dflt=n;;
4924                         *)      echo "Well, the $hint value *is* secure." >&4
4925                                 dflt=y;;
4926                         esac
4927                         ;;
4928                 *)
4929                         $rm -f reflect flect
4930                         echo "#!$ls" >reflect
4931                         chmod +x,u+s reflect
4932                         echo >flect
4933                         chmod a+w flect
4934                         echo '"su" will (probably) prompt you for '"$ans's password."
4935                         su $ans -c './reflect >flect'
4936                         if $contains "/dev/fd" flect >/dev/null; then
4937                                 echo "Okay, it looks like setuid scripts are secure." >&4
4938                                 dflt=y
4939                         else
4940                                 echo "I don't think setuid scripts are secure." >&4
4941                                 dflt=n
4942                         fi
4943                         ;;
4944                 esac
4945                 rp='Does your kernel have *secure* setuid scripts?'
4946                 . ./myread
4947                 case "$ans" in
4948                 [yY]*)  val="$define";;
4949                 *)      val="$undef";;
4950                 esac
4951         fi
4952 else
4953         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4954         echo "(That's for file descriptors, not floppy disks.)"
4955         val="$undef"
4956 fi
4957 set d_suidsafe
4958 eval $setvar
4959
4960 $rm -f reflect flect
4961
4962 : now see if they want to do setuid emulation
4963 echo " "
4964 val="$undef"
4965 case "$d_suidsafe" in
4966 "$define")
4967         val="$undef"
4968         echo "No need to emulate SUID scripts since they are secure here." >& 4
4969         ;;
4970 *)
4971         $cat <<EOM
4972 Some systems have disabled setuid scripts, especially systems where
4973 setuid scripts cannot be secure.  On systems where setuid scripts have
4974 been disabled, the setuid/setgid bits on scripts are currently
4975 useless.  It is possible for $package to detect those bits and emulate
4976 setuid/setgid in a secure fashion.  This emulation will only work if
4977 setuid scripts have been disabled in your kernel.
4978
4979 EOM
4980         case "$d_dosuid" in
4981         "$define") dflt=y ;;
4982         *) dflt=n ;;
4983         esac
4984         rp="Do you want to do setuid/setgid emulation?"
4985         . ./myread
4986         case "$ans" in
4987         [yY]*)  val="$define";;
4988         *)      val="$undef";;
4989         esac
4990         ;;
4991 esac
4992 set d_dosuid
4993 eval $setvar
4994
4995 : determine filename position in cpp output
4996 echo " "
4997 echo "Computing filename position in cpp output for #include directives..." >&4
4998 echo '#include <stdio.h>' > foo.c
4999 $cat >fieldn <<EOF
5000 $startsh
5001 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5002 $grep '^[       ]*#.*stdio\.h' | \
5003 while read cline; do
5004         pos=1
5005         set \$cline
5006         while $test \$# -gt 0; do
5007                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5008                         echo "\$pos"
5009                         exit 0
5010                 fi
5011                 shift
5012                 pos=\`expr \$pos + 1\`
5013         done
5014 done
5015 EOF
5016 chmod +x fieldn
5017 fieldn=`./fieldn`
5018 $rm -f foo.c fieldn
5019 case $fieldn in
5020 '') pos='???';;
5021 1) pos=first;;
5022 2) pos=second;;
5023 3) pos=third;;
5024 *) pos="${fieldn}th";;
5025 esac
5026 echo "Your cpp writes the filename in the $pos field of the line."
5027
5028 : locate header file
5029 $cat >findhdr <<EOF
5030 $startsh
5031 wanted=\$1
5032 name=''
5033 for usrincdir in $usrinc
5034 do
5035         if test -f \$usrincdir/\$wanted; then
5036                 echo "\$usrincdir/\$wanted"
5037                 exit 0
5038         fi
5039 done
5040 awkprg='{ print \$$fieldn }'
5041 echo "#include <\$wanted>" > foo\$\$.c
5042 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5043 $grep "^[       ]*#.*\$wanted" | \
5044 while read cline; do
5045         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5046         case "\$name" in
5047         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5048         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5049         *) exit 2;;
5050         esac;
5051 done;
5052 #
5053 # status = 0: grep returned 0 lines, case statement not executed
5054 # status = 1: headerfile found
5055 # status = 2: while loop executed, no headerfile found
5056 #
5057 status=\$?
5058 $rm -f foo\$\$.c;
5059 if test \$status -eq 1; then
5060         exit 0;
5061 fi
5062 exit 1
5063 EOF
5064 chmod +x findhdr
5065
5066 : define an alternate in-header-list? function
5067 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5068 cont=true; xxf="echo \"<\$1> found.\" >&4";
5069 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5070 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5071 esac;
5072 case $# in 4) instead=instead;; *) instead="at last";; esac;
5073 while $test "$cont"; do
5074         xxx=`./findhdr $1`
5075         var=$2; eval "was=\$$2";
5076         if $test "$xxx" && $test -r "$xxx";
5077         then eval $xxf;
5078         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5079                 cont="";
5080         else eval $xxnf;
5081         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5082         set $yyy; shift; shift; yyy=$@;
5083         case $# in 0) cont="";;
5084         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5085                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5086         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5087                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5088         esac;
5089 done;
5090 while $test "$yyy";
5091 do set $yyy; var=$2; eval "was=\$$2";
5092         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5093         set $yyy; shift; shift; yyy=$@;
5094 done'
5095
5096 : see if this is a malloc.h system
5097 set malloc.h i_malloc
5098 eval $inhdr
5099
5100 : see if stdlib is available
5101 set stdlib.h i_stdlib
5102 eval $inhdr
5103
5104 : determine which malloc to compile in
5105 echo " "
5106 case "$usemymalloc" in
5107 ''|[yY]*|true|$define)  dflt='y' ;;
5108 *)      dflt='n' ;;
5109 esac
5110 rp="Do you wish to attempt to use the malloc that comes with $package?"
5111 . ./myread
5112 usemymalloc="$ans"
5113 case "$ans" in
5114 y*|true)
5115         usemymalloc='y'
5116         mallocsrc='malloc.c'
5117         mallocobj="malloc$_o"
5118         d_mymalloc="$define"
5119         case "$libs" in
5120         *-lmalloc*)
5121                 : Remove malloc from list of libraries to use
5122                 echo "Removing unneeded -lmalloc from library list" >&4
5123                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5124                 shift
5125                 libs="$*"
5126                 echo "libs = $libs" >&4
5127                 ;;
5128         esac
5129         ;;
5130 *)
5131         usemymalloc='n'
5132         mallocsrc=''
5133         mallocobj=''
5134         d_mymalloc="$undef"
5135         ;;
5136 esac
5137
5138 : compute the return types of malloc and free
5139 echo " "
5140 $cat >malloc.c <<END
5141 #$i_malloc I_MALLOC
5142 #$i_stdlib I_STDLIB
5143 #include <stdio.h>
5144 #include <sys/types.h>
5145 #ifdef I_MALLOC
5146 #include <malloc.h>
5147 #endif
5148 #ifdef I_STDLIB
5149 #include <stdlib.h>
5150 #endif
5151 #ifdef TRY_MALLOC
5152 void *malloc();
5153 #endif
5154 #ifdef TRY_FREE
5155 void free();
5156 #endif
5157 END
5158 case "$malloctype" in
5159 '')
5160         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5161                 malloctype='void *'
5162         else
5163                 malloctype='char *'
5164         fi
5165         ;;
5166 esac
5167 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5168
5169 case "$freetype" in
5170 '')
5171         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5172                 freetype='void'
5173         else
5174                 freetype='int'
5175         fi
5176         ;;
5177 esac
5178 echo "Your system uses $freetype free(), it would seem." >&4
5179 $rm -f malloc.[co]
5180 $cat <<EOM
5181
5182 The installation process will also create a directory for
5183 vendor-supplied add-ons.  Vendors who supply perl with their system
5184 may find it convenient to place all vendor-supplied files in this
5185 directory rather than in the main distribution directory.  This will
5186 ease upgrades between binary-compatible maintenance versions of perl.
5187
5188 Of course you may also use these directories in whatever way you see
5189 fit.  For example, you might use them to access modules shared over a
5190 company-wide network.
5191
5192 The default answer should be fine for most people.
5193 This causes further questions about vendor add-ons to be skipped
5194 and no vendor-specific directories will be configured for perl.
5195
5196 EOM
5197 rp='Do you want to configure vendor-specific add-on directories?'
5198 case "$usevendorprefix" in
5199 define|true|[yY]*) dflt=y ;;
5200 *)      : User may have set vendorprefix directly on Configure command line.
5201         case "$vendorprefix" in
5202         ''|' ') dflt=n ;;
5203         *)      dflt=y ;;
5204         esac
5205         ;;
5206 esac
5207 . ./myread
5208 case "$ans" in
5209 [yY]*)  fn=d~+
5210         rp='Installation prefix to use for vendor-supplied add-ons?'
5211         case "$vendorprefix" in
5212         '') dflt='' ;;
5213         *)  dflt=$vendorprefix ;;
5214         esac
5215         . ./getfile
5216         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5217         oldvendorprefix=''
5218         case "$vendorprefix" in
5219         '') ;;
5220         *)      case "$ans" in
5221                 "$prefix") ;;
5222                 *) oldvendorprefix="$prefix";;
5223                 esac
5224                 ;;
5225         esac
5226         usevendorprefix="$define"
5227         vendorprefix="$ans"
5228         vendorprefixexp="$ansexp"
5229         ;;
5230 *)      usevendorprefix="$undef"
5231         vendorprefix=''
5232         vendorprefixexp=''
5233         ;;
5234 esac
5235
5236 case "$vendorprefix" in
5237 '')     d_vendorlib="$undef"
5238         vendorlib=''
5239         vendorlibexp=''
5240         ;;
5241 *)      d_vendorlib="$define"
5242         : determine where vendor-supplied modules go.
5243         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5244         case "$vendorlib" in
5245         '')
5246                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5247                 case "$installstyle" in
5248                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5249                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5250                 esac
5251                 ;;
5252         *)      dflt="$vendorlib"
5253                 ;;
5254         esac
5255         fn=d~+
5256         rp='Pathname for the vendor-supplied library files?'
5257         . ./getfile
5258         vendorlib="$ans"
5259         vendorlibexp="$ansexp"
5260         ;;
5261 esac
5262 : Change installation prefix, if necessary.
5263 if $test X"$prefix" != X"$installprefix"; then
5264         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5265 else
5266         installvendorlib="$vendorlibexp"
5267 fi
5268
5269 : Cruising for prototypes
5270 echo " "
5271 echo "Checking out function prototypes..." >&4
5272 $cat >prototype.c <<'EOCP'
5273 int main(int argc, char *argv[]) {
5274         exit(0);}
5275 EOCP
5276 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5277         echo "Your C compiler appears to support function prototypes."
5278         val="$define"
5279 else
5280         echo "Your C compiler doesn't seem to understand function prototypes."
5281         val="$undef"
5282 fi
5283 set prototype
5284 eval $setvar
5285 $rm -f prototype*
5286
5287 case "$prototype" in
5288 "$define") ;;
5289 *)      ansi2knr='ansi2knr'
5290         echo " "
5291         cat <<EOM >&4
5292
5293 $me:  FATAL ERROR:
5294 This version of $package can only be compiled by a compiler that 
5295 understands function prototypes.  Unfortunately, your C compiler 
5296         $cc $ccflags
5297 doesn't seem to understand them.  Sorry about that.
5298
5299 If GNU cc is available for your system, perhaps you could try that instead.  
5300
5301 Eventually, we hope to support building Perl with pre-ANSI compilers.
5302 If you would like to help in that effort, please contact <perlbug@perl.org>.
5303
5304 Aborting Configure now.
5305 EOM
5306         exit 2
5307         ;;
5308 esac
5309
5310 : determine where public executables go
5311 echo " "
5312 set dflt bin bin
5313 eval $prefixit
5314 fn=d~
5315 rp='Pathname where the public executables will reside?'
5316 . ./getfile
5317 if $test "X$ansexp" != "X$binexp"; then
5318         installbin=''
5319 fi
5320 bin="$ans"
5321 binexp="$ansexp"
5322 : Change installation prefix, if necessary.
5323 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5324 if $test X"$prefix" != X"$installprefix"; then
5325         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5326 else
5327         installbin="$binexp"
5328 fi
5329
5330 : Find perl5.005 or later.
5331 echo "Looking for a previously installed perl5.005 or later... "
5332 case "$perl5" in
5333 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
5334                 : Check if this perl is recent and can load a simple module
5335                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5336                         perl5=$tdir/perl
5337                         break;
5338                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
5339                         perl5=$tdir/perl
5340                         break;
5341                 fi
5342         done
5343         ;;
5344 *)      perl5="$perl5"
5345         ;;
5346 esac
5347 case "$perl5" in
5348 '')     echo "None found.  That's ok.";;
5349 *)      echo "Using $perl5." ;;
5350 esac
5351
5352 $cat <<EOM
5353
5354 After $package is installed, you may wish to install various
5355 add-on modules and utilities.  Typically, these add-ons will
5356 be installed under $prefix with the rest
5357 of this package.  However, you may wish to install such add-ons
5358 elsewhere under a different prefix.
5359
5360 If you do not wish to put everything under a single prefix, that's
5361 ok.  You will be prompted for the individual locations; this siteprefix
5362 is only used to suggest the defaults.
5363
5364 The default should be fine for most people.
5365
5366 EOM
5367 fn=d~+
5368 rp='Installation prefix to use for add-on modules and utilities?'
5369 : XXX Here might be another good place for an installstyle setting.
5370 case "$siteprefix" in
5371 '') dflt=$prefix ;;
5372 *)  dflt=$siteprefix ;;
5373 esac
5374 . ./getfile
5375 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5376 oldsiteprefix=''
5377 case "$siteprefix" in
5378 '') ;;
5379 *)      case "$ans" in
5380         "$prefix") ;;
5381         *) oldsiteprefix="$prefix";;
5382         esac
5383         ;;
5384 esac
5385 siteprefix="$ans"
5386 siteprefixexp="$ansexp"
5387
5388 : determine where site specific libraries go.
5389 : Usual default is /usr/local/lib/perl5/site_perl/$version
5390 : The default "style" setting is made in installstyle.U
5391 : XXX No longer works with Prefixit stuff.
5392 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5393 case "$sitelib" in
5394 '') case "$installstyle" in
5395         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5396         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5397         esac
5398         ;;
5399 *)      dflt="$sitelib"
5400         ;;
5401 esac
5402 $cat <<EOM
5403
5404 The installation process will create a directory for
5405 site-specific extensions and modules.  Most users find it convenient
5406 to place all site-specific files in this directory rather than in the
5407 main distribution directory.
5408
5409 EOM
5410 fn=d~+
5411 rp='Pathname for the site-specific library files?'
5412 . ./getfile
5413 sitelib="$ans"
5414 sitelibexp="$ansexp"
5415 : Change installation prefix, if necessary.
5416 if $test X"$prefix" != X"$installprefix"; then
5417         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5418 else
5419         installsitelib="$sitelibexp"
5420 fi
5421
5422 : Determine list of previous versions to include in @INC
5423 $cat > getverlist <<EOPL
5424 #!$perl5 -w
5425 use File::Basename;
5426 \$api_versionstring = "$api_versionstring";
5427 \$version = "$version";
5428 \$sitelib = "$sitelib";
5429 \$archname = "$archname";
5430 EOPL
5431         $cat >> getverlist <<'EOPL'
5432 # Can't have leading @ because metaconfig interprets it as a command!
5433 ;@inc_version_list=();
5434 $stem=dirname($sitelib);
5435 # XXX Redo to do opendir/readdir? 
5436 if (-d $stem) {
5437     chdir($stem);
5438     ;@candidates = glob("5.*");
5439 }
5440 else {
5441     ;@candidates = ();
5442 }
5443
5444 # XXX ToDo:  These comparisons must be reworked when two-digit
5445 # subversions come along, so that 5.7.10 compares as greater than
5446 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5447 # widespread that we can use the built-in version vectors rather
5448 # than reinventing them here.  For 5.6.0, however, we must
5449 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5450 foreach $d (@candidates) {
5451     if ($d lt $version) {
5452         if ($d ge $api_versionstring) {
5453             unshift(@inc_version_list, "$d/$archname", $d);
5454         }
5455         elsif ($d ge "5.005") {
5456             unshift(@inc_version_list, $d);
5457         }
5458     }
5459     else {
5460         # Skip newer version.  I.e. don't look in
5461         # 5.7.0 if we're installing 5.6.1.
5462     }
5463 }
5464
5465 if (@inc_version_list) {
5466     print join(' ', @inc_version_list);
5467 }
5468 else {
5469     # Blank space to preserve value for next Configure run.
5470     print " ";
5471 }
5472 EOPL
5473 chmod +x getverlist
5474 case "$inc_version_list" in
5475 '')     if test -x "$perl5"; then
5476                 dflt=`$perl5 getverlist`
5477         else
5478                 dflt='none'
5479         fi
5480         ;;
5481 $undef) dflt='none' ;;
5482 *)  dflt="$inc_version_list" ;;
5483 esac
5484 case "$dflt" in
5485 ''|' ') dflt=none ;;
5486 esac
5487 $cat <<'EOM'
5488
5489 In order to ease the process of upgrading, this version of perl 
5490 can be configured to use modules built and installed with earlier 
5491 versions of perl that were installed under $prefix.  Specify here
5492 the list of earlier versions that this version of perl should check.
5493 If Configure detected no earlier versions of perl installed under
5494 $prefix, then the list will be empty.  Answer 'none' to tell perl
5495 to not search earlier versions.
5496
5497 The default should almost always be sensible, so if you're not sure,
5498 just accept the default.
5499 EOM
5500
5501 rp='List of earlier versions to include in @INC?'
5502 . ./myread
5503 case "$ans" in
5504 [Nn]one|''|' ') inc_version_list=' ' ;;
5505 *) inc_version_list="$ans" ;;
5506 esac
5507 case "$inc_version_list" in
5508 ''|' ') 
5509         inc_version_list_init='0';;
5510 *)      inc_version_list_init=`echo $inc_version_list |
5511                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5512         ;;
5513 esac
5514 $rm -f getverlist
5515
5516 : determine whether to install perl also as /usr/bin/perl
5517
5518 echo " "
5519 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5520         $cat <<EOM
5521 Many scripts expect to perl to be installed as /usr/bin/perl.
5522 I can install the perl you are about to compile also as /usr/bin/perl
5523 (in addition to $installbin/perl).
5524 EOM
5525         case "$installusrbinperl" in
5526         "$undef"|[nN]*) dflt='n';;
5527         *)              dflt='y';;
5528         esac
5529         rp="Do you want to install perl as /usr/bin/perl?"
5530         . ./myread
5531         case "$ans" in
5532         [yY]*)  val="$define";;
5533         *)      val="$undef" ;;
5534         esac
5535 else
5536         val="$undef"
5537 fi
5538 set installusrbinperl
5539 eval $setvar
5540
5541 echo " "
5542 echo "Checking for GNU C Library..." >&4
5543 cat >gnulibc.c <<EOM
5544 #include <stdio.h>
5545 int main()
5546 {
5547 #ifdef __GLIBC__
5548     exit(0);
5549 #else
5550     exit(1);
5551 #endif
5552 }
5553 EOM
5554 set gnulibc
5555 if eval $compile_ok && ./gnulibc; then
5556         val="$define"
5557         echo "You are using the GNU C Library"
5558 else
5559         val="$undef"
5560         echo "You are not using the GNU C Library"
5561 fi
5562 $rm -f gnulibc*
5563 set d_gnulibc
5564 eval $setvar
5565
5566 : see if nm is to be used to determine whether a symbol is defined or not
5567 case "$usenm" in
5568 '')
5569         dflt=''
5570         case "$d_gnulibc" in
5571         "$define")
5572                 echo " "
5573                 echo "nm probably won't work on the GNU C Library." >&4
5574                 dflt=n
5575                 ;;
5576         esac
5577         case "$dflt" in
5578         '') 
5579                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5580                         echo " "
5581                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5582                         echo "'nm' won't be sufficient on this sytem." >&4
5583                         dflt=n
5584                 fi
5585                 ;;
5586         esac
5587         case "$dflt" in
5588         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5589                 if $test $dflt -gt 20; then
5590                         dflt=y
5591                 else
5592                         dflt=n
5593                 fi
5594                 ;;
5595         esac
5596         ;;
5597 *)
5598         case "$usenm" in
5599         true|$define) dflt=y;;
5600         *) dflt=n;;
5601         esac
5602         ;;
5603 esac
5604 $cat <<EOM
5605
5606 I can use $nm to extract the symbols from your C libraries. This
5607 is a time consuming task which may generate huge output on the disk (up
5608 to 3 megabytes) but that should make the symbols extraction faster. The
5609 alternative is to skip the 'nm' extraction part and to compile a small
5610 test program instead to determine whether each symbol is present. If
5611 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5612 this may be the best solution.
5613
5614 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5615
5616 EOM
5617 rp="Shall I use $nm to extract C symbols from the libraries?"
5618 . ./myread
5619 case "$ans" in
5620 [Nn]*) usenm=false;;
5621 *) usenm=true;;
5622 esac
5623
5624 runnm=$usenm
5625 case "$reuseval" in
5626 true) runnm=false;;
5627 esac
5628
5629 : nm options which may be necessary
5630 case "$nm_opt" in
5631 '') if $test -f /mach_boot; then
5632                 nm_opt=''       # Mach
5633         elif $test -d /usr/ccs/lib; then
5634                 nm_opt='-p'     # Solaris (and SunOS?)
5635         elif $test -f /dgux; then
5636                 nm_opt='-p'     # DG-UX
5637         elif $test -f /lib64/rld; then
5638                 nm_opt='-p'     # 64-bit Irix
5639         else
5640                 nm_opt=''
5641         fi;;
5642 esac
5643
5644 : nm options which may be necessary for shared libraries but illegal
5645 : for archive libraries.  Thank you, Linux.
5646 case "$nm_so_opt" in
5647 '')     case "$myuname" in
5648         *linux*)
5649                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5650                         nm_so_opt='--dynamic'
5651                 fi
5652                 ;;
5653         esac
5654         ;;
5655 esac
5656
5657 case "$runnm" in
5658 true)
5659 : get list of predefined functions in a handy place
5660 echo " "
5661 case "$libc" in
5662 '') libc=unknown
5663         case "$libs" in
5664         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5665         esac
5666         ;;
5667 esac
5668 libnames='';
5669 case "$libs" in
5670 '') ;;
5671 *)  for thislib in $libs; do
5672         case "$thislib" in
5673         -lc|-lc_s)
5674                 : Handle C library specially below.
5675                 ;;
5676         -l*)
5677                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5678                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5679                         :
5680                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5681                         :
5682                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5683                         :
5684                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5685                         :
5686                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5687                         :
5688                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5689                         :
5690                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5691                         :
5692                 else
5693                         try=''
5694                 fi
5695                 libnames="$libnames $try"
5696                 ;;
5697         *) libnames="$libnames $thislib" ;;
5698         esac
5699         done
5700         ;;
5701 esac
5702 xxx=normal
5703 case "$libc" in
5704 unknown)
5705         set /lib/libc.$so
5706         for xxx in $libpth; do
5707                 $test -r $1 || set $xxx/libc.$so
5708                 : The messy sed command sorts on library version numbers.
5709                 $test -r $1 || \
5710                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5711                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5712                                 h
5713                                 s/[0-9][0-9]*/0000&/g
5714                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5715                                 G
5716                                 s/\n/ /' | \
5717                          sort | $sed -e 's/^.* //'`
5718                 eval set \$$#
5719         done
5720         $test -r $1 || set /usr/ccs/lib/libc.$so
5721         $test -r $1 || set /lib/libsys_s$_a
5722         ;;
5723 *)
5724         set blurfl
5725         ;;
5726 esac
5727 if $test -r "$1"; then
5728         echo "Your (shared) C library seems to be in $1."
5729         libc="$1"
5730 elif $test -r /lib/libc && $test -r /lib/clib; then
5731         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5732         xxx=apollo
5733         libc='/lib/clib /lib/libc'
5734         if $test -r /lib/syslib; then
5735                 echo "(Your math library is in /lib/syslib.)"
5736                 libc="$libc /lib/syslib"
5737         fi
5738 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5739         echo "Your C library seems to be in $libc, as you said before."
5740 elif $test -r $incpath/usr/lib/libc$_a; then
5741         libc=$incpath/usr/lib/libc$_a;
5742         echo "Your C library seems to be in $libc.  That's fine."
5743 elif $test -r /lib/libc$_a; then
5744         libc=/lib/libc$_a;
5745         echo "Your C library seems to be in $libc.  You're normal."
5746 else
5747         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5748                 :
5749         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5750                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5751         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5752                 :
5753         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5754                 :
5755         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5756                 :
5757         else
5758                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5759         fi
5760         if $test -r "$tans"; then
5761                 echo "Your C library seems to be in $tans, of all places."
5762                 libc=$tans
5763         else
5764                 libc='blurfl'
5765         fi
5766 fi
5767 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5768         dflt="$libc"
5769         cat <<EOM
5770
5771 If the guess above is wrong (which it might be if you're using a strange
5772 compiler, or your machine supports multiple models), you can override it here.
5773
5774 EOM
5775 else
5776         dflt=''
5777         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5778         cat >&4 <<EOM
5779 I can't seem to find your C library.  I've looked in the following places:
5780
5781 EOM
5782         $sed 's/^/      /' libpath
5783         cat <<EOM
5784
5785 None of these seems to contain your C library. I need to get its name...
5786
5787 EOM
5788 fi
5789 fn=f
5790 rp='Where is your C library?'
5791 . ./getfile
5792 libc="$ans"
5793
5794 echo " "
5795 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5796 set X `cat libnames`
5797 shift
5798 xxx=files
5799 case $# in 1) xxx=file; esac
5800 echo "Extracting names from the following $xxx for later perusal:" >&4
5801 echo " "
5802 $sed 's/^/      /' libnames >&4
5803 echo " "
5804 $echo $n "This may take a while...$c" >&4
5805
5806 for file in $*; do
5807         case $file in
5808         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5809         *) $nm $nm_opt $file 2>/dev/null;;
5810         esac
5811 done >libc.tmp
5812
5813 $echo $n ".$c"
5814 $grep fprintf libc.tmp > libc.ptf
5815 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5816 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5817 xxx='[ADTSIW]'
5818 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5819         eval $xscan;\
5820         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5821                 eval $xrun
5822 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5823         eval $xscan;\
5824         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5825                 eval $xrun
5826 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5827         eval $xscan;\
5828         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5829                 eval $xrun
5830 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5831         eval $xscan;\
5832         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5833                 eval $xrun
5834 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5835         eval $xscan;\
5836         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5837                 eval $xrun
5838 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5839         eval $xscan;\
5840         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5841                 eval $xrun
5842 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5843                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5844         eval $xscan;\
5845         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5846                 eval $xrun
5847 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5848         eval $xscan;\
5849         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5850                 eval $xrun
5851 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5852         eval $xscan;\
5853         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5854                 eval $xrun
5855 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5856         eval $xscan;\
5857         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5858                 eval $xrun
5859 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5860         eval $xscan;\
5861         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5862                 eval $xrun
5863 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5864         eval $xscan;\
5865         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5866                 eval $xrun
5867 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5868         eval $xscan;\
5869         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5870                 eval $xrun
5871 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5872         eval $xscan;\
5873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5874                 eval $xrun
5875 else
5876         $nm -p $* 2>/dev/null >libc.tmp
5877         $grep fprintf libc.tmp > libc.ptf
5878         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5879                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5880         then
5881                 nm_opt='-p'
5882                 eval $xrun
5883         else
5884                 echo " "
5885                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5886                 com=''
5887                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5888                         for thisname in $libnames $libc; do
5889                                 $ar t $thisname >>libc.tmp
5890                         done
5891                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5892                         echo "Ok." >&4
5893                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5894                         # Repeat libc to extract forwarders to DLL entries too
5895                         for thisname in $libnames $libc; do
5896                                 $ar tv $thisname >>libc.tmp
5897                                 # Revision 50 of EMX has bug in $ar.
5898                                 # it will not extract forwarders to DLL entries
5899                                 # Use emximp which will extract exactly them.
5900                                 emximp -o tmp.imp $thisname \
5901                                     2>/dev/null && \
5902                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5903                                     < tmp.imp >>libc.tmp
5904                                 $rm tmp.imp
5905                         done
5906                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5907                         echo "Ok." >&4
5908                 else
5909                         echo "$ar didn't seem to work right." >&4
5910                         echo "Maybe this is a Cray...trying bld instead..." >&4
5911                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5912                         then
5913                                 for thisname in $libnames; do
5914                                         bld t $libnames | \
5915                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5916                                         $ar t $thisname >>libc.tmp
5917                                 done
5918                                 echo "Ok." >&4
5919                         else
5920                                 echo "That didn't work either.  Giving up." >&4
5921                                 exit 1
5922                         fi
5923                 fi
5924         fi
5925 fi
5926 nm_extract="$com"
5927 if $test -f /lib/syscalls.exp; then
5928         echo " "
5929         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5930         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5931 fi
5932 ;;
5933 esac
5934 $rm -f libnames libpath
5935
5936 : see if dld is available
5937 set dld.h i_dld
5938 eval $inhdr
5939
5940 : is a C symbol defined?
5941 csym='tlook=$1;
5942 case "$3" in
5943 -v) tf=libc.tmp; tc=""; tdc="";;
5944 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5945 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5946 esac;
5947 tx=yes;
5948 case "$reuseval-$4" in
5949 true-) ;;
5950 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5951 esac;
5952 case "$tx" in
5953 yes)
5954         case "$runnm" in
5955         true)
5956                 if $contains $tlook $tf >/dev/null 2>&1;
5957                 then tval=true;
5958                 else tval=false;
5959                 fi;;
5960         *)
5961                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5962                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5963                 then tval=true;
5964                 else tval=false;
5965                 fi;
5966                 $rm -f t t.c;;
5967         esac;;
5968 *)
5969         case "$tval" in
5970         $define) tval=true;;
5971         *) tval=false;;
5972         esac;;
5973 esac;
5974 eval "$2=$tval"'
5975
5976 : define an is-in-libc? function
5977 inlibc='echo " "; td=$define; tu=$undef;
5978 sym=$1; var=$2; eval "was=\$$2";
5979 tx=yes;
5980 case "$reuseval$was" in
5981 true) ;;
5982 true*) tx=no;;
5983 esac;
5984 case "$tx" in
5985 yes)
5986         set $sym tres -f;
5987         eval $csym;
5988         case "$tres" in
5989         true)
5990                 echo "$sym() found." >&4;
5991                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5992         *)
5993                 echo "$sym() NOT found." >&4;
5994                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5995         esac;;
5996 *)
5997         case "$was" in
5998         $define) echo "$sym() found." >&4;;
5999         *) echo "$sym() NOT found." >&4;;
6000         esac;;
6001 esac'
6002
6003 : see if dlopen exists
6004 xxx_runnm="$runnm"
6005 runnm=false
6006 set dlopen d_dlopen
6007 eval $inlibc
6008 runnm="$xxx_runnm"
6009
6010 : determine which dynamic loading, if any, to compile in
6011 echo " "
6012 dldir="ext/DynaLoader"
6013 case "$usedl" in
6014 $define|y|true)
6015         dflt='y'
6016         usedl="$define"
6017         ;;
6018 $undef|n|false)
6019         dflt='n'
6020         usedl="$undef"
6021         ;;
6022 *) 
6023         dflt='n'
6024         case "$d_dlopen" in
6025             $define) dflt='y' ;;
6026         esac
6027         case "$i_dld" in
6028             $define) dflt='y' ;;
6029         esac
6030         : Does a dl_xxx.xs file exist for this operating system
6031         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6032         ;;
6033 esac
6034 rp="Do you wish to use dynamic loading?"
6035 . ./myread
6036 usedl="$ans"
6037 case "$ans" in
6038 y*) usedl="$define"
6039         case "$dlsrc" in
6040         '')
6041                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6042                         dflt="$dldir/dl_${osname}.xs"
6043                 elif $test "$d_dlopen" = "$define" ; then
6044                         dflt="$dldir/dl_dlopen.xs"
6045                 elif $test "$i_dld" = "$define" ; then
6046                         dflt="$dldir/dl_dld.xs"
6047                 else
6048                         dflt=''
6049                 fi
6050                 ;;
6051         *)      dflt="$dldir/$dlsrc"
6052                 ;;
6053         esac
6054     echo "The following dynamic loading files are available:"
6055         : Can not go over to $dldir because getfile has path hard-coded in.
6056         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6057         rp="Source file to use for dynamic loading"
6058         fn="fne"
6059         gfpth="$src"
6060         . ./getfile
6061         usedl="$define"
6062         : emulate basename
6063         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6064
6065         $cat << EOM
6066
6067 Some systems may require passing special flags to $cc -c to
6068 compile modules that will be used to create a shared library.
6069 To use no flags, say "none".
6070
6071 EOM
6072     case "$cccdlflags" in
6073     '') case "$gccversion" in
6074                 '') case "$osname" in
6075                         hpux)   dflt='+z' ;;
6076                         next)   dflt='none' ;;
6077                         irix*)  dflt='-KPIC' ;;
6078                         svr4*|esix*|solaris) dflt='-KPIC' ;;
6079                         sunos)  dflt='-pic' ;;
6080                         *)      dflt='none' ;;
6081                     esac
6082                         ;;
6083                 *)  case "$osname" in
6084                         svr4*|esix*|solaris) dflt='-fPIC' ;;
6085                         *)      dflt='-fpic' ;;
6086                     esac ;;
6087             esac ;;
6088         ' ') dflt='none' ;;
6089     *)  dflt="$cccdlflags" ;;
6090     esac
6091     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6092     . ./myread
6093     case "$ans" in
6094     none) cccdlflags=' ' ;;
6095     *) cccdlflags="$ans" ;;
6096     esac
6097
6098     cat << EOM
6099
6100 Some systems use ld to create libraries that can be dynamically loaded,
6101 while other systems (such as those using ELF) use $cc.
6102
6103 EOM
6104         case "$ld" in
6105         '')     $cat >try.c <<'EOM'
6106 /* Test for whether ELF binaries are produced */
6107 #include <fcntl.h>
6108 #include <stdlib.h>
6109 int main() {
6110         char b[4];
6111         int i = open("a.out",O_RDONLY);
6112         if(i == -1) 
6113                 exit(1); /* fail */
6114         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6115                 exit(0); /* succeed (yes, it's ELF) */
6116         else
6117                 exit(1); /* fail */
6118 }
6119 EOM
6120                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6121                         cat <<EOM
6122 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6123 EOM
6124                         dflt="$cc"
6125                 else
6126                         echo "I'll use ld to build dynamic libraries."
6127                         dflt='ld'
6128                 fi
6129                 rm -f try.c a.out
6130                 ;;
6131         *)      dflt="$ld"
6132                 ;;
6133         esac
6134
6135     rp="What command should be used to create dynamic libraries?"
6136     . ./myread
6137         ld="$ans"
6138
6139     cat << EOM
6140
6141 Some systems may require passing special flags to $ld to create a
6142 library that can be dynamically loaded.  If your ld flags include
6143 -L/other/path options to locate libraries outside your loader's normal
6144 search path, you may need to specify those -L options here as well.  To
6145 use no flags, say "none".
6146
6147 EOM
6148     case "$lddlflags" in
6149     '') case "$osname" in
6150                         beos) dflt='-nostart' ;;
6151                         hpux)  dflt='-b +vnocompatwarnings' ;;
6152                         linux|irix*)    dflt='-shared' ;;
6153                         next)  dflt='none' ;;
6154                         solaris) dflt='-G' ;;
6155                         sunos) dflt='-assert nodefinitions' ;;
6156                         svr4*|esix*) dflt="-G $ldflags" ;;
6157                 *)     dflt='none' ;;
6158                         esac
6159                         ;;
6160     *) dflt="$lddlflags" ;;
6161     esac
6162
6163         : Try to guess additional flags to pick up local libraries.
6164         : Be careful not to append to a plain 'none'
6165         case "$dflt" in
6166         none) dflt='' ;;
6167         esac
6168         for thisflag in $ldflags; do
6169                 case "$thisflag" in
6170                 -L*)
6171                         case " $dflt " in
6172                         *" $thisflag "*) ;;
6173                         *) dflt="$dflt $thisflag" ;;
6174                         esac
6175                         ;;
6176                 esac
6177         done
6178
6179         case "$dflt" in
6180         ''|' ') dflt='none' ;;
6181         esac
6182
6183     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6184     . ./myread
6185     case "$ans" in
6186     none) lddlflags=' ' ;;
6187     *) lddlflags="$ans" ;;
6188     esac
6189
6190         cat <<EOM
6191
6192 Some systems may require passing special flags to $cc to indicate that
6193 the resulting executable will use dynamic linking.  To use no flags,
6194 say "none".
6195
6196 EOM
6197     case "$ccdlflags" in
6198     '') case "$osname" in
6199                 hpux)   dflt='-Wl,-E' ;;
6200                 linux)  dflt='-rdynamic' ;;
6201                 next)   dflt='none' ;;
6202                 sunos)  dflt='none' ;;
6203                 *)      dflt='none' ;;
6204             esac ;;
6205     ' ')  dflt='none' ;;
6206     *)  dflt="$ccdlflags" ;;
6207     esac
6208     rp="Any special flags to pass to $cc to use dynamic linking?"
6209     . ./myread
6210     case "$ans" in
6211     none) ccdlflags=' ' ;;
6212     *) ccdlflags="$ans" ;;
6213     esac
6214     ;;
6215 *)  usedl="$undef"
6216         ld='ld'
6217     dlsrc='dl_none.xs'
6218     lddlflags=''
6219     ccdlflags=''
6220     ;;
6221 esac
6222
6223 also=''
6224 case "$usedl" in
6225 $undef)
6226         # No dynamic loading being used, so don't bother even to prompt.
6227         useshrplib='false'
6228         ;;
6229 *)      case "$useshrplib" in
6230         '')     case "$osname" in
6231                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6232                         dflt=y
6233                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6234                         ;;
6235                 next*)
6236                         case "$osvers" in
6237                         4*)     dflt=y
6238                                 also='Building a shared libperl is needed for MAB support.'
6239                                 ;;
6240                         *)      dflt=n
6241                                 ;;
6242                         esac
6243                         ;;
6244                 *)      dflt=n
6245                         ;;
6246                 esac
6247                 ;;
6248         $define|true|[Yy]*)
6249                 dflt=y
6250                 ;;
6251         *)      dflt=n
6252                 ;;
6253         esac
6254         $cat << EOM
6255
6256 The perl executable is normally obtained by linking perlmain.c with
6257 libperl${_a}, any static extensions (usually just DynaLoader), and
6258 any other libraries needed on this system (such as -lm, etc.).  Since
6259 your system supports dynamic loading, it is probably possible to build
6260 a shared libperl.$so.  If you will have more than one executable linked
6261 to libperl.$so, this will significantly reduce the size of each
6262 executable, but it may have a noticeable affect on performance.  The
6263 default is probably sensible for your system.
6264 $also
6265
6266 EOM
6267         rp="Build a shared libperl.$so (y/n)"
6268         . ./myread
6269         case "$ans" in
6270         true|$define|[Yy]*)
6271                 useshrplib='true'  ;;
6272         *)      useshrplib='false' ;;
6273         esac
6274         ;;
6275 esac
6276
6277 case "$useshrplib" in
6278 true)
6279         case "$libperl" in
6280         '')
6281                 # Figure out a good name for libperl.so.  Since it gets stored in
6282                 # a version-specific architecture-dependent library, the version
6283                 # number isn't really that important, except for making cc/ld happy.
6284                 #
6285                 # A name such as libperl.so.3.1
6286                 majmin="libperl.$so.$patchlevel.$subversion"
6287                 # A name such as libperl.so.301
6288                 majonly=`echo $patchlevel $subversion |
6289                         $awk '{printf "%d%02d", $1, $2}'`
6290                 majonly=libperl.$so.$majonly
6291                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6292                 # rely on figuring it out from the naming of libc.
6293                 case "${osname}${osvers}" in
6294                 next4*)
6295                         dflt=libperl.5.$so
6296                         # XXX How handle the --version stuff for MAB?
6297                         ;;
6298                 linux*)  # ld won't link with a bare -lperl otherwise.
6299                         dflt=libperl.$so
6300                         ;;
6301                 cygwin*) # include version
6302                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6303                         ;;
6304                 *)      # Try to guess based on whether libc has major.minor.
6305                         case "$libc" in
6306                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6307                         *libc.$so.[0-9]*) dflt=$majonly ;;
6308                         *)      dflt=libperl.$so ;;
6309                         esac
6310                         ;;
6311                 esac
6312                 ;;
6313         *)      dflt=$libperl
6314                 ;;
6315         esac
6316         cat << EOM
6317
6318 I need to select a good name for the shared libperl.  If your system uses
6319 library names with major and minor numbers, then you might want something
6320 like $majmin.  Alternatively, if your system uses a single version
6321 number for shared libraries, then you might want to use $majonly.
6322 Or, your system might be quite happy with a simple libperl.$so.
6323
6324 Since the shared libperl will get installed into a version-specific
6325 architecture-dependent directory, the version number of the shared perl
6326 library probably isn't important, so the default should be o.k.
6327
6328 EOM
6329         rp='What name do you want to give to the shared libperl?'
6330         . ./myread
6331         libperl=$ans
6332         echo "Ok, I'll use $libperl"
6333         ;;
6334 *)
6335         libperl="libperl${_a}"
6336         ;;
6337 esac
6338
6339 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6340 case "$shrpdir" in
6341 '') ;;
6342 *)      $cat >&4 <<EOM
6343 WARNING:  Use of the shrpdir variable for the installation location of
6344 the shared $libperl is not supported.  It was never documented and
6345 will not work in this version.  Let me (perlbug@perl.com)
6346 know of any problems this may cause.
6347
6348 EOM
6349         case "$shrpdir" in
6350         "$archlibexp/CORE")
6351                 $cat >&4 <<EOM
6352 But your current setting of $shrpdir is
6353 the default anyway, so it's harmless.
6354 EOM
6355                 ;;
6356         *)
6357                 $cat >&4 <<EOM
6358 Further, your current attempted setting of $shrpdir
6359 conflicts with the value of $archlibexp/CORE
6360 that installperl will use.
6361 EOM
6362                 ;;
6363         esac
6364         ;;
6365 esac
6366
6367 # How will the perl executable find the installed shared $libperl?
6368 # Add $xxx to ccdlflags.
6369 # If we can't figure out a command-line option, use $shrpenv to
6370 # set env LD_RUN_PATH.  The main perl makefile uses this.
6371 shrpdir=$archlibexp/CORE
6372 xxx=''
6373 tmp_shrpenv=''
6374 if "$useshrplib"; then
6375     case "$osname" in 
6376         aix)
6377                 # We'll set it in Makefile.SH...
6378                 ;;
6379         solaris|netbsd)
6380                 xxx="-R $shrpdir"
6381                 ;;
6382         freebsd)
6383                 xxx="-Wl,-R$shrpdir"
6384                 ;;
6385         linux|irix*|dec_osf)
6386                 xxx="-Wl,-rpath,$shrpdir"
6387                 ;;
6388         next)
6389                 # next doesn't like the default...
6390                 ;;
6391         beos)
6392                 # beos doesn't like the default, either.
6393                 ;;
6394         hpux*)
6395                 # hpux doesn't like the default, either.
6396                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6397                 ;;
6398         *)
6399                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6400                 ;;
6401         esac
6402         case "$xxx" in
6403         '') ;;
6404         *)      
6405                 # Only add $xxx if it isn't already in ccdlflags.
6406                 case " $ccdlflags " in
6407                 *" $xxx "*)     ;;
6408                 *)      ccdlflags="$ccdlflags $xxx"
6409                         cat <<EOM >&4
6410
6411 Adding $xxx to the flags
6412 passed to $ld so that the perl executable will find the 
6413 installed shared $libperl.
6414
6415 EOM
6416                         ;;
6417                 esac
6418                 ;;
6419         esac
6420 fi
6421 # Fix ccdlflags in AIX for building external extensions.
6422 # (For building Perl itself bare -bE:perl.exp is needed,
6423 #  Makefile.SH takes care of this.)
6424 case "$osname" in
6425 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6426 esac
6427 # Respect a hint or command-line value.
6428 case "$shrpenv" in
6429 '') shrpenv="$tmp_shrpenv" ;;
6430 esac
6431 case "$ldlibpthname" in
6432 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6433 none)   ldlibpthname='' ;;
6434 esac
6435
6436 : determine where manual pages go
6437 set man1dir man1dir none
6438 eval $prefixit
6439 $cat <<EOM
6440
6441 $spackage has manual pages available in source form.
6442 EOM
6443 case "$nroff" in
6444 nroff)
6445         echo "However, you don't have nroff, so they're probably useless to you."
6446         case "$man1dir" in
6447         '') man1dir="none";;
6448         esac;;
6449 esac
6450 echo "If you don't want the manual sources installed, answer 'none'."
6451 case "$man1dir" in
6452 ' ') dflt=none
6453         ;;
6454 '')
6455         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6456         lookpath="$lookpath $prefixexp/man/p_man/man1"
6457         lookpath="$lookpath $prefixexp/man/u_man/man1"
6458         lookpath="$lookpath $prefixexp/man/man.1"
6459         case "$sysman" in
6460         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6461         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6462         esac
6463         set dflt
6464         eval $prefixup
6465         ;;
6466 *)  dflt="$man1dir"
6467         ;;
6468 esac
6469 echo " "
6470 fn=dn+~
6471 rp="Where do the main $spackage manual pages (source) go?"
6472 . ./getfile
6473 if $test "X$man1direxp" != "X$ansexp"; then
6474         installman1dir=''
6475 fi
6476 man1dir="$ans"
6477 man1direxp="$ansexp"
6478 case "$man1dir" in
6479 '')     man1dir=' '
6480         installman1dir='';;
6481 esac
6482
6483 : Change installation prefix, if necessary.
6484 if $test X"$prefix" != X"$installprefix"; then
6485         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6486 else
6487         installman1dir="$man1direxp"
6488 fi
6489
6490 : What suffix to use on installed man pages
6491
6492 case "$man1dir" in
6493 ' ')
6494         man1ext='0'
6495         ;;
6496 *)
6497         rp="What suffix should be used for the main $spackage man pages?"
6498         case "$man1ext" in
6499         '')     case "$man1dir" in
6500                 *1)  dflt=1 ;;
6501                 *1p) dflt=1p ;;
6502                 *1pm) dflt=1pm ;;
6503                 *l) dflt=l;;
6504                 *n) dflt=n;;
6505                 *o) dflt=o;;
6506                 *p) dflt=p;;
6507                 *C) dflt=C;;
6508                 *L) dflt=L;;
6509                 *L1) dflt=L1;;
6510                 *) dflt=1;;
6511                 esac
6512                 ;;
6513         *)      dflt="$man1ext";;
6514         esac
6515         . ./myread
6516         man1ext="$ans"
6517         ;;
6518 esac
6519
6520 : see if we can have long filenames
6521 echo " "
6522 rmlist="$rmlist /tmp/cf$$"
6523 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6524 first=123456789abcdef
6525 second=/tmp/cf$$/$first
6526 $rm -f $first $second
6527 if (echo hi >$first) 2>/dev/null; then
6528         if $test -f 123456789abcde; then
6529                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6530                 val="$undef"
6531         else
6532                 if (echo hi >$second) 2>/dev/null; then
6533                         if $test -f /tmp/cf$$/123456789abcde; then
6534                                 $cat <<'EOM'
6535 That's peculiar... You can have filenames longer than 14 characters, but only
6536 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6537 I shall consider your system cannot support long filenames at all.
6538 EOM
6539                                 val="$undef"
6540                         else
6541                                 echo 'You can have filenames longer than 14 characters.' >&4
6542                                 val="$define"
6543                         fi
6544                 else
6545                         $cat <<'EOM'
6546 How confusing! Some of your filesystems are sane enough to allow filenames
6547 longer than 14 characters but some others like /tmp can't even think about them.
6548 So, for now on, I shall assume your kernel does not allow them at all.
6549 EOM
6550                         val="$undef"
6551                 fi
6552         fi
6553 else
6554         $cat <<'EOM'
6555 You can't have filenames longer than 14 chars.  You can't even think about them!
6556 EOM
6557         val="$undef"
6558 fi 
6559 set d_flexfnam
6560 eval $setvar
6561 $rm -rf /tmp/cf$$ 123456789abcde*
6562
6563 : determine where library module manual pages go
6564 set man3dir man3dir none
6565 eval $prefixit
6566 $cat <<EOM
6567
6568 $spackage has manual pages for many of the library modules.
6569 EOM
6570
6571 case "$nroff" in
6572 nroff)
6573         $cat <<'EOM'
6574 However, you don't have nroff, so they're probably useless to you.
6575 EOM
6576         case "$man3dir" in
6577         '') man3dir="none";;
6578         esac;;
6579 esac
6580
6581 case "$d_flexfnam" in
6582 undef)
6583         $cat <<'EOM'
6584 However, your system can't handle the long file names like File::Basename.3. 
6585 EOM
6586         case "$man3dir" in
6587         '') man3dir="none";;
6588         esac;;
6589 esac
6590
6591 echo "If you don't want the manual sources installed, answer 'none'."
6592 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6593 case "$man3dir" in
6594 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6595         if $test -d "$privlib/man/man3"; then
6596                 cat <<EOM >&4
6597
6598 WARNING:  Previous versions of perl installed man3 pages into
6599 $privlib/man/man3.  This version will suggest a 
6600 new default of $dflt.  
6601 EOM
6602                 tdflt=$dflt
6603                 dflt='n'
6604                 rp='Do you wish to preserve the old behavior?(y/n)'
6605                 . ./myread
6606                 case "$ans" in
6607                 y*) dflt="$privlib/man/man3" ;;
6608                 *)  dflt=$tdflt ;;
6609                 esac
6610     fi
6611         ;;
6612 ' ') dflt=none;;
6613 *)      dflt="$man3dir" ;;
6614 esac
6615 echo " "
6616 fn=dn+~
6617 rp="Where do the $package library man pages (source) go?"
6618 . ./getfile
6619 man3dir="$ans"
6620 man3direxp="$ansexp"
6621 case "$man1dir" in
6622 '')     man3dir=' '
6623         installman3dir='';;
6624 esac
6625
6626 : Change installation prefix, if necessary.
6627 if $test X"$prefix" != X"$installprefix"; then
6628         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6629 else
6630         installman3dir="$man3direxp"
6631 fi
6632
6633 : What suffix to use on installed man pages
6634 case "$man3dir" in
6635 ' ')
6636         man3ext='0'
6637         ;;
6638 *)
6639         rp="What suffix should be used for the $package library man pages?"
6640         case "$man3ext" in
6641         '')     case "$man3dir" in
6642                 *3)  dflt=3 ;;
6643                 *3p) dflt=3p ;;
6644                 *3pm) dflt=3pm ;;
6645                 *l) dflt=l;;
6646                 *n) dflt=n;;
6647                 *o) dflt=o;;
6648                 *p) dflt=p;;
6649                 *C) dflt=C;;
6650                 *L) dflt=L;;
6651                 *L3) dflt=L3;;
6652                 *) dflt=3;;
6653                 esac
6654                 ;;
6655         *)      dflt="$man3ext";;
6656         esac
6657         . ./myread
6658         man3ext="$ans"
6659         ;;
6660 esac
6661
6662 : see if we have to deal with yellow pages, now NIS.
6663 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6664         if $test -f /usr/etc/nibindd; then
6665                 echo " "
6666                 echo "I'm fairly confident you're on a NeXT."
6667                 echo " "
6668                 rp='Do you get the hosts file via NetInfo?'
6669                 dflt=y
6670                 case "$hostcat" in
6671                 nidump*) ;;
6672                 '') ;;
6673                 *) dflt=n;;
6674                 esac
6675                 . ./myread
6676                 case "$ans" in
6677                 y*) hostcat='nidump hosts .';;
6678                 *)      case "$hostcat" in
6679                         nidump*) hostcat='';;
6680                         esac
6681                         ;;
6682                 esac
6683         fi
6684         case "$hostcat" in
6685         nidump*) ;;
6686         *)
6687                 case "$hostcat" in
6688                 *ypcat*) dflt=y;;
6689                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6690                                 dflt=y
6691                         else
6692                                 dflt=n
6693                         fi;;
6694                 *) dflt=n;;
6695                 esac
6696                 echo " "
6697                 rp='Are you getting the hosts file via yellow pages?'
6698                 . ./myread
6699                 case "$ans" in
6700                 y*) hostcat='ypcat hosts';;
6701                 *) hostcat='cat /etc/hosts';;
6702                 esac
6703                 ;;
6704         esac
6705 fi
6706 case "$hostcat" in
6707 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6708 esac
6709 case "$groupcat" in
6710 '') test -f /etc/group && groupcat='cat /etc/group';;
6711 esac
6712 case "$passcat" in
6713 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6714 esac
6715
6716 : now get the host name
6717 echo " "
6718 echo "Figuring out host name..." >&4
6719 case "$myhostname" in
6720 '') cont=true
6721         echo 'Maybe "hostname" will work...'
6722         if tans=`sh -c hostname 2>&1` ; then
6723                 myhostname=$tans
6724                 phostname=hostname
6725                 cont=''
6726         fi
6727         ;;
6728 *) cont='';;
6729 esac
6730 if $test "$cont"; then
6731         if ./xenix; then
6732                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6733                 if tans=`cat /etc/systemid 2>&1` ; then
6734                         myhostname=$tans
6735                         phostname='cat /etc/systemid'
6736                         echo "Whadyaknow.  Xenix always was a bit strange..."
6737                         cont=''
6738                 fi
6739         elif $test -r /etc/systemid; then
6740                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6741         fi
6742 fi
6743 if $test "$cont"; then
6744         echo 'No, maybe "uuname -l" will work...'
6745         if tans=`sh -c 'uuname -l' 2>&1` ; then
6746                 myhostname=$tans
6747                 phostname='uuname -l'
6748         else
6749                 echo 'Strange.  Maybe "uname -n" will work...'
6750                 if tans=`sh -c 'uname -n' 2>&1` ; then
6751                         myhostname=$tans
6752                         phostname='uname -n'
6753                 else
6754                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6755                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6756                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6757                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6758                         else
6759                                 case "$myhostname" in
6760                                 '') echo "Does this machine have an identity crisis or something?"
6761                                         phostname='';;
6762                                 *)
6763                                         echo "Well, you said $myhostname before..."
6764                                         phostname='echo $myhostname';;
6765                                 esac
6766                         fi
6767                 fi
6768         fi
6769 fi
6770 : you do not want to know about this
6771 set $myhostname
6772 myhostname=$1
6773
6774 : verify guess
6775 if $test "$myhostname" ; then
6776         dflt=y
6777         rp='Your host name appears to be "'$myhostname'".'" Right?"
6778         . ./myread
6779         case "$ans" in
6780         y*) ;;
6781         *) myhostname='';;
6782         esac
6783 fi
6784
6785 : bad guess or no guess
6786 while $test "X$myhostname" = X ; do
6787         dflt=''
6788         rp="Please type the (one word) name of your host:"
6789         . ./myread
6790         myhostname="$ans"
6791 done
6792
6793 : translate upper to lower if necessary
6794 case "$myhostname" in
6795 *[A-Z]*)
6796         echo "(Normalizing case in your host name)"
6797         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6798         ;;
6799 esac
6800
6801 case "$myhostname" in
6802 *.*)
6803         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6804         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6805         echo "(Trimming domain name from host name--host name is now $myhostname)"
6806         ;;
6807 *) case "$mydomain" in
6808         '')
6809                 {
6810                         test "X$hostcat" = "Xypcat hosts" &&
6811                         ypmatch "$myhostname" hosts 2>/dev/null |\
6812                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6813                         $test -s hosts
6814                 } || {
6815                         test "X$hostcat" != "X" &&
6816                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6817                                         /[       ]$myhostname[  . ]/p" > hosts
6818                 }
6819                 tmp_re="[       . ]"
6820                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6821                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6822                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6823                         hosts | $sort | $uniq | \
6824                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6825                 case `$echo X$dflt` in
6826                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6827                         dflt=.
6828                         ;;
6829                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6830                         ;;
6831                 esac
6832                 case "$dflt" in
6833                 .)
6834                         tans=`./loc resolv.conf X /etc /usr/etc`
6835                         if $test -f "$tans"; then
6836                                 echo "(Attempting domain name extraction from $tans)"
6837                                 dflt=.`$sed -n -e 's/   / /g' \
6838                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6839                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6840                                 case "$dflt" in
6841                                 .) dflt=.`$sed -n -e 's/        / /g' \
6842                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6843                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6844                                         ;;
6845                                 esac
6846                         fi
6847                         ;;
6848                 esac
6849                 case "$dflt" in
6850                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6851                         dflt=.`sh -c domainname 2>/dev/null`
6852                         case "$dflt" in
6853                         '') dflt='.';;
6854                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6855                         esac
6856                         ;;
6857                 esac
6858                 case "$dflt" in
6859                 .) echo "(Lost all hope -- silly guess then)"
6860                         dflt='.uucp'
6861                         ;;
6862                 esac
6863                 $rm -f hosts
6864                 ;;
6865         *) dflt="$mydomain";;
6866         esac;;
6867 esac
6868 echo " "
6869 rp="What is your domain name?"
6870 . ./myread
6871 tans="$ans"
6872 case "$ans" in
6873 '') ;;
6874 .*) ;;
6875 *) tans=".$tans";;
6876 esac
6877 mydomain="$tans"
6878
6879 : translate upper to lower if necessary
6880 case "$mydomain" in
6881 *[A-Z]*)
6882         echo "(Normalizing case in your domain name)"
6883         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6884         ;;
6885 esac
6886
6887 : a little sanity check here
6888 case "$phostname" in
6889 '') ;;
6890 *)
6891         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6892         $myhostname$mydomain|$myhostname) ;;
6893         *)
6894                 case "$phostname" in
6895                 sed*)
6896                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6897                         ;;
6898                 *)
6899                         echo "(That doesn't agree with your $phostname command, by the way.)"
6900                         ;;
6901                 esac
6902         ;;
6903         esac
6904         ;;
6905 esac
6906
6907 $cat <<EOM
6908
6909 I need to get your e-mail address in Internet format if possible, i.e.
6910 something like user@host.domain. Please answer accurately since I have
6911 no easy means to double check it. The default value provided below
6912 is most probably close to reality but may not be valid from outside
6913 your organization...
6914
6915 EOM
6916 cont=x
6917 while test "$cont"; do
6918         case "$cf_email" in
6919         '') dflt="$cf_by@$myhostname$mydomain";;
6920         *) dflt="$cf_email";;
6921         esac
6922         rp='What is your e-mail address?'
6923         . ./myread
6924         cf_email="$ans"
6925         case "$cf_email" in
6926         *@*.*) cont='' ;;
6927         *)
6928                 rp='Address does not look like an Internet one.  Use it anyway?'
6929                 case "$fastread" in
6930                 yes) dflt=y ;;
6931                 *) dflt=n ;;
6932                 esac
6933                 . ./myread
6934                 case "$ans" in
6935                 y*) cont='' ;;
6936                 *) echo " " ;;
6937                 esac
6938                 ;;
6939         esac
6940 done
6941
6942 $cat <<EOM
6943
6944 If you or somebody else will be maintaining perl at your site, please
6945 fill in the correct e-mail address here so that they may be contacted
6946 if necessary. Currently, the "perlbug" program included with perl
6947 will send mail to this address in addition to perlbug@perl.com. You may
6948 enter "none" for no administrator.
6949
6950 EOM
6951 case "$perladmin" in
6952 '') dflt="$cf_email";;
6953 *) dflt="$perladmin";;
6954 esac
6955 rp='Perl administrator e-mail address'
6956 . ./myread
6957 perladmin="$ans"
6958
6959 : figure out how to guarantee perl startup
6960 case "$startperl" in
6961 '')
6962         case "$sharpbang" in
6963         *!)
6964                 $cat <<EOH
6965
6966 I can use the #! construct to start perl on your system. This will
6967 make startup of perl scripts faster, but may cause problems if you
6968 want to share those scripts and perl is not in a standard place
6969 ($binexp/perl) on all your platforms. The alternative is to force
6970 a shell by starting the script with a single ':' character.
6971
6972 EOH
6973                 dflt="$binexp/perl"
6974                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6975                 . ./myread
6976                 case "$ans" in
6977                 none)   startperl=": # use perl";;
6978                 *)      startperl="#!$ans"
6979                         if $test 30 -lt `echo "$ans" | wc -c`; then
6980                                 $cat >&4 <<EOM
6981
6982 WARNING:  Some systems limit the #! command to 32 characters.
6983 If you experience difficulty running Perl scripts with #!, try
6984 installing Perl in a directory with a shorter pathname.
6985
6986 EOM
6987                         fi ;;
6988                 esac
6989                 ;;
6990         *) startperl=": # use perl"
6991                 ;;
6992         esac
6993         ;;
6994 esac
6995 echo "I'll use $startperl to start perl scripts."
6996
6997 : figure best path for perl in scripts
6998 case "$perlpath" in
6999 '')
7000         perlpath="$binexp/perl"
7001         case "$startperl" in
7002         *!*) ;;
7003         *)
7004                 $cat <<EOH
7005
7006 I will use the "eval 'exec'" idiom to start Perl on your system.
7007 I can use the full path of your Perl binary for this purpose, but
7008 doing so may cause problems if you want to share those scripts and
7009 Perl is not always in a standard place ($binexp/perl).
7010
7011 EOH
7012                 dflt="$binexp/perl"
7013                 rp="What path shall I use in \"eval 'exec'\"?"
7014                 . ./myread
7015                 perlpath="$ans"
7016                 ;;
7017         esac
7018         ;;
7019 esac
7020 case "$startperl" in
7021 *!*)    ;;
7022 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7023 esac
7024
7025 : determine where public executable scripts go
7026 set scriptdir scriptdir
7027 eval $prefixit
7028 case "$scriptdir" in
7029 '')
7030         dflt="$bin"
7031         : guess some guesses
7032         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7033         $test -d /usr/share/bin     && dflt=/usr/share/bin
7034         $test -d /usr/local/script  && dflt=/usr/local/script
7035         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7036         $test -d $prefixexp/script  && dflt=$prefixexp/script
7037         set dflt
7038         eval $prefixup
7039         ;;
7040 *)  dflt="$scriptdir"
7041         ;;
7042 esac
7043 $cat <<EOM
7044  
7045 Some installations have a separate directory just for executable scripts so
7046 that they can mount it across multiple architectures but keep the scripts in
7047 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7048 Or you might just lump your scripts in with all your other executables.
7049  
7050 EOM
7051 fn=d~
7052 rp='Where do you keep publicly executable scripts?'
7053 . ./getfile
7054 if $test "X$ansexp" != "X$scriptdirexp"; then
7055         installscript=''
7056 fi
7057 scriptdir="$ans"
7058 scriptdirexp="$ansexp"
7059 : Change installation prefix, if necessary.
7060 if $test X"$prefix" != X"$installprefix"; then
7061         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7062 else
7063         installscript="$scriptdirexp"
7064 fi
7065
7066 : determine where site specific architecture-dependent libraries go.
7067 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7068 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7069 : sitelib may have an optional trailing /share.
7070 case "$sitearch" in
7071 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7072         dflt="$dflt/$archname"
7073         ;;
7074 *)      dflt="$sitearch"
7075         ;;
7076 esac
7077 set sitearch sitearch none
7078 eval $prefixit
7079 $cat <<EOM
7080
7081 The installation process will also create a directory for
7082 architecture-dependent site-specific extensions and modules.
7083
7084 EOM
7085 fn=d~+
7086 rp='Pathname for the site-specific architecture-dependent library files?'
7087 . ./getfile
7088 sitearch="$ans"
7089 sitearchexp="$ansexp"
7090 : Change installation prefix, if necessary.
7091 if $test X"$prefix" != X"$installprefix"; then
7092         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7093 else
7094         installsitearch="$sitearchexp"
7095 fi
7096
7097 : determine where add-on public executables go
7098 case "$sitebin" in
7099 '')     dflt=$siteprefix/bin ;;
7100 *)      dflt=$sitebin ;;
7101 esac
7102 fn=d~
7103 rp='Pathname where the add-on public executables should be installed?'
7104 . ./getfile
7105 sitebin="$ans"
7106 sitebinexp="$ansexp"
7107 : Change installation prefix, if necessary.
7108 if $test X"$prefix" != X"$installprefix"; then
7109         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7110 else
7111         installsitebin="$sitebinexp"
7112 fi
7113
7114 : see if sqrtl exists
7115 set sqrtl d_sqrtl
7116 eval $inlibc
7117
7118 case "$ccflags" in
7119 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
7120 esac
7121
7122 case "$uselongdouble" in
7123 $define|true|[yY]*)     dflt='y';;
7124 *) dflt='n';;
7125 esac
7126 cat <<EOM
7127
7128 Perl can be built to take advantage of long doubles which
7129 (if available) may give more accuracy and range for floating point numbers.
7130
7131 If this doesn't make any sense to you, just accept the default '$dflt'.
7132 EOM
7133 rp='Try to use long doubles if available?'
7134 . ./myread
7135 case "$ans" in
7136 y|Y)    val="$define"   ;;
7137 *)      val="$undef"    ;;
7138 esac
7139 set uselongdouble
7140 eval $setvar
7141
7142 case "$uselongdouble" in
7143 true|[yY]*) uselongdouble="$define" ;;
7144 esac
7145
7146 case "$uselongdouble" in
7147 $define)
7148 : Look for a hint-file generated 'call-back-unit'.  If the
7149 : user has specified that long doubles should be used,
7150 : we may need to set or change some other defaults.
7151         if $test -f uselongdouble.cbu; then
7152                 echo "Your platform has some specific hints for long doubles, using them..."
7153                 . ./uselongdouble.cbu
7154         else
7155                 $cat <<EOM
7156 (Your platform doesn't have any specific hints for long doubles.)
7157 EOM
7158         fi
7159         ;;
7160 esac
7161
7162 case "$uselongdouble:$d_sqrtl" in
7163 $define:$undef)
7164                 $cat <<EOM >&4
7165
7166 You requested the use of long doubles but you do not seem to have
7167 the mathematic functions for long doubles.  I'm disabling the use
7168 of long doubles.
7169 EOM
7170         uselongdouble=$undef
7171         ;;
7172 esac
7173
7174 case "$useperlio" in
7175 $define|true|[yY]*)     dflt='y';;
7176 *) dflt='n';;
7177 esac
7178 cat <<EOM
7179
7180 Previous version of $package used the standard IO mechanisms as defined
7181 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7182 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7183 the default.  This abstraction layer can use AT&T's sfio (if you already
7184 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7185 problems with some extension modules.  Using PerlIO with stdio is safe,
7186 but it is slower than plain stdio and therefore is not the default.
7187
7188 If this doesn't make any sense to you, just accept the default '$dflt'.
7189 EOM
7190 rp='Use the experimental PerlIO abstraction layer?'
7191 . ./myread
7192 case "$ans" in
7193 y|Y) 
7194         val="$define"
7195         ;;     
7196 *)      
7197         echo "Ok, doing things the stdio way"
7198         val="$undef"
7199         ;;
7200 esac
7201 set useperlio
7202 eval $setvar 
7203
7204 case "$vendorprefix" in
7205 '')     d_vendorbin="$undef"
7206         vendorbin=''
7207         vendorbinexp=''
7208         ;;
7209 *)      d_vendorbin="$define"
7210         : determine where vendor-supplied executables go.
7211         case "$vendorbin" in
7212         '') dflt=$vendorprefix/bin ;;
7213         *)      dflt="$vendorbin" ;;
7214         esac
7215         fn=d~+
7216         rp='Pathname for the vendor-supplied executables directory?'
7217         . ./getfile
7218         vendorbin="$ans"
7219         vendorbinexp="$ansexp"
7220         ;;
7221 esac
7222 : Change installation prefix, if necessary.
7223 if $test X"$prefix" != X"$installprefix"; then
7224         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7225 else
7226         installvendorbin="$vendorbinexp"
7227 fi
7228
7229 : check for length of double
7230 echo " "
7231 case "$doublesize" in
7232 '')
7233         echo "Checking to see how big your double precision numbers are..." >&4
7234         $cat >try.c <<'EOCP'
7235 #include <stdio.h>
7236 int main()
7237 {
7238     printf("%d\n", (int)sizeof(double));
7239     exit(0);
7240 }
7241 EOCP
7242         set try
7243         if eval $compile_ok; then
7244                 doublesize=`./try`
7245                 echo "Your double is $doublesize bytes long."
7246         else
7247                 dflt='8'
7248                 echo "(I can't seem to compile the test program.  Guessing...)"
7249                 rp="What is the size of a double precision number (in bytes)?"
7250                 . ./myread
7251                 doublesize="$ans"
7252         fi
7253         ;;
7254 esac
7255 $rm -f try.c try
7256
7257 : check for long doubles
7258 echo " "
7259 echo "Checking to see if you have long double..." >&4
7260 echo 'int main() { long double x = 7.0; }' > try.c
7261 set try
7262 if eval $compile; then
7263         val="$define"
7264         echo "You have long double."
7265 else
7266         val="$undef"
7267         echo "You do not have long double."
7268 fi
7269 $rm try.*
7270 set d_longdbl
7271 eval $setvar
7272
7273 : check for length of long double
7274 case "${d_longdbl}${longdblsize}" in
7275 $define)
7276         echo " "
7277         echo "Checking to see how big your long doubles are..." >&4
7278         $cat >try.c <<'EOCP'
7279 #include <stdio.h>
7280 int main()
7281 {
7282         printf("%d\n", sizeof(long double));
7283 }
7284 EOCP
7285         set try
7286         set try
7287         if eval $compile; then
7288                 longdblsize=`./try$exe_ext`
7289                 echo "Your long doubles are $longdblsize bytes long."
7290         else
7291                 dflt='8'
7292                 echo " "
7293                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7294                 rp="What is the size of a long double (in bytes)?"
7295                 . ./myread
7296                 longdblsize="$ans"
7297         fi
7298         if $test "X$doublesize" = "X$longdblsize"; then
7299                 echo "(That isn't any different from an ordinary double.)"
7300         fi      
7301         ;;
7302 esac
7303 $rm -f try.* try
7304
7305 : Check how to convert floats to strings.
7306 if test "X$d_Gconvert" = X; then
7307         echo " "
7308         echo "Checking for an efficient way to convert floats to strings."
7309         $cat >try.c <<EOP
7310 #ifdef TRY_gconvert
7311 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7312 char *myname = "gconvert";
7313 #endif
7314 #ifdef TRY_gcvt
7315 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7316 char *myname = "gcvt";
7317 #endif
7318 #ifdef TRY_qgcvt
7319 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7320 char *myname = "qgcvt";
7321 #define DOUBLETYPE long double
7322 #endif
7323 #ifdef TRY_sprintf
7324 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7325 char *myname = "sprintf";
7326 #endif
7327
7328 #ifndef DOUBLETYPE
7329 #define DOUBLETYPE double
7330 #endif
7331
7332 #include <stdio.h>
7333
7334 #define I_STDLIB $i_stdlib
7335 #ifdef I_STDLIB
7336 #include <stdlib.h>
7337 #endif
7338
7339 int
7340 checkit(expect, got)
7341 char *expect;
7342 char *got;
7343 {
7344     if (strcmp(expect, got)) {
7345                 printf("%s oddity:  Expected %s, got %s\n",
7346                         myname, expect, got);
7347                 exit(1);
7348         }
7349 }
7350
7351 int main()
7352
7353         char buf[64]; 
7354         buf[63] = '\0';
7355
7356         /* This must be 1st test on (which?) platform */
7357         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7358         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7359         checkit("0.1", buf);
7360
7361         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7362         checkit("1", buf);
7363
7364         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7365         checkit("0", buf);
7366
7367         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7368         checkit("-1", buf);
7369
7370         /* Some Linux gcvt's give 1.e+5 here. */
7371         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7372         checkit("100000", buf);
7373         
7374         /* Some Linux gcvt's give -1.e+5 here. */
7375         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7376         checkit("-100000", buf);
7377
7378         exit(0);
7379 }
7380 EOP
7381         case "$d_Gconvert" in
7382         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7383         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7384         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7385         *) xxx_list='gconvert gcvt sprintf' ;;
7386         esac
7387
7388         case "$d_longdbl$uselongdouble" in
7389         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7390         esac
7391
7392         for xxx_convert in $xxx_list; do
7393                 echo "Trying $xxx_convert..."
7394                 $rm -f try try$_o
7395                 set try -DTRY_$xxx_convert
7396                 if eval $compile; then
7397                         echo "$xxx_convert() found." >&4
7398                         if ./try; then
7399                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7400                                 break;
7401                         else
7402                                 echo "...But $xxx_convert didn't work as I expected."
7403                         fi
7404                 else
7405                         echo "$xxx_convert NOT found." >&4
7406                 fi
7407         done
7408                 
7409         case "$xxx_convert" in
7410         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7411         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7412         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7413         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7414         esac
7415 fi
7416
7417 echo " "
7418
7419 if $test X"$d_longdbl" = X"$define"; then
7420
7421 echo "Checking how to print long doubles..." >&4
7422
7423 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7424         $cat >try.c <<'EOCP'
7425 #include <sys/types.h>
7426 #include <stdio.h>
7427 int main() {
7428   double d = 123.456;
7429   printf("%.3f\n", d);
7430 }
7431 EOCP
7432         set try
7433         if eval $compile; then
7434                 yyy=`./try$exe_ext`
7435                 case "$yyy" in
7436                 123.456)
7437                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7438                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7439                         echo "We will use %f."
7440                         ;;
7441                 esac
7442         fi
7443 fi
7444
7445 if $test X"$sPRIfldbl" = X; then
7446         $cat >try.c <<'EOCP'
7447 #include <sys/types.h>
7448 #include <stdio.h>
7449 int main() {
7450   long double d = 123.456;
7451   printf("%.3llf\n", d);
7452 }
7453 EOCP
7454         set try
7455         if eval $compile; then
7456                 yyy=`./try$exe_ext`
7457                 case "$yyy" in
7458                 123.456)
7459                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7460                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7461                         echo "We will use %llf."
7462                         ;;
7463                 esac
7464         fi
7465 fi
7466
7467 if $test X"$sPRIfldbl" = X; then
7468         $cat >try.c <<'EOCP'
7469 #include <sys/types.h>
7470 #include <stdio.h>
7471 int main() {
7472   long double d = 123.456;
7473   printf("%.3Lf\n", d);
7474 }
7475 EOCP
7476         set try
7477         if eval $compile; then
7478                 yyy=`./try$exe_ext`
7479                 case "$yyy" in
7480                 123.456)
7481                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7482                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7483                         echo "We will use %Lf."
7484                         ;;
7485                 esac
7486         fi
7487 fi
7488
7489 if $test X"$sPRIfldbl" = X; then
7490         $cat >try.c <<'EOCP'
7491 #include <sys/types.h>
7492 #include <stdio.h>
7493 int main() {
7494   long double d = 123.456;
7495   printf("%.3lf\n", d);
7496 }
7497 EOCP
7498         set try
7499         if eval $compile; then
7500                 yyy=`./try$exe_ext`
7501                 case "$yyy" in
7502                 123.456)
7503                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7504                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7505                         echo "We will use %lf."
7506                         ;;
7507                 esac
7508         fi
7509 fi
7510
7511 if $test X"$sPRIfldbl" = X; then
7512         echo "Cannot figure out how to print long doubles." >&4
7513 fi
7514
7515 $rm -f try try.*
7516
7517 fi # d_longdbl
7518
7519 case "$sPRIfldbl" in
7520 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7521         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7522         ;;
7523 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7524         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7525         ;;
7526 esac
7527
7528 : Initialize h_fcntl
7529 h_fcntl=false
7530
7531 : Initialize h_sysfile
7532 h_sysfile=false
7533
7534 : access call always available on UNIX
7535 set access d_access
7536 eval $inlibc
7537
7538 : locate the flags for 'access()'
7539 case "$d_access" in
7540 "$define")
7541         echo " "
7542         $cat >access.c <<'EOCP'
7543 #include <sys/types.h>
7544 #ifdef I_FCNTL
7545 #include <fcntl.h>
7546 #endif
7547 #ifdef I_SYS_FILE
7548 #include <sys/file.h>
7549 #endif
7550 #ifdef I_UNISTD
7551 #include <unistd.h>
7552 #endif
7553 int main() {
7554         exit(R_OK);
7555 }
7556 EOCP
7557         : check sys/file.h first, no particular reason here
7558         if $test `./findhdr sys/file.h` && \
7559                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7560                 h_sysfile=true;
7561                 echo "<sys/file.h> defines the *_OK access constants." >&4
7562         elif $test `./findhdr fcntl.h` && \
7563                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7564                 h_fcntl=true;
7565                 echo "<fcntl.h> defines the *_OK access constants." >&4
7566         elif $test `./findhdr unistd.h` && \
7567                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7568                 echo "<unistd.h> defines the *_OK access constants." >&4
7569         else
7570                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7571         fi
7572         ;;
7573 esac
7574 $rm -f access*
7575
7576 : see if accessx exists
7577 set accessx d_accessx
7578 eval $inlibc
7579
7580 : see if alarm exists
7581 set alarm d_alarm
7582 eval $inlibc
7583
7584 : see if atolf exists
7585 set atolf d_atolf
7586 eval $inlibc
7587
7588 : see if atoll exists
7589 set atoll d_atoll
7590 eval $inlibc
7591
7592 : Look for GNU-cc style attribute checking
7593 echo " "
7594 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7595 $cat >attrib.c <<'EOCP'
7596 #include <stdio.h>
7597 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7598 EOCP
7599 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7600         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7601                 echo "Your C compiler doesn't fully support __attribute__."
7602                 val="$undef"
7603         else
7604                 echo "Your C compiler supports __attribute__."
7605                 val="$define"
7606         fi
7607 else
7608         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7609         val="$undef"
7610 fi
7611 set d_attribut
7612 eval $setvar
7613 $rm -f attrib*
7614
7615 : see if bcmp exists
7616 set bcmp d_bcmp
7617 eval $inlibc
7618
7619 : see if bcopy exists
7620 set bcopy d_bcopy
7621 eval $inlibc
7622
7623 : see if this is a unistd.h system
7624 set unistd.h i_unistd
7625 eval $inhdr
7626
7627 : see if getpgrp exists
7628 set getpgrp d_getpgrp
7629 eval $inlibc
7630
7631 case "$d_getpgrp" in
7632 "$define")
7633         echo " "
7634         echo "Checking to see which flavor of getpgrp is in use..."
7635         $cat >set.c <<EOP
7636 #$i_unistd I_UNISTD
7637 #include <sys/types.h>
7638 #ifdef I_UNISTD
7639 #  include <unistd.h>
7640 #endif
7641 int main()
7642 {
7643         if (getuid() == 0) {
7644                 printf("(I see you are running Configure as super-user...)\n");
7645                 setuid(1);
7646         }
7647 #ifdef TRY_BSD_PGRP
7648         if (getpgrp(1) == 0)
7649                 exit(0);
7650 #else
7651         if (getpgrp() > 0)
7652                 exit(0);
7653 #endif
7654         exit(1);
7655 }
7656 EOP
7657         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7658                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7659                 val="$define"
7660         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7661                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7662                 val="$undef"
7663         else
7664                 echo "I can't seem to compile and run the test program."
7665                 if ./usg; then
7666                         xxx="a USG one, i.e. you use getpgrp()."
7667                 else
7668                         # SVR4 systems can appear rather BSD-ish.
7669                         case "$i_unistd" in
7670                         $undef)
7671                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7672                                 val="$define"
7673                                 ;;
7674                         $define)
7675                                 xxx="probably a USG one, i.e. you use getpgrp()."
7676                                 val="$undef"
7677                                 ;;
7678                         esac
7679                 fi
7680                 echo "Assuming your getpgrp is $xxx" >&4
7681         fi
7682         ;;
7683 *) val="$undef";;
7684 esac
7685 set d_bsdgetpgrp
7686 eval $setvar
7687 $rm -f set set.c
7688
7689 : see if setpgrp exists
7690 set setpgrp d_setpgrp
7691 eval $inlibc
7692
7693 case "$d_setpgrp" in
7694 "$define")
7695         echo " "
7696         echo "Checking to see which flavor of setpgrp is in use..."
7697         $cat >set.c <<EOP
7698 #$i_unistd I_UNISTD
7699 #include <sys/types.h>
7700 #ifdef I_UNISTD
7701 #  include <unistd.h>
7702 #endif
7703 int main()
7704 {
7705         if (getuid() == 0) {
7706                 printf("(I see you are running Configure as super-user...)\n");
7707                 setuid(1);
7708         }
7709 #ifdef TRY_BSD_PGRP
7710         if (-1 == setpgrp(1, 1))
7711                 exit(0);
7712 #else
7713         if (setpgrp() != -1)
7714                 exit(0);
7715 #endif
7716         exit(1);
7717 }
7718 EOP
7719         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7720                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7721                 val="$define"
7722         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7723                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7724                 val="$undef"
7725         else
7726                 echo "(I can't seem to compile and run the test program.)"
7727                 if ./usg; then
7728                         xxx="a USG one, i.e. you use setpgrp()."
7729                 else
7730                         # SVR4 systems can appear rather BSD-ish.
7731                         case "$i_unistd" in
7732                         $undef)
7733                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7734                                 val="$define"
7735                                 ;;
7736                         $define)
7737                                 xxx="probably a USG one, i.e. you use setpgrp()."
7738                                 val="$undef"
7739                                 ;;
7740                         esac
7741                 fi
7742                 echo "Assuming your setpgrp is $xxx" >&4
7743         fi
7744         ;;
7745 *) val="$undef";;
7746 esac
7747 set d_bsdsetpgrp
7748 eval $setvar
7749 $rm -f set set.c
7750 : see if bzero exists
7751 set bzero d_bzero
7752 eval $inlibc
7753
7754 : see if signal is declared as pointer to function returning int or void
7755 echo " "
7756 xxx=`./findhdr signal.h`
7757 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7758 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7759         echo "You have int (*signal())() instead of void." >&4
7760         val="$undef"
7761 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7762         echo "You have void (*signal())()." >&4
7763         val="$define"
7764 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7765         echo "You have int (*signal())() instead of void." >&4
7766         val="$undef"
7767 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7768         echo "You have void (*signal())()." >&4
7769         val="$define"
7770 else
7771         case "$d_voidsig" in
7772         '')
7773         echo "I can't determine whether signal handler returns void or int..." >&4
7774                 dflt=void
7775                 rp="What type does your signal handler return?"
7776                 . ./myread
7777                 case "$ans" in
7778                 v*) val="$define";;
7779                 *) val="$undef";;
7780                 esac;;
7781         "$define")
7782                 echo "As you already told me, signal handler returns void." >&4
7783                 val="$define"
7784                 ;;
7785         *)      echo "As you already told me, signal handler returns int." >&4
7786                 val="$undef"
7787                 ;;
7788         esac
7789 fi
7790 set d_voidsig
7791 eval $setvar
7792 case "$d_voidsig" in
7793 "$define") signal_t="void";;
7794 *) signal_t="int";;
7795 esac
7796 $rm -f $$.tmp
7797
7798 : check for ability to cast large floats to 32-bit ints.
7799 echo " "
7800 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7801 if $test "$intsize" -ge 4; then
7802         xxx=int
7803 else
7804         xxx=long
7805 fi
7806 $cat >try.c <<EOCP
7807 #include <stdio.h>
7808 #include <sys/types.h>
7809 #include <signal.h>
7810 $signal_t blech(s) int s; { exit(3); }
7811 int main()
7812 {
7813         $xxx i32;
7814         double f, g;
7815         int result = 0;
7816         char str[16];
7817         signal(SIGFPE, blech);
7818
7819         /* Don't let compiler optimize the test away.  Store the number 
7820            in a writable string for gcc to pass to sscanf under HP/UX.
7821         */
7822         sprintf(str, "2147483647");
7823         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7824         g = 10 * f;
7825         i32  = ($xxx) g;
7826
7827         /* x86 processors will probably give 0x8000 0000, which is a
7828        sign change.  We don't want that.  We want to mimic SPARC
7829            behavior here, which is to preserve the sign and give
7830            back 0x7fff ffff.
7831         */
7832         if (i32 != ($xxx) f)
7833                 result |= 1;
7834         exit(result);
7835 }
7836 EOCP
7837 set try
7838 if eval $compile_ok; then
7839         ./try
7840         yyy=$?
7841 else
7842         echo "(I can't seem to compile the test program--assuming it can't)"
7843         yyy=1
7844 fi
7845 case "$yyy" in
7846 0)      val="$define"
7847         echo "Yup, it can."
7848         ;;
7849 *)      val="$undef"
7850         echo "Nope, it can't."
7851         ;;
7852 esac
7853 set d_casti32
7854 eval $setvar
7855 $rm -f try try.*
7856
7857 : check for ability to cast negative floats to unsigned
7858 echo " "
7859 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7860 $cat >try.c <<EOCP
7861 #include <stdio.h>
7862 #include <sys/types.h>
7863 #include <signal.h>
7864 $signal_t blech(s) int s; { exit(7); }
7865 $signal_t blech_in_list(s) int s; { exit(4); }
7866 unsigned long dummy_long(p) unsigned long p; { return p; }
7867 unsigned int dummy_int(p) unsigned int p; { return p; }
7868 unsigned short dummy_short(p) unsigned short p; { return p; }
7869 int main()
7870 {
7871         double f;
7872         unsigned long along;
7873         unsigned int aint;
7874         unsigned short ashort;
7875         int result = 0;
7876         char str[16];
7877         
7878         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7879            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7880            optimized the whole file away
7881         */
7882         /* Store the number in a writable string for gcc to pass to 
7883            sscanf under HP/UX.
7884         */
7885         sprintf(str, "-123");
7886         sscanf(str, "%lf", &f);  /* f = -123.; */
7887
7888         signal(SIGFPE, blech);
7889         along = (unsigned long)f;
7890         aint = (unsigned int)f;
7891         ashort = (unsigned short)f;
7892         if (along != (unsigned long)-123)
7893                 result |= 1;
7894         if (aint != (unsigned int)-123)
7895                 result |= 1;
7896         if (ashort != (unsigned short)-123)
7897                 result |= 1;
7898         sprintf(str, "1073741824.");
7899         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7900         f = f + f;
7901         along = 0;
7902         along = (unsigned long)f;
7903         if (along != 0x80000000)
7904                 result |= 2;
7905         f -= 1.;
7906         along = 0;
7907         along = (unsigned long)f;
7908         if (along != 0x7fffffff)
7909                 result |= 1;
7910         f += 2.;
7911         along = 0;
7912         along = (unsigned long)f;
7913         if (along != 0x80000001)
7914                 result |= 2;
7915         if (result)
7916                 exit(result);
7917         signal(SIGFPE, blech_in_list);
7918         sprintf(str, "123.");
7919         sscanf(str, "%lf", &f);  /* f = 123.; */
7920         along = dummy_long((unsigned long)f);
7921         aint = dummy_int((unsigned int)f);
7922         ashort = dummy_short((unsigned short)f);
7923         if (along != (unsigned long)123)
7924                 result |= 4;
7925         if (aint != (unsigned int)123)
7926                 result |= 4;
7927         if (ashort != (unsigned short)123)
7928                 result |= 4;
7929         exit(result);
7930
7931 }
7932 EOCP
7933 set try
7934 if eval $compile_ok; then
7935         ./try
7936         castflags=$?
7937 else
7938         echo "(I can't seem to compile the test program--assuming it can't)"
7939         castflags=7
7940 fi
7941 case "$castflags" in
7942 0)      val="$define"
7943         echo "Yup, it can."
7944         ;;
7945 *)      val="$undef"
7946         echo "Nope, it can't."
7947         ;;
7948 esac
7949 set d_castneg
7950 eval $setvar
7951 $rm -f try.*
7952
7953 : see if vprintf exists
7954 echo " "
7955 if set vprintf val -f d_vprintf; eval $csym; $val; then
7956         echo 'vprintf() found.' >&4
7957         val="$define"
7958         $cat >vprintf.c <<'EOF'
7959 #include <varargs.h>
7960
7961 int main() { xxx("foo"); }
7962
7963 xxx(va_alist)
7964 va_dcl
7965 {
7966         va_list args;
7967         char buf[10];
7968
7969         va_start(args);
7970         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7971 }
7972 EOF
7973         set vprintf
7974         if eval $compile && ./vprintf; then
7975                 echo "Your vsprintf() returns (int)." >&4
7976                 val2="$undef"
7977         else
7978                 echo "Your vsprintf() returns (char*)." >&4
7979                 val2="$define"
7980         fi
7981 else
7982         echo 'vprintf() NOT found.' >&4
7983                 val="$undef"
7984                 val2="$undef"
7985 fi
7986 set d_vprintf
7987 eval $setvar
7988 val=$val2
7989 set d_charvspr
7990 eval $setvar
7991
7992 : see if chown exists
7993 set chown d_chown
7994 eval $inlibc
7995
7996 : see if chroot exists
7997 set chroot d_chroot
7998 eval $inlibc
7999
8000 : see if chsize exists
8001 set chsize d_chsize
8002 eval $inlibc
8003
8004 : check for const keyword
8005 echo " "
8006 echo 'Checking to see if your C compiler knows about "const"...' >&4
8007 $cat >const.c <<'EOCP'
8008 typedef struct spug { int drokk; } spug;
8009 int main()
8010 {
8011         const char *foo;
8012         const spug y;
8013 }
8014 EOCP
8015 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8016         val="$define"
8017         echo "Yup, it does."
8018 else
8019         val="$undef"
8020         echo "Nope, it doesn't."
8021 fi
8022 set d_const
8023 eval $setvar
8024
8025 : see if crypt exists
8026 echo " "
8027 if set crypt val -f d_crypt; eval $csym; $val; then
8028         echo 'crypt() found.' >&4
8029         val="$define"
8030         cryptlib=''
8031 else
8032         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8033         if $test -z "$cryptlib"; then
8034                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8035         else
8036                 cryptlib=-lcrypt
8037         fi
8038         if $test -z "$cryptlib"; then
8039                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8040         else
8041                 cryptlib=-lcrypt
8042         fi
8043         if $test -z "$cryptlib"; then
8044                 cryptlib=`./loc libcrypt$_a "" $libpth`
8045         else
8046                 cryptlib=-lcrypt
8047         fi
8048         if $test -z "$cryptlib"; then
8049                 echo 'crypt() NOT found.' >&4
8050                 val="$undef"
8051         else
8052                 val="$define"
8053         fi
8054 fi
8055 set d_crypt
8056 eval $setvar
8057
8058 : get csh whereabouts
8059 case "$csh" in
8060 'csh') val="$undef" ;;
8061 *) val="$define" ;;
8062 esac
8063 set d_csh
8064 eval $setvar
8065 : Respect a hint or command line value for full_csh.
8066 case "$full_csh" in
8067 '') full_csh=$csh ;;
8068 esac
8069
8070 : see if cuserid exists
8071 set cuserid d_cuserid
8072 eval $inlibc
8073
8074 : see if this is a limits.h system
8075 set limits.h i_limits
8076 eval $inhdr
8077
8078 : see if this is a float.h system
8079 set float.h i_float
8080 eval $inhdr
8081
8082 : See if number of significant digits in a double precision number is known
8083 echo " "
8084 $cat >dbl_dig.c <<EOM
8085 #$i_limits I_LIMITS
8086 #$i_float I_FLOAT
8087 #ifdef I_LIMITS
8088 #include <limits.h>
8089 #endif
8090 #ifdef I_FLOAT
8091 #include <float.h>
8092 #endif
8093 #ifdef DBL_DIG
8094 printf("Contains DBL_DIG");
8095 #endif
8096 EOM
8097 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8098 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8099         echo "DBL_DIG found." >&4
8100         val="$define"
8101 else
8102         echo "DBL_DIG NOT found." >&4
8103         val="$undef"
8104 fi
8105 $rm -f dbl_dig.?
8106 set d_dbl_dig
8107 eval $setvar
8108
8109 : see if difftime exists
8110 set difftime d_difftime
8111 eval $inlibc
8112
8113 : see if this is a dirent system
8114 echo " "
8115 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8116         val="$define"
8117         echo "<dirent.h> found." >&4
8118 else
8119         val="$undef"
8120         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8121                 echo "<sys/dir.h> found." >&4
8122                 echo " "
8123         else
8124                 xinc=`./findhdr sys/ndir.h`
8125         fi
8126         echo "<dirent.h> NOT found." >&4
8127 fi
8128 set i_dirent
8129 eval $setvar
8130
8131 : Look for type of directory structure.
8132 echo " "
8133 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8134
8135 case "$direntrytype" in
8136 ''|' ')
8137         case "$i_dirent" in
8138         $define) guess1='struct dirent' ;;
8139         *) guess1='struct direct'  ;;
8140         esac
8141         ;;
8142 *)      guess1="$direntrytype"
8143         ;;
8144 esac
8145
8146 case "$guess1" in
8147 'struct dirent') guess2='struct direct' ;;
8148 *) guess2='struct dirent' ;;
8149 esac
8150                 
8151 if $contains "$guess1" try.c >/dev/null 2>&1; then
8152         direntrytype="$guess1"
8153         echo "Your directory entries are $direntrytype." >&4
8154 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8155         direntrytype="$guess2"
8156         echo "Your directory entries seem to be $direntrytype." >&4
8157 else
8158         echo "I don't recognize your system's directory entries." >&4
8159         rp="What type is used for directory entries on this system?"
8160         dflt="$guess1"
8161         . ./myread
8162         direntrytype="$ans"
8163 fi
8164 $rm -f try.c
8165
8166
8167 : see if the directory entry stores field length
8168 echo " "
8169 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8170 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8171         echo "Good, your directory entry keeps length information in d_namlen." >&4
8172         val="$define"
8173 else
8174         echo "Your directory entry does not know about the d_namlen field." >&4
8175         val="$undef"
8176 fi
8177 set d_dirnamlen
8178 eval $setvar
8179 $rm -f try.c
8180
8181 : see if dlerror exists
8182 xxx_runnm="$runnm"
8183 runnm=false
8184 set dlerror d_dlerror
8185 eval $inlibc
8186 runnm="$xxx_runnm"
8187
8188 : see if dlfcn is available
8189 set dlfcn.h i_dlfcn
8190 eval $inhdr
8191
8192 case "$usedl" in
8193 $define|y|true)
8194         $cat << EOM
8195
8196 On a few systems, the dynamically loaded modules that perl generates and uses
8197 will need a different extension than shared libs. The default will probably
8198 be appropriate.
8199
8200 EOM
8201         case "$dlext" in
8202         '')     dflt="$so" ;;
8203         *)      dflt="$dlext" ;;
8204         esac
8205         rp='What is the extension of dynamically loaded modules'
8206         . ./myread
8207         dlext="$ans"
8208         ;;
8209 *)
8210         dlext="none"
8211         ;;
8212 esac
8213
8214 : Check if dlsym need a leading underscore
8215 echo " "
8216 val="$undef"
8217
8218 case "$dlsrc" in
8219 dl_dlopen.xs)
8220         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8221         $cat >dyna.c <<'EOM'
8222 fred () { }
8223 EOM
8224
8225 $cat >fred.c<<EOM
8226
8227 #include <stdio.h>
8228 #$i_dlfcn I_DLFCN
8229 #ifdef I_DLFCN
8230 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8231 #else
8232 #include <sys/types.h>
8233 #include <nlist.h>
8234 #include <link.h>
8235 #endif
8236
8237 extern int fred() ;
8238
8239 int main()
8240 {
8241     void * handle ;
8242     void * symbol ;
8243 #ifndef RTLD_LAZY
8244     int mode = 1 ;
8245 #else
8246     int mode = RTLD_LAZY ;
8247 #endif
8248     handle = dlopen("./dyna.$dlext", mode) ;
8249     if (handle == NULL) {
8250         printf ("1\n") ;
8251         fflush (stdout) ;
8252         exit(0);
8253     }
8254     symbol = dlsym(handle, "fred") ;
8255     if (symbol == NULL) {
8256         /* try putting a leading underscore */
8257         symbol = dlsym(handle, "_fred") ;
8258         if (symbol == NULL) {
8259             printf ("2\n") ;
8260             fflush (stdout) ;
8261             exit(0);
8262         }
8263         printf ("3\n") ;
8264     }
8265     else
8266         printf ("4\n") ;
8267     fflush (stdout) ;
8268     exit(0);
8269 }
8270 EOM
8271         : Call the object file tmp-dyna.o in case dlext=o.
8272         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8273                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8274                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8275                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8276                 xxx=`./fred`
8277                 case $xxx in
8278                 1)      echo "Test program failed using dlopen." >&4
8279                         echo "Perhaps you should not use dynamic loading." >&4;;
8280                 2)      echo "Test program failed using dlsym." >&4
8281                         echo "Perhaps you should not use dynamic loading." >&4;;
8282                 3)      echo "dlsym needs a leading underscore" >&4
8283                         val="$define" ;;
8284                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8285                 esac
8286         else
8287                 echo "I can't compile and run the test program." >&4
8288                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8289         fi
8290         ;;
8291 esac
8292                 
8293 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8294
8295 set d_dlsymun
8296 eval $setvar
8297
8298 hasproto='varname=$1; func=$2; shift; shift;
8299 while $test $# -ge 2; do
8300         case "$1" in
8301         $define) echo "#include <$2>";;
8302         esac ;
8303     shift 2;
8304 done > try.c;
8305 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8306 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8307         echo "$func() prototype found.";
8308         val="$define";
8309 else
8310         echo "$func() prototype NOT found.";
8311         val="$undef";
8312 fi;
8313 set $varname;
8314 eval $setvar;
8315 $rm -f try.c tryout.c'
8316
8317 : see if prototype for drand48 is available
8318 echo " "
8319 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8320 eval $hasproto
8321
8322 : see if dup2 exists
8323 set dup2 d_dup2
8324 eval $inlibc
8325
8326 : see if eaccess exists
8327 set eaccess d_eaccess
8328 eval $inlibc
8329
8330 : see if endgrent exists
8331 set endgrent d_endgrent
8332 eval $inlibc
8333
8334 : see if endhostent exists
8335 set endhostent d_endhent
8336 eval $inlibc
8337
8338 : see if endnetent exists
8339 set endnetent d_endnent
8340 eval $inlibc
8341
8342 : see if endprotoent exists
8343 set endprotoent d_endpent
8344 eval $inlibc
8345
8346 : see if endpwent exists
8347 set endpwent d_endpwent
8348 eval $inlibc
8349
8350 : see if endservent exists
8351 set endservent d_endsent
8352 eval $inlibc
8353
8354 : see if endspent exists
8355 set endspent d_endspent
8356 eval $inlibc
8357
8358 : Locate the flags for 'open()'
8359 echo " "
8360 $cat >open3.c <<'EOCP'
8361 #include <sys/types.h>
8362 #ifdef I_FCNTL
8363 #include <fcntl.h>
8364 #endif
8365 #ifdef I_SYS_FILE
8366 #include <sys/file.h>
8367 #endif
8368 int main() {
8369         if(O_RDONLY);
8370 #ifdef O_TRUNC
8371         exit(0);
8372 #else
8373         exit(1);
8374 #endif
8375 }
8376 EOCP
8377 : check sys/file.h first to get FREAD on Sun
8378 if $test `./findhdr sys/file.h` && \
8379                 set open3 -DI_SYS_FILE && eval $compile; then
8380         h_sysfile=true;
8381         echo "<sys/file.h> defines the O_* constants..." >&4
8382         if ./open3; then
8383                 echo "and you have the 3 argument form of open()." >&4
8384                 val="$define"
8385         else
8386                 echo "but not the 3 argument form of open().  Oh, well." >&4
8387                 val="$undef"
8388         fi
8389 elif $test `./findhdr fcntl.h` && \
8390                 set open3 -DI_FCNTL && eval $compile; then
8391         h_fcntl=true;
8392         echo "<fcntl.h> defines the O_* constants..." >&4
8393         if ./open3; then
8394                 echo "and you have the 3 argument form of open()." >&4
8395                 val="$define"
8396         else
8397                 echo "but not the 3 argument form of open().  Oh, well." >&4
8398                 val="$undef"
8399         fi
8400 else
8401         val="$undef"
8402         echo "I can't find the O_* constant definitions!  You got problems." >&4
8403 fi
8404 set d_open3
8405 eval $setvar
8406 $rm -f open3*
8407
8408 : see which of string.h or strings.h is needed
8409 echo " "
8410 strings=`./findhdr string.h`
8411 if $test "$strings" && $test -r "$strings"; then
8412         echo "Using <string.h> instead of <strings.h>." >&4
8413         val="$define"
8414 else
8415         val="$undef"
8416         strings=`./findhdr strings.h`
8417         if $test "$strings" && $test -r "$strings"; then
8418                 echo "Using <strings.h> instead of <string.h>." >&4
8419         else
8420                 echo "No string header found -- You'll surely have problems." >&4
8421         fi
8422 fi
8423 set i_string
8424 eval $setvar
8425 case "$i_string" in
8426 "$undef") strings=`./findhdr strings.h`;;
8427 *)        strings=`./findhdr string.h`;;
8428 esac
8429
8430 : check for non-blocking I/O stuff
8431 case "$h_sysfile" in
8432 true) echo "#include <sys/file.h>" > head.c;;
8433 *)
8434         case "$h_fcntl" in
8435         true) echo "#include <fcntl.h>" > head.c;;
8436         *) echo "#include <sys/fcntl.h>" > head.c;;
8437         esac
8438         ;;
8439 esac
8440 echo " "
8441 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8442 case "$o_nonblock" in
8443 '')
8444         $cat head.c > try.c
8445         $cat >>try.c <<'EOCP'
8446 #include <stdio.h>
8447 int main() {
8448 #ifdef O_NONBLOCK
8449         printf("O_NONBLOCK\n");
8450         exit(0);
8451 #endif
8452 #ifdef O_NDELAY
8453         printf("O_NDELAY\n");
8454         exit(0);
8455 #endif
8456 #ifdef FNDELAY
8457         printf("FNDELAY\n");
8458         exit(0);
8459 #endif
8460         exit(0);
8461 }
8462 EOCP
8463         set try
8464         if eval $compile_ok; then
8465                 o_nonblock=`./try`
8466                 case "$o_nonblock" in
8467                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8468                 *) echo "Seems like we can use $o_nonblock.";;
8469                 esac
8470         else
8471                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8472         fi
8473         ;;
8474 *) echo "Using $hint value $o_nonblock.";;
8475 esac
8476 $rm -f try try.* .out core
8477
8478 echo " "
8479 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8480 case "$eagain" in
8481 '')
8482         $cat head.c > try.c
8483         $cat >>try.c <<EOCP
8484 #include <errno.h>
8485 #include <sys/types.h>
8486 #include <signal.h>
8487 #include <stdio.h> 
8488 #define MY_O_NONBLOCK $o_nonblock
8489 #ifndef errno  /* XXX need better Configure test */
8490 extern int errno;
8491 #endif
8492 #$i_unistd I_UNISTD
8493 #ifdef I_UNISTD
8494 #include <unistd.h>
8495 #endif
8496 #ifdef $i_string
8497 #include <string.h>
8498 #else
8499 #include <strings.h>
8500 #endif
8501 $signal_t blech(x) int x; { exit(3); }
8502 EOCP
8503         $cat >> try.c <<'EOCP'
8504 int main()
8505 {
8506         int pd[2];
8507         int pu[2];
8508         char buf[1];
8509         char string[100];
8510
8511         pipe(pd);       /* Down: child -> parent */
8512         pipe(pu);       /* Up: parent -> child */
8513         if (0 != fork()) {
8514                 int ret;
8515                 close(pd[1]);   /* Parent reads from pd[0] */
8516                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8517                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8518                         exit(1);
8519                 signal(SIGALRM, blech);
8520                 alarm(5);
8521                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8522                         exit(2);
8523                 sprintf(string, "%d\n", ret);
8524                 write(2, string, strlen(string));
8525                 alarm(0);
8526 #ifdef EAGAIN
8527                 if (errno == EAGAIN) {
8528                         printf("EAGAIN\n");
8529                         goto ok;
8530                 }
8531 #endif
8532 #ifdef EWOULDBLOCK
8533                 if (errno == EWOULDBLOCK)
8534                         printf("EWOULDBLOCK\n");
8535 #endif
8536         ok:
8537                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8538                 sleep(2);                               /* Give it time to close our pipe */
8539                 alarm(5);
8540                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8541                 alarm(0);
8542                 sprintf(string, "%d\n", ret);
8543                 write(3, string, strlen(string));
8544                 exit(0);
8545         }
8546
8547         close(pd[0]);                   /* We write to pd[1] */
8548         close(pu[1]);                   /* We read from pu[0] */
8549         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8550         close(pd[1]);                   /* Pipe pd is now fully closed! */
8551         exit(0);                                /* Bye bye, thank you for playing! */
8552 }
8553 EOCP
8554         set try
8555         if eval $compile_ok; then
8556                 echo "$startsh" >mtry
8557                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8558                 chmod +x mtry
8559                 ./mtry >/dev/null 2>&1
8560                 case $? in
8561                 0) eagain=`$cat try.out`;;
8562                 1) echo "Could not perform non-blocking setting!";;
8563                 2) echo "I did a successful read() for something that was not there!";;
8564                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8565                 *) echo "Something terribly wrong happened during testing.";;
8566                 esac
8567                 rd_nodata=`$cat try.ret`
8568                 echo "A read() system call with no data present returns $rd_nodata."
8569                 case "$rd_nodata" in
8570                 0|-1) ;;
8571                 *)
8572                         echo "(That's peculiar, fixing that to be -1.)"
8573                         rd_nodata=-1
8574                         ;;
8575                 esac
8576                 case "$eagain" in
8577                 '')
8578                         echo "Forcing errno EAGAIN on read() with no data available."
8579                         eagain=EAGAIN
8580                         ;;
8581                 *)
8582                         echo "Your read() sets errno to $eagain when no data is available."
8583                         ;;
8584                 esac
8585                 status=`$cat try.err`
8586                 case "$status" in
8587                 0) echo "And it correctly returns 0 to signal EOF.";;
8588                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8589                 *) echo "However, your read() returns '$status' on EOF??";;
8590                 esac
8591                 val="$define"
8592                 if test "$status" = "$rd_nodata"; then
8593                         echo "WARNING: you can't distinguish between EOF and no data!"
8594                         val="$undef"
8595                 fi
8596         else
8597                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8598                 eagain=EAGAIN
8599         fi
8600         set d_eofnblk
8601         eval $setvar
8602         ;;
8603 *)
8604         echo "Using $hint value $eagain."
8605         echo "Your read() returns $rd_nodata when no data is present."
8606         case "$d_eofnblk" in
8607         "$define") echo "And you can see EOF because read() returns 0.";;
8608         "$undef") echo "But you can't see EOF status from read() returned value.";;
8609         *)
8610                 echo "(Assuming you can't see EOF status from read anyway.)"
8611                 d_eofnblk=$undef
8612                 ;;
8613         esac
8614         ;;
8615 esac
8616 $rm -f try try.* .out core head.c mtry
8617
8618 : see if fchmod exists
8619 set fchmod d_fchmod
8620 eval $inlibc
8621
8622 : see if fchown exists
8623 set fchown d_fchown
8624 eval $inlibc
8625
8626 : see if this is an fcntl system
8627 set fcntl d_fcntl
8628 eval $inlibc
8629
8630 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8631 while $test $# -ge 2; do
8632         case "$1" in
8633         $define) echo "#include <$2>";;
8634         esac ;
8635     shift 2;
8636 done > try.c;
8637 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8638 set try;
8639 if eval $compile; then
8640         val="$define";
8641 else
8642         val="$undef";
8643 fi;
8644 set $varname;
8645 eval $setvar;
8646 $rm -f try.c try.o'
8647
8648 socketlib=''
8649 sockethdr=''
8650 : see whether socket exists
8651 echo " "
8652 $echo $n "Hmm... $c" >&4
8653 if set socket val -f d_socket; eval $csym; $val; then
8654         echo "Looks like you have Berkeley networking support." >&4
8655         d_socket="$define"
8656         if set setsockopt val -f; eval $csym; $val; then
8657                 d_oldsock="$undef"
8658         else
8659                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8660                 d_oldsock="$define"
8661         fi
8662 else
8663         if $contains socklib libc.list >/dev/null 2>&1; then
8664                 echo "Looks like you have Berkeley networking support." >&4
8665                 d_socket="$define"
8666                 : we will have to assume that it supports the 4.2 BSD interface
8667                 d_oldsock="$undef"
8668         else
8669                 echo "You don't have Berkeley networking in libc$_a..." >&4
8670                 if test "X$d_socket" = "X$define"; then
8671                    echo "...but you seem to believe that you have sockets." >&4
8672                 else
8673                         for net in net socket
8674                         do
8675                                 if test -f /usr/lib/lib$net$_a; then
8676                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8677                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8678                                         if $contains socket libc.list >/dev/null 2>&1; then
8679                                                 d_socket="$define"
8680                                                 socketlib="-l$net"
8681                                                 case "$net" in
8682                                                 net)
8683                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8684                                                         sockethdr="-I/usr/netinclude"
8685                                                         ;;
8686                                                 esac
8687                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8688                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8689                                                         d_oldsock="$undef"
8690                                                 else
8691                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8692                                                         d_oldsock="$define"
8693                                                 fi
8694                                                 break
8695                                         fi
8696                                 fi
8697                         done
8698                         if test "X$d_socket" != "X$define"; then
8699                            echo "or anywhere else I see." >&4
8700                            d_socket="$undef"
8701                            d_oldsock="$undef"
8702                         fi
8703                 fi
8704         fi
8705 fi
8706
8707 : see if socketpair exists
8708 set socketpair d_sockpair
8709 eval $inlibc
8710
8711
8712 echo " "
8713 echo "Checking the availability of certain socket constants..." >& 4
8714 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8715         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8716         $cat >try.c <<EOF
8717 #include <sys/types.h>
8718 #include <sys/socket.h>
8719 int main() {
8720     int i = $ENUM;
8721 }
8722 EOF
8723         val="$undef"
8724         set try; if eval $compile; then
8725                 val="$define"
8726         fi
8727         set d_${enum}; eval $setvar
8728         $rm -f try.c try
8729 done
8730
8731 : see if sys/select.h has to be included
8732 set sys/select.h i_sysselct
8733 eval $inhdr
8734
8735 : see if we should include time.h, sys/time.h, or both
8736 echo " "
8737 if test "X$timeincl" = X; then
8738         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8739         $echo $n "I'm now running the test program...$c"
8740         $cat >try.c <<'EOCP'
8741 #include <sys/types.h>
8742 #ifdef I_TIME
8743 #include <time.h>
8744 #endif
8745 #ifdef I_SYSTIME
8746 #ifdef SYSTIMEKERNEL
8747 #define KERNEL
8748 #endif
8749 #include <sys/time.h>
8750 #endif
8751 #ifdef I_SYSSELECT
8752 #include <sys/select.h>
8753 #endif
8754 int main()
8755 {
8756         struct tm foo;
8757 #ifdef S_TIMEVAL
8758         struct timeval bar;
8759 #endif
8760 #ifdef S_TIMEZONE
8761         struct timezone tzp;
8762 #endif
8763         if (foo.tm_sec == foo.tm_sec)
8764                 exit(0);
8765 #ifdef S_TIMEVAL
8766         if (bar.tv_sec == bar.tv_sec)
8767                 exit(0);
8768 #endif
8769         exit(1);
8770 }
8771 EOCP
8772         flags=''
8773         for s_timezone in '-DS_TIMEZONE' ''; do
8774         sysselect=''
8775         for s_timeval in '-DS_TIMEVAL' ''; do
8776         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8777         for i_time in '' '-DI_TIME'; do
8778         for i_systime in '-DI_SYSTIME' ''; do
8779                 case "$flags" in
8780                 '') $echo $n ".$c"
8781                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8782                         if eval $compile; then
8783                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8784                                 shift
8785                                 flags="$*"
8786                                 echo " "
8787                                 $echo $n "Succeeded with $flags$c"
8788                         fi
8789                         ;;
8790                 esac
8791         done
8792         done
8793         done
8794         done
8795         done
8796         timeincl=''
8797         echo " "
8798         case "$flags" in
8799         *SYSTIMEKERNEL*) i_systimek="$define"
8800                 timeincl=`./findhdr sys/time.h`
8801                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8802         *) i_systimek="$undef";;
8803         esac
8804         case "$flags" in
8805         *I_TIME*) i_time="$define"
8806                 timeincl=`./findhdr time.h`" $timeincl"
8807                 echo "We'll include <time.h>." >&4;;
8808         *) i_time="$undef";;
8809         esac
8810         case "$flags" in
8811         *I_SYSTIME*) i_systime="$define"
8812                 timeincl=`./findhdr sys/time.h`" $timeincl"
8813                 echo "We'll include <sys/time.h>." >&4;;
8814         *) i_systime="$undef";;
8815         esac
8816         $rm -f try.c try
8817 fi
8818
8819 : check for fd_set items
8820 $cat <<EOM
8821
8822 Checking to see how well your C compiler handles fd_set and friends ...
8823 EOM
8824 $cat >fd_set.c <<EOCP
8825 #$i_systime I_SYS_TIME
8826 #$i_sysselct I_SYS_SELECT
8827 #$d_socket HAS_SOCKET
8828 #include <sys/types.h>
8829 #ifdef HAS_SOCKET
8830 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8831 #endif
8832 #ifdef I_SYS_TIME
8833 #include <sys/time.h>
8834 #endif
8835 #ifdef I_SYS_SELECT
8836 #include <sys/select.h>
8837 #endif
8838 int main() {
8839         fd_set fds;
8840
8841 #ifdef TRYBITS
8842         if(fds.fds_bits);
8843 #endif
8844
8845 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8846         exit(0);
8847 #else
8848         exit(1);
8849 #endif
8850 }
8851 EOCP
8852 set fd_set -DTRYBITS
8853 if eval $compile; then
8854         d_fds_bits="$define"
8855         d_fd_set="$define"
8856         echo "Well, your system knows about the normal fd_set typedef..." >&4
8857         if ./fd_set; then
8858                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8859                 d_fd_macros="$define"
8860         else
8861                 $cat >&4 <<'EOM'
8862 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8863 EOM
8864                 d_fd_macros="$undef"
8865         fi
8866 else
8867         $cat <<'EOM'
8868 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8869 EOM
8870         set fd_set
8871         if eval $compile; then
8872                 d_fds_bits="$undef"
8873                 d_fd_set="$define"
8874                 echo "Well, your system has some sort of fd_set available..." >&4
8875                 if ./fd_set; then
8876                         echo "and you have the normal fd_set macros." >&4
8877                         d_fd_macros="$define"
8878                 else
8879                         $cat <<'EOM'
8880 but not the normal fd_set macros!  Gross!  More work for me...
8881 EOM
8882                         d_fd_macros="$undef"
8883                 fi
8884         else
8885         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8886                 d_fd_set="$undef"
8887                 d_fds_bits="$undef"
8888                 d_fd_macros="$undef"
8889         fi
8890 fi
8891 $rm -f fd_set*
8892
8893 : see if fgetpos exists
8894 set fgetpos d_fgetpos
8895 eval $inlibc
8896
8897 : see if flock exists
8898 set flock d_flock
8899 eval $inlibc
8900
8901 : see if fork exists
8902 set fork d_fork
8903 eval $inlibc
8904
8905 : see if pathconf exists
8906 set pathconf d_pathconf
8907 eval $inlibc
8908
8909 : see if fpathconf exists
8910 set fpathconf d_fpathconf
8911 eval $inlibc
8912
8913
8914 : check for fpos64_t
8915 echo " "
8916 echo "Checking to see if you have fpos64_t..." >&4
8917 $cat >try.c <<EOCP
8918 #include <stdio.h>
8919 int main() { fpos64_t x = 7; }
8920 EOCP
8921 set try
8922 if eval $compile; then
8923         val="$define"
8924         echo "You have fpos64_t."
8925 else
8926         val="$undef"
8927         echo "You do not have fpos64_t."
8928         case "$fpossize" in
8929         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8930         esac
8931 fi
8932 $rm -f try.* try
8933 set d_fpos64_t
8934 eval $setvar
8935
8936 hasstruct='varname=$1; struct=$2; shift; shift;
8937 while $test $# -ge 2; do
8938         case "$1" in
8939         $define) echo "#include <$2>";;
8940         esac ;
8941     shift 2;
8942 done > try.c;
8943 echo "int main () { struct $struct foo; }" >> try.c;
8944 set try;
8945 if eval $compile; then
8946         val="$define";
8947 else
8948         val="$undef";
8949 fi;
8950 set $varname;
8951 eval $setvar;
8952 $rm -f try.c try.o'
8953
8954 : see if this is a sys/param system
8955 set sys/param.h i_sysparam
8956 eval $inhdr
8957
8958 : see if this is a sys/mount.h system
8959 set sys/mount.h i_sysmount
8960 eval $inhdr
8961
8962 : see if sys/types.h has to be included
8963 set sys/types.h i_systypes
8964 eval $inhdr
8965
8966
8967 echo " "
8968 echo "Checking to see if your system supports struct fs_data..." >&4
8969 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8970 eval $hasstruct
8971 case "$d_fs_data_s" in
8972 "$define")      echo "Yes, it does."   ;;
8973 *)              echo "No, it doesn't." ;;
8974 esac
8975
8976 : see if fseeko exists
8977 set fseeko d_fseeko
8978 eval $inlibc
8979 case "$longsize" in
8980 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8981 esac
8982
8983 : see if fsetpos exists
8984 set fsetpos d_fsetpos
8985 eval $inlibc
8986
8987
8988 : see if fstatfs exists
8989 set fstatfs d_fstatfs
8990 eval $inlibc
8991
8992
8993 : see if statvfs exists
8994 set statvfs d_statvfs
8995 eval $inlibc
8996
8997 : see if fstatvfs exists
8998 set fstatvfs d_fstatvfs
8999 eval $inlibc
9000
9001
9002 : see if ftello exists
9003 set ftello d_ftello
9004 eval $inlibc
9005 case "$longsize" in
9006 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9007 esac
9008
9009 : see if getcwd exists
9010 set getcwd d_getcwd
9011 eval $inlibc
9012
9013
9014 : see if getfsstat exists
9015 set getfsstat d_getfsstat
9016 eval $inlibc
9017
9018 : see if getgrent exists
9019 set getgrent d_getgrent
9020 eval $inlibc
9021
9022 : see if gethostbyaddr exists
9023 set gethostbyaddr d_gethbyaddr
9024 eval $inlibc
9025
9026 : see if gethostbyname exists
9027 set gethostbyname d_gethbyname
9028 eval $inlibc
9029
9030 : see if gethostent exists
9031 set gethostent d_gethent
9032 eval $inlibc
9033
9034 : see how we will look up host name
9035 echo " "
9036 call=''
9037 if set gethostname val -f d_gethname; eval $csym; $val; then
9038         echo 'gethostname() found.' >&4
9039         d_gethname="$define"
9040         call=gethostname
9041 fi
9042 if set uname val -f d_uname; eval $csym; $val; then
9043         if ./xenix; then
9044                 $cat <<'EOM'
9045 uname() was found, but you're running xenix, and older versions of xenix
9046 have a broken uname(). If you don't really know whether your xenix is old
9047 enough to have a broken system call, use the default answer.
9048
9049 EOM
9050                 dflt=y
9051                 case "$d_uname" in
9052                 "$define") dflt=n;;
9053                 esac
9054                 rp='Is your uname() broken?'
9055                 . ./myread
9056                 case "$ans" in
9057                 n*) d_uname="$define"; call=uname;;
9058                 esac
9059         else
9060                 echo 'uname() found.' >&4
9061                 d_uname="$define"
9062                 case "$call" in
9063                 '') call=uname ;;
9064                 esac
9065         fi
9066 fi
9067 case "$d_gethname" in
9068 '') d_gethname="$undef";;
9069 esac
9070 case "$d_uname" in
9071 '') d_uname="$undef";;
9072 esac
9073 case "$d_uname$d_gethname" in
9074 *define*)
9075         dflt=n
9076         cat <<EOM
9077  
9078 Every now and then someone has a $call() that lies about the hostname
9079 but can't be fixed for political or economic reasons.  If you wish, I can
9080 pretend $call() isn't there and maybe compute hostname at run-time
9081 thanks to the '$phostname' command.
9082
9083 EOM
9084         rp="Shall I ignore $call() from now on?"
9085         . ./myread
9086         case "$ans" in
9087         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9088         esac;;
9089 esac
9090 case "$phostname" in
9091 '') aphostname='';;
9092 *) case "$aphostname" in
9093         /*) ;;
9094         *) set X $phostname
9095                 shift
9096                 file=$1
9097                 shift
9098                 file=`./loc $file $file $pth`
9099                 aphostname=`echo $file $*`
9100                 ;;
9101         esac
9102         ;;
9103 esac
9104 case "$d_uname$d_gethname" in
9105 *define*) ;;
9106 *)
9107         case "$phostname" in
9108         '')
9109                 echo "There will be no way for $package to get your hostname." >&4;;
9110         *)
9111         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9112                 ;;
9113         esac;;
9114 esac
9115 case "$d_phostname" in
9116 '') d_phostname="$undef";;
9117 esac
9118
9119 : see if this is a netdb.h system
9120 set netdb.h i_netdb
9121 eval $inhdr
9122
9123 : see if prototypes for various gethostxxx netdb.h functions are available
9124 echo " "
9125 set d_gethostprotos gethostent $i_netdb netdb.h
9126 eval $hasproto
9127
9128 : see if getlogin exists
9129 set getlogin d_getlogin
9130 eval $inlibc
9131
9132 : see if getmnt exists
9133 set getmnt d_getmnt
9134 eval $inlibc
9135
9136 : see if getmntent exists
9137 set getmntent d_getmntent
9138 eval $inlibc
9139
9140 : see if getnetbyaddr exists
9141 set getnetbyaddr d_getnbyaddr
9142 eval $inlibc
9143
9144 : see if getnetbyname exists
9145 set getnetbyname d_getnbyname
9146 eval $inlibc
9147
9148 : see if getnetent exists
9149 set getnetent d_getnent
9150 eval $inlibc
9151
9152 : see if prototypes for various getnetxxx netdb.h functions are available
9153 echo " "
9154 set d_getnetprotos getnetent $i_netdb netdb.h
9155 eval $hasproto
9156
9157
9158 : see if getprotobyname exists
9159 set getprotobyname d_getpbyname
9160 eval $inlibc
9161
9162 : see if getprotobynumber exists
9163 set getprotobynumber d_getpbynumber
9164 eval $inlibc
9165
9166 : see if getprotoent exists
9167 set getprotoent d_getpent
9168 eval $inlibc
9169
9170 : see if getpgid exists
9171 set getpgid d_getpgid
9172 eval $inlibc
9173
9174 : see if getpgrp2 exists
9175 set getpgrp2 d_getpgrp2
9176 eval $inlibc
9177
9178 : see if getppid exists
9179 set getppid d_getppid
9180 eval $inlibc
9181
9182 : see if getpriority exists
9183 set getpriority d_getprior
9184 eval $inlibc
9185
9186 : see if prototypes for various getprotoxxx netdb.h functions are available
9187 echo " "
9188 set d_getprotoprotos getprotoent $i_netdb netdb.h
9189 eval $hasproto
9190
9191 : see if getpwent exists
9192 set getpwent d_getpwent
9193 eval $inlibc
9194
9195
9196 : see if getservbyname exists
9197 set getservbyname d_getsbyname
9198 eval $inlibc
9199
9200 : see if getservbyport exists
9201 set getservbyport d_getsbyport
9202 eval $inlibc
9203
9204 : see if getservent exists
9205 set getservent d_getsent
9206 eval $inlibc
9207
9208 : see if prototypes for various getservxxx netdb.h functions are available
9209 echo " "
9210 set d_getservprotos getservent $i_netdb netdb.h
9211 eval $hasproto
9212
9213 : see if getspent exists
9214 set getspent d_getspent
9215 eval $inlibc
9216
9217 : see if getspnam exists
9218 set getspnam d_getspnam
9219 eval $inlibc
9220
9221 : see if gettimeofday or ftime exists
9222 set gettimeofday d_gettimeod
9223 eval $inlibc
9224 case "$d_gettimeod" in
9225 "$undef")
9226         set ftime d_ftime 
9227         eval $inlibc
9228         ;;
9229 *)
9230         val="$undef"; set d_ftime; eval $setvar
9231         ;;
9232 esac
9233 case "$d_gettimeod$d_ftime" in
9234 "$undef$undef")
9235         echo " "
9236         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9237         ;;
9238 esac
9239
9240 : see if this is an grp system
9241 set grp.h i_grp
9242 eval $inhdr
9243
9244 case "$i_grp" in
9245 $define)
9246         xxx=`./findhdr grp.h`
9247         $cppstdin $cppflags $cppminus < $xxx >$$.h
9248
9249         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9250                 val="$define"
9251         else
9252                 val="$undef"
9253         fi
9254         set d_grpasswd
9255         eval $setvar
9256
9257         $rm -f $$.h
9258         ;;
9259 *)
9260         val="$undef";
9261         set d_grpasswd; eval $setvar
9262         ;;
9263 esac
9264
9265 : see if hasmntopt exists
9266 set hasmntopt d_hasmntopt
9267 eval $inlibc
9268
9269 : see if this is a netinet/in.h or sys/in.h system
9270 set netinet/in.h i_niin sys/in.h i_sysin
9271 eval $inhdr
9272
9273 : see if arpa/inet.h has to be included
9274 set arpa/inet.h i_arpainet
9275 eval $inhdr
9276
9277 : see if htonl --and friends-- exists
9278 val=''
9279 set htonl val
9280 eval $inlibc
9281
9282 : Maybe they are macros.
9283 case "$val" in
9284 $undef)
9285         $cat >htonl.c <<EOM
9286 #include <stdio.h>
9287 #include <sys/types.h>
9288 #$i_niin I_NETINET_IN
9289 #$i_sysin I_SYS_IN
9290 #$i_arpainet I_ARPA_INET
9291 #ifdef I_NETINET_IN
9292 #include <netinet/in.h>
9293 #endif
9294 #ifdef I_SYS_IN
9295 #include <sys/in.h>
9296 #endif
9297 #ifdef I_ARPA_INET
9298 #include <arpa/inet.h>
9299 #endif
9300 #ifdef htonl
9301 printf("Defined as a macro.");
9302 #endif
9303 EOM
9304         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9305         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9306                 val="$define"
9307                 echo "But it seems to be defined as a macro." >&4
9308         fi
9309         $rm -f htonl.?
9310         ;;
9311 esac
9312 set d_htonl
9313 eval $setvar
9314
9315 : see if iconv exists
9316 set iconv d_iconv
9317 eval $inlibc
9318
9319 : index or strchr
9320 echo " "
9321 if set index val -f; eval $csym; $val; then
9322         if set strchr val -f d_strchr; eval $csym; $val; then
9323                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9324                         val="$define"
9325                         vali="$undef"
9326                         echo "strchr() found." >&4
9327                 else
9328                         val="$undef"
9329                         vali="$define"
9330                         echo "index() found." >&4
9331                 fi
9332         else
9333                 val="$undef"
9334                 vali="$define"
9335                 echo "index() found." >&4
9336         fi
9337 else
9338         if set strchr val -f d_strchr; eval $csym; $val; then
9339                 val="$define"
9340                 vali="$undef"
9341                 echo "strchr() found." >&4
9342         else
9343                 echo "No index() or strchr() found!" >&4
9344                 val="$undef"
9345                 vali="$undef"
9346         fi
9347 fi
9348 set d_strchr; eval $setvar
9349 val="$vali"
9350 set d_index; eval $setvar
9351
9352 : check whether inet_aton exists
9353 set inet_aton d_inetaton
9354 eval $inlibc
9355
9356 : see if inttypes.h is available
9357 : we want a real compile instead of Inhdr because some systems
9358 : have an inttypes.h which includes non-existent headers
9359 echo " "
9360 $cat >try.c <<EOCP
9361 #include <inttypes.h>
9362 int main() {
9363         static int32_t foo32 = 0x12345678;
9364 }
9365 EOCP
9366 set try
9367 if eval $compile; then
9368         echo "<inttypes.h> found." >&4
9369         val="$define"
9370 else
9371         echo "<inttypes.h> NOT found." >&4
9372         val="$undef"
9373 fi
9374 $rm -f try.c try
9375 set i_inttypes
9376 eval $setvar
9377
9378 : check for int64_t
9379 echo " "
9380 echo "Checking to see if you have int64_t..." >&4
9381 $cat >try.c <<EOCP
9382 #include <sys/types.h>
9383 #$i_inttypes I_INTTYPES
9384 #ifdef I_INTTYPES
9385 #include <inttypes.h>
9386 #endif
9387 int main() { int64_t x = 7; }
9388 EOCP
9389 set try
9390 if eval $compile; then
9391         val="$define"
9392         echo "You have int64_t."
9393 else
9394         val="$undef"
9395         echo "You do not have int64_t."
9396 fi
9397 $rm -f try try.*
9398 set d_int64_t
9399 eval $setvar
9400
9401 : Look for isascii
9402 echo " "
9403 $cat >isascii.c <<'EOCP'
9404 #include <stdio.h>
9405 #include <ctype.h>
9406 int main() {
9407         int c = 'A';
9408         if (isascii(c))
9409                 exit(0);
9410         else
9411                 exit(1);
9412 }
9413 EOCP
9414 set isascii
9415 if eval $compile; then
9416         echo "isascii() found." >&4
9417         val="$define"
9418 else
9419         echo "isascii() NOT found." >&4
9420         val="$undef"
9421 fi
9422 set d_isascii
9423 eval $setvar
9424 $rm -f isascii*
9425
9426 : see if killpg exists
9427 set killpg d_killpg
9428 eval $inlibc
9429
9430 : see if lchown exists
9431 echo " "
9432 $cat > try.c <<'EOCP'
9433 /* System header to define __stub macros and hopefully few prototypes,
9434     which can conflict with char lchown(); below.  */
9435 #include <assert.h>
9436 /* Override any gcc2 internal prototype to avoid an error.  */
9437 /* We use char because int might match the return type of a gcc2
9438    builtin and then its argument prototype would still apply.  */
9439 char lchown();
9440 int main() {
9441     /*  The GNU C library defines this for functions which it implements
9442         to always fail with ENOSYS.  Some functions are actually named
9443         something starting with __ and the normal name is an alias.  */
9444 #if defined (__stub_lchown) || defined (__stub___lchown)
9445 choke me
9446 #else
9447 lchown();
9448 #endif
9449 ; return 0; }
9450 EOCP
9451 set try
9452 if eval $compile; then
9453     $echo "lchown() found." >&4
9454     val="$define"
9455 else
9456     $echo "lchown() NOT found." >&4
9457     val="$undef"
9458 fi
9459 set d_lchown
9460 eval $setvar
9461
9462 : See if number of significant digits in a double precision number is known
9463 echo " "
9464 $cat >ldbl_dig.c <<EOM
9465 #$i_limits I_LIMITS
9466 #$i_float I_FLOAT
9467 #ifdef I_LIMITS
9468 #include <limits.h>
9469 #endif
9470 #ifdef I_FLOAT
9471 #include <float.h>
9472 #endif
9473 #ifdef LDBL_DIG
9474 printf("Contains LDBL_DIG");
9475 #endif
9476 EOM
9477 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9478 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9479         echo "LDBL_DIG found." >&4
9480         val="$define"
9481 else
9482         echo "LDBL_DIG NOT found." >&4
9483         val="$undef"
9484 fi
9485 $rm -f ldbl_dig.?
9486 set d_ldbl_dig
9487 eval $setvar
9488
9489 : see if link exists
9490 set link d_link
9491 eval $inlibc
9492
9493 : see if localeconv exists
9494 set localeconv d_locconv
9495 eval $inlibc
9496
9497 : see if lockf exists
9498 set lockf d_lockf
9499 eval $inlibc
9500
9501 : check for long long
9502 echo " "
9503 echo "Checking to see if you have long long..." >&4
9504 echo 'int main() { long long x = 7; return 0; }' > try.c
9505 set try
9506 if eval $compile; then
9507         val="$define"
9508         echo "You have have long long."
9509 else
9510         val="$undef"
9511         echo "You do not have long long."
9512 fi
9513 $rm try.*
9514 set d_longlong
9515 eval $setvar
9516
9517 : check for length of long long
9518 case "${d_longlong}${longlongsize}" in
9519 $define)
9520         echo " "
9521         echo "Checking to see how big your long longs are..." >&4
9522         $cat >try.c <<'EOCP'
9523 #include <stdio.h>
9524 int main()
9525 {
9526     printf("%d\n", (int)sizeof(long long));
9527     return(0);
9528 }
9529 EOCP
9530         set try
9531         if eval $compile_ok; then
9532                 longlongsize=`./try$exe_ext`
9533                 echo "Your long longs are $longlongsize bytes long."
9534         else
9535                 dflt='8'
9536                 echo " "
9537                 echo "(I can't seem to compile the test program.  Guessing...)"
9538                 rp="What is the size of a long long (in bytes)?"
9539                 . ./myread
9540                 longlongsize="$ans"
9541         fi
9542         if $test "X$longsize" = "X$longlongsize"; then
9543                 echo "(That isn't any different from an ordinary long.)"
9544         fi      
9545         ;;
9546 esac
9547 $rm -f try.* try
9548
9549 : see if prototype for lseek is available
9550 echo " "
9551 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9552 eval $hasproto
9553
9554 : see if lstat exists
9555 set lstat d_lstat
9556 eval $inlibc
9557
9558 : see if mblen exists
9559 set mblen d_mblen
9560 eval $inlibc
9561
9562 : see if mbstowcs exists
9563 set mbstowcs d_mbstowcs
9564 eval $inlibc
9565
9566 : see if mbtowc exists
9567 set mbtowc d_mbtowc
9568 eval $inlibc
9569
9570 : see if memchr exists
9571 set memchr d_memchr
9572 eval $inlibc
9573
9574 : see if memcmp exists
9575 set memcmp d_memcmp
9576 eval $inlibc
9577
9578 : see if memcpy exists
9579 set memcpy d_memcpy
9580 eval $inlibc
9581
9582 : see if memmove exists
9583 set memmove d_memmove
9584 eval $inlibc
9585
9586 : see if memset exists
9587 set memset d_memset
9588 eval $inlibc
9589
9590 : see if mkdir exists
9591 set mkdir d_mkdir
9592 eval $inlibc
9593
9594 : see if mkdtemp exists
9595 set mkdtemp d_mkdtemp
9596 eval $inlibc
9597
9598 : see if mkfifo exists
9599 set mkfifo d_mkfifo
9600 eval $inlibc
9601
9602 : see if mkstemp exists
9603 set mkstemp d_mkstemp
9604 eval $inlibc
9605
9606 : see if mkstemps exists
9607 set mkstemps d_mkstemps
9608 eval $inlibc
9609
9610 : see if mktime exists
9611 set mktime d_mktime
9612 eval $inlibc
9613
9614 : see if this is a sys/mman.h system
9615 set sys/mman.h i_sysmman
9616 eval $inhdr
9617
9618 : see if mmap exists
9619 set mmap d_mmap
9620 eval $inlibc
9621 : see what shmat returns
9622 : default to something harmless
9623 mmaptype='void *'
9624 case "$i_sysmman$d_mmap" in
9625 "$define$define")
9626         $cat >mmap.c <<'END'
9627 #include <sys/mman.h>
9628 void *mmap();
9629 END
9630         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9631                 mmaptype='void *'
9632         else
9633                 mmaptype='caddr_t'
9634         fi
9635         echo "and it returns ($mmaptype)." >&4
9636         ;;
9637 esac
9638
9639
9640
9641 : see if mprotect exists
9642 set mprotect d_mprotect
9643 eval $inlibc
9644
9645 : see if msgctl exists
9646 set msgctl d_msgctl
9647 eval $inlibc
9648
9649 : see if msgget exists
9650 set msgget d_msgget
9651 eval $inlibc
9652
9653 : see if msgsnd exists
9654 set msgsnd d_msgsnd
9655 eval $inlibc
9656
9657 : see if msgrcv exists
9658 set msgrcv d_msgrcv
9659 eval $inlibc
9660
9661 : see how much of the 'msg*(2)' library is present.
9662 h_msg=true
9663 echo " "
9664 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9665 *"$undef"*) h_msg=false;;
9666 esac
9667 case "$osname" in
9668 freebsd)
9669     case "`ipcs 2>&1`" in
9670     "SVID messages"*"not configured"*)
9671         echo "Your $osname does not have the msg*(2) configured." >&4
9672         h_msg=false
9673         val="$undef"
9674         set msgctl d_msgctl
9675         eval $setvar
9676         set msgget d_msgget
9677         eval $setvar
9678         set msgsnd d_msgsnd
9679         eval $setvar
9680         set msgrcv d_msgrcv
9681         eval $setvar
9682         ;;
9683     esac
9684     ;;
9685 esac
9686 : we could also check for sys/ipc.h ...
9687 if $h_msg && $test `./findhdr sys/msg.h`; then
9688         echo "You have the full msg*(2) library." >&4
9689         val="$define"
9690 else
9691         echo "You don't have the full msg*(2) library." >&4
9692         val="$undef"
9693 fi
9694 set d_msg
9695 eval $setvar
9696
9697 : see if msync exists
9698 set msync d_msync
9699 eval $inlibc
9700
9701 : see if munmap exists
9702 set munmap d_munmap
9703 eval $inlibc
9704
9705 : see if nice exists
9706 set nice d_nice
9707 eval $inlibc
9708
9709
9710 echo " "
9711 echo "Checking which 64-bit integer type we could use..." >&4
9712
9713 case "$intsize" in
9714 8) val=int
9715    set quadtype
9716    eval $setvar
9717    val='"unsigned int"'
9718    set uquadtype
9719    eval $setvar
9720    quadkind=1
9721    ;;
9722 *) case "$longsize" in
9723    8) val=long
9724       set quadtype
9725       eval $setvar
9726       val='"unsigned long"'
9727       set uquadtype
9728       eval $setvar
9729       quadkind=2
9730       ;;
9731    *) case "$d_longlong:$longlongsize" in
9732       define:8)
9733         val='"long long"'
9734         set quadtype
9735         eval $setvar
9736         val='"unsigned long long"'
9737         set uquadtype
9738         eval $setvar
9739         quadkind=3
9740         ;;
9741       *) case "$d_int64_t" in
9742          define)
9743            val=int64_t
9744            set quadtype
9745            eval $setvar
9746            val=uint64_t
9747            set uquadtype
9748            eval $setvar
9749            quadkind=4
9750            ;;
9751          esac
9752          ;;
9753       esac
9754       ;;
9755    esac
9756    ;;
9757 esac
9758
9759 case "$quadtype" in
9760 '')     echo "Alas, no 64-bit integer types in sight." >&4
9761         d_quad="$undef"
9762         ;;
9763 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9764             verb="will"
9765         else
9766             verb="could"
9767         fi
9768         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9769         d_quad="$define"
9770         ;;
9771 esac
9772
9773 : check for length of character
9774 echo " "
9775 case "$charsize" in
9776 '')
9777         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9778         $cat >try.c <<'EOCP'
9779 #include <stdio.h>
9780 int main()
9781 {
9782     printf("%d\n", (int)sizeof(char));
9783     exit(0);
9784 }
9785 EOCP
9786         set try
9787         if eval $compile_ok; then
9788                 dflt=`./try`
9789         else
9790                 dflt='1'
9791                 echo "(I can't seem to compile the test program.  Guessing...)"
9792         fi
9793         ;;
9794 *)
9795         dflt="$charsize"
9796         ;;
9797 esac
9798 rp="What is the size of a character (in bytes)?"
9799 . ./myread
9800 charsize="$ans"
9801 $rm -f try.c try
9802
9803
9804 echo " "
9805 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9806
9807 case "$use64bits:$d_quad:$quadtype" in
9808 define:define:?*)
9809         ivtype="$quadtype"
9810         uvtype="$uquadtype"
9811         ivsize=8
9812         uvsize=8
9813         ;;
9814 *)      ivtype="long"
9815         uvtype="unsigned long"
9816         ivsize=$longsize
9817         uvsize=$longsize
9818         ;;
9819 esac
9820
9821 case "$uselongdouble:$d_longdbl" in
9822 define:define)
9823         nvtype="long double"
9824         nvsize=$longdblsize
9825         ;;
9826 *)      nvtype=double
9827         nvsize=$doublesize
9828         ;;
9829 esac
9830
9831 $echo "(IV will be "$ivtype", $ivsize bytes)"
9832 $echo "(UV will be "$uvtype", $uvsize bytes)"
9833 $echo "(NV will be "$nvtype", $nvsize bytes)"
9834
9835 $cat >try.c <<EOCP
9836 #$i_inttypes I_INTTYPES
9837 #ifdef I_INTTYPES
9838 #include <inttypes.h>
9839 #endif
9840 #include <stdio.h>
9841 int main() {
9842 #ifdef INT8
9843    int8_t i =  INT8_MAX;
9844   uint8_t u = UINT8_MAX;
9845   printf("int8_t\n");
9846 #endif
9847 #ifdef INT16
9848    int16_t i =  INT16_MAX;
9849   uint16_t i = UINT16_MAX;
9850   printf("int16_t\n");
9851 #endif
9852 #ifdef INT32
9853    int32_t i =  INT32_MAX;
9854   uint32_t u = UINT32_MAX;
9855   printf("int32_t\n");
9856 #endif
9857 }
9858 EOCP
9859
9860 case "$i8type" in
9861 '')     case "$charsize" in
9862         1)      i8type=char
9863                 u8type="unsigned char"
9864                 i8size=$charsize
9865                 u8size=$charsize
9866                 ;;
9867         esac
9868         ;;
9869 esac
9870 case "$i8type" in
9871 '')     set try -DINT8
9872         if eval $compile; then
9873                 case "`./try$exe_ext`" in
9874                 int8_t) i8type=int8_t
9875                         u8type=uint8_t
9876                         i8size=1
9877                         u8size=1
9878                         ;;
9879                 esac
9880         fi
9881         ;;
9882 esac
9883 case "$i8type" in
9884 '')     if $test $charsize -ge 1; then
9885                 i8type=char
9886                 u8type="unsigned char"
9887                 i8size=$charsize
9888                 u8size=$charsize
9889         fi
9890         ;;
9891 esac
9892
9893 case "$i16type" in
9894 '')     case "$shortsize" in
9895         2)      i16type=short
9896                 u16type="unsigned short"
9897                 i16size=$shortsize
9898                 u16size=$shortsize
9899                 ;;
9900         esac
9901         ;;
9902 esac
9903 case "$i16type" in
9904 '')     set try -DINT16
9905         if eval $compile; then
9906                 case "`./try$exe_ext`" in
9907                 int16_t)
9908                         i16type=int16_t
9909                         u16type=uint16_t
9910                         i16size=2
9911                         u16size=2
9912                         ;;
9913                 esac
9914         fi
9915         ;;
9916 esac
9917 case "$i16type" in
9918 '')     if $test $shortsize -ge 2; then
9919                 i16type=short
9920                 u16type="unsigned short"
9921                 i16size=$shortsize
9922                 u16size=$shortsize
9923         fi
9924         ;;
9925 esac
9926
9927 case "$i32type" in
9928 '')     case "$longsize" in
9929         4)      i32type=long
9930                 u32type="unsigned long"
9931                 i32size=$longsize
9932                 u32size=$longsize
9933                 ;;
9934         *)      case "$intsize" in
9935                 4)      i32type=int
9936                         u32type="unsigned int"
9937                         i32size=$intsize
9938                         u32size=$intsize
9939                         ;;
9940                 esac
9941                 ;;
9942         esac
9943         ;;
9944 esac
9945 case "$i32type" in
9946 '')     set try -DINT32
9947         if eval $compile; then
9948                 case "`./try$exe_ext`" in
9949                 int32_t)
9950                         i32type=int32_t
9951                         u32type=uint32_t
9952                         i32size=4
9953                         u32size=4
9954                         ;;
9955                 esac
9956         fi
9957         ;;
9958 esac
9959 case "$i32type" in
9960 '')     if $test $intsize -ge 4; then
9961                 i32type=int
9962                 u32type="unsigned int"
9963                 i32size=$intsize
9964                 u32size=$intsize
9965         fi
9966         ;;
9967 esac
9968
9969 case "$i64type" in
9970 '')     case "$d_quad:$quadtype" in
9971         define:?*)
9972                 i64type="$quadtype"
9973                 u64type="$uquadtype"
9974                 i64size=8
9975                 u64size=8
9976                 ;;
9977         esac
9978         ;;
9979 esac
9980
9981 $echo "Checking whether your NVs can preserve your UVs..." >&4
9982 $cat <<EOP >try.c
9983 #include <stdio.h>
9984 int main() {
9985     $uvtype k = ($uvtype)~0, l;
9986     $nvtype d;
9987     l = k;
9988     d = ($nvtype)l;
9989     l = ($uvtype)d;
9990     if (l == k)
9991        printf("preserve\n");
9992     exit(0);
9993 }
9994 EOP
9995 set try
9996 if eval $compile; then
9997         case "`./try$exe_ext`" in
9998         preserve) d_nv_preserves_uv="$define" ;;
9999         esac
10000 fi      
10001 case "$d_nv_preserves_uv" in
10002 $define) $echo "Yes, they can."  2>&1 ;;
10003 *)       $echo "No, they can't." 2>&1
10004          d_nv_preserves_uv="$undef"
10005          ;;
10006 esac
10007
10008 $rm -f try.* try
10009
10010
10011 : check for off64_t
10012 echo " "
10013 echo "Checking to see if you have off64_t..." >&4
10014 $cat >try.c <<EOCP
10015 #include <sys/types.h>
10016 #include <unistd.h>
10017 int main() { off64_t x = 7; }
10018 EOCP
10019 set try
10020 if eval $compile; then
10021         val="$define"
10022         echo "You have off64_t."
10023 else
10024         val="$undef"
10025         echo "You do not have off64_t."
10026         case "$lseeksize" in
10027         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10028         esac
10029 fi
10030 $rm -f try.* try
10031 set d_off64_t
10032 eval $setvar
10033
10034 : see if POSIX threads are available
10035 set pthread.h i_pthread
10036 eval $inhdr
10037
10038
10039
10040
10041 : how to create joinable pthreads
10042 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10043         echo " "
10044         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10045         $cat >try.c <<'EOCP'
10046 #include <pthread.h>
10047 int main() {
10048     int detachstate = JOINABLE;
10049 }
10050 EOCP
10051         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10052         if eval $compile; then
10053                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10054                 val="$undef" # Yes, undef.
10055                 set d_old_pthread_create_joinable
10056                 eval $setvar
10057                 val=""
10058                 set old_pthread_create_joinable
10059                 eval $setvar
10060         else
10061                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10062                 if eval $compile; then
10063                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10064                         val="$define"
10065                         set d_old_pthread_create_joinable
10066                         eval $setvar
10067                         val=PTHREAD_CREATE_UNDETACHED
10068                         set old_pthread_create_joinable
10069                         eval $setvar
10070                 else            
10071                         set try -DJOINABLE=__UNDETACHED
10072                         if eval $compile; then
10073                                 echo "You seem to use __UNDETACHED." >&4
10074                                 val="$define"
10075                                 set d_old_pthread_create_joinable
10076                                 eval $setvar
10077                                 val=__UNDETACHED
10078                                 set old_pthread_create_joinable
10079                                 eval $setvar
10080                         else
10081                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10082                                 val="$define"
10083                                 set d_old_pthread_create_joinable
10084                                 eval $setvar
10085                                 val=0
10086                                 set old_pthread_create_joinable
10087                                 eval $setvar
10088                         fi
10089                 fi
10090         fi
10091         $rm -f try try.*
10092 else
10093     d_old_pthread_create_joinable="$undef"
10094     old_pthread_create_joinable=""
10095 fi
10096
10097 : see if pause exists
10098 set pause d_pause
10099 eval $inlibc
10100
10101 : see if pipe exists
10102 set pipe d_pipe
10103 eval $inlibc
10104
10105 : see if poll exists
10106 set poll d_poll
10107 eval $inlibc
10108
10109
10110 : see whether the various POSIXish _yields exist
10111 $cat >try.c <<EOP
10112 #include <pthread.h>
10113 #include <stdio.h>
10114 int main() {
10115 #ifdef SCHED_YIELD
10116         sched_yield();
10117 #else
10118 #ifdef PTHREAD_YIELD
10119         pthread_yield();
10120 #else
10121 #ifdef PTHREAD_YIELD_NULL
10122         pthread_yield(NULL);
10123 #endif
10124 #endif
10125 #endif
10126 }
10127 EOP
10128 : see if sched_yield exists
10129 set try -DSCHED_YIELD
10130 if eval $compile; then
10131     val="$define"
10132     sched_yield='sched_yield()'
10133 else
10134     val="$undef"
10135 fi
10136 case "$usethreads" in
10137 $define)
10138         case "$val" in
10139         $define) echo 'sched_yield() found.' >&4        ;;
10140         *)       echo 'sched_yield() NOT found.' >&4    ;;
10141         esac
10142 esac
10143 set d_sched_yield
10144 eval $setvar
10145
10146 : see if pthread_yield exists
10147 set try -DPTHREAD_YIELD
10148 if eval $compile; then
10149     val="$define"
10150     case "$sched_yield" in
10151     '') sched_yield='pthread_yield()' ;;
10152     esac
10153 else
10154     set try -DPTHREAD_YIELD_NULL
10155     if eval $compile; then
10156         val="$define"
10157         case "$sched_yield" in
10158         '') sched_yield='pthread_yield(NULL)' ;;
10159         esac
10160     else
10161         val="$undef"
10162     fi
10163 fi
10164 case "$usethreads" in
10165 $define)
10166         case "$val" in
10167         $define) echo 'pthread_yield() found.' >&4      ;;
10168         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10169         esac
10170         ;;
10171 esac
10172 set d_pthread_yield
10173 eval $setvar
10174
10175 case "$sched_yield" in
10176 '') sched_yield=undef ;;
10177 esac
10178
10179 $rm -f try try.*
10180
10181 : see if this is a pwd.h system
10182 set pwd.h i_pwd
10183 eval $inhdr
10184
10185 case "$i_pwd" in
10186 $define)
10187         xxx=`./findhdr pwd.h`
10188         $cppstdin $cppflags $cppminus < $xxx >$$.h
10189
10190         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10191                 val="$define"
10192         else
10193                 val="$undef"
10194         fi
10195         set d_pwquota
10196         eval $setvar
10197
10198         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10199                 val="$define"
10200         else
10201                 val="$undef"
10202         fi
10203         set d_pwage
10204         eval $setvar
10205
10206         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10207                 val="$define"
10208         else
10209                 val="$undef"
10210         fi
10211         set d_pwchange
10212         eval $setvar
10213
10214         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10215                 val="$define"
10216         else
10217                 val="$undef"
10218         fi
10219         set d_pwclass
10220         eval $setvar
10221
10222         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10223                 val="$define"
10224         else
10225                 val="$undef"
10226         fi
10227         set d_pwexpire
10228         eval $setvar
10229
10230         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10231                 val="$define"
10232         else
10233                 val="$undef"
10234         fi
10235         set d_pwcomment
10236         eval $setvar
10237
10238         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10239                 val="$define"
10240         else
10241                 val="$undef"
10242         fi
10243         set d_pwgecos
10244         eval $setvar
10245
10246         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10247                 val="$define"
10248         else
10249                 val="$undef"
10250         fi
10251         set d_pwpasswd
10252         eval $setvar
10253
10254         $rm -f $$.h
10255         ;;
10256 *)
10257         val="$undef"; 
10258         set d_pwquota; eval $setvar
10259         set d_pwage; eval $setvar
10260         set d_pwchange; eval $setvar
10261         set d_pwclass; eval $setvar
10262         set d_pwexpire; eval $setvar
10263         set d_pwcomment; eval $setvar
10264         set d_pwgecos; eval $setvar
10265         set d_pwpasswd; eval $setvar
10266         ;;
10267 esac
10268
10269 : see if readdir and friends exist
10270 set readdir d_readdir
10271 eval $inlibc
10272 set seekdir d_seekdir
10273 eval $inlibc
10274 set telldir d_telldir
10275 eval $inlibc
10276 set rewinddir d_rewinddir
10277 eval $inlibc
10278
10279 : see if readlink exists
10280 set readlink d_readlink
10281 eval $inlibc
10282
10283 : see if rename exists
10284 set rename d_rename
10285 eval $inlibc
10286
10287 : see if rmdir exists
10288 set rmdir d_rmdir
10289 eval $inlibc
10290
10291 : see if memory.h is available.
10292 val=''
10293 set memory.h val
10294 eval $inhdr
10295
10296 : See if it conflicts with string.h
10297 case "$val" in
10298 $define)
10299         case "$strings" in
10300         '') ;;
10301         *)
10302                 $cppstdin $cppflags $cppminus < $strings > mem.h
10303                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10304                         echo " "
10305                         echo "We won't be including <memory.h>."
10306                         val="$undef"
10307                 fi
10308                 $rm -f mem.h
10309                 ;;
10310         esac
10311 esac
10312 set i_memory
10313 eval $setvar
10314
10315 : can bcopy handle overlapping blocks?
10316 val="$undef"
10317 case "$d_bcopy" in
10318 "$define")
10319         echo " "
10320         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10321         $cat >try.c <<EOCP
10322 #$i_memory I_MEMORY
10323 #$i_stdlib I_STDLIB
10324 #$i_string I_STRING
10325 #$i_unistd I_UNISTD
10326 EOCP
10327         $cat >>try.c <<'EOCP'
10328 #include <stdio.h>
10329 #ifdef I_MEMORY
10330 #  include <memory.h>
10331 #endif
10332 #ifdef I_STDLIB
10333 #  include <stdlib.h>
10334 #endif
10335 #ifdef I_STRING
10336 #  include <string.h>
10337 #else
10338 #  include <strings.h>
10339 #endif
10340 #ifdef I_UNISTD
10341 #  include <unistd.h>  /* Needed for NetBSD */
10342 #endif
10343 int main()
10344 {
10345 char buf[128], abc[128];
10346 char *b;
10347 int len;
10348 int off;
10349 int align;
10350
10351 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10352
10353 for (align = 7; align >= 0; align--) {
10354         for (len = 36; len; len--) {
10355                 b = buf+align;
10356                 bcopy(abc, b, len);
10357                 for (off = 1; off <= len; off++) {
10358                         bcopy(b, b+off, len);
10359                         bcopy(b+off, b, len);
10360                         if (bcmp(b, abc, len))
10361                                 exit(1);
10362                 }
10363         }
10364 }
10365 exit(0);
10366 }
10367 EOCP
10368         set try
10369         if eval $compile_ok; then
10370                 if ./try 2>/dev/null; then
10371                         echo "Yes, it can."
10372                         val="$define"
10373                 else
10374                         echo "It can't, sorry."
10375                         case "$d_memmove" in
10376                         "$define") echo "But that's Ok since you have memmove()." ;;
10377                         esac
10378                 fi
10379         else
10380                 echo "(I can't compile the test program, so we'll assume not...)"
10381                 case "$d_memmove" in
10382                 "$define") echo "But that's Ok since you have memmove()." ;;
10383                 esac
10384         fi
10385         ;;
10386 esac
10387 $rm -f try.* try core
10388 set d_safebcpy
10389 eval $setvar
10390
10391 : can memcpy handle overlapping blocks?
10392 val="$undef"
10393 case "$d_memcpy" in
10394 "$define")
10395         echo " "
10396         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10397         $cat >try.c <<EOCP
10398 #$i_memory I_MEMORY
10399 #$i_stdlib I_STDLIB
10400 #$i_string I_STRING
10401 #$i_unistd I_UNISTD
10402 EOCP
10403         $cat >>try.c <<'EOCP'
10404 #include <stdio.h>
10405 #ifdef I_MEMORY
10406 #  include <memory.h>
10407 #endif
10408 #ifdef I_STDLIB
10409 #  include <stdlib.h>
10410 #endif
10411 #ifdef I_STRING
10412 #  include <string.h>
10413 #else
10414 #  include <strings.h>
10415 #endif
10416 #ifdef I_UNISTD
10417 #  include <unistd.h>  /* Needed for NetBSD */
10418 #endif
10419 int main()
10420 {
10421 char buf[128], abc[128];
10422 char *b;
10423 int len;
10424 int off;
10425 int align;
10426
10427 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10428    try to store the string in read-only memory. */
10429 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10430
10431 for (align = 7; align >= 0; align--) {
10432         for (len = 36; len; len--) {
10433                 b = buf+align;
10434                 memcpy(b, abc, len);
10435                 for (off = 1; off <= len; off++) {
10436                         memcpy(b+off, b, len);
10437                         memcpy(b, b+off, len);
10438                         if (memcmp(b, abc, len))
10439                                 exit(1);
10440                 }
10441         }
10442 }
10443 exit(0);
10444 }
10445 EOCP
10446         set try
10447         if eval $compile_ok; then
10448                 if ./try 2>/dev/null; then
10449                         echo "Yes, it can."
10450                         val="$define"
10451                 else
10452                         echo "It can't, sorry."
10453                         case "$d_memmove" in
10454                         "$define") echo "But that's Ok since you have memmove()." ;;
10455                         esac
10456                 fi
10457         else
10458                 echo "(I can't compile the test program, so we'll assume not...)"
10459                 case "$d_memmove" in
10460                 "$define") echo "But that's Ok since you have memmove()." ;;
10461                 esac
10462         fi
10463         ;;
10464 esac
10465 $rm -f try.* try core
10466 set d_safemcpy
10467 eval $setvar
10468
10469 : can memcmp be trusted to compare relative magnitude?
10470 val="$undef"
10471 case "$d_memcmp" in
10472 "$define")
10473         echo " "
10474         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10475         $cat >try.c <<EOCP
10476 #$i_memory I_MEMORY
10477 #$i_stdlib I_STDLIB
10478 #$i_string I_STRING
10479 #$i_unistd I_UNISTD
10480 EOCP
10481         $cat >>try.c <<'EOCP'
10482 #include <stdio.h>
10483 #ifdef I_MEMORY
10484 #  include <memory.h>
10485 #endif
10486 #ifdef I_STDLIB
10487 #  include <stdlib.h>
10488 #endif
10489 #ifdef I_STRING
10490 #  include <string.h>
10491 #else
10492 #  include <strings.h>
10493 #endif
10494 #ifdef I_UNISTD
10495 #  include <unistd.h>  /* Needed for NetBSD */
10496 #endif
10497 int main()
10498 {
10499 char a = -1;
10500 char b = 0;
10501 if ((a < b) && memcmp(&a, &b, 1) < 0)
10502         exit(1);
10503 exit(0);
10504 }
10505 EOCP
10506         set try
10507         if eval $compile_ok; then
10508                 if ./try 2>/dev/null; then
10509                         echo "Yes, it can."
10510                         val="$define"
10511                 else
10512                         echo "No, it can't (it uses signed chars)."
10513                 fi
10514         else
10515                 echo "(I can't compile the test program, so we'll assume not...)"
10516         fi
10517         ;;
10518 esac
10519 $rm -f try.* try core
10520 set d_sanemcmp
10521 eval $setvar
10522
10523 : see if select exists
10524 set select d_select
10525 eval $inlibc
10526
10527 : see if semctl exists
10528 set semctl d_semctl
10529 eval $inlibc
10530
10531 : see if semget exists
10532 set semget d_semget
10533 eval $inlibc
10534
10535 : see if semop exists
10536 set semop d_semop
10537 eval $inlibc
10538
10539 : see how much of the 'sem*(2)' library is present.
10540 h_sem=true
10541 echo " "
10542 case "$d_semctl$d_semget$d_semop" in
10543 *"$undef"*) h_sem=false;;
10544 esac
10545 case "$osname" in
10546 freebsd)
10547     case "`ipcs 2>&1`" in
10548     "SVID messages"*"not configured"*)
10549         echo "Your $osname does not have the sem*(2) configured." >&4
10550         h_sem=false
10551         val="$undef"
10552         set semctl d_semctl
10553         eval $setvar
10554         set semget d_semget
10555         eval $setvar
10556         set semop d_semop
10557         eval $setvar
10558         ;;
10559     esac
10560     ;;
10561 esac
10562 : we could also check for sys/ipc.h ...
10563 if $h_sem && $test `./findhdr sys/sem.h`; then
10564         echo "You have the full sem*(2) library." >&4
10565         val="$define"
10566 else
10567         echo "You don't have the full sem*(2) library." >&4
10568         val="$undef"
10569 fi
10570 set d_sem
10571 eval $setvar
10572
10573 : see whether sys/sem.h defines union semun
10574 echo " "
10575 $cat > try.c <<'END'
10576 #include <sys/types.h>
10577 #include <sys/ipc.h>
10578 #include <sys/sem.h>
10579 int main () { union semun semun; semun.buf = 0; }
10580 END
10581 set try
10582 if eval $compile; then
10583     echo "You have union semun in <sys/sem.h>." >&4
10584     val="$define"
10585 else
10586     echo "You do not have union semun in <sys/sem.h>." >&4
10587     val="$undef"
10588 fi
10589 $rm -f try try.c try.h
10590 set d_union_semun
10591 eval $setvar
10592
10593 : see how to do semctl IPC_STAT
10594 case "$d_sem" in
10595 $define)
10596     : see whether semctl IPC_STAT can use union semun
10597     echo " "
10598     $cat > try.h <<END
10599 #ifndef S_IRUSR
10600 #   ifdef S_IREAD
10601 #       define S_IRUSR S_IREAD
10602 #       define S_IWUSR S_IWRITE
10603 #       define S_IXUSR S_IEXEC
10604 #   else
10605 #       define S_IRUSR 0400
10606 #       define S_IWUSR 0200
10607 #       define S_IXUSR 0100
10608 #   endif
10609 #   define S_IRGRP (S_IRUSR>>3)
10610 #   define S_IWGRP (S_IWUSR>>3)
10611 #   define S_IXGRP (S_IXUSR>>3)
10612 #   define S_IROTH (S_IRUSR>>6)
10613 #   define S_IWOTH (S_IWUSR>>6)
10614 #   define S_IXOTH (S_IXUSR>>6)
10615 #endif
10616 #ifndef S_IRWXU
10617 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10618 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10619 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10620 #endif
10621 END
10622
10623     $cat > try.c <<END
10624 #include <sys/types.h>
10625 #include <sys/ipc.h>
10626 #include <sys/sem.h>
10627 #include <sys/stat.h>
10628 #include <stdio.h>
10629 #include <errno.h>
10630 #include "try.h"
10631 #ifndef errno
10632 extern int errno;
10633 #endif
10634 #$d_union_semun HAS_UNION_SEMUN
10635 int main() {
10636     union semun
10637 #ifndef HAS_UNION_SEMUN
10638     {
10639         int val;
10640         struct semid_ds *buf;
10641         unsigned short *array;
10642     }
10643 #endif
10644     arg;
10645     int sem, st;
10646
10647 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10648     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10649     if (sem > -1) {
10650         struct semid_ds argbuf;
10651         arg.buf = &argbuf;
10652 #       ifdef IPC_STAT
10653         st = semctl(sem, 0, IPC_STAT, arg);
10654         if (st == 0)
10655             printf("semun\n");
10656         else
10657 #       endif /* IPC_STAT */
10658             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10659 #       ifdef IPC_RMID
10660         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10661 #       endif /* IPC_RMID */
10662             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10663     } else
10664 #endif /* IPC_PRIVATE && ... */
10665         printf("semget failed: errno = %d\n", errno);
10666   return 0;
10667 }
10668 END
10669     val="$undef"
10670     set try
10671     if eval $compile; then
10672         xxx=`./try`
10673         case "$xxx" in
10674         semun) val="$define" ;;
10675         esac
10676     fi
10677     $rm -f try try.c
10678     set d_semctl_semun
10679     eval $setvar
10680     case "$d_semctl_semun" in
10681     $define)
10682         echo "You can use union semun for semctl IPC_STAT." >&4
10683         also='also'
10684         ;;
10685     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10686         also=''
10687         ;;
10688     esac
10689
10690     : see whether semctl IPC_STAT can use struct semid_ds pointer
10691     $cat > try.c <<'END'
10692 #include <sys/types.h>
10693 #include <sys/ipc.h>
10694 #include <sys/sem.h>
10695 #include <sys/stat.h>
10696 #include "try.h"
10697 #include <stdio.h>
10698 #include <errno.h>
10699 #ifndef errno
10700 extern int errno;
10701 #endif
10702 int main() {
10703     struct semid_ds arg;
10704     int sem, st;
10705
10706 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10707     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10708     if (sem > -1) {
10709 #       ifdef IPC_STAT
10710         st = semctl(sem, 0, IPC_STAT, &arg);
10711         if (st == 0)
10712             printf("semid_ds\n");
10713         else
10714 #       endif /* IPC_STAT */
10715             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10716 #       ifdef IPC_RMID
10717         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10718 #       endif /* IPC_RMID */
10719             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10720     } else
10721 #endif /* IPC_PRIVATE && ... */
10722         printf("semget failed: errno = %d\n", errno);
10723
10724     return 0;
10725 }
10726 END
10727     val="$undef"
10728     set try
10729     if eval $compile; then
10730         xxx=`./try`
10731         case "$xxx" in
10732         semid_ds) val="$define" ;;
10733         esac
10734     fi
10735     $rm -f try try.c
10736     set d_semctl_semid_ds
10737     eval $setvar
10738     case "$d_semctl_semid_ds" in
10739     $define)
10740         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10741         ;;
10742     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10743         ;;
10744     esac
10745     $rm -f try.h
10746     ;;
10747 *)  val="$undef"
10748
10749     # We do not have the full sem*(2) library, so assume we can not
10750     # use either.
10751
10752     set d_semctl_semun
10753     eval $setvar
10754
10755     set d_semctl_semid_ds
10756     eval $setvar
10757     ;;
10758 esac
10759
10760 : see if setegid exists
10761 set setegid d_setegid
10762 eval $inlibc
10763
10764 : see if seteuid exists
10765 set seteuid d_seteuid
10766 eval $inlibc
10767
10768 : see if setgrent exists
10769 set setgrent d_setgrent
10770 eval $inlibc
10771
10772 : see if sethostent exists
10773 set sethostent d_sethent
10774 eval $inlibc
10775
10776 : see if setlinebuf exists
10777 set setlinebuf d_setlinebuf
10778 eval $inlibc
10779
10780 : see if setlocale exists
10781 set setlocale d_setlocale
10782 eval $inlibc
10783
10784 : see if setnetent exists
10785 set setnetent d_setnent
10786 eval $inlibc
10787
10788 : see if setprotoent exists
10789 set setprotoent d_setpent
10790 eval $inlibc
10791
10792 : see if setpgid exists
10793 set setpgid d_setpgid
10794 eval $inlibc
10795
10796 : see if setpgrp2 exists
10797 set setpgrp2 d_setpgrp2
10798 eval $inlibc
10799
10800 : see if setpriority exists
10801 set setpriority d_setprior
10802 eval $inlibc
10803
10804 : see if setpwent exists
10805 set setpwent d_setpwent
10806 eval $inlibc
10807
10808 : see if setregid exists
10809 set setregid d_setregid
10810 eval $inlibc
10811 set setresgid d_setresgid
10812 eval $inlibc
10813
10814 : see if setreuid exists
10815 set setreuid d_setreuid
10816 eval $inlibc
10817 set setresuid d_setresuid
10818 eval $inlibc
10819
10820 : see if setrgid exists
10821 set setrgid d_setrgid
10822 eval $inlibc
10823
10824 : see if setruid exists
10825 set setruid d_setruid
10826 eval $inlibc
10827
10828 : see if setservent exists
10829 set setservent d_setsent
10830 eval $inlibc
10831
10832 : see if setsid exists
10833 set setsid d_setsid
10834 eval $inlibc
10835
10836 : see if setspent exists
10837 set setspent d_setspent
10838 eval $inlibc
10839
10840 : see if setvbuf exists
10841 set setvbuf d_setvbuf
10842 eval $inlibc
10843
10844 : see if sfio.h is available
10845 set sfio.h i_sfio
10846 eval $inhdr
10847
10848
10849 : see if sfio library is available
10850 case "$i_sfio" in
10851 $define)
10852         val=''
10853         set sfreserve val
10854         eval $inlibc
10855         ;;
10856 *)
10857         val="$undef"
10858         ;;
10859 esac
10860 : Ok, but do we want to use it.
10861 case "$val" in
10862 $define)
10863         case "$usesfio" in
10864         true|$define|[yY]*) dflt='y';;
10865         *) dflt='n';;
10866         esac
10867         echo "$package can use the sfio library, but it is experimental."
10868         rp="You seem to have sfio available, do you want to try using it?"
10869         . ./myread
10870         case "$ans" in
10871         y|Y) ;;
10872         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10873                 val="$undef"
10874                 : Remove sfio from list of libraries to use
10875                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10876                 shift
10877                 libs="$*"
10878                 echo "libs = $libs" >&4
10879                 ;;
10880         esac
10881         ;;
10882 *)      case "$usesfio" in
10883         true|$define|[yY]*)
10884                 echo "Sorry, cannot find sfio on this machine" >&4
10885                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10886                 ;;
10887         esac
10888         ;;
10889 esac
10890 set d_sfio
10891 eval $setvar
10892 case "$d_sfio" in
10893 $define) usesfio='true';;
10894 *) usesfio='false';;
10895 esac
10896
10897 : see if shmctl exists
10898 set shmctl d_shmctl
10899 eval $inlibc
10900
10901 : see if shmget exists
10902 set shmget d_shmget
10903 eval $inlibc
10904
10905 : see if shmat exists
10906 set shmat d_shmat
10907 eval $inlibc
10908 : see what shmat returns
10909 case "$d_shmat" in
10910 "$define")
10911         $cat >shmat.c <<'END'
10912 #include <sys/shm.h>
10913 void *shmat();
10914 END
10915         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10916                 shmattype='void *'
10917         else
10918                 shmattype='char *'
10919         fi
10920         echo "and it returns ($shmattype)." >&4
10921         : see if a prototype for shmat is available
10922         xxx=`./findhdr sys/shm.h`
10923         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10924         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10925                 val="$define"
10926         else
10927                 val="$undef"
10928         fi
10929         $rm -f shmat.[co]
10930         ;;
10931 *)
10932         val="$undef"
10933         ;;
10934 esac
10935 set d_shmatprototype
10936 eval $setvar
10937
10938 : see if shmdt exists
10939 set shmdt d_shmdt
10940 eval $inlibc
10941
10942 : see how much of the 'shm*(2)' library is present.
10943 h_shm=true
10944 echo " "
10945 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10946 *"$undef"*) h_shm=false;;
10947 esac
10948 case "$osname" in
10949 freebsd)
10950     case "`ipcs 2>&1`" in
10951     "SVID shared memory"*"not configured"*)
10952         echo "Your $osname does not have the shm*(2) configured." >&4
10953         h_shm=false
10954         val="$undef"
10955         set shmctl d_shmctl
10956         evat $setvar
10957         set shmget d_shmget
10958         evat $setvar
10959         set shmat d_shmat
10960         evat $setvar
10961         set shmdt d_shmdt
10962         evat $setvar
10963         ;;
10964     esac
10965     ;;
10966 esac
10967 : we could also check for sys/ipc.h ...
10968 if $h_shm && $test `./findhdr sys/shm.h`; then
10969         echo "You have the full shm*(2) library." >&4
10970         val="$define"
10971 else
10972         echo "You don't have the full shm*(2) library." >&4
10973         val="$undef"
10974 fi
10975 set d_shm
10976 eval $setvar
10977
10978 echo " "
10979 : see if we have sigaction
10980 if set sigaction val -f d_sigaction; eval $csym; $val; then
10981         echo 'sigaction() found.' >&4
10982         $cat > try.c <<'EOP'
10983 #include <stdio.h>
10984 #include <sys/types.h>
10985 #include <signal.h>
10986 int main()
10987 {
10988     struct sigaction act, oact;
10989     act.sa_flags = 0;
10990     oact.sa_handler = 0;
10991     /* so that act and oact are used */
10992     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10993 }
10994 EOP
10995         set try
10996         if eval $compile_ok; then
10997                 val="$define"
10998         else
10999                 echo "But you don't seem to have a useable struct sigaction." >&4
11000                 val="$undef"
11001         fi
11002 else
11003         echo 'sigaction NOT found.' >&4
11004         val="$undef"
11005 fi
11006 set d_sigaction; eval $setvar
11007 $rm -f try try$_o try.c
11008
11009 : see if sigsetjmp exists
11010 echo " "
11011 case "$d_sigsetjmp" in
11012 '')
11013         $cat >try.c <<'EOP'
11014 #include <setjmp.h>
11015 sigjmp_buf env;
11016 int set = 1;
11017 int main()
11018 {
11019         if (sigsetjmp(env,1))
11020                 exit(set);
11021         set = 0;
11022         siglongjmp(env, 1);
11023         exit(1);
11024 }
11025 EOP
11026         set try
11027         if eval $compile; then
11028                 if ./try >/dev/null 2>&1; then
11029                         echo "POSIX sigsetjmp found." >&4
11030                         val="$define"
11031                 else
11032                         $cat >&4 <<EOM
11033 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11034 I'll ignore them.
11035 EOM
11036                         val="$undef"
11037                 fi
11038         else
11039                 echo "sigsetjmp not found." >&4
11040                 val="$undef"
11041         fi
11042         ;;
11043 *) val="$d_sigsetjmp"
11044         case "$d_sigsetjmp" in
11045         $define) echo "POSIX sigsetjmp found." >&4;;
11046         $undef) echo "sigsetjmp not found." >&4;;
11047         esac
11048         ;;
11049 esac
11050 set d_sigsetjmp
11051 eval $setvar
11052 $rm -f try.c try
11053
11054 : see if sys/stat.h is available
11055 set sys/stat.h i_sysstat
11056 eval $inhdr
11057
11058
11059 : see if stat knows about block sizes
11060 echo " "
11061 echo "Checking to see if your struct stat has st_blocks field..." >&4
11062 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11063 eval $hasfield
11064
11065
11066 : see if this is a sys/vfs.h system
11067 set sys/vfs.h i_sysvfs
11068 eval $inhdr
11069
11070
11071 : see if this is a sys/statfs.h system
11072 set sys/statfs.h i_sysstatfs
11073 eval $inhdr
11074
11075
11076 echo " "
11077 echo "Checking to see if your system supports struct statfs..." >&4
11078 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
11079 eval $hasstruct
11080 case "$d_statfs_s" in
11081 "$define")      echo "Yes, it does."   ;;
11082 *)              echo "No, it doesn't." ;;
11083 esac
11084
11085
11086
11087 : see if struct statfs knows about f_flags
11088 case "$d_statfs_s" in
11089 define) 
11090         echo " "
11091         echo "Checking to see if your struct statfs has f_flags field..." >&4
11092         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
11093         eval $hasfield
11094         ;;
11095 *)      val="$undef"
11096         set d_statfs_f_flags
11097         eval $setvar
11098         ;;
11099 esac
11100 case "$d_statfs_f_flags" in
11101 "$define")      echo "Yes, it does."   ;;
11102 *)              echo "No, it doesn't." ;;
11103 esac
11104
11105 : see if _ptr and _cnt from stdio act std
11106 echo " "
11107 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11108         echo "(Looks like you have stdio.h from Linux.)"
11109         case "$stdio_ptr" in
11110         '') stdio_ptr='((fp)->_IO_read_ptr)'
11111                 ptr_lval=$define
11112                 ;;
11113         *)      ptr_lval=$d_stdio_ptr_lval;;
11114         esac
11115         case "$stdio_cnt" in
11116         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11117                 cnt_lval=$undef
11118                 ;;
11119         *)      cnt_lval=$d_stdio_cnt_lval;;
11120         esac
11121         case "$stdio_base" in
11122         '') stdio_base='((fp)->_IO_read_base)';;
11123         esac
11124         case "$stdio_bufsiz" in
11125         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11126         esac
11127 else
11128         case "$stdio_ptr" in
11129         '') stdio_ptr='((fp)->_ptr)'
11130                 ptr_lval=$define
11131                 ;;
11132         *)      ptr_lval=$d_stdio_ptr_lval;;
11133         esac
11134         case "$stdio_cnt" in
11135         '') stdio_cnt='((fp)->_cnt)'
11136                 cnt_lval=$define
11137                 ;;
11138         *)      cnt_lval=$d_stdio_cnt_lval;;
11139         esac
11140         case "$stdio_base" in
11141         '') stdio_base='((fp)->_base)';;
11142         esac
11143         case "$stdio_bufsiz" in
11144         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11145         esac
11146 fi
11147 : test whether _ptr and _cnt really work
11148 echo "Checking how std your stdio is..." >&4
11149 $cat >try.c <<EOP
11150 #include <stdio.h>
11151 #define FILE_ptr(fp)    $stdio_ptr
11152 #define FILE_cnt(fp)    $stdio_cnt
11153 int main() {
11154         FILE *fp = fopen("try.c", "r");
11155         char c = getc(fp);
11156         if (
11157                 18 <= FILE_cnt(fp) &&
11158                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11159         )
11160                 exit(0);
11161         exit(1);
11162 }
11163 EOP
11164 val="$undef"
11165 set try
11166 if eval $compile; then
11167         if ./try; then
11168                 echo "Your stdio acts pretty std."
11169                 val="$define"
11170         else
11171                 echo "Your stdio isn't very std."
11172         fi
11173 else
11174         echo "Your stdio doesn't appear very std."
11175 fi
11176 $rm -f try.c try
11177 set d_stdstdio
11178 eval $setvar
11179
11180 : Can _ptr be used as an lvalue?
11181 case "$d_stdstdio$ptr_lval" in
11182 $define$define) val=$define ;;
11183 *) val=$undef ;;
11184 esac
11185 set d_stdio_ptr_lval
11186 eval $setvar
11187
11188 : Can _cnt be used as an lvalue?
11189 case "$d_stdstdio$cnt_lval" in
11190 $define$define) val=$define ;;
11191 *) val=$undef ;;
11192 esac
11193 set d_stdio_cnt_lval
11194 eval $setvar
11195
11196 : see if _base is also standard
11197 val="$undef"
11198 case "$d_stdstdio" in
11199 $define)
11200         $cat >try.c <<EOP
11201 #include <stdio.h>
11202 #define FILE_base(fp)   $stdio_base
11203 #define FILE_bufsiz(fp) $stdio_bufsiz
11204 int main() {
11205         FILE *fp = fopen("try.c", "r");
11206         char c = getc(fp);
11207         if (
11208                 19 <= FILE_bufsiz(fp) &&
11209                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11210         )
11211                 exit(0);
11212         exit(1);
11213 }
11214 EOP
11215         set try
11216         if eval $compile; then
11217                 if ./try; then
11218                         echo "And its _base field acts std."
11219                         val="$define"
11220                 else
11221                         echo "But its _base field isn't std."
11222                 fi
11223         else
11224                 echo "However, it seems to be lacking the _base field."
11225         fi
11226         $rm -f try.c try
11227         ;;
11228 esac
11229 set d_stdiobase
11230 eval $setvar
11231
11232 $cat >&4 <<EOM
11233 Checking how to access stdio streams by file descriptor number...
11234 EOM
11235 case "$stdio_stream_array" in
11236 '')     $cat >try.c <<EOCP
11237 #include <stdio.h>
11238 int main() {
11239   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11240     printf("yes\n");
11241 }
11242 EOCP
11243         for s in _iob __iob __sF
11244         do
11245                 set try -DSTDIO_STREAM_ARRAY=$s
11246                 if eval $compile; then
11247                         case "`./try$exe_ext`" in
11248                         yes)    stdio_stream_array=$s; break ;;
11249                         esac
11250                 fi
11251         done
11252         $rm -f try.* try$exe_ext
11253 esac
11254 case "$stdio_stream_array" in
11255 '')     $cat >&4 <<EOM
11256 I can't figure out how to access stdio streams by file descriptor number.
11257 EOM
11258         d_stdio_stream_array="$undef"
11259         ;;
11260 *)      $cat >&4 <<EOM
11261 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11262 EOM
11263         d_stdio_stream_array="$define"
11264         ;;
11265 esac
11266
11267 : see if strcoll exists
11268 set strcoll d_strcoll
11269 eval $inlibc
11270
11271 : check for structure copying
11272 echo " "
11273 echo "Checking to see if your C compiler can copy structs..." >&4
11274 $cat >try.c <<'EOCP'
11275 int main()
11276 {
11277         struct blurfl {
11278                 int dyick;
11279         } foo, bar;
11280
11281         foo = bar;
11282 }
11283 EOCP
11284 if $cc -c try.c >/dev/null 2>&1 ; then
11285         val="$define"
11286         echo "Yup, it can."
11287 else
11288         val="$undef"
11289         echo "Nope, it can't."
11290 fi
11291 set d_strctcpy
11292 eval $setvar
11293 $rm -f try.*
11294
11295 : see if strerror and/or sys_errlist[] exist
11296 echo " "
11297 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11298     if set strerror val -f d_strerror; eval $csym; $val; then
11299                 echo 'strerror() found.' >&4
11300                 d_strerror="$define"
11301                 d_strerrm='strerror(e)'
11302                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11303                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11304                         d_syserrlst="$define"
11305                 else
11306                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11307                         d_syserrlst="$undef"
11308                 fi
11309     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11310                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11311                 echo 'strerror() found in string header.' >&4
11312                 d_strerror="$define"
11313                 d_strerrm='strerror(e)'
11314                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11315                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11316                                 d_syserrlst="$define"
11317                 else
11318                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11319                         d_syserrlst="$undef"
11320                 fi
11321     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11322                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11323                 d_strerror="$undef"
11324                 d_syserrlst="$define"
11325                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11326     else
11327                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11328                 d_strerror="$undef"
11329                 d_syserrlst="$undef"
11330                 d_strerrm='"unknown"'
11331     fi
11332 fi
11333
11334 : see if strtod exists
11335 set strtod d_strtod
11336 eval $inlibc
11337
11338 : see if strtol exists
11339 set strtol d_strtol
11340 eval $inlibc
11341
11342 : see if strtold exists
11343 set strtold d_strtold
11344 eval $inlibc
11345
11346 : see if strtoll exists
11347 set strtoll d_strtoll
11348 eval $inlibc
11349
11350 : see if strtoul exists
11351 set strtoul d_strtoul
11352 eval $inlibc
11353
11354 : see if strtoull exists
11355 set strtoull d_strtoull
11356 eval $inlibc
11357
11358 : see if strtouq exists
11359 set strtouq d_strtouq
11360 eval $inlibc
11361
11362 : see if strxfrm exists
11363 set strxfrm d_strxfrm
11364 eval $inlibc
11365
11366 : see if symlink exists
11367 set symlink d_symlink
11368 eval $inlibc
11369
11370 : see if syscall exists
11371 set syscall d_syscall
11372 eval $inlibc
11373
11374 : see if sysconf exists
11375 set sysconf d_sysconf
11376 eval $inlibc
11377
11378 : see if system exists
11379 set system d_system
11380 eval $inlibc
11381
11382 : see if tcgetpgrp exists
11383 set tcgetpgrp d_tcgetpgrp
11384 eval $inlibc
11385
11386 : see if tcsetpgrp exists
11387 set tcsetpgrp d_tcsetpgrp
11388 eval $inlibc
11389
11390 : see if prototype for telldir is available
11391 echo " "
11392 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11393 eval $hasproto
11394
11395 : see if this is a sys/times.h system
11396 set sys/times.h i_systimes
11397 eval $inhdr
11398
11399 : see if times exists
11400 echo " "
11401 if set times val -f d_times; eval $csym; $val; then
11402         echo 'times() found.' >&4
11403         d_times="$define"
11404         inc=''
11405         case "$i_systimes" in
11406         "$define") inc='sys/times.h';;
11407         esac
11408         rp="What is the type returned by times() on this system?"
11409         set clock_t clocktype long stdio.h sys/types.h $inc
11410         eval $typedef_ask
11411 else
11412         echo 'times() NOT found, hope that will do.' >&4
11413         d_times="$undef"
11414         clocktype='int'
11415 fi
11416
11417 : see if truncate exists
11418 set truncate d_truncate
11419 eval $inlibc
11420
11421 : see if tzname[] exists
11422 echo " "
11423 if set tzname val -a d_tzname; eval $csym; $val; then
11424         val="$define"
11425         echo 'tzname[] found.' >&4
11426 else
11427         val="$undef"
11428         echo 'tzname[] NOT found.' >&4
11429 fi
11430 set d_tzname
11431 eval $setvar
11432
11433 : see if umask exists
11434 set umask d_umask
11435 eval $inlibc
11436
11437 : see if ustat exists
11438 set ustat d_ustat
11439 eval $inlibc
11440
11441 : backward compatibility for d_hvfork
11442 if test X$d_hvfork != X; then
11443         d_vfork="$d_hvfork"
11444         d_hvfork=''
11445 fi
11446 : see if there is a vfork
11447 val=''
11448 set vfork val
11449 eval $inlibc
11450
11451 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11452 : perl on Solaris 2.x, and probably elsewhere.
11453 case "$val" in
11454 $define)
11455         echo " "
11456         case "$usevfork" in
11457         false) dflt='n';;
11458         *) dflt='y';;
11459         esac
11460         cat <<'EOM'
11461  
11462 Perl can only use a vfork() that doesn't suffer from strict
11463 restrictions on calling functions or modifying global data in
11464 the child.  For example, glibc-2.1 contains such a vfork()
11465 that is unsuitable.  If your system provides a proper fork()
11466 call, chances are that you do NOT want perl to use vfork().
11467
11468 EOM
11469         rp="Do you still want to use vfork()?"
11470         . ./myread
11471         case "$ans" in
11472         y|Y) ;;
11473         *)
11474                 echo "Ok, we won't use vfork()."
11475                 val="$undef"
11476                 ;;
11477         esac
11478         ;;
11479 esac
11480 set d_vfork
11481 eval $setvar
11482 case "$d_vfork" in
11483 $define) usevfork='true';;
11484 *) usevfork='false';;
11485 esac
11486
11487 : see if this is an sysdir system
11488 set sys/dir.h i_sysdir
11489 eval $inhdr
11490
11491 : see if this is an sysndir system
11492 set sys/ndir.h i_sysndir
11493 eval $inhdr
11494
11495 : see if closedir exists
11496 set closedir d_closedir
11497 eval $inlibc
11498
11499 case "$d_closedir" in
11500 "$define")
11501         echo " "
11502         echo "Checking whether closedir() returns a status..." >&4
11503         cat > closedir.c <<EOM
11504 #$i_dirent I_DIRENT             /**/
11505 #$i_sysdir I_SYS_DIR            /**/
11506 #$i_sysndir I_SYS_NDIR          /**/
11507 #$i_systypes I_SYS_TYPES        /**/
11508
11509 #if defined(I_SYS_TYPES)
11510 #include <sys/types.h>
11511 #endif
11512 #if defined(I_DIRENT)
11513 #include <dirent.h>
11514 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11515 #include <sys/dir.h>
11516 #endif
11517 #else
11518 #ifdef I_SYS_NDIR
11519 #include <sys/ndir.h>
11520 #else
11521 #ifdef I_SYS_DIR
11522 #ifdef hp9000s500
11523 #include <ndir.h>       /* may be wrong in the future */
11524 #else
11525 #include <sys/dir.h>
11526 #endif
11527 #endif
11528 #endif
11529 #endif 
11530 int main() { return closedir(opendir(".")); }
11531 EOM
11532         set closedir
11533         if eval $compile_ok; then
11534                 if ./closedir > /dev/null 2>&1 ; then
11535                         echo "Yes, it does."
11536                         val="$undef"
11537                 else
11538                         echo "No, it doesn't."
11539                         val="$define"
11540                 fi
11541         else
11542                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11543                 val="$define"
11544         fi
11545         ;;
11546 *)
11547         val="$undef";
11548         ;;
11549 esac
11550 set d_void_closedir
11551 eval $setvar
11552 $rm -f closedir*
11553 : check for volatile keyword
11554 echo " "
11555 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11556 $cat >try.c <<'EOCP'
11557 int main()
11558 {
11559         typedef struct _goo_struct goo_struct;
11560         goo_struct * volatile goo = ((goo_struct *)0);
11561         struct _goo_struct {
11562                 long long_int;
11563                 int reg_int;
11564                 char char_var;
11565         };
11566         typedef unsigned short foo_t;
11567         char *volatile foo;
11568         volatile int bar;
11569         volatile foo_t blech;
11570         foo = foo;
11571 }
11572 EOCP
11573 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11574         val="$define"
11575         echo "Yup, it does."
11576 else
11577         val="$undef"
11578         echo "Nope, it doesn't."
11579 fi
11580 set d_volatile
11581 eval $setvar
11582 $rm -f try.*
11583
11584 : see if there is a wait4
11585 set wait4 d_wait4
11586 eval $inlibc
11587
11588 : see if waitpid exists
11589 set waitpid d_waitpid
11590 eval $inlibc
11591
11592 : see if wcstombs exists
11593 set wcstombs d_wcstombs
11594 eval $inlibc
11595
11596 : see if wctomb exists
11597 set wctomb d_wctomb
11598 eval $inlibc
11599
11600 : preserve RCS keywords in files with variable substitution, grrr
11601 Date='$Date'
11602 Id='$Id'
11603 Log='$Log'
11604 RCSfile='$RCSfile'
11605 Revision='$Revision'
11606
11607 case "$crosscompile" in
11608 ''|[nN]*) crosscompile="$undef" ;;
11609 esac
11610
11611 case "$osname" in
11612 next|rhapsody) multiarch="$define" ;;
11613 esac
11614 case "$multiarch" in
11615 ''|[nN]*) multiarch="$undef" ;;
11616 esac
11617
11618 : check for alignment requirements
11619 echo " "
11620 case "$crosscompile$multiarch" in
11621 *$define*)
11622         $cat <<EOM
11623 You seem to be either cross-compiling or doing a multiarchitecture build,
11624 skipping the memory alignment check.
11625
11626 EOM
11627         case "$alignbytes" in
11628         '') alignbytes=8 ;;
11629         esac
11630         ;;
11631 *)
11632         case "$alignbytes" in
11633         '') echo "Checking alignment constraints..." >&4
11634                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
11635                         $cat >try.c <<'EOCP'
11636 typedef long double NV;
11637 EOCP
11638                 else
11639                         $cat >try.c <<'EOCP'
11640 typedef double NV;
11641 EOCP
11642                 fi
11643                 $cat >>try.c <<'EOCP'
11644 #include <stdio.h>
11645 struct foobar {
11646         char foo;
11647         NV bar;
11648 } try_algn;
11649 int main()
11650 {
11651     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11652     return(0);
11653 }
11654 EOCP
11655                 set try
11656                 if eval $compile_ok; then
11657                         dflt=`./try`
11658                 else
11659                         dflt='8'
11660                         echo "(I can't seem to compile the test program...)"
11661                 fi
11662                 ;;
11663         *) dflt="$alignbytes"
11664                 ;;
11665         esac
11666         rp="Doubles must be aligned on a how-many-byte boundary?"
11667         . ./myread
11668         alignbytes="$ans"
11669         $rm -f try.c try
11670         ;;
11671 esac
11672
11673
11674 : set the base revision
11675 baserev=5.0
11676
11677 : check for ordering of bytes in a long
11678 echo " "
11679 case "$crosscompile$multiarch" in
11680 *$define*)
11681         $cat <<EOM
11682 You seem to be either cross-compiling or doing a multiarchitecture build,
11683 skipping the byteorder check.
11684
11685 EOM
11686         byteorder='0xffff'
11687         ;;
11688 *)
11689         case "$byteorder" in
11690         '')
11691                 $cat <<'EOM'
11692 In the following, larger digits indicate more significance.  A big-endian
11693 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11694 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11695 machines may have weird orders like 3412.  A Cray will report 87654321,
11696 an Alpha will report 12345678. If the test program works the default is
11697 probably right.
11698 I'm now running the test program...
11699 EOM
11700                 $cat >try.c <<'EOCP'
11701 #include <stdio.h>
11702 int main()
11703 {
11704         int i;
11705         union {
11706                 unsigned long l;
11707                 char c[sizeof(long)];
11708         } u;
11709
11710         if (sizeof(long) > 4)
11711                 u.l = (0x08070605L << 32) | 0x04030201L;
11712         else
11713                 u.l = 0x04030201L;
11714         for (i = 0; i < sizeof(long); i++)
11715                 printf("%c", u.c[i]+'0');
11716         printf("\n");
11717         exit(0);
11718 }
11719 EOCP
11720                 xxx_prompt=y
11721                 set try
11722                 if eval $compile && ./try > /dev/null; then
11723                         dflt=`./try`
11724                         case "$dflt" in
11725                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11726                                 echo "(The test program ran ok.)"
11727                                 echo "byteorder=$dflt"
11728                                 xxx_prompt=n
11729                         ;;
11730                         ????|????????) echo "(The test program ran ok.)" ;;
11731                         *) echo "(The test program didn't run right for some reason.)" ;;
11732                         esac
11733                 else
11734                         dflt='4321'
11735                         cat <<'EOM'
11736 (I can't seem to compile the test program.  Guessing big-endian...)
11737 EOM
11738                 fi
11739                 case "$xxx_prompt" in
11740                 y)
11741                         rp="What is the order of bytes in a long?"
11742                         . ./myread
11743                         byteorder="$ans"
11744                         ;;
11745                 *)      byteorder=$dflt
11746                         ;;
11747                 esac
11748                 ;;
11749         esac
11750         $rm -f try.c try
11751         ;;
11752 esac
11753
11754
11755 : how do we catenate cpp tokens here?
11756 echo " "
11757 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11758 $cat >cpp_stuff.c <<'EOCP'
11759 #define RCAT(a,b)a/**/b
11760 #define ACAT(a,b)a ## b
11761 RCAT(Rei,ser)
11762 ACAT(Cir,cus)
11763 EOCP
11764 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11765 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11766         echo "Oh!  Smells like ANSI's been here." >&4
11767         echo "We can catify or stringify, separately or together!"
11768         cpp_stuff=42
11769 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11770         echo "Ah, yes!  The good old days!" >&4
11771         echo "However, in the good old days we don't know how to stringify and"
11772         echo "catify at the same time."
11773         cpp_stuff=1
11774 else
11775         $cat >&4 <<EOM
11776 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11777 to have to edit the values of CAT[2-5] in config.h...
11778 EOM
11779         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11780 fi
11781 $rm -f cpp_stuff.*
11782
11783 : see if this is a db.h system
11784 set db.h i_db
11785 eval $inhdr
11786
11787 case "$i_db" in
11788 $define)
11789         : Check db version.
11790         echo " "
11791         echo "Checking Berkeley DB version ..." >&4
11792         $cat >try.c <<EOCP
11793 #$d_const HASCONST
11794 #ifndef HASCONST
11795 #define const
11796 #endif
11797 #include <sys/types.h>
11798 #include <stdio.h>
11799 #include <db.h>
11800 int main()
11801 {
11802 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11803     int Major, Minor, Patch ;
11804     unsigned long Version ;
11805     (void)db_version(&Major, &Minor, &Patch) ;
11806     printf("You have Berkeley DB Version 2 or greater\n");
11807
11808     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11809                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11810     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11811                 Major, Minor, Patch) ;
11812
11813     /* check that db.h & libdb are compatible */
11814     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11815         printf("db.h and libdb are incompatible\n") ;
11816         exit(3);        
11817     }
11818
11819     printf("db.h and libdb are compatible\n") ;
11820
11821     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11822                 + DB_VERSION_PATCH ;
11823
11824     /* needs to be >= 2.3.4 */
11825     if (Version < 2003004) {
11826     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11827         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11828         exit(2);        
11829     }
11830
11831     exit(0);
11832 #else
11833 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11834     printf("You have Berkeley DB Version 1\n");
11835     exit(0);    /* DB version < 2: the coast is clear. */
11836 #else
11837     exit(1);    /* <db.h> not Berkeley DB? */
11838 #endif
11839 #endif
11840 }
11841 EOCP
11842         set try
11843         if eval $compile_ok && ./try; then
11844                 echo 'Looks OK.' >&4
11845         else
11846                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11847                 i_db=$undef
11848                 case " $libs " in
11849                 *"-ldb "*)
11850                         : Remove db from list of libraries to use
11851                         echo "Removing unusable -ldb from library list" >&4
11852                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11853                         shift
11854                         libs="$*"
11855                         echo "libs = $libs" >&4
11856                         ;;
11857                 esac
11858         fi
11859         $rm -f try.*
11860         ;;
11861 esac
11862
11863 case "$i_db" in
11864 define)
11865         : Check the return type needed for hash 
11866         echo " "
11867         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11868         $cat >try.c <<EOCP
11869 #$d_const HASCONST
11870 #ifndef HASCONST
11871 #define const
11872 #endif
11873 #include <sys/types.h>
11874 #include <db.h>
11875
11876 #ifndef DB_VERSION_MAJOR
11877 u_int32_t hash_cb (ptr, size)
11878 const void *ptr;
11879 size_t size;
11880 {
11881 }
11882 HASHINFO info;
11883 int main()
11884 {
11885         info.hash = hash_cb;
11886 }
11887 #endif
11888 EOCP
11889         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11890                 if $contains warning try.out >>/dev/null 2>&1 ; then
11891                         db_hashtype='int'
11892                 else
11893                         db_hashtype='u_int32_t'
11894                 fi
11895         else
11896                 : XXX Maybe we should just give up here.
11897                 db_hashtype=u_int32_t
11898                 $cat try.out >&4
11899                 echo "Help:  I can't seem to compile the db test program." >&4
11900                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11901         fi
11902         $rm -f try.*
11903         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11904         ;;
11905 *)      db_hashtype=u_int32_t
11906         ;;
11907 esac
11908 case "$i_db" in
11909 define)
11910         : Check the return type needed for prefix 
11911         echo " "
11912         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11913         cat >try.c <<EOCP
11914 #$d_const HASCONST
11915 #ifndef HASCONST
11916 #define const
11917 #endif
11918 #include <sys/types.h>
11919 #include <db.h>
11920
11921 #ifndef DB_VERSION_MAJOR
11922 size_t prefix_cb (key1, key2)
11923 const DBT *key1;
11924 const DBT *key2;
11925 {
11926 }
11927 BTREEINFO info;
11928 int main()
11929 {
11930         info.prefix = prefix_cb;
11931 }
11932 #endif
11933 EOCP
11934         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11935                 if $contains warning try.out >>/dev/null 2>&1 ; then
11936                         db_prefixtype='int'
11937                 else
11938                         db_prefixtype='size_t'
11939                 fi
11940         else
11941                 db_prefixtype='size_t'
11942                 : XXX Maybe we should just give up here.
11943                 $cat try.out >&4
11944                 echo "Help:  I can't seem to compile the db test program." >&4
11945                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11946         fi
11947         $rm -f try.*
11948         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11949         ;;
11950 *)      db_prefixtype='size_t'
11951         ;;
11952 esac
11953
11954 : check for void type
11955 echo " "
11956 echo "Checking to see how well your C compiler groks the void type..." >&4
11957 case "$voidflags" in
11958 '')
11959         $cat >try.c <<'EOCP'
11960 #if TRY & 1
11961 void sub() {
11962 #else
11963 sub() {
11964 #endif
11965         extern void moo();      /* function returning void */
11966         void (*goo)();          /* ptr to func returning void */
11967 #if TRY & 8
11968         void *hue;              /* generic ptr */
11969 #endif
11970 #if TRY & 2
11971         void (*foo[10])();
11972 #endif
11973
11974 #if TRY & 4
11975         if(goo == moo) {
11976                 exit(0);
11977         }
11978 #endif
11979         exit(0);
11980 }
11981 int main() { sub(); }
11982 EOCP
11983         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11984                 voidflags=$defvoidused
11985         echo "Good.  It appears to support void to the level $package wants.">&4
11986                 if $contains warning .out >/dev/null 2>&1; then
11987                         echo "However, you might get some warnings that look like this:"
11988                         $cat .out
11989                 fi
11990         else
11991 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11992                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11993                         echo "It supports 1..."
11994                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11995                                 echo "It also supports 2..."
11996                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11997                                         voidflags=7
11998                                         echo "And it supports 4 but not 8 definitely."
11999                                 else
12000                                         echo "It doesn't support 4..."
12001                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12002                                                 voidflags=11
12003                                                 echo "But it supports 8."
12004                                         else
12005                                                 voidflags=3
12006                                                 echo "Neither does it support 8."
12007                                         fi
12008                                 fi
12009                         else
12010                                 echo "It does not support 2..."
12011                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12012                                         voidflags=13
12013                                         echo "But it supports 4 and 8."
12014                                 else
12015                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12016                                                 voidflags=5
12017                                                 echo "And it supports 4 but has not heard about 8."
12018                                         else
12019                                                 echo "However it supports 8 but not 4."
12020                                         fi
12021                                 fi
12022                         fi
12023                 else
12024                         echo "There is no support at all for void."
12025                         voidflags=0
12026                 fi
12027         fi
12028 esac
12029 case "$voidflags" in
12030 "$defvoidused") ;;
12031 *)      $cat >&4 <<'EOM'
12032   Support flag bits are:
12033     1: basic void declarations.
12034     2: arrays of pointers to functions returning void.
12035     4: operations between pointers to and addresses of void functions.
12036     8: generic void pointers.
12037 EOM
12038         dflt="$voidflags";
12039         rp="Your void support flags add up to what?"
12040         . ./myread
12041         voidflags="$ans"
12042         ;;
12043 esac
12044 $rm -f try.* .out
12045
12046
12047 : How can we generate normalized random numbers ?
12048 echo " "
12049 echo "Looking for a random number function..." >&4
12050 case "$randfunc" in
12051 '')
12052         if set drand48 val -f; eval $csym; $val; then
12053                 dflt="drand48"
12054                 echo "Good, found drand48()." >&4
12055         elif set random val -f; eval $csym; $val; then
12056                 dflt="random"
12057                 echo "OK, found random()." >&4
12058         else
12059                 dflt="rand"
12060                 echo "Yick, looks like I have to use rand()." >&4
12061         fi
12062         echo " "
12063         ;;
12064 *)
12065         dflt="$randfunc"
12066         ;;
12067 esac
12068 cont=true
12069
12070 case "$ccflags" in
12071 *-Dmy_rand=*|*-Dmy_srand=*)
12072         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12073         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12074         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12075         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12076         ;;
12077 esac
12078
12079 while $test "$cont"; do
12080         rp="Use which function to generate random numbers?"
12081         . ./myread
12082         if $test "$ans" = "$dflt"; then
12083                 : null
12084         else
12085                 randbits=''
12086         fi
12087         randfunc="$ans"
12088         if set $ans val -f; eval $csym; $val; then
12089                 cont=''
12090         else
12091                 dflt=y
12092                 rp="I cannot find function $ans. Use that name anyway?"
12093                 . ./myread
12094                 dflt=rand
12095                 case "$ans" in
12096                         [yY]*) cont='';;
12097                 esac
12098         fi
12099         case "$cont" in
12100         '')
12101                 case "$randfunc" in
12102                 drand48)
12103                         drand01="drand48()"
12104                         seedfunc="srand48"
12105                         randbits=48
12106                         randseedtype=long
12107                         ;;
12108                 rand|random)
12109                         case "$randbits" in
12110                         '')
12111 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12112                                 $cat >try.c <<EOCP
12113 #$i_unistd I_UNISTD
12114 #$i_stdlib I_STDLIB
12115 #include <stdio.h>
12116 #ifdef I_UNISTD
12117 #  include <unistd.h>
12118 #endif
12119 #ifdef I_STDLIB
12120 #  include <stdlib.h>
12121 #endif
12122 int main()
12123 {
12124         register int i;
12125         register unsigned long tmp;
12126         register unsigned long max = 0L;
12127
12128         for (i = 1000; i; i--) {
12129                 tmp = (unsigned long) $randfunc();
12130                 if (tmp > max) max = tmp;
12131         }
12132         for (i = 0; max; i++)
12133                 max /= 2;
12134         printf("%d\n",i);
12135 }
12136 EOCP
12137                                 set try
12138                                 if eval $compile_ok; then
12139                                         dflt=`try`
12140                                 else
12141                                         dflt='?'
12142                                         echo "(I can't seem to compile the test program...)"
12143                                 fi
12144                                 ;;
12145                         *)
12146                                 dflt="$randbits"
12147                                 ;;
12148                         esac
12149                         rp="How many bits does your $randfunc() function produce?"
12150                         . ./myread
12151                         randbits="$ans"
12152                         $rm -f try.c try
12153                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12154                         seedfunc="s$randfunc"
12155                         randseedtype=unsigned
12156                         ;;
12157                 *)
12158                         dflt="31"
12159                         rp="How many bits does your $randfunc() function produce?"
12160                         . ./myread
12161                         randbits="$ans"
12162                         seedfunc="s$randfunc"
12163                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12164                         if set $seedfunc val -f; eval $csym; $val; then
12165                                 echo "(Using $seedfunc() to seed random generator)"
12166                         else
12167                                 echo "(Warning: no $seedfunc() to seed random generator)"
12168                                 seedfunc=rand
12169                         fi
12170                         randseedtype=unsigned
12171                         ;;
12172                 esac
12173                 ;;
12174         esac
12175 done
12176
12177 echo " "
12178 echo "Determining whether or not we are on an EBCDIC system..." >&4
12179 $cat >tebcdic.c <<'EOM'
12180 int main()
12181 {
12182   if ('M'==0xd4) return 0;
12183   return 1;
12184 }
12185 EOM
12186
12187 val=$undef
12188 set tebcdic
12189 if eval $compile_ok; then
12190         if ./tebcdic; then
12191                 echo "You have EBCDIC." >&4
12192                 val="$define"
12193         else
12194                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12195         fi
12196 else
12197         echo "I'm unable to compile the test program." >&4
12198         echo "I'll assume ASCII or some ISO Latin." >&4
12199 fi
12200 $rm -f tebcdic.c tebcdic
12201 set ebcdic
12202 eval $setvar
12203
12204 echo " "
12205 $cat >&4 <<EOM
12206 Checking how to flush all pending stdio output...
12207 EOM
12208 # I only know how to find the first 32 possibly open files on SunOS.
12209 # See also hints/sunos_4_1.sh and util.c  --AD
12210 case "$osname" in
12211 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12212 esac
12213 $cat >>try.c <<EOCP
12214 #include <stdio.h>
12215 #$i_unistd I_UNISTD
12216 #ifdef I_UNISTD
12217 # include <unistd.h>
12218 #endif
12219 #$d_sysconf HAS_SYSCONF
12220 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12221 #ifdef HAS_STDIO_STREAM_ARRAY
12222 # define STDIO_STREAM_ARRAY $stdio_stream_array
12223 #endif
12224 int main() {
12225   FILE* p = fopen("try.out", "w");
12226 #ifdef TRY_FPUTC
12227   fputc('x', p);
12228 #else
12229 # ifdef TRY_FPRINTF
12230   fprintf(p, "x");
12231 # endif
12232 #endif
12233 #ifdef TRY_FFLUSH_NULL
12234   fflush(NULL);
12235 #endif
12236 #ifdef TRY_FFLUSH_ALL
12237   {
12238     long open_max = -1;
12239 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12240     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12241 # else
12242 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12243     open_max = sysconf(_SC_OPEN_MAX);
12244 #  else
12245 #   ifdef FOPEN_MAX
12246     open_max = FOPEN_MAX;
12247 #   else
12248 #    ifdef OPEN_MAX
12249     open_max = OPEN_MAX;
12250 #    else
12251 #     ifdef _NFILE
12252     open_max = _NFILE;
12253 #     endif
12254 #    endif
12255 #   endif
12256 #  endif
12257 # endif 
12258 # ifdef HAS_STDIO_STREAM_ARRAY
12259     if (open_max > 0) {
12260       long i;
12261       for (i = 0; i < open_max; i++)
12262             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12263                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12264                 STDIO_STREAM_ARRAY[i]._flag)
12265                 fflush(&STDIO_STREAM_ARRAY[i]);
12266     }   
12267   }
12268 # endif
12269 #endif
12270   _exit(42);
12271 }
12272 EOCP
12273 : first we have to find out how _not_ to flush
12274 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12275     output=''
12276     set try -DTRY_FPUTC
12277     if eval $compile; then
12278             $rm -f try.out
12279             ./try$exe_ext 2>/dev/null
12280             if $test ! -s try.out -a "X$?" = X42; then
12281                 output=-DTRY_FPUTC
12282             fi
12283     fi
12284     case "$output" in
12285     '')
12286             set try -DTRY_FPRINTF
12287             $rm -f try.out
12288             if eval $compile; then
12289                     $rm -f try.out
12290                     ./try$exe_ext 2>/dev/null
12291                     if $test ! -s try.out -a "X$?" = X42; then
12292                         output=-DTRY_FPRINTF
12293                     fi
12294             fi
12295         ;;
12296     esac
12297 fi
12298 : check for fflush NULL behaviour
12299 case "$fflushNULL" in
12300 '')     set try -DTRY_FFLUSH_NULL $output
12301         if eval $compile; then
12302                 $rm -f try.out
12303                 ./try$exe_ext 2>/dev/null
12304                 code="$?"
12305                 if $test -s try.out -a "X$code" = X42; then
12306                         fflushNULL="`$cat try.out`"
12307                 else
12308                         if $test "X$code" != X42; then
12309                                 $cat >&4 <<EOM
12310 (If this test failed, don't worry, we'll try another method shortly.)
12311 EOM
12312                         fi
12313                 fi
12314         fi
12315         $rm -f core try.core core.try.*
12316         case "$fflushNULL" in
12317         x)      $cat >&4 <<EOM
12318 Your fflush(NULL) works okay.
12319 EOM
12320                 fflushNULL="$define"
12321                 ;;
12322         '')     $cat >&4 <<EOM
12323 Your fflush(NULL) isn't working (contrary to ANSI C).
12324 EOM
12325                 fflushNULL="$undef"
12326                 ;;
12327         *)      $cat >&4 <<EOM
12328 Cannot figure out whether your fflush(NULL) works or not.
12329 I'm assuming it doesn't (contrary to ANSI C).
12330 EOM
12331                 fflushNULL="$undef"
12332                 ;;
12333         esac
12334         ;;
12335 $define|true|[yY]*)
12336         fflushNULL="$define"
12337         ;;
12338 *)
12339         fflushNULL="$undef"
12340         ;;
12341 esac
12342 : check explicit looping only if NULL did not work
12343 case "$fflushNULL" in
12344 "$undef")
12345         : check for fflush all behaviour
12346         case "$fflushall" in
12347         '')     set try -DTRY_FFLUSH_ALL $output
12348                 if eval $compile; then
12349                         $cat >&4 <<EOM
12350 (Now testing the other method--but note that also this may fail.)
12351 EOM
12352                         $rm -f try.out
12353                         ./try$exe_ext 2>/dev/null
12354                         if $test -s try.out -a "X$?" = X42; then
12355                                 fflushall="`$cat try.out`"
12356                         fi
12357                 fi
12358                 $rm -f core try.core core.try.*
12359                 case "$fflushall" in
12360                 x)      $cat >&4 <<EOM
12361 Whew. Flushing explicitly all the stdio streams works.
12362 EOM
12363                         fflushall="$define"
12364                         ;;
12365                 '')     $cat >&4 <<EOM
12366 Sigh. Flushing explicitly all the stdio streams doesn't work.
12367 EOM
12368                         fflushall="$undef"
12369                         ;;
12370                 *)      $cat >&4 <<EOM
12371 Cannot figure out whether flushing stdio streams explicitly works or not.
12372 I'm assuming it doesn't.
12373 EOM
12374                         fflushall="$undef"
12375                         ;;
12376                 esac
12377                 ;;
12378         "$define"|true|[yY]*)
12379                 fflushall="$define"
12380                 ;;
12381         *)
12382                 fflushall="$undef"
12383                 ;;
12384         esac
12385         ;;
12386 *)      fflushall="$undef"      
12387         ;;
12388 esac
12389 case "$fflushNULL$fflushall" in
12390 undefundef)
12391         $cat <<EOM
12392 I cannot figure out how to flush pending stdio output.
12393 EOM
12394         ;;
12395 esac
12396 $rm -f try.* try$exe_ext
12397
12398 : Store the full pathname to the ar program for use in the C program
12399 : Respect a hint or command line value for full_ar.
12400 case "$full_ar" in
12401 '') full_ar=$ar ;;
12402 esac
12403
12404 : Store the full pathname to the sed program for use in the C program
12405 full_sed=$sed
12406
12407 : see what type gids are declared as in the kernel
12408 echo " "
12409 echo "Looking for the type for group ids returned by getgid()."
12410 set gid_t gidtype xxx stdio.h sys/types.h
12411 eval $typedef
12412 case "$gidtype" in
12413 xxx)
12414         xxx=`./findhdr sys/user.h`
12415         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12416         case $1 in
12417         unsigned) dflt="$1 $2" ;;
12418         *) dflt="$1" ;;
12419         esac
12420         ;;
12421 *) dflt="$gidtype";;
12422 esac
12423 case "$gidtype" in
12424 gid_t) echo "gid_t found." ;;
12425 *)      rp="What is the type for group ids returned by getgid()?"
12426         . ./myread
12427         gidtype="$ans"
12428         ;;
12429 esac
12430
12431 echo " "
12432 case "$gidtype" in
12433 *_t) zzz="$gidtype"     ;;
12434 *)   zzz="gid"          ;;
12435 esac
12436 echo "Checking the size of $zzz..." >&4 
12437 cat > try.c <<EOCP
12438 #include <sys/types.h>
12439 #include <stdio.h>
12440 int main() {
12441     printf("%d\n", (int)sizeof($gidtype));
12442     exit(0);
12443 }
12444 EOCP
12445 set try
12446 if eval $compile_ok; then
12447         yyy=`./try`
12448         case "$yyy" in
12449         '')     gidsize=4
12450                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12451                 ;;
12452         *)      gidsize=$yyy
12453                 echo "Your $zzz is $gidsize bytes long."
12454                 ;;
12455         esac
12456 else
12457         gidsize=4
12458         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12459 fi
12460
12461
12462 echo " "
12463 case "$gidtype" in
12464 *_t) zzz="$gidtype"     ;;
12465 *)   zzz="gid"          ;;
12466 esac
12467 echo "Checking the sign of $zzz..." >&4 
12468 cat > try.c <<EOCP
12469 #include <sys/types.h>
12470 #include <stdio.h>
12471 int main() {
12472         $gidtype foo = -1;
12473         if (foo < 0)
12474                 printf("-1\n");
12475         else
12476                 printf("1\n");
12477 }
12478 EOCP
12479 set try
12480 if eval $compile; then
12481         yyy=`./try`
12482         case "$yyy" in
12483         '')     gidsign=1
12484                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12485                 ;;
12486         *)      gidsign=$yyy
12487                 case "$gidsign" in
12488                  1) echo "Your $zzz is unsigned." ;;
12489                 -1) echo "Your $zzz is signed."   ;;
12490                 esac
12491                 ;;
12492         esac
12493 else
12494         gidsign=1
12495         echo "(I can't compile the test program--guessing unsigned.)" >&4
12496 fi
12497
12498
12499 echo " "
12500
12501 if $test X"$quadtype" != X; then
12502
12503 echo "Checking how to print 64-bit integers..." >&4
12504
12505 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12506         $cat >try.c <<'EOCP'
12507 #include <sys/types.h>
12508 #include <stdio.h>
12509 int main() {
12510   int q = 12345678901;
12511   printf("%ld\n", q);
12512 }
12513 EOCP
12514         set try
12515         if eval $compile; then
12516                 yyy=`./try$exe_ext`
12517                 case "$yyy" in
12518                 12345678901)
12519                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12520                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12521                         echo "We will use %d."
12522                         ;;
12523                 esac
12524         fi
12525 fi
12526
12527 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12528         $cat >try.c <<'EOCP'
12529 #include <sys/types.h>
12530 #include <stdio.h>
12531 int main() {
12532   long q = 12345678901;
12533   printf("%ld\n", q);
12534 }
12535 EOCP
12536         set try
12537         if eval $compile; then
12538                 yyy=`./try$exe_ext`
12539                 case "$yyy" in
12540                 12345678901)
12541                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12542                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12543                         echo "We will use %ld."
12544                         ;;
12545                 esac
12546         fi
12547 fi
12548
12549 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12550         $cat >try.c <<'EOCP'
12551 #include <sys/types.h>
12552 #include <inttypes.h>
12553 #include <stdio.h>
12554 int main() {
12555   int64_t q = 12345678901;
12556   printf("%" PRId64 "\n", q);
12557 }
12558 EOCP
12559         set try
12560         if eval $compile; then
12561                 yyy=`./try$exe_ext`
12562                 case "$yyy" in
12563                 12345678901)
12564                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12565                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12566                         echo "We will use the C9X style."
12567                         ;;
12568                 esac
12569         fi
12570 fi
12571
12572 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12573         $cat >try.c <<'EOCP'
12574 #include <sys/types.h>
12575 #include <stdio.h>
12576 int main() {
12577   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12578   printf("%lld\n", q);
12579 }
12580 EOCP
12581         set try
12582         if eval $compile; then
12583                 yyy=`./try$exe_ext`
12584                 case "$yyy" in
12585                 12345678901)
12586                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12587                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12588                         echo "We will use the %lld style."
12589                         ;;
12590                 esac
12591         fi
12592 fi
12593
12594 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12595         $cat >try.c <<EOCP
12596 #include <sys/types.h>
12597 #include <stdio.h>
12598 int main() {
12599   $quadtype q = 12345678901;
12600   printf("%Ld\n", q);
12601 }
12602 EOCP
12603         set try
12604         if eval $compile; then
12605                 yyy=`./try$exe_ext`
12606                 case "$yyy" in
12607                 12345678901)
12608                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12609                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12610                         echo "We will use %Ld."
12611                         ;;
12612                 esac
12613         fi
12614 fi
12615
12616 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12617         $cat >try.c <<EOCP
12618 #include <sys/types.h>
12619 #include <stdio.h>
12620 int main() {
12621   $quadtype q = 12345678901;
12622   printf("%qd\n", q);
12623 }
12624 EOCP
12625         set try
12626         if eval $compile; then
12627                 yyy=`./try$exe_ext`
12628                 case "$yyy" in
12629                 12345678901)
12630                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12631                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12632                         echo "We will use %qd."
12633                         ;;
12634                 esac
12635         fi
12636 fi
12637
12638 if $test X"$sPRId64" = X; then
12639         echo "Cannot figure out how to print 64-bit integers." >&4
12640 fi
12641
12642 $rm -f try try.*
12643
12644 fi
12645
12646 case "$sPRId64" in
12647 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12648         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12649         ;;
12650 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12651         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12652         ;;
12653 esac
12654
12655
12656 echo " "
12657 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12658
12659 if $test X"$ivsize" = X8; then
12660         ivdformat="$sPRId64"
12661         uvuformat="$sPRIu64"
12662         uvoformat="$sPRIo64"
12663         uvxformat="$sPRIx64"
12664 else
12665         if $test X"$ivsize" = X"$longsize"; then
12666                 ivdformat='"ld"'
12667                 uvuformat='"lu"'
12668                 uvoformat='"lo"'
12669                 uvxformat='"lx"'
12670         else
12671                 if $test X"$ivsize" = X"$intsize"; then
12672                         ivdformat='"d"'
12673                         uvuformat='"u"'
12674                         uvoformat='"o"'
12675                         uvxformat='"x"'
12676                 else
12677                         : far out
12678                         if $test X"$ivsize" = X"$shortsize"; then
12679                                 ivdformat='"hd"'
12680                                 uvuformat='"hu"'
12681                                 uvoformat='"ho"'
12682                                 uvxformat='"hx"'
12683                         fi
12684                 fi
12685         fi
12686 fi
12687
12688 case "$ivdformat" in
12689 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12690     exit 1
12691     ;;
12692 esac
12693
12694
12695 echo " "
12696 $echo "Checking the format string to be used for gids..." >&4
12697
12698 case "$gidsign" in
12699 -1)     if $test X"$gidsize" = X"$ivsize"; then
12700                 gidformat="$ivdformat"
12701         else
12702                 if $test X"$gidsize" = X"$longsize"; then
12703                         gidformat='"ld"'
12704                 else
12705                         if $test X"$gidsize" = X"$intsize"; then
12706                                 gidformat='"d"'
12707                         else
12708                                 if $test X"$gidsize" = X"$shortsize"; then
12709                                         gidformat='"hd"'
12710                                 fi
12711                         fi
12712                 fi
12713         fi
12714         ;;
12715 *)      if $test X"$gidsize" = X"$uvsize"; then
12716                 gidformat="$uvuformat"
12717         else
12718                 if $test X"$gidsize" = X"$longsize"; then
12719                         gidformat='"lu"'
12720                 else
12721                         if $test X"$gidsize" = X"$intsize"; then
12722                                 gidformat='"u"'
12723                         else
12724                                 if $test X"$gidsize" = X"$shortsize"; then
12725                                         gidformat='"hu"'
12726                                 fi
12727                         fi
12728                 fi
12729         fi
12730         ;;
12731 esac
12732
12733 : see if getgroups exists
12734 set getgroups d_getgrps
12735 eval $inlibc
12736
12737 : see if setgroups exists
12738 set setgroups d_setgrps
12739 eval $inlibc
12740
12741
12742 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12743 echo " "
12744 case "$d_getgrps$d_setgrps" in
12745 *define*)
12746         case "$groupstype" in
12747         '') dflt="$gidtype" ;;
12748         *)  dflt="$groupstype" ;;
12749         esac
12750         $cat <<EOM
12751 What type of pointer is the second argument to getgroups() and setgroups()?
12752 Usually this is the same as group ids, $gidtype, but not always.
12753
12754 EOM
12755         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12756         . ./myread
12757         groupstype="$ans"
12758         ;;
12759 *)  groupstype="$gidtype";;
12760 esac
12761
12762 echo " "
12763 echo "Checking if your $make program sets \$(MAKE)..." >&4
12764 case "$make_set_make" in
12765 '')
12766         $sed 's/^X //' > testmake.mak << 'EOF'
12767 Xall:
12768 X       @echo 'maketemp="$(MAKE)"'
12769 EOF
12770         case "`$make -f testmake.mak 2>/dev/null`" in
12771         *maketemp=*) make_set_make='#' ;;
12772         *)      make_set_make="MAKE=$make" ;;
12773         esac
12774         $rm -f testmake.mak
12775         ;;
12776 esac
12777 case "$make_set_make" in
12778 '#') echo "Yup, it does.";;
12779 *) echo "Nope, it doesn't.";;
12780 esac
12781
12782 : see what type is used for mode_t
12783 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12784 set mode_t modetype int stdio.h sys/types.h
12785 eval $typedef_ask
12786
12787 : define a fucntion to check prototypes
12788 $cat > protochk <<EOSH
12789 $startsh
12790 cc="$cc"
12791 optimize="$optimize"
12792 ccflags="$ccflags"
12793 prototype="$prototype"
12794 define="$define"
12795 rm=$rm
12796 EOSH
12797
12798 $cat >> protochk <<'EOSH'
12799
12800 $rm -f try.c
12801 foo="$1"
12802 shift
12803 while test $# -ge 2; do
12804         case "$1" in
12805                 $define) echo "#include <$2>" >> try.c ;;
12806                 literal) echo "$2" >> try.c ;;
12807         esac
12808     shift 2
12809 done
12810 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12811 cat >> try.c <<'EOCP'
12812 #ifdef CAN_PROTOTYPE
12813 #define _(args) args
12814 #else
12815 #define _(args) ()
12816 #endif
12817 EOCP
12818 echo "$foo" >> try.c
12819 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12820 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12821 status=$?
12822 $rm -f try.[co]
12823 exit $status
12824 EOSH
12825 chmod +x protochk
12826 $eunicefix protochk
12827
12828 : see what type is used for size_t
12829 rp="What is the type used for the length parameter for string functions?"
12830 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12831 eval $typedef_ask
12832
12833 : check for type of arguments to gethostbyaddr. 
12834 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12835         case "$d_gethbyaddr" in
12836         $define)
12837                 $cat <<EOM
12838
12839 Checking to see what type of arguments are accepted by gethostbyaddr().
12840 EOM
12841                 hdrs="$define sys/types.h
12842                         $d_socket sys/socket.h 
12843                         $i_niin netinet/in.h 
12844                         $i_netdb netdb.h
12845                         $i_unistd unistd.h"
12846                 : The first arg can 'char *' or 'void *'
12847                 : The second arg is some of integral type
12848                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12849                         for yyy in size_t long int; do
12850                                 case "$netdb_host_type" in
12851                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12852                                         if ./protochk "$try" $hdrs; then
12853                                                 echo "Your system accepts $xxx for the first arg."
12854                                                 echo "...and $yyy for the second arg."
12855                                                 netdb_host_type="$xxx"
12856                                                 netdb_hlen_type="$yyy"
12857                                         fi
12858                                         ;;
12859                                 esac
12860                         done
12861                 done
12862                 : In case none of those worked, prompt the user.
12863                 case "$netdb_host_type" in
12864                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12865                         dflt='char *'
12866                         . ./myread
12867                         netdb_host_type=$ans
12868                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12869                         dflt="$sizetype"
12870                         . ./myread
12871                         netdb_hlen_type=$ans
12872                         ;;
12873                 esac
12874                 ;;
12875         *)      : no gethostbyaddr, so pick harmless defaults
12876                 netdb_host_type='char *'
12877                 netdb_hlen_type="$sizetype"
12878                 ;;
12879         esac
12880         # Remove the "const" if needed. -- but then we'll have a 
12881         # prototype clash!
12882         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12883 fi
12884
12885 : check for type of argument to gethostbyname. 
12886 if test "X$netdb_name_type" = X ; then
12887         case "$d_gethbyname" in
12888         $define)
12889                 $cat <<EOM
12890
12891 Checking to see what type of argument is accepted by gethostbyname().
12892 EOM
12893                 hdrs="$define sys/types.h
12894                         $d_socket sys/socket.h 
12895                         $i_niin netinet/in.h 
12896                         $i_netdb netdb.h
12897                         $i_unistd unistd.h"
12898                 for xxx in "const char *" "char *"; do
12899                         case "$netdb_name_type" in
12900                         '')     try="extern struct hostent *gethostbyname($xxx);"
12901                                 if ./protochk "$try" $hdrs; then
12902                                         echo "Your system accepts $xxx."
12903                                         netdb_name_type="$xxx"
12904                                 fi
12905                                 ;;
12906                         esac
12907                 done
12908                 : In case none of those worked, prompt the user.
12909                 case "$netdb_name_type" in
12910                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12911                         dflt='char *'
12912                         . ./myread
12913                         netdb_name_type=$ans
12914                         ;;
12915                 esac
12916                 ;;
12917         *)      : no gethostbyname, so pick harmless default
12918                 netdb_name_type='char *'
12919                 ;;
12920         esac
12921 fi
12922
12923 : check for type of 1st argument to getnetbyaddr. 
12924 if test "X$netdb_net_type" = X ; then
12925         case "$d_getnbyaddr" in
12926         $define)
12927                 $cat <<EOM
12928
12929 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12930 EOM
12931                 hdrs="$define sys/types.h
12932                         $d_socket sys/socket.h 
12933                         $i_niin netinet/in.h 
12934                         $i_netdb netdb.h
12935                         $i_unistd unistd.h"
12936                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12937                         case "$netdb_net_type" in
12938                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12939                                 if ./protochk "$try" $hdrs; then
12940                                         echo "Your system accepts $xxx."
12941                                         netdb_net_type="$xxx"
12942                                 fi
12943                                 ;;
12944                         esac
12945                 done
12946                 : In case none of those worked, prompt the user.
12947                 case "$netdb_net_type" in
12948                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12949                         dflt='long'
12950                         . ./myread
12951                         netdb_net_type=$ans
12952                         ;;
12953                 esac
12954                 ;;
12955         *)      : no getnetbyaddr, so pick harmless default
12956                 netdb_net_type='long'
12957                 ;;
12958         esac
12959 fi
12960 : locate the preferred pager for this system
12961 case "$pager" in
12962 '')
12963         dflt=''
12964         case "$pg" in
12965         /*) dflt=$pg;;
12966         esac
12967         case "$more" in
12968         /*) dflt=$more;;
12969         esac
12970         case "$less" in
12971         /*) dflt=$less;;
12972         esac
12973         case "$dflt" in
12974         '') dflt=/usr/ucb/more;;
12975         esac
12976         ;;
12977 *) dflt="$pager";;
12978 esac
12979 echo " "
12980 fn=f/
12981 rp='What pager is used on your system?'
12982 . ./getfile
12983 pager="$ans"
12984
12985 : see what type pids are declared as in the kernel
12986 rp="What is the type of process ids on this system?"
12987 set pid_t pidtype int stdio.h sys/types.h
12988 eval $typedef_ask
12989
12990 : Find earliest binary compatible site_perl subdirectory perl can use.
12991 case "$bincompat5005" in
12992 "$define") xs_apiversion='5.005' ;;
12993 *) xs_apiversion=$version ;;   # The current site_perl version.
12994 esac
12995 : Find earliest pure perl site_perl subdirectory perl can use.
12996 : The versioned directories started at 5.005.
12997 pm_apiversion='5.005'
12998
12999 : check for length of pointer
13000 echo " "
13001 case "$ptrsize" in
13002 '')
13003         echo "Checking to see how big your pointers are..." >&4
13004         if test "$voidflags" -gt 7; then
13005                 echo '#define VOID_PTR char *' > try.c
13006         else
13007                 echo '#define VOID_PTR void *' > try.c
13008         fi
13009         $cat >>try.c <<'EOCP'
13010 #include <stdio.h>
13011 int main()
13012 {
13013     printf("%d\n", (int)sizeof(VOID_PTR));
13014     exit(0);
13015 }
13016 EOCP
13017         set try
13018         if eval $compile_ok; then
13019                 ptrsize=`./try`
13020                 echo "Your pointers are $ptrsize bytes long."
13021         else
13022                 dflt='4'
13023                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13024                 rp="What is the size of a pointer (in bytes)?"
13025                 . ./myread
13026                 ptrsize="$ans"
13027         fi
13028         ;;
13029 esac
13030 $rm -f try.c try
13031
13032 : see if ar generates random libraries by itself
13033 echo " "
13034 echo "Checking how to generate random libraries on your machine..." >&4
13035 echo 'int bar1() { return bar2(); }' > bar1.c
13036 echo 'int bar2() { return 2; }' > bar2.c
13037 $cat > foo.c <<'EOP'
13038 int main() { printf("%d\n", bar1()); exit(0); }
13039 EOP
13040 $cc $ccflags -c bar1.c >/dev/null 2>&1
13041 $cc $ccflags -c bar2.c >/dev/null 2>&1
13042 $cc $ccflags -c foo.c >/dev/null 2>&1
13043 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13044 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13045         ./foobar >/dev/null 2>&1; then
13046         echo "$ar appears to generate random libraries itself."
13047         orderlib=false
13048         ranlib=":"
13049 elif $ar ts bar$_a >/dev/null 2>&1 &&
13050         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
13051         ./foobar >/dev/null 2>&1; then
13052                 echo "a table of contents needs to be added with '$ar ts'."
13053                 orderlib=false
13054                 ranlib="$ar ts"
13055 else
13056         case "$ranlib" in
13057         :) ranlib='';;
13058         '')
13059                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13060                 $test -f $ranlib || ranlib=''
13061                 ;;
13062         esac
13063         if $test -n "$ranlib"; then
13064                 echo "your system has '$ranlib'; we'll use that."
13065                 orderlib=false
13066         else
13067                 echo "your system doesn't seem to support random libraries"
13068                 echo "so we'll use lorder and tsort to order the libraries."
13069                 orderlib=true
13070                 ranlib=":"
13071         fi
13072 fi
13073 $rm -f foo* bar* 
13074
13075 : check for type of arguments to select. 
13076 case "$selecttype" in
13077 '') case "$d_select" in
13078         $define)
13079                 echo " "
13080                 $cat <<EOM
13081 Checking to see what type of arguments are accepted by select().
13082 EOM
13083                 hdrs="$define sys/types.h
13084                         $i_systime sys/time.h 
13085                         $i_sysselct sys/select.h
13086                         $d_socket sys/socket.h"
13087                 : The first arg can be int, unsigned, or size_t
13088                 : The last arg may or may not be 'const'
13089                 val=''
13090                 : void pointer has been seen but using that
13091                 : breaks the selectminbits test
13092                 for xxx in 'fd_set *' 'int *'; do
13093                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13094                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13095                                         case "$val" in
13096                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13097                                                 if ./protochk "$try" $hdrs; then
13098                                                         echo "Your system accepts $xxx."
13099                                                         val="$xxx"
13100                                                 fi
13101                                                 ;;
13102                                         esac
13103                                 done
13104                         done
13105                 done
13106                 case "$val" in
13107                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13108                         case "$d_fd_set" in
13109                                 $define) dflt="fd_set *" ;;
13110                                 *)              dflt="int *" ;;
13111                         esac
13112                         . ./myread
13113                         val=$ans
13114                         ;;
13115                 esac
13116                 selecttype="$val"
13117                 ;;
13118         *)      : no select, so pick a harmless default
13119                 selecttype='int *'
13120                 ;;
13121         esac
13122         ;;
13123 esac
13124
13125 : check for the select 'width'
13126 case "$selectminbits" in
13127 '') case "$d_select" in
13128         $define)
13129                 $cat <<EOM
13130
13131 Checking to see on how many bits at a time your select() operates...
13132 EOM
13133                 $cat >try.c <<EOCP
13134 #include <sys/types.h>
13135 #$i_time I_TIME
13136 #$i_systime I_SYS_TIME
13137 #$i_systimek I_SYS_TIME_KERNEL
13138 #ifdef I_TIME
13139 #   include <time.h>
13140 #endif
13141 #ifdef I_SYS_TIME
13142 #   ifdef I_SYS_TIME_KERNEL
13143 #       define KERNEL
13144 #   endif
13145 #   include <sys/time.h>
13146 #   ifdef I_SYS_TIME_KERNEL
13147 #       undef KERNEL
13148 #   endif
13149 #endif
13150 #$i_sysselct I_SYS_SELECT
13151 #ifdef I_SYS_SELECT
13152 #include <sys/select.h>
13153 #endif
13154 #$d_socket HAS_SOCKET
13155 #ifdef HAS_SOCKET
13156 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13157 #endif
13158 #include <stdio.h>
13159 $selecttype b;
13160 #define S sizeof(*(b))
13161 #define MINBITS 64
13162 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13163 #define NBITS  (NBYTES * 8)
13164 int main() {
13165     char s[NBYTES];
13166     struct timeval t;
13167     int i;
13168     FILE* fp;
13169     int fd;
13170
13171     fclose(stdin);
13172     fp = fopen("try.c", "r");
13173     if (fp == 0)
13174       exit(1);
13175     fd = fileno(fp);
13176     if (fd < 0)
13177       exit(2);
13178     b = ($selecttype)s;
13179     for (i = 0; i < NBITS; i++)
13180         FD_SET(i, b);
13181     t.tv_sec  = 0;
13182     t.tv_usec = 0;
13183     select(fd + 1, b, 0, 0, &t);
13184     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13185     printf("%d\n", i + 1);
13186     return 0;
13187 }
13188 EOCP
13189                 set try
13190                 if eval $compile_ok; then
13191                         selectminbits=`./try`
13192                         case "$selectminbits" in
13193                         '')     cat >&4 <<EOM
13194 Cannot figure out on how many bits at a time your select() operates.
13195 I'll play safe and guess it is 32 bits.
13196 EOM
13197                                 selectminbits=32
13198                                 bits="32 bits"
13199                                 ;;
13200                         1)      bits="1 bit" ;;
13201                         *)      bits="$selectminbits bits" ;;
13202                         esac
13203                         echo "Your select() operates on $bits at a time." >&4
13204                 else
13205                         rp='What is the minimum number of bits your select() operates on?'
13206                         case "$byteorder" in
13207                         1234|12345678)  dflt=32 ;;
13208                         *)              dflt=1  ;;
13209                         esac
13210                         . ./myread
13211                         val=$ans
13212                         selectminbits="$val"
13213                 fi
13214                 $rm -f try.* try
13215                 ;;
13216         *)      : no select, so pick a harmless default
13217                 selectminbits='32'
13218                 ;;
13219         esac
13220         ;;
13221 esac
13222
13223 : Trace out the files included by signal.h, then look for SIGxxx names.
13224 : Remove SIGARRAYSIZE used by HPUX.
13225 : Remove SIGSTKSIZE used by Linux.
13226 : Remove SIGSTKSZ used by Posix.
13227 : Remove SIGTYP void lines used by OS2.
13228 : Some cpps, like os390, dont give the file name anywhere
13229 if [ "X$fieldn" = X ]; then
13230         : Just make some guesses.  We check them later.
13231         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13232 else
13233         xxx=`echo '#include <signal.h>' |
13234         $cppstdin $cppminus $cppflags 2>/dev/null |
13235         $grep '^[       ]*#.*include' | 
13236         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13237 fi
13238 : Check this list of files to be sure we have parsed the cpp output ok.
13239 : This will also avoid potentially non-existent files, such 
13240 : as ../foo/bar.h
13241 xxxfiles=''
13242 for xx in $xxx /dev/null ; do
13243         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13244 done
13245 : If we have found no files, at least try signal.h
13246 case "$xxxfiles" in
13247 '')     xxxfiles=`./findhdr signal.h` ;;
13248 esac
13249 xxx=`awk '
13250 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13251         print substr($2, 4, 20)
13252 }
13253 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13254         print substr($3, 4, 20)
13255 }' $xxxfiles`
13256 : Append some common names just in case the awk scan failed.
13257 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13258 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13259 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13260 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13261 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13262
13263 : generate a few handy files for later
13264 $cat > signal.c <<'EOCP'
13265 #include <sys/types.h>
13266 #include <signal.h>
13267 #include <stdio.h>
13268 int main() {
13269
13270 /* Strange style to avoid deeply-nested #if/#else/#endif */
13271 #ifndef NSIG
13272 #  ifdef _NSIG
13273 #    define NSIG (_NSIG)
13274 #  endif
13275 #endif
13276
13277 #ifndef NSIG
13278 #  ifdef SIGMAX
13279 #    define NSIG (SIGMAX+1)
13280 #  endif
13281 #endif
13282
13283 #ifndef NSIG
13284 #  ifdef SIG_MAX
13285 #    define NSIG (SIG_MAX+1)
13286 #  endif
13287 #endif
13288
13289 #ifndef NSIG
13290 #  ifdef MAXSIG
13291 #    define NSIG (MAXSIG+1)
13292 #  endif
13293 #endif
13294
13295 #ifndef NSIG
13296 #  ifdef MAX_SIG
13297 #    define NSIG (MAX_SIG+1)
13298 #  endif
13299 #endif
13300
13301 #ifndef NSIG
13302 #  ifdef SIGARRAYSIZE
13303 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13304 #  endif
13305 #endif
13306
13307 #ifndef NSIG
13308 #  ifdef _sys_nsig
13309 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13310 #  endif
13311 #endif
13312
13313 /* Default to some arbitrary number that's big enough to get most
13314    of the common signals.
13315 */
13316 #ifndef NSIG
13317 #    define NSIG 50
13318 #endif
13319
13320 printf("NSIG %d\n", NSIG);
13321
13322 #ifndef JUST_NSIG
13323
13324 EOCP
13325
13326 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13327 {
13328         printf "#ifdef SIG"; printf $1; printf "\n"
13329         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13330         printf $1; printf ");\n"
13331         printf "#endif\n"
13332 }
13333 END {
13334         printf "#endif /* JUST_NSIG */\n";
13335         printf "exit(0);\n}\n";
13336 }
13337 ' >>signal.c
13338 $cat >signal.awk <<'EOP'
13339 BEGIN { ndups = 0 }
13340 $1 ~ /^NSIG$/ { nsig = $2 }
13341 ($1 !~ /^NSIG$/) && (NF == 2) {
13342     if ($2 > maxsig) { maxsig = $2 }
13343     if (sig_name[$2]) {
13344         dup_name[ndups] = $1
13345         dup_num[ndups] = $2
13346         ndups++ 
13347     }
13348     else {
13349         sig_name[$2] = $1
13350         sig_num[$2] = $2
13351     }
13352 }
13353 END { 
13354     if (nsig == 0) {
13355         nsig = maxsig + 1
13356     }
13357     printf("NSIG %d\n", nsig);
13358     for (n = 1; n < nsig; n++) {
13359         if (sig_name[n]) {
13360             printf("%s %d\n", sig_name[n], sig_num[n])
13361         }
13362         else {
13363             printf("NUM%d %d\n", n, n) 
13364         }
13365     }
13366     for (n = 0; n < ndups; n++) {
13367         printf("%s %d\n", dup_name[n], dup_num[n])
13368     }
13369 }
13370 EOP
13371 $cat >signal_cmd <<EOS
13372 $startsh
13373 if $test -s signal.lst; then
13374     echo "Using your existing signal.lst file"
13375         exit 0
13376 fi
13377 xxx="$xxx"
13378 EOS
13379 $cat >>signal_cmd <<'EOS'
13380
13381 set signal
13382 if eval $compile_ok; then
13383         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13384 else
13385         echo "(I can't seem be able to compile the whole test program)" >&4
13386         echo "(I'll try it in little pieces.)" >&4
13387         set signal -DJUST_NSIG
13388         if eval $compile_ok; then
13389                 ./signal$_exe > signal.nsg
13390                 $cat signal.nsg
13391         else
13392                 echo "I can't seem to figure out how many signals you have." >&4
13393                 echo "Guessing 50." >&4
13394                 echo 'NSIG 50' > signal.nsg
13395         fi
13396         : Now look at all the signal names, one at a time.
13397         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13398                 $cat > signal.c <<EOCP
13399 #include <sys/types.h>
13400 #include <signal.h>
13401 #include <stdio.h>
13402 int main() {
13403 printf("$xx %d\n", SIG${xx});
13404 return 0;
13405 }
13406 EOCP
13407                 set signal
13408                 if eval $compile; then
13409                         echo "SIG${xx} found."
13410                         ./signal$_exe  >> signal.ls1
13411                 else
13412                         echo "SIG${xx} NOT found."
13413                 fi
13414         done
13415         if $test -s signal.ls1; then
13416                 $cat signal.nsg signal.ls1 |
13417                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13418         fi
13419
13420 fi
13421 if $test -s signal.lst; then
13422         :
13423 else
13424         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13425         echo 'kill -l' >signal
13426         set X `csh -f <signal`
13427         $rm -f signal
13428         shift
13429         case $# in
13430         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13431         esac
13432         echo $@ | $tr ' ' $trnl | \
13433             $awk '{ printf "%s %d\n", $1, ++s; }
13434                   END { printf "NSIG %d\n", ++s }' >signal.lst
13435 fi
13436 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13437 EOS
13438 chmod a+x signal_cmd
13439 $eunicefix signal_cmd
13440
13441 : generate list of signal names
13442 echo " "
13443 case "$sig_name_init" in
13444 '') doinit=yes ;;
13445 *)  case "$sig_num_init" in
13446     ''|*,*) doinit=yes ;;
13447     esac ;;
13448 esac
13449 case "$doinit" in
13450 yes)
13451         echo "Generating a list of signal names and numbers..." >&4
13452         . ./signal_cmd
13453         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13454         sig_name=`$awk 'BEGIN { printf "ZERO " }
13455                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13456         sig_num=`$awk  'BEGIN { printf "0 " }
13457                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13458         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13459                              !/^NSIG/   { printf "\"%s\", ", $1 }
13460                              END        { printf "0\n" }' signal.lst`
13461         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13462                              !/^NSIG/   { printf "%d, ", $2}
13463                              END        { printf "0\n"}' signal.lst`
13464         ;;
13465 esac
13466 echo "The following $sig_count signals are available:"
13467 echo " "
13468 echo $sig_name | $awk \
13469 'BEGIN { linelen = 0 }
13470 {
13471         for (i = 1; i <= NF; i++) {
13472                 name = "SIG" $i " "
13473                 linelen = linelen + length(name)
13474                 if (linelen > 70) {
13475                         printf "\n"
13476                         linelen = length(name)
13477                 }
13478                 printf "%s", name
13479         }
13480         printf "\n"
13481 }'
13482 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13483
13484 : check for socklen_t
13485 echo " "
13486 echo "Checking to see if you have socklen_t..." >&4
13487 $cat >try.c <<EOCP
13488 #include <sys/types.h>
13489 #$d_socket HAS_SOCKET
13490 #ifdef HAS_SOCKET
13491 #include <sys/socket.h>
13492 #endif
13493 int main() { socklen_t x = 16; }
13494 EOCP
13495 set try
13496 if eval $compile; then
13497         val="$define"
13498         echo "You have socklen_t."
13499 else
13500         val="$undef"
13501         echo "You do not have socklen_t."
13502         case "$sizetype" in
13503         size_t) echo "(You do have size_t, that might work.)" ;;
13504         esac
13505 fi
13506 $rm -f try try.*
13507 set d_socklen_t
13508 eval $setvar
13509
13510 : check for type of the size argument to socket calls
13511 case "$d_socket" in
13512 "$define")
13513         $cat <<EOM
13514
13515 Checking to see what type is the last argument of accept().
13516 EOM
13517         hdrs="$define sys/types.h $d_socket sys/socket.h" 
13518         yyy=''
13519         case "$d_socklen_t" in
13520         "$define") yyy="$yyy socklen_t"
13521         esac
13522         yyy="$yyy $sizetype int long"
13523         for xxx in $yyy; do
13524                 case "$socksizetype" in
13525                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
13526                         if ./protochk "$try" $hdrs; then
13527                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
13528                                 socksizetype="$xxx *"
13529                         fi
13530                         ;;
13531                 esac
13532         done
13533 : In case none of those worked, prompt the user.
13534         case "$socksizetype" in
13535         '')     rp='What is the type for the last argument to accept()?'
13536                 dflt='int *'
13537                 . ./myread
13538                 socksizetype=$ans
13539                 ;;
13540         esac
13541         ;;
13542 *)      : no gethostbyaddr, so pick relatively harmless defaults
13543         socksizetype='char *'
13544         ;;
13545 esac
13546
13547 : see what type is used for signed size_t
13548 set ssize_t ssizetype int stdio.h sys/types.h
13549 eval $typedef
13550 dflt="$ssizetype"
13551 $cat > ssize.c <<EOM
13552 #include <stdio.h>
13553 #include <sys/types.h>
13554 #define Size_t $sizetype
13555 #define SSize_t $dflt
13556 int main()
13557 {
13558         if (sizeof(Size_t) == sizeof(SSize_t))
13559                 printf("$dflt\n");
13560         else if (sizeof(Size_t) == sizeof(int))
13561                 printf("int\n");
13562         else 
13563                 printf("long\n");
13564         exit(0);
13565 }
13566 EOM
13567 echo " "
13568 set ssize
13569 if eval $compile_ok && ./ssize > /dev/null; then
13570         ssizetype=`./ssize`
13571         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13572 else
13573         $cat >&4 <<EOM
13574 Help! I can't compile and run the ssize_t test program: please enlighten me!
13575 (This is probably a misconfiguration in your system or libraries, and
13576 you really ought to fix it.  Still, I'll try anyway.)
13577
13578 I need a type that is the same size as $sizetype, but is guaranteed to
13579 be signed.  Common values are ssize_t, int and long.
13580
13581 EOM
13582         rp="What signed type is the same size as $sizetype?"
13583         . ./myread
13584         ssizetype="$ans"
13585 fi
13586 $rm -f ssize ssize.*
13587
13588 : see what type of char stdio uses.
13589 echo " "
13590 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13591         echo "Your stdio uses unsigned chars." >&4
13592         stdchar="unsigned char"
13593 else
13594         echo "Your stdio uses signed chars." >&4
13595         stdchar="char"
13596 fi
13597
13598 : see if time exists
13599 echo " "
13600 if test "X$d_time" = X -o X"$timetype" = X; then
13601     if set time val -f d_time; eval $csym; $val; then
13602                 echo 'time() found.' >&4
13603                 val="$define"
13604                 rp="What is the type returned by time() on this system?"
13605                 set time_t timetype long stdio.h sys/types.h
13606                 eval $typedef_ask
13607     else
13608                 echo 'time() not found, hope that will do.' >&4
13609                 val="$undef"
13610                 timetype='int';
13611     fi
13612     set d_time
13613     eval $setvar
13614 fi
13615
13616 : see what type uids are declared as in the kernel
13617 echo " "
13618 echo "Looking for the type for user ids returned by getuid()."
13619 set uid_t uidtype xxx stdio.h sys/types.h
13620 eval $typedef
13621 case "$uidtype" in
13622 xxx)
13623         xxx=`./findhdr sys/user.h`
13624         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13625         case $1 in
13626         unsigned) dflt="$1 $2" ;;
13627         *) dflt="$1" ;;
13628         esac
13629         ;;
13630 *) dflt="$uidtype";;
13631 esac
13632 case "$uidtype" in
13633 uid_t)  echo "uid_t found." ;;
13634 *)      rp="What is the type for user ids returned by getuid()?"
13635         . ./myread
13636         uidtype="$ans"
13637         ;;
13638 esac
13639
13640 echo " "
13641 case "$uidtype" in
13642 *_t) zzz="$uidtype"     ;;
13643 *)   zzz="uid"          ;;
13644 esac
13645 echo "Checking the size of $zzz..." >&4 
13646 cat > try.c <<EOCP
13647 #include <sys/types.h>
13648 #include <stdio.h>
13649 int main() {
13650     printf("%d\n", (int)sizeof($uidtype));
13651     exit(0);
13652 }
13653 EOCP
13654 set try
13655 if eval $compile_ok; then
13656         yyy=`./try`
13657         case "$yyy" in
13658         '')     uidsize=4
13659                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13660                 ;;
13661         *)      uidsize=$yyy
13662                 echo "Your $zzz is $uidsize bytes long."
13663                 ;;
13664         esac
13665 else
13666         uidsize=4
13667         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13668 fi
13669
13670 echo " "
13671 case "$uidtype" in
13672 *_t) zzz="$uidtype"     ;;
13673 *)   zzz="uid"          ;;
13674 esac
13675 echo "Checking the sign of $zzz..." >&4
13676 cat > try.c <<EOCP
13677 #include <sys/types.h>
13678 #include <stdio.h>
13679 int main() {
13680         $uidtype foo = -1;
13681         if (foo < 0)
13682                 printf("-1\n");
13683         else
13684                 printf("1\n");
13685 }
13686 EOCP
13687 set try
13688 if eval $compile; then
13689         yyy=`./try`
13690         case "$yyy" in
13691         '')     uidsign=1
13692                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13693                 ;;
13694         *)      uidsign=$yyy
13695                 case "$uidsign" in
13696                  1) echo "Your $zzz is unsigned." ;;
13697                 -1) echo "Your $zzz is signed."   ;;
13698                 esac
13699                 ;;
13700         esac
13701 else
13702         uidsign=1
13703         echo "(I can't compile the test program--guessing unsigned.)" >&4
13704 fi
13705
13706
13707
13708 echo " "
13709 $echo "Checking the format string to be used for uids..." >&4
13710
13711 case "$uidsign" in
13712 -1)     if $test X"$uidsize" = X"$ivsize"; then
13713                 uidformat="$ivdformat"
13714         else
13715                 if $test X"$uidsize" = X"$longsize"; then
13716                         uidformat='"ld"'
13717                 else
13718                         if $test X"$uidsize" = X"$intsize"; then
13719                                 uidformat='"d"'
13720                         else
13721                                 if $test X"$uidsize" = X"$shortsize"; then
13722                                         uidformat='"hd"'
13723                                 fi
13724                         fi
13725                 fi
13726         fi
13727         ;;
13728 *)      if $test X"$uidsize" = X"$uvsize"; then
13729                 uidformat="$uvuformat"
13730         else
13731                 if $test X"$uidsize" = X"$longsize"; then
13732                         uidformat='"lu"'
13733                 else
13734                         if $test X"$uidsize" = X"$intsize"; then
13735                                 uidformat='"u"'
13736                         else
13737                                 if $test X"$uidsize" = X"$shortsize"; then
13738                                         uidformat='"hu"'
13739                                 fi
13740                         fi
13741                 fi
13742         fi
13743         ;;
13744 esac
13745
13746 : see if dbm.h is available
13747 : see if dbmclose exists
13748 set dbmclose d_dbmclose
13749 eval $inlibc
13750
13751 case "$d_dbmclose" in
13752 $define)
13753         set dbm.h i_dbm
13754         eval $inhdr
13755         case "$i_dbm" in
13756         $define)
13757                 val="$undef"
13758                 set i_rpcsvcdbm
13759                 eval $setvar
13760                 ;;
13761         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13762                 eval $inhdr
13763                 ;;
13764         esac
13765         ;;
13766 *)      echo "We won't be including <dbm.h>"
13767         val="$undef"
13768         set i_dbm
13769         eval $setvar
13770         val="$undef"
13771         set i_rpcsvcdbm
13772         eval $setvar
13773         ;;
13774 esac
13775
13776 : see if this is a sys/file.h system
13777 val=''
13778 set sys/file.h val
13779 eval $inhdr
13780
13781 : do we need to include sys/file.h ?
13782 case "$val" in
13783 "$define")
13784         echo " "
13785         if $h_sysfile; then
13786                 val="$define"
13787                 echo "We'll be including <sys/file.h>." >&4
13788         else
13789                 val="$undef"
13790                 echo "We won't be including <sys/file.h>." >&4
13791         fi
13792         ;;
13793 *)
13794         h_sysfile=false
13795         ;;
13796 esac
13797 set i_sysfile
13798 eval $setvar
13799
13800 : see if fcntl.h is there
13801 val=''
13802 set fcntl.h val
13803 eval $inhdr
13804
13805 : see if we can include fcntl.h
13806 case "$val" in
13807 "$define")
13808         echo " "
13809         if $h_fcntl; then
13810                 val="$define"
13811                 echo "We'll be including <fcntl.h>." >&4
13812         else
13813                 val="$undef"
13814                 if $h_sysfile; then
13815         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13816                 else
13817                         echo "We won't be including <fcntl.h>." >&4
13818                 fi
13819         fi
13820         ;;
13821 *)
13822         h_fcntl=false
13823         val="$undef"
13824         ;;
13825 esac
13826 set i_fcntl
13827 eval $setvar
13828
13829 : see if this is a iconv.h system
13830 set iconv.h i_iconv
13831 eval $inhdr
13832
13833 : see if locale.h is available
13834 set locale.h i_locale
13835 eval $inhdr
13836
13837 : see if mach cthreads are available
13838 if test "X$usethreads" = "X$define"; then
13839         set mach/cthreads.h i_machcthr
13840         eval $inhdr
13841 else
13842         i_machcthr="$undef"
13843 fi
13844
13845
13846
13847 : see if this is a math.h system
13848 set math.h i_math
13849 eval $inhdr
13850
13851 : see if this is a mntent.h system
13852 set mntent.h i_mntent
13853 eval $inhdr
13854
13855 : see if ndbm.h is available
13856 set ndbm.h t_ndbm
13857 eval $inhdr
13858 case "$t_ndbm" in
13859 $define)
13860         : see if dbm_open exists
13861         set dbm_open d_dbm_open
13862         eval $inlibc
13863         case "$d_dbm_open" in
13864         $undef)
13865                 t_ndbm="$undef"
13866                 echo "We won't be including <ndbm.h>"
13867                 ;;
13868         esac
13869         ;;
13870 esac
13871 val="$t_ndbm"
13872 set i_ndbm
13873 eval $setvar
13874
13875 : see if net/errno.h is available
13876 val=''
13877 set net/errno.h val
13878 eval $inhdr
13879
13880 : Unfortunately, it causes problems on some systems.  Arrgh.
13881 case "$val" in
13882 $define)
13883         cat > try.c <<'EOM'
13884 #include <stdio.h>
13885 #include <errno.h>
13886 #include <net/errno.h>
13887 int func()
13888 {
13889         return ENOTSOCK;
13890 }
13891 EOM
13892         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13893                 echo "We'll be including <net/errno.h>." >&4
13894         else
13895                 echo "We won't be including <net/errno.h>." >&4
13896                 val="$undef"
13897         fi
13898         $rm -f try.* try
13899         ;;
13900 esac
13901 set i_neterrno
13902 eval $setvar
13903
13904 : see if netinet/tcp.h is available
13905 set netinet/tcp.h i_netinettcp
13906 eval $inhdr
13907
13908 : see if this is a poll.h system
13909 set poll.h i_poll
13910 eval $inhdr
13911
13912 echo " "
13913 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13914 $cat <<'EOSH' > Cppsym.know
13915 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13916 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13917 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13918 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13919 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13920 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13921 bull c cadmus clipper CMU COFF COMPILER_VERSION
13922 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13923 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13924 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13925 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13926 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13927 H3050R H3050RX hbullx20 hcx host_mips
13928 hp200 hp300 hp700 HP700 hp800 hp9000
13929 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13930 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13931 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13932 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13933 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13934 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13935 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13936 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13937 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13938 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13939 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13940 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13941 MATH_HAS_NO_SIDE_EFFECTS
13942 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13943 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13944 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13945 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13946 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13947 NetBSD news1500 news1700 news1800 news1900 news3700
13948 news700 news800 news900 NeXT NLS ns16000 ns32000
13949 ns32016 ns32332 ns32k nsc32000
13950 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13951 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13952 pc532 pdp11 PGC PIC plexus PORTAR posix
13953 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13954 POSIX_C_SOURCE POSIX_SOURCE POWER
13955 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13956 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13957 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13958 sony sony_news sonyrisc sparc sparclite spectrum
13959 stardent stdc STDC_EXT stratos sun sun3 sun386
13960 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13961 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13962 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13963 sysV68 sysV88 Tek4132 Tek4300 titan
13964 tower tower32 tower32_200 tower32_600 tower32_700
13965 tower32_800 tower32_850 tss
13966 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13967 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13968 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13969 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13970 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13971 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13972 z8000
13973 EOSH
13974 # Maybe put other stuff here too.
13975 cat <<EOSH >>Cppsym.know
13976 $osname
13977 EOSH
13978 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13979 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13980 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13981 $rm -f Cppsym.a Cppsym.b
13982 cat <<EOSH > Cppsym
13983 $startsh
13984 if $test \$# -gt 0; then
13985     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13986     if $test -s Cppsym.got; then
13987         $rm -f Cppsym.got
13988         exit 0
13989     fi
13990     $rm -f Cppsym.got
13991     exit 1
13992 else
13993     $tr " " "$trnl" | ./Cppsym.try
13994     exit 0
13995 fi
13996 EOSH
13997 chmod +x Cppsym
13998 $eunicefix Cppsym
13999 cat <<EOSH > Cppsym.try
14000 $startsh
14001 cat <<'EOCP' > try.c
14002 #include <stdio.h>
14003 int main() {
14004 EOCP
14005 $awk \\
14006 EOSH
14007 cat <<'EOSH' >> Cppsym.try
14008 'length($1) > 0 {
14009     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
14010     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
14011     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
14012     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
14013 }'       >> try.c
14014 echo '}' >> try.c
14015 EOSH
14016 cat <<EOSH >> Cppsym.try
14017 cc="$cc"
14018 optimize="$optimize"
14019 ccflags="$ccflags"
14020 ldflags="$ldflags"
14021 libs="$libs"
14022 exe_ext="$exe_ext"
14023 $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try$exe_ext
14024 EOSH
14025 chmod +x Cppsym.try
14026 $eunicefix Cppsym.try
14027 ./Cppsym < Cppsym.know > Cppsym.true
14028 : now check the C compiler for additional symbols
14029 postprocess_cc_v=''
14030 case "$osname" in
14031 aix) postprocess_cc_v="|$tr , ' '" ;;
14032 esac
14033 $cat >ccsym <<EOS
14034 $startsh
14035 $cat >tmp.c <<EOF
14036 extern int foo;
14037 EOF
14038 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14039 do
14040         case "\$i" in
14041         -D*) echo "\$i" | $sed 's/^-D//';;
14042         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14043         esac
14044 done
14045 $rm -f try.c
14046 EOS
14047 postprocess_cc_v=''
14048 chmod +x ccsym
14049 $eunicefix ccsym
14050 ./ccsym > ccsym1.raw
14051 if $test -s ccsym1.raw; then
14052        $sort ccsym1.raw | $uniq >ccsym.raw
14053 else
14054        mv ccsym1.raw ccsym.raw
14055 fi
14056
14057 $awk '/\=/ { print $0; next }
14058         { print $0"=1" }' ccsym.raw >ccsym.list
14059 $awk '/\=/ { print $0; next }
14060         { print $0"=1" }' Cppsym.true >ccsym.true
14061 $comm -13 ccsym.true ccsym.list >ccsym.own
14062 $comm -12 ccsym.true ccsym.list >ccsym.com
14063 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14064 also=''
14065 if $test -z ccsym.raw; then
14066         echo "Your C compiler doesn't seem to define any symbols!" >&4
14067         echo " "
14068         echo "However, your C preprocessor defines the following symbols:"
14069         $cat Cppsym.true
14070         ccsymbols=''
14071         cppsymbols=`$cat Cppsym.true`
14072         cppsymbols=`echo $cppsymbols`
14073         cppccsymbols="$cppsymbols"
14074 else
14075         if $test -s ccsym.com; then
14076                 echo "Your C compiler and pre-processor define these symbols:"
14077                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
14078                 also='also '
14079                 symbols='ones'
14080                 cppccsymbols=`$cat ccsym.com`
14081                 cppccsymbols=`echo $cppccsymbols`
14082                 $test "$silent" || sleep 1
14083         fi
14084         if $test -s ccsym.cpp; then
14085                 $test "$also" && echo " "
14086                 echo "Your C pre-processor ${also}defines the following symbols:"
14087                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
14088                 also='further '
14089                 cppsymbols=`$cat ccsym.cpp`
14090                 cppsymbols=`echo $cppsymbols`
14091                 $test "$silent" || sleep 1
14092         fi
14093         if $test -s ccsym.own; then
14094                 $test "$also" && echo " "
14095                 echo "Your C compiler ${also}defines the following cpp symbols:"
14096                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
14097                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14098                 ccsymbols=`$cat ccsym.own`
14099                 ccsymbols=`echo $ccsymbols`
14100                 $test "$silent" || sleep 1
14101         fi
14102 fi
14103 $rm -f ccsym*
14104
14105 : see if this is a termio system
14106 val="$undef"
14107 val2="$undef"
14108 val3="$undef"
14109 if $test `./findhdr termios.h`; then
14110         set tcsetattr i_termios
14111         eval $inlibc
14112         val3="$i_termios"
14113 fi
14114 echo " "
14115 case "$val3" in
14116 "$define") echo "You have POSIX termios.h... good!" >&4;;
14117 *) if ./Cppsym pyr; then
14118                 case "`/bin/universe`" in
14119                 ucb) if $test `./findhdr sgtty.h`; then
14120                                 val2="$define"
14121                                 echo "<sgtty.h> found." >&4
14122                         else
14123                                 echo "System is pyramid with BSD universe."
14124                                 echo "<sgtty.h> not found--you could have problems." >&4
14125                         fi;;
14126                 *) if $test `./findhdr termio.h`; then
14127                                 val="$define"
14128                                 echo "<termio.h> found." >&4
14129                         else
14130                                 echo "System is pyramid with USG universe."
14131                                 echo "<termio.h> not found--you could have problems." >&4
14132                         fi;;
14133                 esac
14134         elif ./usg; then
14135                 if $test `./findhdr termio.h`; then
14136                         echo "<termio.h> found." >&4
14137                         val="$define"
14138                 elif $test `./findhdr sgtty.h`; then
14139                         echo "<sgtty.h> found." >&4
14140                         val2="$define"
14141                 else
14142 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14143                 fi
14144         else
14145                 if $test `./findhdr sgtty.h`; then
14146                         echo "<sgtty.h> found." >&4
14147                         val2="$define"
14148                 elif $test `./findhdr termio.h`; then
14149                         echo "<termio.h> found." >&4
14150                         val="$define"
14151                 else
14152 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14153                 fi
14154         fi;;
14155 esac
14156 set i_termio; eval $setvar
14157 val=$val2; set i_sgtty; eval $setvar
14158 val=$val3; set i_termios; eval $setvar
14159
14160 : see if this is a shadow.h system
14161 set shadow.h i_shadow
14162 eval $inhdr
14163
14164 : see if this is a socks.h system
14165 set socks.h i_socks
14166 eval $inhdr
14167
14168 : see if stdarg is available
14169 echo " "
14170 if $test `./findhdr stdarg.h`; then
14171         echo "<stdarg.h> found." >&4
14172         valstd="$define"
14173 else
14174         echo "<stdarg.h> NOT found." >&4
14175         valstd="$undef"
14176 fi
14177
14178 : see if varags is available
14179 echo " "
14180 if $test `./findhdr varargs.h`; then
14181         echo "<varargs.h> found." >&4
14182 else
14183         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14184 fi
14185
14186 : set up the varargs testing programs
14187 $cat > varargs.c <<EOP
14188 #ifdef I_STDARG
14189 #include <stdarg.h>
14190 #endif
14191 #ifdef I_VARARGS
14192 #include <varargs.h>
14193 #endif
14194
14195 #ifdef I_STDARG
14196 int f(char *p, ...)
14197 #else
14198 int f(va_alist)
14199 va_dcl
14200 #endif
14201 {
14202         va_list ap;
14203 #ifndef I_STDARG
14204         char *p;
14205 #endif
14206 #ifdef I_STDARG
14207         va_start(ap,p);
14208 #else
14209         va_start(ap);
14210         p = va_arg(ap, char *);
14211 #endif
14212         va_end(ap);
14213 }
14214 EOP
14215 $cat > varargs <<EOP
14216 $startsh
14217 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14218         echo "true"
14219 else
14220         echo "false"
14221 fi
14222 $rm -f varargs$_o
14223 EOP
14224 chmod +x varargs
14225
14226 : now check which varargs header should be included
14227 echo " "
14228 i_varhdr=''
14229 case "$valstd" in
14230 "$define")
14231         if `./varargs I_STDARG`; then
14232                 val='stdarg.h'
14233         elif `./varargs I_VARARGS`; then
14234                 val='varargs.h'
14235         fi
14236         ;;
14237 *)
14238         if `./varargs I_VARARGS`; then
14239                 val='varargs.h'
14240         fi
14241         ;;
14242 esac
14243 case "$val" in
14244 '')
14245 echo "I could not find the definition for va_dcl... You have problems..." >&4
14246         val="$undef"; set i_stdarg; eval $setvar
14247         val="$undef"; set i_varargs; eval $setvar
14248         ;;
14249 *) 
14250         set i_varhdr
14251         eval $setvar
14252         case "$i_varhdr" in
14253         stdarg.h)
14254                 val="$define"; set i_stdarg; eval $setvar
14255                 val="$undef"; set i_varargs; eval $setvar
14256                 ;;
14257         varargs.h)
14258                 val="$undef"; set i_stdarg; eval $setvar
14259                 val="$define"; set i_varargs; eval $setvar
14260                 ;;
14261         esac
14262         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14263 esac
14264 $rm -f varargs*
14265
14266 : see if stddef is available
14267 set stddef.h i_stddef
14268 eval $inhdr
14269
14270 : see if sys/access.h is available
14271 set sys/access.h i_sysaccess
14272 eval $inhdr
14273
14274 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14275 set sys/filio.h i_sysfilio
14276 eval $inhdr
14277 echo " "
14278 if $test `./findhdr sys/ioctl.h`; then
14279         val="$define"
14280         echo '<sys/ioctl.h> found.' >&4
14281 else
14282         val="$undef"
14283         if $test $i_sysfilio = "$define"; then
14284             echo '<sys/ioctl.h> NOT found.' >&4
14285         else
14286                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14287                 $test $i_termio = "$define" && xxx="termio.h"
14288                 $test $i_termios = "$define" && xxx="termios.h"
14289 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14290         fi
14291 fi
14292 set i_sysioctl
14293 eval $setvar
14294
14295
14296 : see if this is a syslog.h system
14297 set syslog.h i_syslog
14298 eval $inhdr
14299
14300
14301 : see if this is a sys/mode.h system
14302 set sys/mode.h i_sysmode
14303 eval $inhdr
14304
14305 : see if sys/resource.h has to be included
14306 set sys/resource.h i_sysresrc
14307 eval $inhdr
14308
14309 : see if sys/security.h is available
14310 set sys/security.h i_syssecrt
14311 eval $inhdr
14312
14313 : see if this is a sys/statvfs.h system
14314 set sys/statvfs.h i_sysstatvfs
14315 eval $inhdr
14316
14317 : see if this is a sys/uio.h system
14318 set sys/uio.h i_sysuio
14319 eval $inhdr
14320
14321 : see if this is a sys/un.h system
14322 set sys/un.h i_sysun
14323 eval $inhdr
14324
14325
14326 : see if this is a sys/utsname.h system
14327 set sys/utsname.h i_sysutsname
14328 eval $inhdr
14329
14330 : see if this is a syswait system
14331 set sys/wait.h i_syswait
14332 eval $inhdr
14333
14334 : see if this is a ustat.h system
14335 set ustat.h i_ustat
14336 eval $inhdr
14337
14338 : see if this is an utime system
14339 set utime.h i_utime
14340 eval $inhdr
14341
14342 : see if this is a values.h system
14343 set values.h i_values
14344 eval $inhdr
14345
14346 : see if this is a vfork system
14347 case "$d_vfork" in
14348 "$define")
14349         set vfork.h i_vfork
14350         eval $inhdr
14351         ;;
14352 *)
14353         i_vfork="$undef"
14354         ;;
14355 esac
14356
14357 : see if gdbm.h is available
14358 set gdbm.h t_gdbm
14359 eval $inhdr
14360 case "$t_gdbm" in
14361 $define)
14362         : see if gdbm_open exists
14363         set gdbm_open d_gdbm_open
14364         eval $inlibc
14365         case "$d_gdbm_open" in
14366         $undef)
14367                 t_gdbm="$undef"
14368                 echo "We won't be including <gdbm.h>"
14369                 ;;
14370         esac
14371         ;;
14372 esac
14373 val="$t_gdbm"
14374 set i_gdbm
14375 eval $setvar
14376
14377 echo " "
14378 echo "Looking for extensions..." >&4
14379 : If we are using the old config.sh, known_extensions may contain
14380 : old or inaccurate or duplicate values.
14381 known_extensions=''
14382 nonxs_extensions=''
14383 : We do not use find because it might not be available.
14384 : We do not just use MANIFEST because the user may have dropped
14385 : some additional extensions into the source tree and expect them
14386 : to be built.
14387
14388 : Function to recursively find available extensions, ignoring DynaLoader
14389 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14390 find_extensions='
14391     for xxx in *; do
14392        case "$xxx" in
14393            DynaLoader|dynaload) ;;
14394            *)
14395            if $test -f $xxx/$xxx.xs; then
14396                known_extensions="$known_extensions $1$xxx";
14397            elif $test -f $xxx/Makefile.PL; then
14398                nonxs_extensions="$nonxs_extensions $1$xxx";
14399            else
14400                if $test -d $xxx -a $# -lt 10; then
14401                    set $1$xxx/ $*;
14402                    cd $xxx;
14403                    eval $find_extensions;
14404                    cd ..;
14405                    shift;
14406                fi;
14407            fi
14408            ;;
14409        esac;
14410     done'
14411 tdir=`pwd`
14412 cd $rsrc/ext
14413 set X
14414 shift
14415 eval $find_extensions
14416 set X $nonxs_extensions
14417 shift
14418 nonxs_extensions="$*"
14419 set X $known_extensions
14420 shift
14421 known_extensions="$*"
14422 cd $tdir
14423
14424 : Now see which are supported on this system.
14425 avail_ext=''
14426 for xxx in $known_extensions ; do
14427         case "$xxx" in
14428         DB_File|db_file)
14429                 case "$i_db" in
14430                 $define) avail_ext="$avail_ext $xxx" ;;
14431                 esac
14432                 ;;
14433         GDBM_File|gdbm_fil)
14434                 case "$i_gdbm" in 
14435                 $define) avail_ext="$avail_ext $xxx" ;;
14436                 esac
14437                 ;;
14438         NDBM_File|ndbm_fil)
14439                 case "$i_ndbm" in
14440                 $define)
14441                     case "$osname-$use64bits" in
14442                     hpux-define)
14443                         case "$libs" in
14444                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
14445                         esac
14446                         ;;
14447                     *) avail_ext="$avail_ext $xxx" ;;
14448                     esac
14449                     ;;
14450                 esac
14451                 ;;
14452         ODBM_File|odbm_fil) 
14453                 case "${i_dbm}${i_rpcsvcdbm}" in
14454                 *"${define}"*)
14455                     case "$osname-$use64bits" in
14456                     hpux-define)
14457                         case "$libs" in
14458                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
14459                         esac
14460                         ;;
14461                     *) avail_ext="$avail_ext $xxx" ;;
14462                     esac
14463                     ;;
14464                 esac
14465                 ;;
14466         POSIX|posix)
14467                 case "$useposix" in
14468                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14469                 esac
14470                 ;;
14471         Opcode|opcode)
14472                 case "$useopcode" in
14473                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14474                 esac
14475                 ;;
14476         Socket|socket)
14477                 case "$d_socket" in 
14478                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14479                 esac
14480                 ;;
14481         Thread|thread)
14482                 case "$usethreads" in 
14483                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14484                 esac
14485                 ;;
14486         IPC/SysV|ipc/sysv)
14487                 : XXX Do we need a useipcsysv variable here
14488                 case "${d_msg}${d_sem}${d_shm}" in 
14489                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14490                 esac
14491                 ;;
14492         *)      avail_ext="$avail_ext $xxx"
14493                 ;;
14494         esac
14495 done
14496
14497 set X $avail_ext
14498 shift
14499 avail_ext="$*"
14500
14501 : Now see which nonxs extensions are supported on this system.
14502 : For now assume all are.
14503 nonxs_ext=''
14504 for xxx in $nonxs_extensions ; do
14505         case "$xxx" in
14506         *)      nonxs_ext="$nonxs_ext $xxx"
14507                 ;;
14508         esac
14509 done
14510
14511 set X $nonxs_ext
14512 shift
14513 nonxs_ext="$*"
14514
14515 case $usedl in
14516 $define)
14517         $cat <<EOM
14518 A number of extensions are supplied with $package.  You may choose to
14519 compile these extensions for dynamic loading (the default), compile
14520 them into the $package executable (static loading), or not include
14521 them at all.  Answer "none" to include no extensions.
14522 Note that DynaLoader is always built and need not be mentioned here.
14523
14524 EOM
14525         case "$dynamic_ext" in
14526         '') dflt="$avail_ext" ;;
14527         *)      dflt="$dynamic_ext"
14528                 # Perhaps we are reusing an old out-of-date config.sh.
14529                 case "$hint" in
14530                 previous)
14531                         if test X"$dynamic_ext" != X"$avail_ext"; then
14532                                 $cat <<EOM
14533 NOTICE:  Your previous config.sh list may be incorrect. 
14534 The extensions now available to you are 
14535         ${avail_ext}
14536 but the default list from your previous config.sh is
14537         ${dynamic_ext} 
14538
14539 EOM
14540                         fi
14541                         ;;
14542                 esac
14543                 ;;
14544         esac
14545         case "$dflt" in
14546         '')     dflt=none;;
14547         esac
14548         rp="What extensions do you wish to load dynamically?"
14549         . ./myread
14550         case "$ans" in
14551         none) dynamic_ext=' ' ;;
14552         *) dynamic_ext="$ans" ;;
14553         esac
14554
14555         case "$static_ext" in
14556         '')
14557                 : Exclude those already listed in dynamic linking
14558                 dflt=''
14559                 for xxx in $avail_ext; do
14560                         case " $dynamic_ext " in
14561                         *" $xxx "*) ;;
14562                         *) dflt="$dflt $xxx" ;;
14563                         esac
14564                 done
14565                 set X $dflt
14566                 shift
14567                 dflt="$*"
14568                 ;;
14569         *)  dflt="$static_ext" 
14570                 ;;
14571         esac
14572
14573         case "$dflt" in
14574         '')     dflt=none;;
14575         esac
14576         rp="What extensions do you wish to load statically?"
14577         . ./myread
14578         case "$ans" in
14579         none) static_ext=' ' ;;
14580         *) static_ext="$ans" ;;
14581         esac
14582         ;;
14583 *)
14584         $cat <<EOM
14585 A number of extensions are supplied with $package.  Answer "none" 
14586 to include no extensions. 
14587 Note that DynaLoader is always built and need not be mentioned here.
14588
14589 EOM
14590         case "$static_ext" in
14591         '') dflt="$avail_ext" ;;
14592         *)      dflt="$static_ext"
14593                 # Perhaps we are reusing an old out-of-date config.sh.
14594                 case "$hint" in
14595                 previous)
14596                         if test X"$static_ext" != X"$avail_ext"; then
14597                                 $cat <<EOM
14598 NOTICE:  Your previous config.sh list may be incorrect. 
14599 The extensions now available to you are 
14600         ${avail_ext}
14601 but the default list from your previous config.sh is
14602         ${static_ext} 
14603
14604 EOM
14605                         fi
14606                         ;;
14607                 esac
14608                 ;;
14609         esac
14610         : Exclude those that are not xs extensions
14611         case "$dflt" in
14612         '')     dflt=none;;
14613         esac
14614         rp="What extensions do you wish to include?"
14615         . ./myread
14616         case "$ans" in
14617         none) static_ext=' ' ;;
14618         *) static_ext="$ans" ;;
14619         esac
14620         ;;
14621 esac
14622
14623 set X $dynamic_ext $static_ext $nonxs_ext
14624 shift
14625 extensions="$*"
14626
14627 : Remove build directory name from cppstdin so it can be used from
14628 : either the present location or the final installed location.
14629 echo " "
14630 : Get out of the UU directory to get correct path name.
14631 cd ..
14632 case "$cppstdin" in
14633 `pwd`/cppstdin)
14634         echo "Stripping down cppstdin path name"
14635         cppstdin=cppstdin
14636         ;;
14637 esac
14638 cd UU
14639
14640 : end of configuration questions
14641 echo " "
14642 echo "End of configuration questions."
14643 echo " "
14644
14645 : back to where it started
14646 if test -d ../UU; then
14647         cd ..
14648 fi
14649
14650 : configuration may be patched via a 'config.over' file
14651 if $test -f config.over; then
14652         echo " "
14653         dflt=y
14654         rp='I see a config.over file.  Do you wish to load it?'
14655         . UU/myread
14656         case "$ans" in
14657         n*) echo "OK, I'll ignore it.";;
14658         *)      . ./config.over
14659                 echo "Configuration override changes have been loaded."
14660                 ;;
14661         esac
14662 fi
14663
14664 : in case they want portability, strip down executable paths
14665 case "$d_portable" in
14666 "$define")
14667         echo " "
14668         echo "Stripping down executable paths..." >&4
14669         for file in $loclist $trylist; do
14670                 eval temp=\$$file
14671                 eval $file=`basename $temp`
14672         done
14673         ;;
14674 esac
14675
14676 : create config.sh file
14677 echo " "
14678 echo "Creating config.sh..." >&4
14679 $spitshell <<EOT >config.sh
14680 $startsh
14681 #
14682 # This file was produced by running the Configure script. It holds all the
14683 # definitions figured out by Configure. Should you modify one of these values,
14684 # do not forget to propagate your changes by running "Configure -der". You may
14685 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14686 #
14687
14688 # Package name      : $package
14689 # Source directory  : $src
14690 # Configuration time: $cf_time
14691 # Configured by     : $cf_by
14692 # Target system     : $myuname
14693
14694 Author='$Author'
14695 Date='$Date'
14696 Header='$Header'
14697 Id='$Id'
14698 Locker='$Locker'
14699 Log='$Log'
14700 Mcc='$Mcc'
14701 RCSfile='$RCSfile'
14702 Revision='$Revision'
14703 Source='$Source'
14704 State='$State'
14705 _a='$_a'
14706 _exe='$_exe'
14707 _o='$_o'
14708 afs='$afs'
14709 alignbytes='$alignbytes'
14710 ansi2knr='$ansi2knr'
14711 aphostname='$aphostname'
14712 api_revision='$api_revision'
14713 api_subversion='$api_subversion'
14714 api_version='$api_version'
14715 api_versionstring='$api_versionstring'
14716 ar='$ar'
14717 archlib='$archlib'
14718 archlibexp='$archlibexp'
14719 archname64='$archname64'
14720 archname='$archname'
14721 archobjs='$archobjs'
14722 awk='$awk'
14723 baserev='$baserev'
14724 bash='$bash'
14725 bin='$bin'
14726 bincompat5005='$bincompat5005'
14727 binexp='$binexp'
14728 bison='$bison'
14729 byacc='$byacc'
14730 byteorder='$byteorder'
14731 c='$c'
14732 castflags='$castflags'
14733 cat='$cat'
14734 cc='$cc'
14735 cccdlflags='$cccdlflags'
14736 ccdlflags='$ccdlflags'
14737 ccflags='$ccflags'
14738 ccsymbols='$ccsymbols'
14739 cf_by='$cf_by'
14740 cf_email='$cf_email'
14741 cf_time='$cf_time'
14742 charsize='$charsize'
14743 chgrp='$chgrp'
14744 chmod='$chmod'
14745 chown='$chown'
14746 clocktype='$clocktype'
14747 comm='$comm'
14748 compress='$compress'
14749 contains='$contains'
14750 cp='$cp'
14751 cpio='$cpio'
14752 cpp='$cpp'
14753 cpp_stuff='$cpp_stuff'
14754 cppccsymbols='$cppccsymbols'
14755 cppflags='$cppflags'
14756 cpplast='$cpplast'
14757 cppminus='$cppminus'
14758 cpprun='$cpprun'
14759 cppstdin='$cppstdin'
14760 cppsymbols='$cppsymbols'
14761 crosscompile='$crosscompile'
14762 cryptlib='$cryptlib'
14763 csh='$csh'
14764 d_Gconvert='$d_Gconvert'
14765 d_PRIEldbl='$d_PRIEldbl'
14766 d_PRIFldbl='$d_PRIFldbl'
14767 d_PRIGldbl='$d_PRIGldbl'
14768 d_PRIX64='$d_PRIX64'
14769 d_PRId64='$d_PRId64'
14770 d_PRIeldbl='$d_PRIeldbl'
14771 d_PRIfldbl='$d_PRIfldbl'
14772 d_PRIgldbl='$d_PRIgldbl'
14773 d_PRIi64='$d_PRIi64'
14774 d_PRIo64='$d_PRIo64'
14775 d_PRIu64='$d_PRIu64'
14776 d_PRIx64='$d_PRIx64'
14777 d_access='$d_access'
14778 d_accessx='$d_accessx'
14779 d_alarm='$d_alarm'
14780 d_archlib='$d_archlib'
14781 d_atolf='$d_atolf'
14782 d_atoll='$d_atoll'
14783 d_attribut='$d_attribut'
14784 d_bcmp='$d_bcmp'
14785 d_bcopy='$d_bcopy'
14786 d_bincompat5005='$d_bincompat5005'
14787 d_bsd='$d_bsd'
14788 d_bsdgetpgrp='$d_bsdgetpgrp'
14789 d_bsdsetpgrp='$d_bsdsetpgrp'
14790 d_bzero='$d_bzero'
14791 d_casti32='$d_casti32'
14792 d_castneg='$d_castneg'
14793 d_charvspr='$d_charvspr'
14794 d_chown='$d_chown'
14795 d_chroot='$d_chroot'
14796 d_chsize='$d_chsize'
14797 d_closedir='$d_closedir'
14798 d_const='$d_const'
14799 d_crypt='$d_crypt'
14800 d_csh='$d_csh'
14801 d_cuserid='$d_cuserid'
14802 d_dbl_dig='$d_dbl_dig'
14803 d_difftime='$d_difftime'
14804 d_dirnamlen='$d_dirnamlen'
14805 d_dlerror='$d_dlerror'
14806 d_dlopen='$d_dlopen'
14807 d_dlsymun='$d_dlsymun'
14808 d_dosuid='$d_dosuid'
14809 d_drand48proto='$d_drand48proto'
14810 d_dup2='$d_dup2'
14811 d_eaccess='$d_eaccess'
14812 d_endgrent='$d_endgrent'
14813 d_endhent='$d_endhent'
14814 d_endnent='$d_endnent'
14815 d_endpent='$d_endpent'
14816 d_endpwent='$d_endpwent'
14817 d_endsent='$d_endsent'
14818 d_endspent='$d_endspent'
14819 d_eofnblk='$d_eofnblk'
14820 d_eunice='$d_eunice'
14821 d_fchmod='$d_fchmod'
14822 d_fchown='$d_fchown'
14823 d_fcntl='$d_fcntl'
14824 d_fd_macros='$d_fd_macros'
14825 d_fd_set='$d_fd_set'
14826 d_fds_bits='$d_fds_bits'
14827 d_fgetpos='$d_fgetpos'
14828 d_flexfnam='$d_flexfnam'
14829 d_flock='$d_flock'
14830 d_fork='$d_fork'
14831 d_fpathconf='$d_fpathconf'
14832 d_fpos64_t='$d_fpos64_t'
14833 d_fs_data_s='$d_fs_data_s'
14834 d_fseeko='$d_fseeko'
14835 d_fsetpos='$d_fsetpos'
14836 d_fstatfs='$d_fstatfs'
14837 d_fstatvfs='$d_fstatvfs'
14838 d_ftello='$d_ftello'
14839 d_ftime='$d_ftime'
14840 d_getcwd='$d_getcwd'
14841 d_getfsstat='$d_getfsstat'
14842 d_getgrent='$d_getgrent'
14843 d_getgrps='$d_getgrps'
14844 d_gethbyaddr='$d_gethbyaddr'
14845 d_gethbyname='$d_gethbyname'
14846 d_gethent='$d_gethent'
14847 d_gethname='$d_gethname'
14848 d_gethostprotos='$d_gethostprotos'
14849 d_getlogin='$d_getlogin'
14850 d_getmnt='$d_getmnt'
14851 d_getmntent='$d_getmntent'
14852 d_getnbyaddr='$d_getnbyaddr'
14853 d_getnbyname='$d_getnbyname'
14854 d_getnent='$d_getnent'
14855 d_getnetprotos='$d_getnetprotos'
14856 d_getpbyname='$d_getpbyname'
14857 d_getpbynumber='$d_getpbynumber'
14858 d_getpent='$d_getpent'
14859 d_getpgid='$d_getpgid'
14860 d_getpgrp2='$d_getpgrp2'
14861 d_getpgrp='$d_getpgrp'
14862 d_getppid='$d_getppid'
14863 d_getprior='$d_getprior'
14864 d_getprotoprotos='$d_getprotoprotos'
14865 d_getpwent='$d_getpwent'
14866 d_getsbyname='$d_getsbyname'
14867 d_getsbyport='$d_getsbyport'
14868 d_getsent='$d_getsent'
14869 d_getservprotos='$d_getservprotos'
14870 d_getspent='$d_getspent'
14871 d_getspnam='$d_getspnam'
14872 d_gettimeod='$d_gettimeod'
14873 d_gnulibc='$d_gnulibc'
14874 d_grpasswd='$d_grpasswd'
14875 d_hasmntopt='$d_hasmntopt'
14876 d_htonl='$d_htonl'
14877 d_iconv='$d_iconv'
14878 d_index='$d_index'
14879 d_inetaton='$d_inetaton'
14880 d_int64_t='$d_int64_t'
14881 d_isascii='$d_isascii'
14882 d_killpg='$d_killpg'
14883 d_lchown='$d_lchown'
14884 d_ldbl_dig='$d_ldbl_dig'
14885 d_link='$d_link'
14886 d_locconv='$d_locconv'
14887 d_lockf='$d_lockf'
14888 d_longdbl='$d_longdbl'
14889 d_longlong='$d_longlong'
14890 d_lseekproto='$d_lseekproto'
14891 d_lstat='$d_lstat'
14892 d_mblen='$d_mblen'
14893 d_mbstowcs='$d_mbstowcs'
14894 d_mbtowc='$d_mbtowc'
14895 d_memchr='$d_memchr'
14896 d_memcmp='$d_memcmp'
14897 d_memcpy='$d_memcpy'
14898 d_memmove='$d_memmove'
14899 d_memset='$d_memset'
14900 d_mkdir='$d_mkdir'
14901 d_mkdtemp='$d_mkdtemp'
14902 d_mkfifo='$d_mkfifo'
14903 d_mkstemp='$d_mkstemp'
14904 d_mkstemps='$d_mkstemps'
14905 d_mktime='$d_mktime'
14906 d_mmap='$d_mmap'
14907 d_mprotect='$d_mprotect'
14908 d_msg='$d_msg'
14909 d_msg_ctrunc='$d_msg_ctrunc'
14910 d_msg_dontroute='$d_msg_dontroute'
14911 d_msg_oob='$d_msg_oob'
14912 d_msg_peek='$d_msg_peek'
14913 d_msg_proxy='$d_msg_proxy'
14914 d_msgctl='$d_msgctl'
14915 d_msgget='$d_msgget'
14916 d_msgrcv='$d_msgrcv'
14917 d_msgsnd='$d_msgsnd'
14918 d_msync='$d_msync'
14919 d_munmap='$d_munmap'
14920 d_mymalloc='$d_mymalloc'
14921 d_nice='$d_nice'
14922 d_nv_preserves_uv='$d_nv_preserves_uv'
14923 d_off64_t='$d_off64_t'
14924 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14925 d_oldpthreads='$d_oldpthreads'
14926 d_oldsock='$d_oldsock'
14927 d_open3='$d_open3'
14928 d_pathconf='$d_pathconf'
14929 d_pause='$d_pause'
14930 d_phostname='$d_phostname'
14931 d_pipe='$d_pipe'
14932 d_poll='$d_poll'
14933 d_portable='$d_portable'
14934 d_pthread_yield='$d_pthread_yield'
14935 d_pwage='$d_pwage'
14936 d_pwchange='$d_pwchange'
14937 d_pwclass='$d_pwclass'
14938 d_pwcomment='$d_pwcomment'
14939 d_pwexpire='$d_pwexpire'
14940 d_pwgecos='$d_pwgecos'
14941 d_pwpasswd='$d_pwpasswd'
14942 d_pwquota='$d_pwquota'
14943 d_quad='$d_quad'
14944 d_readdir='$d_readdir'
14945 d_readlink='$d_readlink'
14946 d_rename='$d_rename'
14947 d_rewinddir='$d_rewinddir'
14948 d_rmdir='$d_rmdir'
14949 d_safebcpy='$d_safebcpy'
14950 d_safemcpy='$d_safemcpy'
14951 d_sanemcmp='$d_sanemcmp'
14952 d_sched_yield='$d_sched_yield'
14953 d_scm_rights='$d_scm_rights'
14954 d_seekdir='$d_seekdir'
14955 d_select='$d_select'
14956 d_sem='$d_sem'
14957 d_semctl='$d_semctl'
14958 d_semctl_semid_ds='$d_semctl_semid_ds'
14959 d_semctl_semun='$d_semctl_semun'
14960 d_semget='$d_semget'
14961 d_semop='$d_semop'
14962 d_setegid='$d_setegid'
14963 d_seteuid='$d_seteuid'
14964 d_setgrent='$d_setgrent'
14965 d_setgrps='$d_setgrps'
14966 d_sethent='$d_sethent'
14967 d_setlinebuf='$d_setlinebuf'
14968 d_setlocale='$d_setlocale'
14969 d_setnent='$d_setnent'
14970 d_setpent='$d_setpent'
14971 d_setpgid='$d_setpgid'
14972 d_setpgrp2='$d_setpgrp2'
14973 d_setpgrp='$d_setpgrp'
14974 d_setprior='$d_setprior'
14975 d_setpwent='$d_setpwent'
14976 d_setregid='$d_setregid'
14977 d_setresgid='$d_setresgid'
14978 d_setresuid='$d_setresuid'
14979 d_setreuid='$d_setreuid'
14980 d_setrgid='$d_setrgid'
14981 d_setruid='$d_setruid'
14982 d_setsent='$d_setsent'
14983 d_setsid='$d_setsid'
14984 d_setspent='$d_setspent'
14985 d_setvbuf='$d_setvbuf'
14986 d_sfio='$d_sfio'
14987 d_shm='$d_shm'
14988 d_shmat='$d_shmat'
14989 d_shmatprototype='$d_shmatprototype'
14990 d_shmctl='$d_shmctl'
14991 d_shmdt='$d_shmdt'
14992 d_shmget='$d_shmget'
14993 d_sigaction='$d_sigaction'
14994 d_sigsetjmp='$d_sigsetjmp'
14995 d_socket='$d_socket'
14996 d_socklen_t='$d_socklen_t'
14997 d_sockpair='$d_sockpair'
14998 d_sqrtl='$d_sqrtl'
14999 d_statblks='$d_statblks'
15000 d_statfs_f_flags='$d_statfs_f_flags'
15001 d_statfs_s='$d_statfs_s'
15002 d_statvfs='$d_statvfs'
15003 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15004 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15005 d_stdio_stream_array='$d_stdio_stream_array'
15006 d_stdiobase='$d_stdiobase'
15007 d_stdstdio='$d_stdstdio'
15008 d_strchr='$d_strchr'
15009 d_strcoll='$d_strcoll'
15010 d_strctcpy='$d_strctcpy'
15011 d_strerrm='$d_strerrm'
15012 d_strerror='$d_strerror'
15013 d_strtod='$d_strtod'
15014 d_strtol='$d_strtol'
15015 d_strtold='$d_strtold'
15016 d_strtoll='$d_strtoll'
15017 d_strtoul='$d_strtoul'
15018 d_strtoull='$d_strtoull'
15019 d_strtouq='$d_strtouq'
15020 d_strxfrm='$d_strxfrm'
15021 d_suidsafe='$d_suidsafe'
15022 d_symlink='$d_symlink'
15023 d_syscall='$d_syscall'
15024 d_sysconf='$d_sysconf'
15025 d_sysernlst='$d_sysernlst'
15026 d_syserrlst='$d_syserrlst'
15027 d_system='$d_system'
15028 d_tcgetpgrp='$d_tcgetpgrp'
15029 d_tcsetpgrp='$d_tcsetpgrp'
15030 d_telldir='$d_telldir'
15031 d_telldirproto='$d_telldirproto'
15032 d_time='$d_time'
15033 d_times='$d_times'
15034 d_truncate='$d_truncate'
15035 d_tzname='$d_tzname'
15036 d_umask='$d_umask'
15037 d_uname='$d_uname'
15038 d_union_semun='$d_union_semun'
15039 d_ustat='$d_ustat'
15040 d_vendorbin='$d_vendorbin'
15041 d_vendorlib='$d_vendorlib'
15042 d_vfork='$d_vfork'
15043 d_void_closedir='$d_void_closedir'
15044 d_voidsig='$d_voidsig'
15045 d_voidtty='$d_voidtty'
15046 d_volatile='$d_volatile'
15047 d_vprintf='$d_vprintf'
15048 d_wait4='$d_wait4'
15049 d_waitpid='$d_waitpid'
15050 d_wcstombs='$d_wcstombs'
15051 d_wctomb='$d_wctomb'
15052 d_xenix='$d_xenix'
15053 date='$date'
15054 db_hashtype='$db_hashtype'
15055 db_prefixtype='$db_prefixtype'
15056 defvoidused='$defvoidused'
15057 direntrytype='$direntrytype'
15058 dlext='$dlext'
15059 dlsrc='$dlsrc'
15060 doublesize='$doublesize'
15061 drand01='$drand01'
15062 dynamic_ext='$dynamic_ext'
15063 eagain='$eagain'
15064 ebcdic='$ebcdic'
15065 echo='$echo'
15066 egrep='$egrep'
15067 emacs='$emacs'
15068 eunicefix='$eunicefix'
15069 exe_ext='$exe_ext'
15070 expr='$expr'
15071 extensions='$extensions'
15072 fflushNULL='$fflushNULL'
15073 fflushall='$fflushall'
15074 find='$find'
15075 firstmakefile='$firstmakefile'
15076 flex='$flex'
15077 fpossize='$fpossize'
15078 fpostype='$fpostype'
15079 freetype='$freetype'
15080 full_ar='$full_ar'
15081 full_csh='$full_csh'
15082 full_sed='$full_sed'
15083 gccversion='$gccversion'
15084 gidformat='$gidformat'
15085 gidsign='$gidsign'
15086 gidsize='$gidsize'
15087 gidtype='$gidtype'
15088 glibpth='$glibpth'
15089 grep='$grep'
15090 groupcat='$groupcat'
15091 groupstype='$groupstype'
15092 gzip='$gzip'
15093 h_fcntl='$h_fcntl'
15094 h_sysfile='$h_sysfile'
15095 hint='$hint'
15096 hostcat='$hostcat'
15097 huge='$huge'
15098 i16size='$i16size'
15099 i16type='$i16type'
15100 i32size='$i32size'
15101 i32type='$i32type'
15102 i64size='$i64size'
15103 i64type='$i64type'
15104 i8size='$i8size'
15105 i8type='$i8type'
15106 i_arpainet='$i_arpainet'
15107 i_bsdioctl='$i_bsdioctl'
15108 i_db='$i_db'
15109 i_dbm='$i_dbm'
15110 i_dirent='$i_dirent'
15111 i_dld='$i_dld'
15112 i_dlfcn='$i_dlfcn'
15113 i_fcntl='$i_fcntl'
15114 i_float='$i_float'
15115 i_gdbm='$i_gdbm'
15116 i_grp='$i_grp'
15117 i_iconv='$i_iconv'
15118 i_inttypes='$i_inttypes'
15119 i_limits='$i_limits'
15120 i_locale='$i_locale'
15121 i_machcthr='$i_machcthr'
15122 i_malloc='$i_malloc'
15123 i_math='$i_math'
15124 i_memory='$i_memory'
15125 i_mntent='$i_mntent'
15126 i_ndbm='$i_ndbm'
15127 i_netdb='$i_netdb'
15128 i_neterrno='$i_neterrno'
15129 i_netinettcp='$i_netinettcp'
15130 i_niin='$i_niin'
15131 i_poll='$i_poll'
15132 i_pthread='$i_pthread'
15133 i_pwd='$i_pwd'
15134 i_rpcsvcdbm='$i_rpcsvcdbm'
15135 i_sfio='$i_sfio'
15136 i_sgtty='$i_sgtty'
15137 i_shadow='$i_shadow'
15138 i_socks='$i_socks'
15139 i_stdarg='$i_stdarg'
15140 i_stddef='$i_stddef'
15141 i_stdlib='$i_stdlib'
15142 i_string='$i_string'
15143 i_sysaccess='$i_sysaccess'
15144 i_sysdir='$i_sysdir'
15145 i_sysfile='$i_sysfile'
15146 i_sysfilio='$i_sysfilio'
15147 i_sysin='$i_sysin'
15148 i_sysioctl='$i_sysioctl'
15149 i_syslog='$i_syslog'
15150 i_sysmman='$i_sysmman'
15151 i_sysmode='$i_sysmode'
15152 i_sysmount='$i_sysmount'
15153 i_sysndir='$i_sysndir'
15154 i_sysparam='$i_sysparam'
15155 i_sysresrc='$i_sysresrc'
15156 i_syssecrt='$i_syssecrt'
15157 i_sysselct='$i_sysselct'
15158 i_syssockio='$i_syssockio'
15159 i_sysstat='$i_sysstat'
15160 i_sysstatfs='$i_sysstatfs'
15161 i_sysstatvfs='$i_sysstatvfs'
15162 i_systime='$i_systime'
15163 i_systimek='$i_systimek'
15164 i_systimes='$i_systimes'
15165 i_systypes='$i_systypes'
15166 i_sysuio='$i_sysuio'
15167 i_sysun='$i_sysun'
15168 i_sysutsname='$i_sysutsname'
15169 i_sysvfs='$i_sysvfs'
15170 i_syswait='$i_syswait'
15171 i_termio='$i_termio'
15172 i_termios='$i_termios'
15173 i_time='$i_time'
15174 i_unistd='$i_unistd'
15175 i_ustat='$i_ustat'
15176 i_utime='$i_utime'
15177 i_values='$i_values'
15178 i_varargs='$i_varargs'
15179 i_varhdr='$i_varhdr'
15180 i_vfork='$i_vfork'
15181 ignore_versioned_solibs='$ignore_versioned_solibs'
15182 inc_version_list='$inc_version_list'
15183 inc_version_list_init='$inc_version_list_init'
15184 incpath='$incpath'
15185 inews='$inews'
15186 installarchlib='$installarchlib'
15187 installbin='$installbin'
15188 installman1dir='$installman1dir'
15189 installman3dir='$installman3dir'
15190 installprefix='$installprefix'
15191 installprefixexp='$installprefixexp'
15192 installprivlib='$installprivlib'
15193 installscript='$installscript'
15194 installsitearch='$installsitearch'
15195 installsitebin='$installsitebin'
15196 installsitelib='$installsitelib'
15197 installstyle='$installstyle'
15198 installusrbinperl='$installusrbinperl'
15199 installvendorbin='$installvendorbin'
15200 installvendorlib='$installvendorlib'
15201 intsize='$intsize'
15202 ivdformat='$ivdformat'
15203 ivsize='$ivsize'
15204 ivtype='$ivtype'
15205 known_extensions='$known_extensions'
15206 ksh='$ksh'
15207 large='$large'
15208 ld='$ld'
15209 lddlflags='$lddlflags'
15210 ldflags='$ldflags'
15211 ldlibpthname='$ldlibpthname'
15212 less='$less'
15213 lib_ext='$lib_ext'
15214 libc='$libc'
15215 libperl='$libperl'
15216 libpth='$libpth'
15217 libs='$libs'
15218 libsdirs='$libsdirs'
15219 libsfiles='$libsfiles'
15220 libsfound='$libsfound'
15221 libspath='$libspath'
15222 libswanted='$libswanted'
15223 line='$line'
15224 lint='$lint'
15225 lkflags='$lkflags'
15226 ln='$ln'
15227 lns='$lns'
15228 locincpth='$locincpth'
15229 loclibpth='$loclibpth'
15230 longdblsize='$longdblsize'
15231 longlongsize='$longlongsize'
15232 longsize='$longsize'
15233 lp='$lp'
15234 lpr='$lpr'
15235 ls='$ls'
15236 lseeksize='$lseeksize'
15237 lseektype='$lseektype'
15238 mail='$mail'
15239 mailx='$mailx'
15240 make='$make'
15241 make_set_make='$make_set_make'
15242 mallocobj='$mallocobj'
15243 mallocsrc='$mallocsrc'
15244 malloctype='$malloctype'
15245 man1dir='$man1dir'
15246 man1direxp='$man1direxp'
15247 man1ext='$man1ext'
15248 man3dir='$man3dir'
15249 man3direxp='$man3direxp'
15250 man3ext='$man3ext'
15251 medium='$medium'
15252 mips_type='$mips_type'
15253 mkdir='$mkdir'
15254 mmaptype='$mmaptype'
15255 models='$models'
15256 modetype='$modetype'
15257 more='$more'
15258 multiarch='$multiarch'
15259 mv='$mv'
15260 myarchname='$myarchname'
15261 mydomain='$mydomain'
15262 myhostname='$myhostname'
15263 myuname='$myuname'
15264 n='$n'
15265 netdb_hlen_type='$netdb_hlen_type'
15266 netdb_host_type='$netdb_host_type'
15267 netdb_name_type='$netdb_name_type'
15268 netdb_net_type='$netdb_net_type'
15269 nm='$nm'
15270 nm_opt='$nm_opt'
15271 nm_so_opt='$nm_so_opt'
15272 nonxs_ext='$nonxs_ext'
15273 nroff='$nroff'
15274 nvsize='$nvsize'
15275 nvtype='$nvtype'
15276 o_nonblock='$o_nonblock'
15277 obj_ext='$obj_ext'
15278 old_pthread_create_joinable='$old_pthread_create_joinable'
15279 optimize='$optimize'
15280 orderlib='$orderlib'
15281 osname='$osname'
15282 osvers='$osvers'
15283 package='$package'
15284 pager='$pager'
15285 passcat='$passcat'
15286 patchlevel='$patchlevel'
15287 path_sep='$path_sep'
15288 perl5='$perl5'
15289 perl='$perl'
15290 perladmin='$perladmin'
15291 perlpath='$perlpath'
15292 pg='$pg'
15293 phostname='$phostname'
15294 pidtype='$pidtype'
15295 plibpth='$plibpth'
15296 pm_apiversion='$pm_apiversion'
15297 pmake='$pmake'
15298 pr='$pr'
15299 prefix='$prefix'
15300 prefixexp='$prefixexp'
15301 privlib='$privlib'
15302 privlibexp='$privlibexp'
15303 prototype='$prototype'
15304 ptrsize='$ptrsize'
15305 quadkind='$quadkind'
15306 quadtype='$quadtype'
15307 randbits='$randbits'
15308 randfunc='$randfunc'
15309 randseedtype='$randseedtype'
15310 ranlib='$ranlib'
15311 rd_nodata='$rd_nodata'
15312 revision='$revision'
15313 rm='$rm'
15314 rmail='$rmail'
15315 runnm='$runnm'
15316 sPRIEldbl='$sPRIEldbl'
15317 sPRIFldbl='$sPRIFldbl'
15318 sPRIGldbl='$sPRIGldbl'
15319 sPRIX64='$sPRIX64'
15320 sPRId64='$sPRId64'
15321 sPRIeldbl='$sPRIeldbl'
15322 sPRIfldbl='$sPRIfldbl'
15323 sPRIgldbl='$sPRIgldbl'
15324 sPRIi64='$sPRIi64'
15325 sPRIo64='$sPRIo64'
15326 sPRIu64='$sPRIu64'
15327 sPRIx64='$sPRIx64'
15328 sched_yield='$sched_yield'
15329 scriptdir='$scriptdir'
15330 scriptdirexp='$scriptdirexp'
15331 sed='$sed'
15332 seedfunc='$seedfunc'
15333 selectminbits='$selectminbits'
15334 selecttype='$selecttype'
15335 sendmail='$sendmail'
15336 sh='$sh'
15337 shar='$shar'
15338 sharpbang='$sharpbang'
15339 shmattype='$shmattype'
15340 shortsize='$shortsize'
15341 shrpenv='$shrpenv'
15342 shsharp='$shsharp'
15343 sig_count='$sig_count'
15344 sig_name='$sig_name'
15345 sig_name_init='$sig_name_init'
15346 sig_num='$sig_num'
15347 sig_num_init='$sig_num_init'
15348 signal_t='$signal_t'
15349 sitearch='$sitearch'
15350 sitearchexp='$sitearchexp'
15351 sitebin='$sitebin'
15352 sitebinexp='$sitebinexp'
15353 sitelib='$sitelib'
15354 sitelibexp='$sitelibexp'
15355 siteprefix='$siteprefix'
15356 siteprefixexp='$siteprefixexp'
15357 sizetype='$sizetype'
15358 sleep='$sleep'
15359 smail='$smail'
15360 small='$small'
15361 so='$so'
15362 sockethdr='$sockethdr'
15363 socketlib='$socketlib'
15364 socksizetype='$socksizetype'
15365 sort='$sort'
15366 spackage='$spackage'
15367 spitshell='$spitshell'
15368 split='$split'
15369 src='$src'
15370 ssizetype='$ssizetype'
15371 startperl='$startperl'
15372 startsh='$startsh'
15373 static_ext='$static_ext'
15374 stdchar='$stdchar'
15375 stdio_base='$stdio_base'
15376 stdio_bufsiz='$stdio_bufsiz'
15377 stdio_cnt='$stdio_cnt'
15378 stdio_filbuf='$stdio_filbuf'
15379 stdio_ptr='$stdio_ptr'
15380 stdio_stream_array='$stdio_stream_array'
15381 strings='$strings'
15382 submit='$submit'
15383 subversion='$subversion'
15384 sysman='$sysman'
15385 tail='$tail'
15386 tar='$tar'
15387 tbl='$tbl'
15388 tee='$tee'
15389 test='$test'
15390 timeincl='$timeincl'
15391 timetype='$timetype'
15392 touch='$touch'
15393 tr='$tr'
15394 trnl='$trnl'
15395 troff='$troff'
15396 u16size='$u16size'
15397 u16type='$u16type'
15398 u32size='$u32size'
15399 u32type='$u32type'
15400 u64size='$u64size'
15401 u64type='$u64type'
15402 u8size='$u8size'
15403 u8type='$u8type'
15404 uidformat='$uidformat'
15405 uidsign='$uidsign'
15406 uidsize='$uidsize'
15407 uidtype='$uidtype'
15408 uname='$uname'
15409 uniq='$uniq'
15410 uquadtype='$uquadtype'
15411 use5005threads='$use5005threads'
15412 use64bits='$use64bits'
15413 usedl='$usedl'
15414 usefull64bits='$usefull64bits'
15415 useithreads='$useithreads'
15416 uselargefiles='$uselargefiles'
15417 uselongdouble='$uselongdouble'
15418 usemorebits='$usemorebits'
15419 usemultiplicity='$usemultiplicity'
15420 usemymalloc='$usemymalloc'
15421 usenm='$usenm'
15422 useopcode='$useopcode'
15423 useperlio='$useperlio'
15424 useposix='$useposix'
15425 usesfio='$usesfio'
15426 useshrplib='$useshrplib'
15427 usesocks='$usesocks'
15428 usethreads='$usethreads'
15429 usevendorprefix='$usevendorprefix'
15430 usevfork='$usevfork'
15431 usrinc='$usrinc'
15432 uuname='$uuname'
15433 uvoformat='$uvoformat'
15434 uvsize='$uvsize'
15435 uvtype='$uvtype'
15436 uvuformat='$uvuformat'
15437 uvxformat='$uvxformat'
15438 vendorbin='$vendorbin'
15439 vendorbinexp='$vendorbinexp'
15440 vendorlib='$vendorlib'
15441 vendorlibexp='$vendorlibexp'
15442 vendorprefix='$vendorprefix'
15443 vendorprefixexp='$vendorprefixexp'
15444 version='$version'
15445 vi='$vi'
15446 voidflags='$voidflags'
15447 xlibpth='$xlibpth'
15448 xs_apiversion='$xs_apiversion'
15449 zcat='$zcat'
15450 zip='$zip'
15451 EOT
15452
15453 : Add in command line options if available
15454 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15455
15456 : add special variables
15457 $test -f $src/patchlevel.h && \
15458 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15459 echo "CONFIGDOTSH=true" >>config.sh
15460
15461 : propagate old symbols
15462 if $test -f UU/config.sh; then
15463         <UU/config.sh sort | uniq >UU/oldconfig.sh
15464         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15465         sort | uniq -u >UU/oldsyms
15466         set X `cat UU/oldsyms`
15467         shift
15468         case $# in
15469         0) ;;
15470         *)
15471                 cat <<EOM
15472 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15473 EOM
15474                 echo "# Variables propagated from previous config.sh file." >>config.sh
15475                 for sym in `cat UU/oldsyms`; do
15476                         echo "    Propagating $hint variable "'$'"$sym..."
15477                         eval 'tmp="$'"${sym}"'"'
15478                         echo "$tmp" | \
15479                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15480                 done
15481                 ;;
15482         esac
15483 fi
15484
15485 : Finish up by extracting the .SH files
15486 case "$alldone" in
15487 exit)
15488         $rm -rf UU
15489         echo "Done."
15490         exit 0
15491         ;;
15492 cont)
15493         ;;
15494 '')
15495         dflt=''
15496         nostick=true
15497         $cat <<EOM
15498
15499 If you'd like to make any changes to the config.sh file before I begin
15500 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15501
15502 EOM
15503         rp="Press return or use a shell escape to edit config.sh:"
15504         . UU/myread
15505         nostick=''
15506         case "$ans" in
15507         '') ;;
15508         *) : in case they cannot read
15509                 sh 1>&4 -c "$ans";;
15510         esac
15511         ;;
15512 esac
15513
15514 : if this fails, just run all the .SH files by hand
15515 . ./config.sh
15516
15517 echo " "
15518 exec 1>&4
15519 . ./UU/extract
15520
15521 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15522         dflt=y
15523         case "$silent" in
15524         true) ;;
15525         *)
15526                 $cat <<EOM
15527
15528 Now you need to generate make dependencies by running "$make depend".
15529 You might prefer to run it in background: "$make depend > makedepend.out &"
15530 It can take a while, so you might not want to run it right now.
15531
15532 EOM
15533                 ;;
15534         esac
15535         rp="Run $make depend now?"
15536         . UU/myread
15537         case "$ans" in
15538         y*)
15539                 $make depend && echo "Now you must run a $make."
15540                 ;;
15541         *)
15542                 echo "You must run '$make depend' then '$make'."
15543                 ;;
15544         esac
15545 elif test -f [Mm]akefile; then
15546         echo " "
15547         echo "Now you must run a $make."
15548 else
15549         echo "Done."
15550 fi
15551
15552 if $test -f Policy.sh; then
15553     $cat <<EOM
15554
15555 If you compile $package on a different machine or from a different object
15556 directory, copy the Policy.sh file from this object directory to the
15557 new one before you run Configure -- this will help you with most of
15558 the policy defaults.
15559
15560 EOM
15561 fi
15562 if $test -f config.msg; then
15563     echo "Hmm.  I also noted the following information while running:"
15564     echo " "
15565     $cat config.msg >&4
15566     $rm -f config.msg
15567 fi
15568 $rm -f kit*isdone ark*isdone
15569 $rm -rf UU
15570
15571 : End of Configure
15572