10e203b01736b8a4cefedbb2b9b0eb1cefde853d
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Nov  8 01:38:53 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d_access=''
312 d_accessx=''
313 d_alarm=''
314 d_attribut=''
315 d_bcmp=''
316 d_bcopy=''
317 d_bzero=''
318 d_casti32=''
319 castflags=''
320 d_castneg=''
321 d_chown=''
322 d_chroot=''
323 d_chsize=''
324 d_closedir=''
325 d_void_closedir=''
326 d_const=''
327 cryptlib=''
328 d_crypt=''
329 d_csh=''
330 full_csh=''
331 d_cuserid=''
332 d_dbl_dig=''
333 d_difftime=''
334 d_dlerror=''
335 d_dlopen=''
336 d_dlsymun=''
337 d_dosuid=''
338 d_suidsafe=''
339 d_drand48proto=''
340 d_dup2=''
341 d_eaccess=''
342 d_endgrent=''
343 d_endhent=''
344 d_endnent=''
345 d_endpent=''
346 d_endpwent=''
347 d_endsent=''
348 d_fchmod=''
349 d_fchown=''
350 d_fcntl=''
351 d_fcntl_can_lock=''
352 d_fd_macros=''
353 d_fd_set=''
354 d_fds_bits=''
355 d_fgetpos=''
356 d_flexfnam=''
357 d_flock=''
358 d_fork=''
359 d_fpos64_t=''
360 d_frexpl=''
361 d_fs_data_s=''
362 d_fseeko=''
363 d_fsetpos=''
364 d_fstatfs=''
365 d_ftello=''
366 d_ftime=''
367 d_gettimeod=''
368 d_Gconvert=''
369 d_getcwd=''
370 d_getespwnam=''
371 d_getfsstat=''
372 d_getgrent=''
373 d_getgrps=''
374 d_gethbyaddr=''
375 d_gethbyname=''
376 d_gethent=''
377 aphostname=''
378 d_gethname=''
379 d_phostname=''
380 d_uname=''
381 d_gethostprotos=''
382 d_getlogin=''
383 d_getmnt=''
384 d_getmntent=''
385 d_getnbyaddr=''
386 d_getnbyname=''
387 d_getnent=''
388 d_getnetprotos=''
389 d_getpent=''
390 d_getpgid=''
391 d_getpgrp2=''
392 d_bsdgetpgrp=''
393 d_getpgrp=''
394 d_getppid=''
395 d_getprior=''
396 d_getpbyname=''
397 d_getpbynumber=''
398 d_getprotoprotos=''
399 d_getprpwnam=''
400 d_getpwent=''
401 d_getsent=''
402 d_getservprotos=''
403 d_getspnam=''
404 d_getsbyname=''
405 d_getsbyport=''
406 d_gnulibc=''
407 d_hasmntopt=''
408 d_htonl=''
409 d_iconv=''
410 d_inetaton=''
411 d_int64_t=''
412 d_isascii=''
413 d_isnan=''
414 d_isnanl=''
415 d_killpg=''
416 d_lchown=''
417 d_ldbl_dig=''
418 d_link=''
419 d_locconv=''
420 d_lockf=''
421 d_longdbl=''
422 longdblsize=''
423 d_longlong=''
424 longlongsize=''
425 d_lseekproto=''
426 d_lstat=''
427 d_madvise=''
428 d_mblen=''
429 d_mbstowcs=''
430 d_mbtowc=''
431 d_memchr=''
432 d_memcmp=''
433 d_memcpy=''
434 d_memmove=''
435 d_memset=''
436 d_mkdir=''
437 d_mkdtemp=''
438 d_mkfifo=''
439 d_mkstemp=''
440 d_mkstemps=''
441 d_mktime=''
442 d_mmap=''
443 mmaptype=''
444 d_modfl=''
445 d_mprotect=''
446 d_msg=''
447 d_msgctl=''
448 d_msgget=''
449 d_msgrcv=''
450 d_msgsnd=''
451 d_msync=''
452 d_munmap=''
453 d_nice=''
454 d_off64_t=''
455 d_open3=''
456 d_fpathconf=''
457 d_pathconf=''
458 d_pause=''
459 d_pipe=''
460 d_poll=''
461 d_portable=''
462 d_old_pthread_create_joinable=''
463 old_pthread_create_joinable=''
464 d_pthread_yield=''
465 d_sched_yield=''
466 sched_yield=''
467 d_qgcvt=''
468 d_readdir=''
469 d_rewinddir=''
470 d_seekdir=''
471 d_telldir=''
472 d_readlink=''
473 d_rename=''
474 d_rmdir=''
475 d_safebcpy=''
476 d_safemcpy=''
477 d_sanemcmp=''
478 d_select=''
479 d_sem=''
480 d_semctl=''
481 d_semget=''
482 d_semop=''
483 d_setegid=''
484 d_seteuid=''
485 d_setgrent=''
486 d_setgrps=''
487 d_sethent=''
488 d_setlinebuf=''
489 d_setlocale=''
490 d_setnent=''
491 d_setpent=''
492 d_setpgid=''
493 d_setpgrp2=''
494 d_bsdsetpgrp=''
495 d_setpgrp=''
496 d_setprior=''
497 d_setproctitle=''
498 d_setpwent=''
499 d_setregid=''
500 d_setresgid=''
501 d_setresuid=''
502 d_setreuid=''
503 d_setrgid=''
504 d_setruid=''
505 d_setsent=''
506 d_setsid=''
507 d_setvbuf=''
508 d_sfio=''
509 usesfio=''
510 d_shm=''
511 d_shmat=''
512 d_shmatprototype=''
513 shmattype=''
514 d_shmctl=''
515 d_shmdt=''
516 d_shmget=''
517 d_sigaction=''
518 d_sigsetjmp=''
519 d_msg_ctrunc=''
520 d_msg_dontroute=''
521 d_msg_oob=''
522 d_msg_peek=''
523 d_msg_proxy=''
524 d_oldsock=''
525 d_scm_rights=''
526 d_socket=''
527 d_sockpair=''
528 sockethdr=''
529 socketlib=''
530 d_socklen_t=''
531 d_socks5_init=''
532 d_sqrtl=''
533 d_statblks=''
534 d_statfs_f_flags=''
535 d_statfs_s=''
536 d_fstatvfs=''
537 d_statvfs=''
538 d_stdio_cnt_lval=''
539 d_stdio_ptr_lval=''
540 d_stdio_ptr_lval_nochange_cnt=''
541 d_stdio_ptr_lval_sets_cnt=''
542 d_stdiobase=''
543 d_stdstdio=''
544 stdio_base=''
545 stdio_bufsiz=''
546 stdio_cnt=''
547 stdio_filbuf=''
548 stdio_ptr=''
549 d_index=''
550 d_strchr=''
551 d_strcoll=''
552 d_strctcpy=''
553 d_strerrm=''
554 d_strerror=''
555 d_sysernlst=''
556 d_syserrlst=''
557 d_strtod=''
558 d_strtol=''
559 d_strtold=''
560 d_strtoll=''
561 d_strtoul=''
562 d_strtoull=''
563 d_strtouq=''
564 d_strxfrm=''
565 d_symlink=''
566 d_syscall=''
567 d_sysconf=''
568 d_system=''
569 d_tcgetpgrp=''
570 d_tcsetpgrp=''
571 d_telldirproto=''
572 d_time=''
573 timetype=''
574 clocktype=''
575 d_times=''
576 d_truncate=''
577 d_tzname=''
578 d_umask=''
579 d_semctl_semid_ds=''
580 d_semctl_semun=''
581 d_union_semun=''
582 d_ustat=''
583 d_vfork=''
584 usevfork=''
585 d_voidsig=''
586 signal_t=''
587 d_volatile=''
588 d_charvspr=''
589 d_vprintf=''
590 d_wait4=''
591 d_waitpid=''
592 d_wcstombs=''
593 d_wctomb=''
594 dlext=''
595 cccdlflags=''
596 ccdlflags=''
597 dlsrc=''
598 ld=''
599 lddlflags=''
600 usedl=''
601 doublesize=''
602 ebcdic=''
603 fflushNULL=''
604 fflushall=''
605 fpossize=''
606 fpostype=''
607 gccosandvers=''
608 gccversion=''
609 gidformat=''
610 gidsign=''
611 gidsize=''
612 gidtype=''
613 groupstype=''
614 h_fcntl=''
615 h_sysfile=''
616 i_arpainet=''
617 db_hashtype=''
618 db_prefixtype=''
619 i_db=''
620 i_dbm=''
621 i_rpcsvcdbm=''
622 d_dirnamlen=''
623 direntrytype=''
624 i_dirent=''
625 i_dld=''
626 i_dlfcn=''
627 i_fcntl=''
628 i_float=''
629 i_gdbm=''
630 d_grpasswd=''
631 i_grp=''
632 i_iconv=''
633 i_ieeefp=''
634 i_inttypes=''
635 i_libutil=''
636 i_limits=''
637 i_locale=''
638 i_machcthr=''
639 i_malloc=''
640 i_math=''
641 i_memory=''
642 i_mntent=''
643 i_ndbm=''
644 i_netdb=''
645 i_neterrno=''
646 i_netinettcp=''
647 i_niin=''
648 i_sysin=''
649 i_poll=''
650 i_prot=''
651 i_pthread=''
652 d_pwage=''
653 d_pwchange=''
654 d_pwclass=''
655 d_pwcomment=''
656 d_pwexpire=''
657 d_pwgecos=''
658 d_pwpasswd=''
659 d_pwquota=''
660 i_pwd=''
661 i_sfio=''
662 i_shadow=''
663 i_socks=''
664 i_stddef=''
665 i_stdlib=''
666 i_string=''
667 strings=''
668 i_sunmath=''
669 i_sysaccess=''
670 i_sysdir=''
671 i_sysfile=''
672 d_voidtty=''
673 i_bsdioctl=''
674 i_sysfilio=''
675 i_sysioctl=''
676 i_syssockio=''
677 i_syslog=''
678 i_sysmman=''
679 i_sysmode=''
680 i_sysmount=''
681 i_sysndir=''
682 i_sysparam=''
683 i_sysresrc=''
684 i_syssecrt=''
685 i_sysselct=''
686 i_sysstat=''
687 i_sysstatfs=''
688 i_sysstatvfs=''
689 i_systimes=''
690 i_systypes=''
691 i_sysuio=''
692 i_sysun=''
693 i_sysutsname=''
694 i_sysvfs=''
695 i_syswait=''
696 i_sgtty=''
697 i_termio=''
698 i_termios=''
699 i_systime=''
700 i_systimek=''
701 i_time=''
702 timeincl=''
703 i_unistd=''
704 i_ustat=''
705 i_utime=''
706 i_values=''
707 i_stdarg=''
708 i_varargs=''
709 i_varhdr=''
710 i_vfork=''
711 inc_version_list=''
712 inc_version_list_init=''
713 installprefix=''
714 installprefixexp=''
715 installstyle=''
716 installusrbinperl=''
717 intsize=''
718 longsize=''
719 shortsize=''
720 libc=''
721 ldlibpthname=''
722 libperl=''
723 shrpenv=''
724 useshrplib=''
725 glibpth=''
726 libpth=''
727 loclibpth=''
728 plibpth=''
729 xlibpth=''
730 ignore_versioned_solibs=''
731 libs=''
732 libsdirs=''
733 libsfiles=''
734 libsfound=''
735 libspath=''
736 lns=''
737 d_PRIEUldbl=''
738 d_PRIFUldbl=''
739 d_PRIGUldbl=''
740 d_PRIeldbl=''
741 d_PRIfldbl=''
742 d_PRIgldbl=''
743 d_SCNfldbl=''
744 sPRIEUldbl=''
745 sPRIFUldbl=''
746 sPRIGUldbl=''
747 sPRIeldbl=''
748 sPRIfldbl=''
749 sPRIgldbl=''
750 sSCNfldbl=''
751 lseeksize=''
752 lseektype=''
753 make_set_make=''
754 d_mymalloc=''
755 freetype=''
756 mallocobj=''
757 mallocsrc=''
758 malloctype=''
759 usemymalloc=''
760 installman1dir=''
761 man1dir=''
762 man1direxp=''
763 man1ext=''
764 installman3dir=''
765 man3dir=''
766 man3direxp=''
767 man3ext=''
768 modetype=''
769 multiarch=''
770 mydomain=''
771 myhostname=''
772 phostname=''
773 c=''
774 n=''
775 d_eofnblk=''
776 eagain=''
777 o_nonblock=''
778 rd_nodata=''
779 netdb_hlen_type=''
780 netdb_host_type=''
781 netdb_name_type=''
782 netdb_net_type=''
783 groupcat=''
784 hostcat=''
785 passcat=''
786 orderlib=''
787 ranlib=''
788 d_perl_otherlibdirs=''
789 otherlibdirs=''
790 package=''
791 spackage=''
792 pager=''
793 api_revision=''
794 api_subversion=''
795 api_version=''
796 api_versionstring=''
797 patchlevel=''
798 revision=''
799 subversion=''
800 version=''
801 perl5=''
802 perladmin=''
803 perlpath=''
804 d_nv_preserves_uv=''
805 d_nv_preserves_uv_bits=''
806 i16size=''
807 i16type=''
808 i32size=''
809 i32type=''
810 i64size=''
811 i64type=''
812 i8size=''
813 i8type=''
814 ivsize=''
815 ivtype=''
816 nvsize=''
817 nvtype=''
818 u16size=''
819 u16type=''
820 u32size=''
821 u32type=''
822 u64size=''
823 u64type=''
824 u8size=''
825 u8type=''
826 uvsize=''
827 uvtype=''
828 ivdformat=''
829 nvEUformat=''
830 nvFUformat=''
831 nvGUformat=''
832 nveformat=''
833 nvfformat=''
834 nvgformat=''
835 uvXUformat=''
836 uvoformat=''
837 uvuformat=''
838 uvxformat=''
839 pidtype=''
840 prefix=''
841 prefixexp=''
842 installprivlib=''
843 privlib=''
844 privlibexp=''
845 prototype=''
846 ptrsize=''
847 d_PRIXU64=''
848 d_PRId64=''
849 d_PRIi64=''
850 d_PRIo64=''
851 d_PRIu64=''
852 d_PRIx64=''
853 sPRIXU64=''
854 sPRId64=''
855 sPRIi64=''
856 sPRIo64=''
857 sPRIu64=''
858 sPRIx64=''
859 d_quad=''
860 quadkind=''
861 quadtype=''
862 uquadtype=''
863 drand01=''
864 randbits=''
865 randfunc=''
866 randseedtype=''
867 seedfunc=''
868 installscript=''
869 scriptdir=''
870 scriptdirexp=''
871 selectminbits=''
872 selecttype=''
873 sh=''
874 sig_count=''
875 sig_name=''
876 sig_name_init=''
877 sig_num=''
878 sig_num_init=''
879 installsitearch=''
880 sitearch=''
881 sitearchexp=''
882 installsitebin=''
883 sitebin=''
884 sitebinexp=''
885 installsitelib=''
886 sitelib=''
887 sitelib_stem=''
888 sitelibexp=''
889 siteprefix=''
890 siteprefixexp=''
891 sizesize=''
892 sizetype=''
893 so=''
894 socksizetype=''
895 sharpbang=''
896 shsharp=''
897 spitshell=''
898 src=''
899 ssizetype=''
900 startperl=''
901 startsh=''
902 stdchar=''
903 d_stdio_stream_array=''
904 stdio_stream_array=''
905 sysman=''
906 trnl=''
907 uidformat=''
908 uidsign=''
909 uidsize=''
910 uidtype=''
911 archname64=''
912 use64bitall=''
913 use64bitint=''
914 ccflags_uselargefiles=''
915 ldflags_uselargefiles=''
916 libswanted_uselargefiles=''
917 uselargefiles=''
918 uselongdouble=''
919 usemorebits=''
920 usemultiplicity=''
921 nm_opt=''
922 nm_so_opt=''
923 runnm=''
924 usenm=''
925 useperlio=''
926 usesocks=''
927 d_oldpthreads=''
928 use5005threads=''
929 useithreads=''
930 usethreads=''
931 incpath=''
932 mips_type=''
933 usrinc=''
934 d_vendorarch=''
935 installvendorarch=''
936 vendorarch=''
937 vendorarchexp=''
938 d_vendorbin=''
939 installvendorbin=''
940 vendorbin=''
941 vendorbinexp=''
942 d_vendorlib=''
943 installvendorlib=''
944 vendorlib=''
945 vendorlib_stem=''
946 vendorlibexp=''
947 usevendorprefix=''
948 vendorprefix=''
949 vendorprefixexp=''
950 versiononly=''
951 defvoidused=''
952 voidflags=''
953 pm_apiversion=''
954 xs_apiversion=''
955 CONFIG=''
956
957 define='define'
958 undef='undef'
959 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
960 rmlist=''
961
962 : We must find out about Eunice early
963 eunicefix=':'
964 if test -f /etc/unixtovms; then
965         eunicefix=/etc/unixtovms
966 fi
967 if test -f /etc/unixtovms.exe; then
968         eunicefix=/etc/unixtovms.exe
969 fi
970
971 i_whoami=''
972 ccname=''
973 ccversion=''
974 perllibs=''
975 : set useposix=false in your hint file to disable the POSIX extension.
976 useposix=true
977 : set useopcode=false in your hint file to disable the Opcode extension.
978 useopcode=true
979 : Trailing extension.  Override this in a hint file, if needed.
980 _exe=''
981 : Extra object files, if any, needed on this platform.
982 archobjs=''
983 archname=''
984 : Possible local include directories to search.
985 : Set locincpth to "" in a hint file to defeat local include searches.
986 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
987 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
988 :
989 : no include file wanted by default
990 inclwanted=''
991
992 groupstype=''
993 : change the next line if compiling for Xenix/286 on Xenix/386
994 xlibpth='/usr/lib/386 /lib/386'
995 : Possible local library directories to search.
996 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
997 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
998
999 : general looking path for locating libraries
1000 glibpth="/lib /usr/lib $xlibpth"
1001 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1002 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1003 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1004
1005 : Private path used by Configure to find libraries.  Its value
1006 : is prepended to libpth. This variable takes care of special
1007 : machines, like the mips.  Usually, it should be empty.
1008 plibpth=''
1009
1010 : default library list
1011 libswanted=''
1012 : some systems want to use only the non-versioned libso:s
1013 ignore_versioned_solibs=''
1014 archname64=''
1015 ccflags_uselargefiles=''
1016 ldflags_uselargefiles=''
1017 libswanted_uselargefiles=''
1018 : set usemultiplicity on the Configure command line to enable multiplicity.
1019 : set usesocks on the Configure command line to enable socks.
1020 : set usethreads on the Configure command line to enable threads.
1021 : full support for void wanted by default
1022 defvoidused=15
1023
1024 : List of libraries we want.
1025 : If anyone needs -lnet, put it in a hint file.
1026 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1027 libswanted="$libswanted dld ld sun m c cposix posix"
1028 libswanted="$libswanted ndir dir crypt sec"
1029 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1030 : We probably want to search /usr/shlib before most other libraries.
1031 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1032 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1033 glibpth="/usr/shlib $glibpth"
1034 : Do not use vfork unless overridden by a hint file.
1035 usevfork=false
1036
1037 : Find the basic shell for Bourne shell scripts
1038 case "$sh" in
1039 '')
1040         case "$SYSTYPE" in
1041         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1042         *) xxx='/bin/sh';;
1043         esac
1044         if test -f "$xxx"; then
1045                 sh="$xxx"
1046         else
1047                 : Build up a list and do a single loop so we can 'break' out.
1048                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1049                 for xxx in sh bash ksh pdksh ash; do
1050                         for p in $pth; do
1051                                 try="$try ${p}/${xxx}"
1052                         done
1053                 done
1054                 for xxx in $try; do
1055                         if test -f "$xxx"; then
1056                                 sh="$xxx";
1057                                 break
1058                         elif test -f "$xxx.exe"; then
1059                                 sh="$xxx";
1060                                 break
1061                         fi
1062                 done
1063         fi
1064         ;;
1065 esac
1066
1067 case "$sh" in
1068 '')     cat <<EOM >&2
1069 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1070
1071 Usually it's in /bin/sh.  How did you even get this far?
1072 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1073 we'll try to straighten this all out.
1074 EOM
1075         exit 1
1076         ;;
1077 esac
1078
1079 : see if sh knows # comments
1080 if `$sh -c '#' >/dev/null 2>&1`; then
1081         shsharp=true
1082         spitshell=cat
1083         xcat=/bin/cat
1084         test -f $xcat || xcat=/usr/bin/cat
1085         echo "#!$xcat" >try
1086         $eunicefix try
1087         chmod +x try
1088         ./try > today
1089         if test -s today; then
1090                 sharpbang='#!'
1091         else
1092                 echo "#! $xcat" > try
1093                 $eunicefix try
1094                 chmod +x try
1095                 ./try > today
1096                 if test -s today; then
1097                         sharpbang='#! '
1098                 else
1099                         sharpbang=': use '
1100                 fi
1101         fi
1102 else
1103         echo " "
1104         echo "Your $sh doesn't grok # comments--I will strip them later on."
1105         shsharp=false
1106         cd ..
1107         echo "exec grep -v '^[  ]*#'" >spitshell
1108         chmod +x spitshell
1109         $eunicefix spitshell
1110         spitshell=`pwd`/spitshell
1111         cd UU
1112         echo "I presume that if # doesn't work, #! won't work either!"
1113         sharpbang=': use '
1114 fi
1115 rm -f try today
1116
1117 : figure out how to guarantee sh startup
1118 case "$startsh" in
1119 '') startsh=${sharpbang}${sh} ;;
1120 *)
1121 esac
1122 cat >try <<EOSS
1123 $startsh
1124 set abc
1125 test "$?abc" != 1
1126 EOSS
1127
1128 chmod +x try
1129 $eunicefix try
1130 if ./try; then
1131         : echo "Yup, it does."
1132 else
1133         echo "Hmm... '$startsh' does not guarantee sh startup..."
1134         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1135 fi
1136 rm -f try
1137
1138
1139 : Save command line options in file UU/cmdline.opt for later use in
1140 : generating config.sh.
1141 cat > cmdline.opt <<EOSH
1142 # Configure command line arguments.
1143 config_arg0='$0'
1144 config_args='$*'
1145 config_argc=$#
1146 EOSH
1147 argn=1
1148 for arg in "$@"; do
1149         cat >>cmdline.opt <<EOSH
1150 config_arg$argn='$arg'
1151 EOSH
1152         argn=`expr $argn + 1`
1153 done
1154
1155 : produce awk script to parse command line options
1156 cat >options.awk <<'EOF'
1157 BEGIN {
1158         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1159
1160         len = length(optstr);
1161         for (i = 1; i <= len; i++) {
1162                 c = substr(optstr, i, 1);
1163                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1164                 if (a == ":") {
1165                         arg[c] = 1;
1166                         i++;
1167                 }
1168                 opt[c] = 1;
1169         }
1170 }
1171 {
1172         expect = 0;
1173         str = $0;
1174         if (substr(str, 1, 1) != "-") {
1175                 printf("'%s'\n", str);
1176                 next;
1177         }
1178         len = length($0);
1179         for (i = 2; i <= len; i++) {
1180                 c = substr(str, i, 1);
1181                 if (!opt[c]) {
1182                         printf("-%s\n", substr(str, i));
1183                         next;
1184                 }
1185                 printf("-%s\n", c);
1186                 if (arg[c]) {
1187                         if (i < len)
1188                                 printf("'%s'\n", substr(str, i + 1));
1189                         else
1190                                 expect = 1;
1191                         next;
1192                 }
1193         }
1194 }
1195 END {
1196         if (expect)
1197                 print "?";
1198 }
1199 EOF
1200
1201 : process the command line options
1202 set X `for arg in "$@"; do echo "X$arg"; done |
1203         sed -e s/X// | awk -f options.awk`
1204 eval "set $*"
1205 shift
1206 rm -f options.awk
1207
1208 : set up default values
1209 fastread=''
1210 reuseval=false
1211 config_sh=''
1212 alldone=''
1213 error=''
1214 silent=''
1215 extractsh=''
1216 override=''
1217 knowitall=''
1218 rm -f optdef.sh posthint.sh
1219 cat >optdef.sh <<EOS
1220 $startsh
1221 EOS
1222
1223
1224 : option parsing
1225 while test $# -gt 0; do
1226         case "$1" in
1227         -d) shift; fastread=yes;;
1228         -e) shift; alldone=cont;;
1229         -f)
1230                 shift
1231                 cd ..
1232                 if test -r "$1"; then
1233                         config_sh="$1"
1234                 else
1235                         echo "$me: cannot read config file $1." >&2
1236                         error=true
1237                 fi
1238                 cd UU
1239                 shift;;
1240         -h) shift; error=true;;
1241         -r) shift; reuseval=true;;
1242         -s) shift; silent=true; realsilent=true;;
1243         -E) shift; alldone=exit;;
1244         -K) shift; knowitall=true;;
1245         -O) shift; override=true;;
1246         -S) shift; silent=true; extractsh=true;;
1247         -D)
1248                 shift
1249                 case "$1" in
1250                 *=)
1251                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1252                         echo "$me: ignoring -D $1" >&2
1253                         ;;
1254                 *=*) echo "$1" | \
1255                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1256                 *) echo "$1='define'" >> optdef.sh;;
1257                 esac
1258                 shift
1259                 ;;
1260         -U)
1261                 shift
1262                 case "$1" in
1263                 *=) echo "$1" >> optdef.sh;;
1264                 *=*)
1265                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1266                         echo "$me: ignoring -U $1" >&2
1267                         ;;
1268                 *) echo "$1='undef'" >> optdef.sh;;
1269                 esac
1270                 shift
1271                 ;;
1272         -A)
1273             shift
1274             xxx=''
1275             yyy="$1"
1276             zzz=''
1277             uuu=undef
1278             case "$yyy" in
1279             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1280                  case "$zzz" in
1281                  *:*) zzz='' ;;
1282                  *)   xxx=append
1283                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1284                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1285                  esac
1286                  ;;
1287             esac
1288             case "$xxx" in
1289             '')  case "$yyy" in
1290                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1291                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1292                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1293                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1294                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1295                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1296                  esac
1297                  ;;       
1298             esac
1299             case "$xxx" in
1300             append)
1301                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1302             clear)
1303                 echo "$yyy=''"                  >> posthint.sh ;;
1304             define)
1305                 case "$zzz" in
1306                 '') zzz=define ;;
1307                 esac
1308                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1309             eval)
1310                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1311             prepend)
1312                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1313             undef)
1314                 case "$zzz" in
1315                 '') zzz="$uuu" ;;
1316                 esac
1317                 echo "$yyy=$zzz"                >> posthint.sh ;;
1318             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1319             esac
1320             shift
1321             ;;
1322         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1323             exit 0;;
1324         --) break;;
1325         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1326         *) break;;
1327         esac
1328 done
1329
1330 case "$error" in
1331 true)
1332         cat >&2 <<EOM
1333 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1334                  [-U symbol] [-U symbol=] [-A command:symbol...]
1335   -d : use defaults for all answers.
1336   -e : go on without questioning past the production of config.sh.
1337   -f : specify an alternate default configuration file.
1338   -h : print this help message and exit (with an error status).
1339   -r : reuse C symbols value if possible (skips costly nm extraction).
1340   -s : silent mode, only echoes questions and essential information.
1341   -D : define symbol to have some value:
1342          -D symbol         symbol gets the value 'define'
1343          -D symbol=value   symbol gets the value 'value'
1344   -E : stop at the end of questions, after having produced config.sh.
1345   -K : do not use unless you know what you are doing.
1346   -O : let -D and -U override definitions from loaded configuration file.
1347   -S : perform variable substitutions on all .SH files (can mix with -f)
1348   -U : undefine symbol:
1349          -U symbol    symbol gets the value 'undef'
1350          -U symbol=   symbol gets completely empty
1351   -A : manipulate symbol after the platform specific hints have been applied:
1352          -A symbol=value                append " "value to symbol
1353          -A append:symbol=value         append value to symbol
1354          -A define:symbol=value         define symbol to have value
1355          -A clear:symbol                define symbol to be ''
1356          -A define:symbol               define symbol to be 'define'
1357          -A eval:symbol=value           define symbol to be eval of value
1358          -A prepend:symbol=value        prepend value to symbol
1359          -A undef:symbol                define symbol to be 'undef'
1360          -A undef:symbol=               define symbol to be ''
1361   -V : print version number and exit (with a zero status).
1362 EOM
1363         exit 1
1364         ;;
1365 esac
1366
1367 : Sanity checks
1368 case "$fastread$alldone" in
1369 yescont|yesexit) ;;
1370 *)
1371         case "$extractsh" in
1372         true) ;;
1373         *)
1374                 if test ! -t 0; then
1375                         echo "Say 'sh Configure', not 'sh <Configure'"
1376                         exit 1
1377                 fi
1378                 ;;
1379         esac
1380         ;;
1381 esac
1382
1383 exec 4>&1
1384 case "$silent" in
1385 true) exec 1>/dev/null;;
1386 esac
1387
1388 : run the defines and the undefines, if any, but leave the file out there...
1389 touch optdef.sh
1390 . ./optdef.sh
1391 : create the posthint manipulation script and leave the file out there...
1392 touch posthint.sh
1393
1394 : set package name
1395 package=perl5
1396 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1397 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1398 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1399 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1400 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1401 esac
1402
1403 : Some greps do not return status, grrr.
1404 echo "grimblepritz" >grimble
1405 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1406         contains=contains
1407 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1408         contains=grep
1409 else
1410         contains=contains
1411 fi
1412 rm -f grimble
1413 : the following should work in any shell
1414 case "$contains" in
1415 contains*)
1416         echo " "
1417         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1418         cat >contains <<'EOSS'
1419 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1420 EOSS
1421 chmod +x contains
1422 esac
1423
1424 : Find the path to the source tree
1425 case "$src" in
1426 '') case "$0" in
1427     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1428          case "$src" in
1429          /*)    ;;
1430          *)     src=`cd ../$src && pwd` ;;
1431          esac
1432          ;;
1433     *)   src='.';;
1434     esac;;
1435 esac
1436 case "$src" in
1437 '')     src=/
1438         rsrc=/
1439         ;;
1440 /*) rsrc="$src";;
1441 *) rsrc="../$src";;
1442 esac
1443 if test -f $rsrc/Configure && \
1444         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1445 then
1446    : found it, so we are ok.
1447 else
1448         rsrc=''
1449         for src in . .. ../.. ../../.. ../../../..; do
1450                 if test -f ../$src/Configure && \
1451                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1452                 then
1453                         rsrc=../$src
1454                         break
1455                 fi
1456         done
1457 fi
1458 case "$rsrc" in
1459 '')
1460         cat <<EOM >&4
1461
1462 Sorry, I can't seem to locate the source dir for $package.  Please start
1463 Configure with an explicit path -- i.e. /some/path/Configure.
1464
1465 EOM
1466         exit 1
1467         ;;
1468 ../.)   rsrc='..';;
1469 *)
1470         echo " "
1471         echo "Sources for $package found in \"$src\"." >&4
1472         ;;
1473 esac
1474
1475 : script used to extract .SH files with variable substitutions
1476 cat >extract <<'EOS'
1477 CONFIGDOTSH=true
1478 echo "Doing variable substitutions on .SH files..."
1479 if test -f $src/MANIFEST; then
1480         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1481 else
1482         echo "(Looking for .SH files under the source directory.)"
1483         set x `(cd $src; find . -name "*.SH" -print)`
1484 fi
1485 shift
1486 case $# in
1487 0) set x `(cd $src; echo *.SH)`; shift;;
1488 esac
1489 if test ! -f $src/$1; then
1490         shift
1491 fi
1492 mkdir_p='
1493 name=$1;
1494 create="";
1495 while test $name; do
1496         if test ! -d "$name"; then
1497                 create="$name $create";
1498                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1499                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1500         else
1501                 name="";
1502         fi;
1503 done;
1504 for file in $create; do
1505         mkdir $file;
1506 done
1507 '
1508 for file in $*; do
1509         case "$src" in
1510         ".")
1511                 case "$file" in
1512                 */*)
1513                         dir=`expr X$file : 'X\(.*\)/'`
1514                         file=`expr X$file : 'X.*/\(.*\)'`
1515                         (cd $dir && . ./$file)
1516                         ;;
1517                 *)
1518                         . ./$file
1519                         ;;
1520                 esac
1521                 ;;
1522         *)
1523                 case "$file" in
1524                 */*)
1525                         dir=`expr X$file : 'X\(.*\)/'`
1526                         file=`expr X$file : 'X.*/\(.*\)'`
1527                         (set x $dir; shift; eval $mkdir_p)
1528                         sh <$src/$dir/$file
1529                         ;;
1530                 *)
1531                         sh <$src/$file
1532                         ;;
1533                 esac
1534                 ;;
1535         esac
1536 done
1537 if test -f $src/config_h.SH; then
1538         if test ! -f config.h; then
1539         : oops, they left it out of MANIFEST, probably, so do it anyway.
1540         . $src/config_h.SH
1541         fi
1542 fi
1543 EOS
1544
1545 : extract files and exit if asked to do so
1546 case "$extractsh" in
1547 true)
1548         case "$realsilent" in
1549         true) ;;
1550         *) exec 1>&4;;
1551         esac
1552         case "$config_sh" in
1553         '') config_sh='config.sh';;
1554         esac
1555         echo " "
1556         echo "Fetching answers from $config_sh..."
1557         cd ..
1558         . $config_sh
1559         test "$override" && . ./optdef.sh
1560         echo " "
1561         . UU/extract
1562         rm -rf UU
1563         echo "Done."
1564         exit 0
1565         ;;
1566 esac
1567
1568 : Eunice requires " " instead of "", can you believe it
1569 echo " "
1570 : Here we go...
1571 echo "Beginning of configuration questions for $package."
1572
1573 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1574
1575 : first determine how to suppress newline on echo command
1576 echo " "
1577 echo "Checking echo to see how to suppress newlines..."
1578 (echo "hi there\c" ; echo " ") >.echotmp
1579 if $contains c .echotmp >/dev/null 2>&1 ; then
1580         echo "...using -n."
1581         n='-n'
1582         c=''
1583 else
1584         cat <<'EOM'
1585 ...using \c
1586 EOM
1587         n=''
1588         c='\c'
1589 fi
1590 echo $n "The star should be here-->$c"
1591 echo '*'
1592 rm -f .echotmp
1593
1594 : Now test for existence of everything in MANIFEST
1595 echo " "
1596 if test -f $rsrc/MANIFEST; then
1597         echo "First let's make sure your kit is complete.  Checking..." >&4
1598         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1599         rm -f missing
1600         tmppwd=`pwd`
1601         for filelist in x??; do
1602                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1603         done
1604         if test -s missing; then
1605                 cat missing >&4
1606                 cat >&4 <<'EOM'
1607
1608 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1609
1610 You have the option of continuing the configuration process, despite the
1611 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1612 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1613 and contact the author (perlbug@perl.org).
1614
1615 EOM
1616                 echo $n "Continue? [n] $c" >&4
1617                 read ans
1618                 case "$ans" in
1619                 y*)
1620                         echo "Continuing..." >&4
1621                         rm -f missing
1622                         ;;
1623                 *)
1624                         echo "ABORTING..." >&4
1625                         kill $$
1626                         ;;
1627                 esac
1628         else
1629                 echo "Looks good..."
1630         fi
1631 else
1632         echo "There is no MANIFEST file.  I hope your kit is complete !"
1633 fi
1634 rm -f missing x??
1635
1636 echo " "
1637 : Find the appropriate value for a newline for tr
1638 if test -n "$DJGPP"; then
1639        trnl='\012'
1640 fi
1641 if test X"$trnl" = X; then
1642         case "`echo foo|tr '\n' x 2>/dev/null`" in
1643         foox) trnl='\n' ;;
1644         esac
1645 fi
1646 if test X"$trnl" = X; then
1647         case "`echo foo|tr '\012' x 2>/dev/null`" in
1648         foox) trnl='\012' ;;
1649         esac
1650 fi
1651 if test X"$trnl" = X; then
1652         cat <<EOM >&2
1653
1654 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1655
1656 EOM
1657         exit 1
1658 fi
1659
1660 : compute the number of columns on the terminal for proper question formatting
1661 case "$COLUMNS" in
1662 '') COLUMNS='80';;
1663 esac
1664
1665 : set up the echo used in my read
1666 myecho="case \"\$xxxm\" in
1667 '') echo $n \"\$rp $c\" >&4;;
1668 *) case \"\$rp\" in
1669         '') echo $n \"[\$xxxm] $c\";;
1670         *)
1671                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1672                         echo \"\$rp\" >&4
1673                         echo $n \"[\$xxxm] $c\" >&4
1674                 else
1675                         echo $n \"\$rp [\$xxxm] $c\" >&4
1676                 fi
1677                 ;;
1678         esac;;
1679 esac"
1680
1681 : now set up to do reads with possible shell escape and default assignment
1682 cat <<EOSC >myread
1683 $startsh
1684 xxxm=\$dflt
1685 $myecho
1686 ans='!'
1687 case "\$fastread" in
1688 yes) case "\$dflt" in
1689         '') ;;
1690         *) ans='';
1691                 case "\$silent-\$rp" in
1692                 true-) ;;
1693                 *) echo " " >&4;;
1694                 esac;;
1695         esac;;
1696 *) case "\$silent" in
1697         true) case "\$rp" in
1698                 '') ans='';;
1699                 esac;;
1700         esac;;
1701 esac
1702 while expr "X\$ans" : "X!" >/dev/null; do
1703         read answ
1704         set x \$xxxm
1705         shift
1706         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1707         case  "\$answ" in
1708         "!")
1709                 sh 1>&4
1710                 echo " "
1711                 $myecho
1712                 ;;
1713         !*)
1714                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1715                 shift
1716                 sh 1>&4 -c "\$*"
1717                 echo " "
1718                 $myecho
1719                 ;;
1720         "\$ans")
1721                 case "\$ans" in
1722                 \\&*)
1723                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1724                         shift
1725                         case "\$1" in
1726                         -d)
1727                                 fastread=yes
1728                                 echo "(OK, I'll run with -d after this question.)" >&4
1729                                 ;;
1730                         -*)
1731                                 echo "*** Sorry, \$1 not supported yet." >&4
1732                                 ;;
1733                         esac
1734                         $myecho
1735                         ans=!
1736                         ;;
1737                 esac;;
1738         *)
1739                 case "\$aok" in
1740                 y)
1741                         echo "*** Substitution done -- please confirm."
1742                         xxxm="\$ans"
1743                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1744                         xxxm="\$ans"
1745                         ans=!
1746                         ;;
1747                 *)
1748                         echo "*** Error -- try again."
1749                         ans=!
1750                         ;;
1751                 esac
1752                 $myecho
1753                 ;;
1754         esac
1755         case "\$ans\$xxxm\$nostick" in
1756         '')
1757                 ans=!
1758                 $myecho
1759                 ;;
1760         esac
1761 done
1762 case "\$ans" in
1763 '') ans="\$xxxm";;
1764 esac
1765 EOSC
1766
1767 : create .config dir to save info across Configure sessions
1768 test -d ../.config || mkdir ../.config
1769 cat >../.config/README <<EOF
1770 This directory created by Configure to save information that should
1771 persist across sessions for $package.
1772
1773 You may safely delete it if you wish.
1774 EOF
1775
1776 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1777 case "$usedevel" in
1778 $define|true|[yY]*) ;;
1779 *) case "$xversion" in
1780    *[13579])
1781         cat >&4 <<EOH
1782 *** WHOA THERE!!! ***
1783
1784     This is an UNSTABLE DEVELOPMENT release.
1785     The version of this $package distribution is $xversion, that is, odd,
1786     (as opposed to even) and that signifies a development release.
1787     If you want a maintenance release, you want an even-numbered version.
1788
1789     Do ***NOT*** install this into production use.
1790     Data corruption and crashes are possible.
1791
1792     It is most seriously suggested that you do not continue any further
1793     unless you want to help in developing and debugging Perl.
1794
1795 EOH
1796         rp='Do you really want to continue?'
1797         dflt='n'
1798         . ./myread
1799         case "$ans" in
1800         [yY]) echo >&4 "Okay, continuing." ;;
1801         *) echo >&4 "Okay, bye."
1802            exit 1
1803            ;;
1804         esac
1805         ;;
1806     esac
1807     ;;
1808 esac
1809
1810 : general instructions
1811 needman=true
1812 firsttime=true
1813 user=`(logname) 2>/dev/null`
1814 case "$user" in
1815 '') user=`whoami 2>&1`;;
1816 esac
1817 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1818         firsttime=false
1819         echo " "
1820         rp='Would you like to see the instructions?'
1821         dflt=n
1822         . ./myread
1823         case "$ans" in
1824         [yY]*) ;;
1825         *) needman=false;;
1826         esac
1827 fi
1828 if $needman; then
1829         cat <<EOH
1830
1831 This installation shell script will examine your system and ask you questions
1832 to determine how the perl5 package should be installed. If you get
1833 stuck on a question, you may use a ! shell escape to start a subshell or
1834 execute a command.  Many of the questions will have default answers in square
1835 brackets; typing carriage return will give you the default.
1836
1837 On some of the questions which ask for file or directory names you are allowed
1838 to use the ~name construct to specify the login directory belonging to "name",
1839 even if you don't have a shell which knows about that.  Questions where this is
1840 allowed will be marked "(~name ok)".
1841
1842 EOH
1843         rp=''
1844         dflt='Type carriage return to continue'
1845         . ./myread
1846         cat <<'EOH'
1847
1848 The prompter used in this script allows you to use shell variables and
1849 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1850 in the default answer, as if the default line was a set of arguments given to a
1851 script shell.  This means you may also use $* to repeat the whole default line,
1852 so you do not have to re-type everything to add something to the default.
1853
1854 Everytime there is a substitution, you will have to confirm.  If there is an
1855 error (e.g. an unmatched backtick), the default answer will remain unchanged
1856 and you will be prompted again.
1857
1858 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1859 the questions and use the computed defaults (or the previous answers if there
1860 was already a config.sh file). Type 'Configure -h' for a list of options.
1861 You may also start interactively and then answer '& -d' at any prompt to turn
1862 on the non-interactive behaviour for the remainder of the execution.
1863
1864 EOH
1865         . ./myread
1866         cat <<EOH
1867
1868 Much effort has been expended to ensure that this shell script will run on any
1869 Unix system.  If despite that it blows up on yours, your best bet is to edit
1870 Configure and run it again.  If you can't run Configure for some reason,
1871 you'll have to generate a config.sh file by hand.  Whatever problems you
1872 have, let me (perlbug@perl.org) know how I blew it.
1873
1874 This installation script affects things in two ways:
1875
1876 1) it may do direct variable substitutions on some of the files included
1877    in this kit.
1878 2) it builds a config.h file for inclusion in C programs.  You may edit
1879    any of these files as the need arises after running this script.
1880
1881 If you make a mistake on a question, there is no easy way to back up to it
1882 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1883 files.  Configure will offer to let you do this before it runs the SH files.
1884
1885 EOH
1886         dflt='Type carriage return to continue'
1887         . ./myread
1888         case "$firsttime" in
1889         true) echo $user >>../.config/instruct;;
1890         esac
1891 fi
1892
1893 : find out where common programs are
1894 echo " "
1895 echo "Locating common programs..." >&4
1896 cat <<EOSC >loc
1897 $startsh
1898 case \$# in
1899 0) exit 1;;
1900 esac
1901 thing=\$1
1902 shift
1903 dflt=\$1
1904 shift
1905 for dir in \$*; do
1906         case "\$thing" in
1907         .)
1908         if test -d \$dir/\$thing; then
1909                 echo \$dir
1910                 exit 0
1911         fi
1912         ;;
1913         *)
1914         for thisthing in \$dir/\$thing; do
1915                 : just loop through to pick last item
1916         done
1917         if test -f \$thisthing; then
1918                 echo \$thisthing
1919                 exit 0
1920         elif test -f \$dir/\$thing.exe; then
1921                 if test -n "$DJGPP"; then
1922                         echo \$dir/\$thing.exe
1923                 else
1924                         : on Eunice apparently
1925                         echo \$dir/\$thing
1926                 fi
1927                 exit 0
1928         fi
1929         ;;
1930         esac
1931 done
1932 echo \$dflt
1933 exit 1
1934 EOSC
1935 chmod +x loc
1936 $eunicefix loc
1937 loclist="
1938 awk
1939 cat
1940 comm
1941 cp
1942 echo
1943 expr
1944 grep
1945 ls
1946 make
1947 mkdir
1948 rm
1949 sed
1950 sort
1951 touch
1952 tr
1953 uniq
1954 "
1955 trylist="
1956 Mcc
1957 ar
1958 byacc
1959 cpp
1960 csh
1961 date
1962 egrep
1963 gzip
1964 less
1965 ln
1966 more
1967 nm
1968 nroff
1969 pg
1970 test
1971 uname
1972 zip
1973 "
1974 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1975 pth="$pth /lib /usr/lib"
1976 for file in $loclist; do
1977         eval xxx=\$$file
1978         case "$xxx" in
1979         /*|?:[\\/]*)
1980                 if test -f "$xxx"; then
1981                         : ok
1982                 else
1983                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1984                         xxx=`./loc $file $file $pth`
1985                 fi
1986                 ;;
1987         '') xxx=`./loc $file $file $pth`;;
1988         *) xxx=`./loc $xxx $xxx $pth`;;
1989         esac
1990         eval $file=$xxx
1991         eval _$file=$xxx
1992         case "$xxx" in
1993         /*)
1994                 echo $file is in $xxx.
1995                 ;;
1996         ?:[\\/]*)
1997                 echo $file is in $xxx.
1998                 ;;
1999         *)
2000                 echo "I don't know where '$file' is, and my life depends on it." >&4
2001                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2002                 exit 1
2003                 ;;
2004         esac
2005 done
2006 echo " "
2007 echo "Don't worry if any of the following aren't found..."
2008 say=offhand
2009 for file in $trylist; do
2010         eval xxx=\$$file
2011         case "$xxx" in
2012         /*|?:[\\/]*)
2013                 if test -f "$xxx"; then
2014                         : ok
2015                 else
2016                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2017                         xxx=`./loc $file $file $pth`
2018                 fi
2019                 ;;
2020         '') xxx=`./loc $file $file $pth`;;
2021         *) xxx=`./loc $xxx $xxx $pth`;;
2022         esac
2023         eval $file=$xxx
2024         eval _$file=$xxx
2025         case "$xxx" in
2026         /*)
2027                 echo $file is in $xxx.
2028                 ;;
2029         ?:[\\/]*)
2030                 echo $file is in $xxx.
2031                 ;;
2032         *)
2033                 echo "I don't see $file out there, $say."
2034                 say=either
2035                 ;;
2036         esac
2037 done
2038 case "$egrep" in
2039 egrep)
2040         echo "Substituting grep for egrep."
2041         egrep=$grep
2042         ;;
2043 esac
2044 case "$ln" in
2045 ln)
2046         echo "Substituting cp for ln."
2047         ln=$cp
2048         ;;
2049 esac
2050 case "$test" in
2051 test)
2052         echo "Hopefully test is built into your sh."
2053         ;;
2054 *)
2055         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2056                 echo "Using the test built into your sh."
2057                 test=test
2058                 _test=test
2059         fi
2060         ;;
2061 esac
2062 case "$echo" in
2063 echo)
2064         echo "Hopefully echo is built into your sh."
2065         ;;
2066 '') ;;
2067 *)
2068         echo " "
2069 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2070         $echo $n "hi there$c" >foo1
2071         echo $n "hi there$c" >foo2
2072         if cmp foo1 foo2 >/dev/null 2>&1; then
2073                 echo "They are compatible.  In fact, they may be identical."
2074         else
2075                 case "$n" in
2076                 '-n') n='' c='\c';;
2077                 *) n='-n' c='';;
2078                 esac
2079                 cat <<FOO
2080 They are not compatible!  You are probably running ksh on a non-USG system.
2081 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2082 have echo built in and we may have to run some Bourne shell scripts.  That
2083 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2084
2085 FOO
2086                 $echo $n "The star should be here-->$c"
2087                 $echo "*"
2088         fi
2089         $rm -f foo1 foo2
2090         ;;
2091 esac
2092
2093 cat <<EOS >checkcc
2094 $startsh
2095 EOS
2096 cat <<'EOSC' >>checkcc
2097 case "$cc" in
2098 '') ;;
2099 *)  $rm -f try try.*
2100     $cat >try.c <<EOM
2101 int main(int argc, char *argv[]) {
2102   return 0;
2103 }
2104 EOM
2105     if $cc -o try $ccflags try.c; then
2106        :
2107     else
2108         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2109         despair=yes
2110         trygcc=yes
2111         case "$cc" in
2112         *gcc*) trygcc=no ;;
2113         esac
2114         case "`$cc -v -c try.c 2>&1`" in
2115         *gcc*) trygcc=no ;;
2116         esac
2117         if $test X"$trygcc" = Xyes; then
2118             if gcc -o try -c try.c; then
2119                 echo " "
2120                 echo "You seem to have a working gcc, though." >&4
2121                 rp="Would you like to use it?"
2122                 dflt=y
2123                 if $test -f myread; then
2124                     . ./myread
2125                 else
2126                     if $test -f UU/myread; then
2127                         . ./UU/myread
2128                     else
2129                         echo "Cannot find myread, sorry.  Aborting." >&2
2130                         exit 1
2131                     fi
2132                 fi  
2133                 case "$ans" in
2134                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2135                 esac
2136             fi
2137         fi
2138         if $test X"$despair" = Xyes; then
2139             $cat >&4 <<EOM
2140 You need to find a working C compiler.
2141 Either (purchase and) install the C compiler supplied by your OS vendor,
2142 or for a free C compiler try http://gcc.gnu.org/
2143 I cannot continue any further, aborting.
2144 EOM
2145             exit 1
2146         fi
2147     fi
2148     $rm -f try try.*
2149     ;;
2150 esac
2151 EOSC
2152
2153 : determine whether symbolic links are supported
2154 echo " "
2155 $touch blurfl
2156 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2157         echo "Symbolic links are supported." >&4
2158         lns="$ln -s"
2159 else
2160         echo "Symbolic links are NOT supported." >&4
2161         lns="$ln"
2162 fi
2163 $rm -f blurfl sym
2164
2165 : see whether [:lower:] and [:upper:] are supported character classes
2166 echo " "
2167 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2168 ABYZ)
2169         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2170         up='[:upper:]'
2171         low='[:lower:]'
2172         ;;
2173 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2174         # (0xc9 and 0xd1), therefore that is a nice testing point.
2175         if test "X$up" = X -o "X$low" = X; then
2176             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2177             ij) up='[A-Z]'
2178                 low='[a-z]'
2179                 ;;
2180             esac
2181         fi
2182         if test "X$up" = X -o "X$low" = X; then
2183             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2184             ij) up='A-Z'
2185                 low='a-z'
2186                 ;;
2187             esac
2188         fi
2189         if test "X$up" = X -o "X$low" = X; then
2190             case "`echo IJ | od -x 2>/dev/null`" in
2191             *C9D1*|*c9d1*)
2192                 echo "Hey, this might be EBCDIC." >&4
2193                 if test "X$up" = X -o "X$low" = X; then
2194                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2195                     ij) up='[A-IJ-RS-Z]'
2196                         low='[a-ij-rs-z]'
2197                         ;;
2198                     esac
2199                 fi
2200                 if test "X$up" = X -o "X$low" = X; then
2201                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2202                     ij) up='A-IJ-RS-Z'
2203                         low='a-ij-rs-z'
2204                         ;;
2205                     esac
2206                 fi
2207                 ;;
2208             esac
2209         fi
2210 esac
2211 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2212 ij)
2213     echo "Using $up and $low to convert case." >&4
2214     ;;
2215 *)
2216     echo "I don't know how to translate letters from upper to lower case." >&4
2217     echo "Your tr is not acting any way I know of." >&4
2218     exit 1
2219     ;;
2220 esac
2221 : set up the translation script tr, must be called with ./tr of course
2222 cat >tr <<EOSC
2223 $startsh
2224 case "\$1\$2" in
2225 '[A-Z][a-z]') exec $tr '$up' '$low';;
2226 '[a-z][A-Z]') exec $tr '$low' '$up';;
2227 esac
2228 exec $tr "\$@"
2229 EOSC
2230 chmod +x tr
2231 $eunicefix tr
2232
2233 : Try to determine whether config.sh was made on this system
2234 case "$config_sh" in
2235 '')
2236 myuname=`$uname -a 2>/dev/null`
2237 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2238 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2239 # because the A-Z/a-z are not consecutive.
2240 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2241         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2242 newmyuname="$myuname"
2243 dflt=n
2244 case "$knowitall" in
2245 '')
2246         if test -f ../config.sh; then
2247                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2248                         eval "`grep myuname= ../config.sh`"
2249                 fi
2250                 if test "X$myuname" = "X$newmyuname"; then
2251                         dflt=y
2252                 fi
2253         fi
2254         ;;
2255 *) dflt=y;;
2256 esac
2257
2258 : Get old answers from old config file if Configure was run on the
2259 : same system, otherwise use the hints.
2260 hint=default
2261 cd ..
2262 if test -f config.sh; then
2263         echo " "
2264         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2265         . UU/myread
2266         case "$ans" in
2267         n*|N*) echo "OK, I'll ignore it."
2268                 mv config.sh config.sh.old
2269                 myuname="$newmyuname"
2270                 ;;
2271         *)  echo "Fetching default answers from your old config.sh file..." >&4
2272                 tmp_n="$n"
2273                 tmp_c="$c"
2274                 tmp_sh="$sh"
2275                 . ./config.sh
2276                 cp config.sh UU
2277                 n="$tmp_n"
2278                 c="$tmp_c"
2279                 : Older versions did not always set $sh.  Catch re-use of such
2280                 : an old config.sh.
2281                 case "$sh" in
2282                 '') sh="$tmp_sh" ;;
2283                 esac
2284                 hint=previous
2285                 ;;
2286         esac
2287 fi
2288 . ./UU/checkcc
2289 if test ! -f config.sh; then
2290         $cat <<EOM
2291
2292 First time through, eh?  I have some defaults handy for some systems
2293 that need some extra help getting the Configure answers right:
2294
2295 EOM
2296         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2297         dflt=''
2298         : Half the following guesses are probably wrong... If you have better
2299         : tests or hints, please send them to perlbug@perl.org
2300         : The metaconfig authors would also appreciate a copy...
2301         $test -f /irix && osname=irix
2302         $test -f /xenix && osname=sco_xenix
2303         $test -f /dynix && osname=dynix
2304         $test -f /dnix && osname=dnix
2305         $test -f /lynx.os && osname=lynxos
2306         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2307         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2308         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2309         $test -f /bin/mips && /bin/mips && osname=mips
2310         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2311                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2312         $test -d /usr/apollo/bin && osname=apollo
2313         $test -f /etc/saf/_sactab && osname=svr4
2314         $test -d /usr/include/minix && osname=minix
2315         if $test -d /MachTen -o -d /MachTen_Folder; then
2316                 osname=machten
2317                 if $test -x /sbin/version; then
2318                         osvers=`/sbin/version | $awk '{print $2}' |
2319                         $sed -e 's/[A-Za-z]$//'`
2320                 elif $test -x /usr/etc/version; then
2321                         osvers=`/usr/etc/version | $awk '{print $2}' |
2322                         $sed -e 's/[A-Za-z]$//'`
2323                 else
2324                         osvers="$2.$3"
2325                 fi
2326         fi
2327
2328         $test -f /sys/posix.dll &&
2329                 $test -f /usr/bin/what &&
2330                 set X `/usr/bin/what /sys/posix.dll` &&
2331                 $test "$3" = UWIN &&
2332                 osname=uwin &&
2333                 osvers="$5"
2334
2335         if $test -f $uname; then
2336                 set X $myuname
2337                 shift
2338
2339                 case "$5" in
2340                 fps*) osname=fps ;;
2341                 mips*)
2342                         case "$4" in
2343                         umips) osname=umips ;;
2344                         *) osname=mips ;;
2345                         esac;;
2346                 [23]100) osname=mips ;;
2347                 next*) osname=next ;;
2348                 i386*)
2349                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2350                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2351                                 osname='sco'
2352                                 osvers=$tmp
2353                         elif $test -f /etc/kconfig; then
2354                                 osname=isc
2355                                 if test "$lns" = "$ln -s"; then
2356                                         osvers=4
2357                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2358                                         osvers=3
2359                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2360                                         osvers=2
2361                                 fi
2362                         fi
2363                         tmp=''
2364                         ;;
2365                 pc*)
2366                         if test -n "$DJGPP"; then
2367                                 osname=dos
2368                                 osvers=djgpp
2369                         fi
2370                         ;;
2371                 esac
2372
2373                 case "$1" in
2374                 aix) osname=aix
2375                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2376                         case "$tmp" in
2377                         'not found') osvers="$4"."$3" ;;
2378                         '<3240'|'<>3240') osvers=3.2.0 ;;
2379                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2380                         '=3250'|'>3250') osvers=3.2.5 ;;
2381                         *) osvers=$tmp;;
2382                         esac
2383                         ;;
2384                 bsd386) osname=bsd386
2385                         osvers=`$uname -r`
2386                         ;;
2387                 cygwin*) osname=cygwin
2388                         osvers="$3"
2389                         ;;
2390                 *dc.osx) osname=dcosx
2391                         osvers="$3"
2392                         ;;
2393                 dnix) osname=dnix
2394                         osvers="$3"
2395                         ;;
2396                 domainos) osname=apollo
2397                         osvers="$3"
2398                         ;;
2399                 dgux) osname=dgux 
2400                         osvers="$3"
2401                         ;;
2402                 dynixptx*) osname=dynixptx
2403                         osvers=`echo "$4"|sed 's/^v//'`
2404                         ;;
2405                 freebsd) osname=freebsd 
2406                         osvers="$3" ;;
2407                 genix) osname=genix ;;
2408                 hp*) osname=hpux 
2409                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2410                         ;;
2411                 irix*) osname=irix
2412                         case "$3" in
2413                         4*) osvers=4 ;;
2414                         5*) osvers=5 ;;
2415                         *)      osvers="$3" ;;
2416                         esac
2417                         ;;
2418                 linux) osname=linux
2419                         case "$3" in
2420                         *)      osvers="$3" ;;
2421                         esac
2422                         ;;
2423                 MiNT) osname=mint
2424                         ;;
2425                 netbsd*) osname=netbsd
2426                         osvers="$3"
2427                         ;;
2428                 news-os) osvers="$3"
2429                         case "$3" in
2430                         4*) osname=newsos4 ;;
2431                         *) osname=newsos ;;
2432                         esac
2433                         ;;
2434                 next*) osname=next ;;
2435                 nonstop-ux) osname=nonstopux ;;
2436                 POSIX-BC | posix-bc ) osname=posix-bc
2437                         osvers="$3"
2438                         ;;
2439                 powerux | power_ux | powermax_os | powermaxos | \
2440                 powerunix | power_unix) osname=powerux
2441                         osvers="$3"
2442                         ;;
2443                 qnx) osname=qnx
2444                         osvers="$4"
2445                         ;;
2446                 solaris) osname=solaris
2447                         case "$3" in
2448                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2449                         *)      osvers="$3" ;;
2450                         esac
2451                         ;;
2452                 sunos) osname=sunos
2453                         case "$3" in
2454                         5*) osname=solaris
2455                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2456                         *)      osvers="$3" ;;
2457                         esac
2458                         ;;
2459                 titanos) osname=titanos
2460                         case "$3" in
2461                         1*) osvers=1 ;;
2462                         2*) osvers=2 ;;
2463                         3*) osvers=3 ;;
2464                         4*) osvers=4 ;;
2465                         *)      osvers="$3" ;;
2466                         esac
2467                         ;;
2468                 ultrix) osname=ultrix
2469                         osvers="$3"
2470                         ;;
2471                 osf1|mls+)      case "$5" in
2472                                 alpha)
2473                                         osname=dec_osf
2474                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2475                                         case "$osvers" in
2476                                         [1-9].[0-9]*) ;;
2477                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2478                                         esac
2479                                         ;;
2480                         hp*)    osname=hp_osf1  ;;
2481                         mips)   osname=mips_osf1 ;;
2482                         esac
2483                         ;;
2484                 unixware) osname=svr5
2485                         osvers="$4"
2486                         ;;
2487                 uts) osname=uts
2488                         osvers="$3"
2489                         ;;
2490                 $2) case "$osname" in
2491                         *isc*) ;;
2492                         *freebsd*) ;;
2493                         svr*)
2494                                 : svr4.x or possibly later
2495                                 case "svr$3" in 
2496                                 ${osname}*)
2497                                         osname=svr$3
2498                                         osvers=$4
2499                                         ;;
2500                                 esac
2501                                 case "$osname" in
2502                                 svr4.0)
2503                                         : Check for ESIX
2504                                         if test -f /stand/boot ; then
2505                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2506                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2507                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2508                                                         if test -n "$isesix"; then
2509                                                                 osname=esix4
2510                                                         fi
2511                                                 fi
2512                                         fi
2513                                         ;;
2514                                 esac
2515                                 ;;
2516                         *)      if test -f /etc/systemid; then
2517                                         osname=sco
2518                                         set `echo $3 | $sed 's/\./ /g'` $4
2519                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2520                                                 osvers=$1.$2.$3
2521                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2522                                                 osvers=$1.$2
2523                                         elif $test -f $src/hints/sco_$1.sh; then
2524                                                 osvers=$1
2525                                         fi
2526                                 else
2527                                         case "$osname" in
2528                                         '') : Still unknown.  Probably a generic Sys V.
2529                                                 osname="sysv"
2530                                                 osvers="$3"
2531                                                 ;;
2532                                         esac
2533                                 fi
2534                                 ;;
2535                         esac
2536                         ;;
2537                 *)      case "$osname" in
2538                         '') : Still unknown.  Probably a generic BSD.
2539                                 osname="$1"
2540                                 osvers="$3"
2541                                 ;;
2542                         esac
2543                         ;;
2544                 esac
2545         else
2546                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2547                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2548                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2549                                 osname=news_os
2550                         fi
2551                         $rm -f UU/kernel.what
2552                 elif test -d c:/.; then
2553                         set X $myuname
2554                         osname=os2
2555                         osvers="$5"
2556                 fi
2557         fi
2558         
2559         : Now look for a hint file osname_osvers, unless one has been
2560         : specified already.
2561         case "$hintfile" in
2562         ''|' ')
2563                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2564                 : Also try without trailing minor version numbers.
2565                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2566                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2567                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2568                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2569                 case "$file" in
2570                 '') dflt=none ;;
2571                 *)  case "$osvers" in
2572                         '') dflt=$file
2573                                 ;;
2574                         *)  if $test -f $src/hints/$file.sh ; then
2575                                         dflt=$file
2576                                 elif $test -f $src/hints/$xfile.sh ; then
2577                                         dflt=$xfile
2578                                 elif $test -f $src/hints/$xxfile.sh ; then
2579                                         dflt=$xxfile
2580                                 elif $test -f $src/hints/$xxxfile.sh ; then
2581                                         dflt=$xxxfile
2582                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2583                                         dflt=$xxxxfile
2584                                 elif $test -f "$src/hints/${osname}.sh" ; then
2585                                         dflt="${osname}"
2586                                 else
2587                                         dflt=none
2588                                 fi
2589                                 ;;
2590                         esac
2591                         ;;
2592                 esac
2593                 if $test -f Policy.sh ; then
2594                         case "$dflt" in
2595                         *Policy*) ;;
2596                         none) dflt="Policy" ;;
2597                         *) dflt="Policy $dflt" ;;
2598                         esac
2599                 fi
2600                 ;;
2601         *)
2602                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2603                 ;;
2604         esac
2605
2606         if $test -f Policy.sh ; then
2607                 $cat <<EOM
2608
2609 There's also a Policy hint file available, which should make the
2610 site-specific (policy) questions easier to answer.
2611 EOM
2612
2613         fi
2614
2615         $cat <<EOM
2616
2617 You may give one or more space-separated answers, or "none" if appropriate.
2618 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2619 is a good thing.  DO NOT give a wrong version or a wrong OS.
2620
2621 EOM
2622
2623         rp="Which of these apply, if any?"
2624         . UU/myread
2625         tans=$ans
2626         for file in $tans; do
2627                 if $test X$file = XPolicy -a -f Policy.sh; then
2628                         . Policy.sh
2629                         $cat Policy.sh >> UU/config.sh
2630                 elif $test -f $src/hints/$file.sh; then
2631                         . $src/hints/$file.sh
2632                         $cat $src/hints/$file.sh >> UU/config.sh
2633                 elif $test X$tans = X -o X$tans = Xnone ; then
2634                         : nothing
2635                 else
2636                         : Give one chance to correct a possible typo.
2637                         echo "$file.sh does not exist"
2638                         dflt=$file
2639                         rp="hint to use instead?"
2640                         . UU/myread
2641                         for file in $ans; do
2642                                 if $test -f "$src/hints/$file.sh"; then
2643                                         . $src/hints/$file.sh
2644                                         $cat $src/hints/$file.sh >> UU/config.sh
2645                                 elif $test X$ans = X -o X$ans = Xnone ; then
2646                                         : nothing
2647                                 else
2648                                         echo "$file.sh does not exist -- ignored."
2649                                 fi
2650                         done
2651                 fi
2652         done
2653
2654         hint=recommended
2655         : Remember our hint file for later.
2656         if $test -f "$src/hints/$file.sh" ; then
2657                 hintfile="$file"
2658         else
2659                 hintfile=''
2660         fi
2661 fi
2662 cd UU
2663 ;;
2664 *)
2665         echo " "
2666         echo "Fetching default answers from $config_sh..." >&4
2667         tmp_n="$n"
2668         tmp_c="$c"
2669         cd ..
2670         cp $config_sh config.sh 2>/dev/null
2671         chmod +w config.sh
2672         . ./config.sh
2673         cd UU
2674         cp ../config.sh .
2675         n="$tmp_n"
2676         c="$tmp_c"
2677         hint=previous
2678         ;;
2679 esac
2680 test "$override" && . ./optdef.sh
2681
2682 : Restore computed paths
2683 for file in $loclist $trylist; do
2684         eval $file="\$_$file"
2685 done
2686
2687 cat << EOM
2688
2689 Configure uses the operating system name and version to set some defaults.
2690 The default value is probably right if the name rings a bell. Otherwise,
2691 since spelling matters for me, either accept the default or answer "none"
2692 to leave it blank.
2693
2694 EOM
2695 case "$osname" in
2696         ''|' ')
2697                 case "$hintfile" in
2698                 ''|' '|none) dflt=none ;;
2699                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2700                 esac
2701                 ;;
2702         *) dflt="$osname" ;;
2703 esac
2704 rp="Operating system name?"
2705 . ./myread
2706 case "$ans" in
2707 none)  osname='' ;;
2708 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2709 esac
2710 echo " "
2711 case "$osvers" in
2712         ''|' ')
2713                 case "$hintfile" in
2714                 ''|' '|none) dflt=none ;;
2715                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2716                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2717                         case "$dflt" in
2718                         ''|' ') dflt=none ;;
2719                         esac
2720                         ;;
2721                 esac
2722                 ;;
2723         *) dflt="$osvers" ;;
2724 esac
2725 rp="Operating system version?"
2726 . ./myread
2727 case "$ans" in
2728 none)  osvers='' ;;
2729 *) osvers="$ans" ;;
2730 esac
2731
2732
2733 . ./posthint.sh
2734
2735 : who configured the system
2736 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2737 cf_by=`(logname) 2>/dev/null`
2738 case "$cf_by" in
2739 "")
2740         cf_by=`(whoami) 2>/dev/null`
2741         case "$cf_by" in
2742         "") cf_by=unknown ;;
2743         esac ;;
2744 esac
2745
2746 : set up the script used to warn in case of inconsistency
2747 cat <<EOS >whoa
2748 $startsh
2749 EOS
2750 cat <<'EOSC' >>whoa
2751 dflt=y
2752 echo " "
2753 echo "*** WHOA THERE!!! ***" >&4
2754 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2755 rp="    Keep the $hint value?"
2756 . ./myread
2757 case "$ans" in
2758 y) td=$was; tu=$was;;
2759 esac
2760 EOSC
2761
2762 : function used to set $1 to $val
2763 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2764 case "$val$was" in
2765 $define$undef) . ./whoa; eval "$var=\$td";;
2766 $undef$define) . ./whoa; eval "$var=\$tu";;
2767 *) eval "$var=$val";;
2768 esac'
2769
2770 case "$usethreads" in
2771 $define|true|[yY]*)     dflt='y';;
2772 *) dflt='n';;
2773 esac
2774 cat <<EOM
2775
2776 Perl can be built to take advantage of threads on some systems.
2777 To do so, Configure can be run with -Dusethreads.
2778
2779 Note that threading is a highly experimental feature, and
2780 some known race conditions still remain.  If you choose to try
2781 it, be very sure to not actually deploy it for production
2782 purposes.  README.threads has more details, and is required
2783 reading if you enable threads.
2784
2785 If this doesn't make any sense to you, just accept the default '$dflt'.
2786 EOM
2787 rp='Build a threading Perl?'
2788 . ./myread
2789 case "$ans" in
2790 y|Y)    val="$define" ;;
2791 *)      val="$undef" ;;
2792 esac
2793 set usethreads
2794 eval $setvar
2795
2796 case "$usethreads" in
2797 $define)
2798         $cat <<EOM
2799
2800 As of 5.5.640, Perl has two different internal threading implementations,
2801 the 5.005 version (5005threads) and an interpreter-based version
2802 (ithreads) that has one interpreter per thread.  Both are very 
2803 experimental.  This arrangement exists to help developers work out
2804 which one is better.
2805
2806 If you're a casual user, you probably don't want interpreter-threads
2807 at this time.  There doesn't yet exist a way to create threads from
2808 within Perl in this model, i.e., "use Thread;" will NOT work.
2809 EOM
2810         : Default to ithreads unless overridden on command line or with
2811         : old config.sh
2812         dflt='y'
2813         case "$use5005threads" in
2814                 $define|true|[yY]*) dflt='n';;
2815         esac
2816         case "$useithreads" in
2817                 $undef|false|[nN]*) dflt='n';;
2818         esac
2819         rp='Use interpreter-based ithreads?'
2820         . ./myread
2821         case "$ans" in
2822         y|Y)    val="$define" ;;
2823         *)      val="$undef" ;;
2824         esac
2825         set useithreads
2826         eval $setvar
2827         : Now set use5005threads to the opposite value.
2828         case "$useithreads" in
2829         $define) val="$undef" ;;
2830         *) val="$define" ;;
2831         esac
2832         set use5005threads
2833         eval $setvar
2834         ;;
2835 *)
2836         useithreads="$undef"
2837         use5005threads="$undef"
2838         ;;
2839 esac
2840
2841 case "$d_oldpthreads" in
2842 '')     : Configure tests would be welcome here.  For now, assume undef.
2843         val="$undef" ;;
2844 *)      val="$d_oldpthreads" ;;
2845 esac
2846 set d_oldpthreads
2847 eval $setvar
2848
2849
2850 case "$usethreads" in
2851 "$define"|true|[yY]*)
2852 : Look for a hint-file generated 'call-back-unit'.  If the
2853 : user has specified that a threading perl is to be built,
2854 : we may need to set or change some other defaults.
2855         if $test -f usethreads.cbu; then
2856                 echo "Your platform has some specific hints for threaded builds, using them..."
2857                 . ./usethreads.cbu
2858         else
2859                 $cat <<EOM
2860 (Your platform doesn't have any specific hints for threaded builds.
2861  Assuming POSIX threads, then.)
2862 EOM
2863         fi
2864         ;;
2865 esac
2866
2867 cat <<EOM
2868
2869 Perl can be built so that multiple Perl interpreters can coexist
2870 within the same Perl executable.
2871 EOM
2872
2873 case "$useithreads" in
2874 $define)
2875         cat <<EOM
2876 This multiple interpreter support is required for interpreter-based threads.
2877 EOM
2878         val="$define"
2879         ;;
2880 *)      case "$usemultiplicity" in
2881         $define|true|[yY]*)     dflt='y';;
2882         *) dflt='n';;
2883         esac
2884         echo " "
2885         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2886         rp='Build Perl for multiplicity?'
2887         . ./myread
2888         case "$ans" in
2889         y|Y)    val="$define" ;;
2890         *)      val="$undef" ;;
2891         esac
2892         ;;
2893 esac
2894 set usemultiplicity
2895 eval $setvar
2896
2897 : make some quick guesses about what we are up against
2898 echo " "
2899 $echo $n "Hmm...  $c"
2900 echo exit 1 >bsd
2901 echo exit 1 >usg
2902 echo exit 1 >v7
2903 echo exit 1 >osf1
2904 echo exit 1 >eunice
2905 echo exit 1 >xenix
2906 echo exit 1 >venix
2907 echo exit 1 >os2
2908 d_bsd="$undef"
2909 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2910 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2911 then
2912         echo "Looks kind of like an OSF/1 system, but we'll see..."
2913         echo exit 0 >osf1
2914 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2915         xxx=`./loc addbib blurfl $pth`
2916         if $test -f $xxx; then
2917         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2918                 echo exit 0 >bsd
2919                 echo exit 0 >usg
2920         else
2921                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2922                         echo "Looks kind of like an extended USG system, but we'll see..."
2923                 else
2924                         echo "Looks kind of like a USG system, but we'll see..."
2925                 fi
2926                 echo exit 0 >usg
2927         fi
2928 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2929         echo "Looks kind of like a BSD system, but we'll see..."
2930         d_bsd="$define"
2931         echo exit 0 >bsd
2932 else
2933         echo "Looks kind of like a Version 7 system, but we'll see..."
2934         echo exit 0 >v7
2935 fi
2936 case "$eunicefix" in
2937 *unixtovms*)
2938         $cat <<'EOI'
2939 There is, however, a strange, musty smell in the air that reminds me of
2940 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2941 EOI
2942         echo exit 0 >eunice
2943         d_eunice="$define"
2944 : it so happens the Eunice I know will not run shell scripts in Unix format
2945         ;;
2946 *)
2947         echo " "
2948         echo "Congratulations.  You aren't running Eunice."
2949         d_eunice="$undef"
2950         ;;
2951 esac
2952 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2953 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2954 : semicolon as a patch separator
2955 case "$p_" in
2956 :) ;;
2957 *)
2958         $cat <<'EOI'
2959 I have the feeling something is not exactly right, however...don't tell me...
2960 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2961 (Or you may be running DOS with DJGPP.)
2962 EOI
2963         echo exit 0 >os2
2964         ;;
2965 esac
2966 if test -f /xenix; then
2967         echo "Actually, this looks more like a XENIX system..."
2968         echo exit 0 >xenix
2969         d_xenix="$define"
2970 else
2971         echo " "
2972         echo "It's not Xenix..."
2973         d_xenix="$undef"
2974 fi
2975 chmod +x xenix
2976 $eunicefix xenix
2977 if test -f /venix; then
2978         echo "Actually, this looks more like a VENIX system..."
2979         echo exit 0 >venix
2980 else
2981         echo " "
2982         if ./xenix; then
2983                 : null
2984         else
2985                 echo "Nor is it Venix..."
2986         fi
2987 fi
2988 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2989 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2990 $rm -f foo
2991
2992 case "$cc" in
2993 '') dflt=cc;;
2994 *) dflt="$cc";;
2995 esac
2996 rp="Use which C compiler?"
2997 . ./myread
2998 cc="$ans"
2999 : Look for a hint-file generated 'call-back-unit'.  Now that the
3000 : user has specified the compiler, we may need to set or change some
3001 : other defaults.
3002 if $test -f cc.cbu; then
3003     . ./cc.cbu
3004 fi
3005 . ./checkcc
3006
3007 echo " "
3008 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3009 $cat >gccvers.c <<EOM
3010 #include <stdio.h>
3011 int main() {
3012 #ifdef __GNUC__
3013 #ifdef __VERSION__
3014         printf("%s\n", __VERSION__);
3015 #else
3016         printf("%s\n", "1");
3017 #endif
3018 #endif
3019         exit(0);
3020 }
3021 EOM
3022 if $cc -o gccvers $ldflags gccvers.c; then
3023         gccversion=`./gccvers`
3024         case "$gccversion" in
3025         '') echo "You are not using GNU cc." ;;
3026         *)  echo "You are using GNU cc $gccversion."
3027             ccname=gcc  
3028             ;;
3029         esac
3030 else
3031         echo " "
3032         echo "*** WHOA THERE!!! ***" >&4
3033         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3034         case "$knowitall" in
3035         '')
3036         echo "    You'd better start hunting for one and let me know about it." >&4
3037                 exit 1
3038                 ;;
3039         esac
3040 fi
3041 $rm -f gccvers*
3042 case "$gccversion" in
3043 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3044 esac
3045 case "$gccversion" in
3046 '') gccosandvers='' ;;
3047 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3048    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3049    gccshortvers=''
3050    case "$gccosandvers" in
3051    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3052    $osname$osvers) ;; # looking good
3053    $osname*) cat <<EOM >&4
3054
3055 *** WHOA THERE!!! ***
3056
3057     Your gcc has not been compiled for the exact release of
3058     your operating system ($gccosandvers versus $osname$osvers).
3059
3060     In general it is a good idea to keep gcc synchronized with
3061     the operating system because otherwise serious problems
3062     may ensue when trying to compile software, like Perl.
3063
3064     I'm trying to be optimistic here, though, and will continue.
3065     If later during the configuration and build icky compilation
3066     problems appear (headerfile conflicts being the most common
3067     manifestation), I suggest reinstalling the gcc to match
3068     your operating system release.
3069
3070 EOM
3071       ;;
3072    *) gccosandvers='' ;; # failed to parse, better be silent
3073    esac
3074    ;;
3075 esac
3076 case "$ccname" in
3077 '') ccname="$cc" ;;
3078 esac
3079
3080 : see how we invoke the C preprocessor
3081 echo " "
3082 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3083 cat <<'EOT' >testcpp.c
3084 #define ABC abc
3085 #define XYZ xyz
3086 ABC.XYZ
3087 EOT
3088 cd ..
3089 if test ! -f cppstdin; then
3090         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3091                 # AIX cc -E doesn't show the absolute headerfile
3092                 # locations but we'll cheat by using the -M flag.
3093                 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
3094         else
3095                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3096         fi
3097 else
3098         echo "Keeping your $hint cppstdin wrapper."
3099 fi
3100 chmod 755 cppstdin
3101 wrapper=`pwd`/cppstdin
3102 ok='false'
3103 cd UU
3104
3105 if $test "X$cppstdin" != "X" && \
3106         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3107         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3108 then
3109         echo "You used to use $cppstdin $cppminus so we'll use that again."
3110         case "$cpprun" in
3111         '') echo "But let's see if we can live without a wrapper..." ;;
3112         *)
3113                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3114                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3115                 then
3116                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3117                         ok='true'
3118                 else
3119                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3120                 fi
3121                 ;;
3122         esac
3123 else
3124         case "$cppstdin" in
3125         '') ;;
3126         *)
3127                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3128                 ;;
3129         esac
3130 fi
3131
3132 if $ok; then
3133         : nothing
3134 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3135         $cc -E <testcpp.c >testcpp.out 2>&1; \
3136         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3137         echo "Yup, it does."
3138         x_cpp="$cc -E"
3139         x_minus='';
3140 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3141         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3142         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3143         echo "Yup, it does."
3144         x_cpp="$cc -E"
3145         x_minus='-';
3146 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3147         $cc -P <testcpp.c >testcpp.out 2>&1; \
3148         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3149         echo "Yipee, that works!"
3150         x_cpp="$cc -P"
3151         x_minus='';
3152 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3153         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3154         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3155         echo "At long last!"
3156         x_cpp="$cc -P"
3157         x_minus='-';
3158 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3159         $cpp <testcpp.c >testcpp.out 2>&1; \
3160         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3161         echo "It works!"
3162         x_cpp="$cpp"
3163         x_minus='';
3164 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3165         $cpp - <testcpp.c >testcpp.out 2>&1; \
3166         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3167         echo "Hooray, it works!  I was beginning to wonder."
3168         x_cpp="$cpp"
3169         x_minus='-';
3170 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3171         $wrapper <testcpp.c >testcpp.out 2>&1; \
3172         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3173         x_cpp="$wrapper"
3174         x_minus=''
3175         echo "Eureka!"
3176 else
3177         dflt=''
3178         rp="No dice.  I can't find a C preprocessor.  Name one:"
3179         . ./myread
3180         x_cpp="$ans"
3181         x_minus=''
3182         $x_cpp <testcpp.c >testcpp.out 2>&1
3183         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3184                 echo "OK, that will do." >&4
3185         else
3186 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3187                 exit 1
3188         fi
3189 fi
3190
3191 case "$ok" in
3192 false)
3193         cppstdin="$x_cpp"
3194         cppminus="$x_minus"
3195         cpprun="$x_cpp"
3196         cpplast="$x_minus"
3197         set X $x_cpp
3198         shift
3199         case "$1" in
3200         "$cpp")
3201                 echo "Perhaps can we force $cc -E using a wrapper..."
3202                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3203                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3204                 then
3205                         echo "Yup, we can."
3206                         cppstdin="$wrapper"
3207                         cppminus='';
3208                 else
3209                         echo "Nope, we'll have to live without it..."
3210                 fi
3211                 ;;
3212         esac
3213         case "$cpprun" in
3214         "$wrapper")
3215                 cpprun=''
3216                 cpplast=''
3217                 ;;
3218         esac
3219         ;;
3220 esac
3221
3222 case "$cppstdin" in
3223 "$wrapper"|'cppstdin') ;;
3224 *) $rm -f $wrapper;;
3225 esac
3226 $rm -f testcpp.c testcpp.out
3227
3228 : decide how portable to be.  Allow command line overrides.
3229 case "$d_portable" in
3230 "$undef") ;;
3231 *)      d_portable="$define" ;;
3232 esac
3233
3234 : set up shell script to do ~ expansion
3235 cat >filexp <<EOSS
3236 $startsh
3237 : expand filename
3238 case "\$1" in
3239  ~/*|~)
3240         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3241         ;;
3242  ~*)
3243         if $test -f /bin/csh; then
3244                 /bin/csh -f -c "glob \$1"
3245                 failed=\$?
3246                 echo ""
3247                 exit \$failed
3248         else
3249                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3250                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3251                 if $test ! -d "\$dir"; then
3252                         me=\`basename \$0\`
3253                         echo "\$me: can't locate home directory for: \$name" >&2
3254                         exit 1
3255                 fi
3256                 case "\$1" in
3257                 */*)
3258                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3259                         ;;
3260                 *)
3261                         echo \$dir
3262                         ;;
3263                 esac
3264         fi
3265         ;;
3266 *)
3267         echo \$1
3268         ;;
3269 esac
3270 EOSS
3271 chmod +x filexp
3272 $eunicefix filexp
3273
3274 : now set up to get a file name
3275 cat <<EOS >getfile
3276 $startsh
3277 EOS
3278 cat <<'EOSC' >>getfile
3279 tilde=''
3280 fullpath=''
3281 already=''
3282 skip=''
3283 none_ok=''
3284 exp_file=''
3285 nopath_ok=''
3286 orig_rp="$rp"
3287 orig_dflt="$dflt"
3288 case "$gfpth" in
3289 '') gfpth='.' ;;
3290 esac
3291
3292 case "$fn" in
3293 *\(*)
3294         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3295         fn=`echo $fn | sed 's/(.*)//'`
3296         ;;
3297 esac
3298
3299 case "$fn" in
3300 *:*)
3301         loc_file=`expr $fn : '.*:\(.*\)'`
3302         fn=`expr $fn : '\(.*\):.*'`
3303         ;;
3304 esac
3305
3306 case "$fn" in
3307 *~*) tilde=true;;
3308 esac
3309 case "$fn" in
3310 */*) fullpath=true;;
3311 esac
3312 case "$fn" in
3313 *+*) skip=true;;
3314 esac
3315 case "$fn" in
3316 *n*) none_ok=true;;
3317 esac
3318 case "$fn" in
3319 *e*) exp_file=true;;
3320 esac
3321 case "$fn" in
3322 *p*) nopath_ok=true;;
3323 esac
3324
3325 case "$fn" in
3326 *f*) type='File';;
3327 *d*) type='Directory';;
3328 *l*) type='Locate';;
3329 esac
3330
3331 what="$type"
3332 case "$what" in
3333 Locate) what='File';;
3334 esac
3335
3336 case "$exp_file" in
3337 '')
3338         case "$d_portable" in
3339         "$define") ;;
3340         *) exp_file=true;;
3341         esac
3342         ;;
3343 esac
3344
3345 cd ..
3346 while test "$type"; do
3347         redo=''
3348         rp="$orig_rp"
3349         dflt="$orig_dflt"
3350         case "$tilde" in
3351         true) rp="$rp (~name ok)";;
3352         esac
3353         . UU/myread
3354         if test -f UU/getfile.ok && \
3355                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3356         then
3357                 value="$ans"
3358                 ansexp="$ans"
3359                 break
3360         fi
3361         case "$ans" in
3362         none)
3363                 value=''
3364                 ansexp=''
3365                 case "$none_ok" in
3366                 true) type='';;
3367                 esac
3368                 ;;
3369         *)
3370                 case "$tilde" in
3371                 '') value="$ans"
3372                         ansexp="$ans";;
3373                 *)
3374                         value=`UU/filexp $ans`
3375                         case $? in
3376                         0)
3377                                 if test "$ans" != "$value"; then
3378                                         echo "(That expands to $value on this system.)"
3379                                 fi
3380                                 ;;
3381                         *) value="$ans";;
3382                         esac
3383                         ansexp="$value"
3384                         case "$exp_file" in
3385                         '') value="$ans";;
3386                         esac
3387                         ;;
3388                 esac
3389                 case "$fullpath" in
3390                 true)
3391                         case "$ansexp" in
3392                         /*) value="$ansexp" ;;
3393                         [a-zA-Z]:/*) value="$ansexp" ;;
3394                         *)
3395                                 redo=true
3396                                 case "$already" in
3397                                 true)
3398                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3399                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3400                                         ;;
3401                                 *)
3402                                 echo "Please give a full path name, starting with slash." >&4
3403                                         case "$tilde" in
3404                                         true)
3405                                 echo "Note that using ~name is ok provided it expands well." >&4
3406                                                 already=true
3407                                                 ;;
3408                                         esac
3409                                 esac
3410                                 ;;
3411                         esac
3412                         ;;
3413                 esac
3414                 case "$redo" in
3415                 '')
3416                         case "$type" in
3417                         File)
3418                                 for fp in $gfpth; do
3419                                         if test "X$fp" = X.; then
3420                                             pf="$ansexp"
3421                                         else    
3422                                             pf="$fp/$ansexp"
3423                                         fi
3424                                         if test -f "$pf"; then
3425                                                 type=''
3426                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3427                                         then
3428                                                 echo "($value is not a plain file, but that's ok.)"
3429                                                 type=''
3430                                         fi
3431                                         if test X"$type" = X; then
3432                                             value="$pf"
3433                                             break
3434                                         fi
3435                                 done
3436                                 ;;
3437                         Directory)
3438                                 for fp in $gfpth; do
3439                                         if test "X$fp" = X.; then
3440                                             dir="$ans"
3441                                             direxp="$ansexp"
3442                                         else    
3443                                             dir="$fp/$ansexp"
3444                                             direxp="$fp/$ansexp"
3445                                         fi
3446                                         if test -d "$direxp"; then
3447                                                 type=''
3448                                                 value="$dir"
3449                                                 break
3450                                         fi
3451                                 done
3452                                 ;;
3453                         Locate)
3454                                 if test -d "$ansexp"; then
3455                                         echo "(Looking for $loc_file in directory $value.)"
3456                                         value="$value/$loc_file"
3457                                         ansexp="$ansexp/$loc_file"
3458                                 fi
3459                                 if test -f "$ansexp"; then
3460                                         type=''
3461                                 fi
3462                                 case "$nopath_ok" in
3463                                 true)   case "$value" in
3464                                         */*) ;;
3465                                         *)      echo "Assuming $value will be in people's path."
3466                                                 type=''
3467                                                 ;;
3468                                         esac
3469                                         ;;
3470                                 esac
3471                                 ;;
3472                         esac
3473
3474                         case "$skip" in
3475                         true) type='';
3476                         esac
3477
3478                         case "$type" in
3479                         '') ;;
3480                         *)
3481                                 if test "$fastread" = yes; then
3482                                         dflt=y
3483                                 else
3484                                         dflt=n
3485                                 fi
3486                                 rp="$what $value doesn't exist.  Use that name anyway?"
3487                                 . UU/myread
3488                                 dflt=''
3489                                 case "$ans" in
3490                                 y*) type='';;
3491                                 *) echo " ";;
3492                                 esac
3493                                 ;;
3494                         esac
3495                         ;;
3496                 esac
3497                 ;;
3498         esac
3499 done
3500 cd UU
3501 ans="$value"
3502 rp="$orig_rp"
3503 dflt="$orig_dflt"
3504 rm -f getfile.ok
3505 test "X$gfpthkeep" != Xy && gfpth=""
3506 EOSC
3507
3508 : What should the include directory be ?
3509 echo " "
3510 $echo $n "Hmm...  $c"
3511 dflt='/usr/include'
3512 incpath=''
3513 mips_type=''
3514 if $test -f /bin/mips && /bin/mips; then
3515         echo "Looks like a MIPS system..."
3516         $cat >usr.c <<'EOCP'
3517 #ifdef SYSTYPE_BSD43
3518 /bsd43
3519 #endif
3520 EOCP
3521         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3522                 dflt='/bsd43/usr/include'
3523                 incpath='/bsd43'
3524                 mips_type='BSD 4.3'
3525         else
3526                 mips_type='System V'
3527         fi
3528         $rm -f usr.c usr.out
3529         echo "and you're compiling with the $mips_type compiler and libraries."
3530         xxx_prompt=y
3531         echo "exit 0" >mips
3532 else
3533         echo "Doesn't look like a MIPS system."
3534         xxx_prompt=n
3535         echo "exit 1" >mips
3536 fi
3537 chmod +x mips
3538 $eunicefix mips
3539 case "$usrinc" in
3540 '') ;;
3541 *) dflt="$usrinc";;
3542 esac
3543 case "$xxx_prompt" in
3544 y)      fn=d/
3545         echo " "
3546         rp='Where are the include files you want to use?'
3547         . ./getfile
3548         usrinc="$ans"
3549         ;;
3550 *)      usrinc="$dflt"
3551         ;;
3552 esac
3553
3554 : Set private lib path
3555 case "$plibpth" in
3556 '') if ./mips; then
3557                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3558         fi;;
3559 esac
3560 case "$libpth" in
3561 ' ') dlist='';;
3562 '') dlist="$loclibpth $plibpth $glibpth";;
3563 *) dlist="$libpth";;
3564 esac
3565
3566 : Now check and see which directories actually exist, avoiding duplicates
3567 libpth=''
3568 for xxx in $dlist
3569 do
3570     if $test -d $xxx; then
3571                 case " $libpth " in
3572                 *" $xxx "*) ;;
3573                 *) libpth="$libpth $xxx";;
3574                 esac
3575     fi
3576 done
3577 $cat <<'EOM'
3578
3579 Some systems have incompatible or broken versions of libraries.  Among
3580 the directories listed in the question below, please remove any you
3581 know not to be holding relevant libraries, and add any that are needed.
3582 Say "none" for none.
3583
3584 EOM
3585 case "$libpth" in
3586 '') dflt='none';;
3587 *)
3588         set X $libpth
3589         shift
3590         dflt=${1+"$@"}
3591         ;;
3592 esac
3593 rp="Directories to use for library searches?"
3594 . ./myread
3595 case "$ans" in
3596 none) libpth=' ';;
3597 *) libpth="$ans";;
3598 esac
3599
3600 : compute shared library extension
3601 case "$so" in
3602 '')
3603         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3604                 dflt='sl'
3605         else
3606                 dflt='so'
3607         fi
3608         ;;
3609 *) dflt="$so";;
3610 esac
3611 $cat <<EOM
3612
3613 On some systems, shared libraries may be available.  Answer 'none' if
3614 you want to suppress searching of shared libraries for the remainder
3615 of this configuration.
3616
3617 EOM
3618 rp='What is the file extension used for shared libraries?'
3619 . ./myread
3620 so="$ans"
3621
3622 : Define several unixisms.
3623 : Hints files or command line option can be used to override them.
3624 : The convoluted testing is in case hints files set either the old
3625 : or the new name.
3626 case "$_exe" in
3627 '')     case "$exe_ext" in
3628     '') ;;
3629         *)      _exe="$exe_ext" ;;
3630         esac
3631         ;;
3632 esac
3633 case "$_a" in
3634 '')     case "$lib_ext" in
3635     '') _a='.a';;
3636         *)      _a="$lib_ext" ;;
3637         esac
3638         ;;
3639 esac
3640 case "$_o" in
3641 '') case "$obj_ext" in
3642         '')     _o='.o';;
3643         *)      _o="$obj_ext";;
3644         esac
3645         ;;
3646 esac
3647 case "$p_" in
3648 '') case "$path_sep" in
3649         '')     p_=':';;
3650         *)      p_="$path_sep";;
3651         esac
3652         ;;
3653 esac
3654 exe_ext=$_exe
3655 lib_ext=$_a
3656 obj_ext=$_o
3657 path_sep=$p_
3658
3659 : Which makefile gets called first.  This is used by make depend.
3660 case "$firstmakefile" in
3661 '') firstmakefile='makefile';;
3662 esac
3663
3664 case "$usesocks" in
3665 $define|true|[yY]*)     dflt='y';;
3666 *) dflt='n';;
3667 esac
3668 cat <<EOM
3669
3670 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3671 Configure must be run with -Dusesocks.
3672
3673 If this doesn't make any sense to you, just accept the default '$dflt'.
3674 EOM
3675 rp='Build Perl for SOCKS?'
3676 . ./myread
3677 case "$ans" in
3678 y|Y)    val="$define" ;;     
3679 *)      val="$undef" ;;
3680 esac
3681 set usesocks
3682 eval $setvar
3683
3684 : Looking for optional libraries
3685 echo " "
3686 echo "Checking for optional libraries..." >&4
3687 case "$libs" in
3688 ' '|'') dflt='';;
3689 *) dflt="$libs";;
3690 esac
3691 case "$libswanted" in
3692 '') libswanted='c_s';;
3693 esac
3694 case "$usesocks" in
3695 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3696 esac
3697 libsfound=''
3698 libsfiles=''
3699 libsdirs=''
3700 libspath=''
3701 for thisdir in $libpth $xlibpth; do
3702   test -d $thisdir && libspath="$libspath $thisdir"
3703 done
3704 for thislib in $libswanted; do
3705         for thisdir in $libspath; do
3706             xxx=''
3707             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3708                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3709                 $test -f "$xxx" && eval $libscheck
3710                 $test -f "$xxx" && libstyle=shared
3711             fi
3712             if test ! -f "$xxx"; then
3713                 xxx=$thisdir/lib$thislib.$so
3714                 $test -f "$xxx" && eval $libscheck
3715                 $test -f "$xxx" && libstyle=shared
3716             fi  
3717             if test ! -f "$xxx"; then
3718                 xxx=$thisdir/lib$thislib$_a
3719                 $test -f "$xxx" && eval $libscheck
3720                 $test -f "$xxx" && libstyle=static
3721             fi
3722             if test ! -f "$xxx"; then
3723                 xxx=$thisdir/$thislib$_a
3724                 $test -f "$xxx" && eval $libscheck
3725                 $test -f "$xxx" && libstyle=static
3726             fi
3727             if test ! -f "$xxx"; then
3728                 xxx=$thisdir/lib${thislib}_s$_a
3729                 $test -f "$xxx" && eval $libscheck
3730                 $test -f "$xxx" && libstyle=static
3731                 $test -f "$xxx" && thislib=${thislib}_s
3732             fi
3733             if test ! -f "$xxx"; then
3734                 xxx=$thisdir/Slib$thislib$_a
3735                 $test -f "$xxx" && eval $libscheck
3736                 $test -f "$xxx" && libstyle=static
3737             fi
3738             if $test -f "$xxx"; then
3739                 case "$libstyle" in
3740                 shared) echo "Found -l$thislib (shared)." ;;
3741                 static) echo "Found -l$thislib." ;;
3742                 *)      echo "Found -l$thislib ($libstyle)." ;;
3743                 esac
3744                 case " $dflt " in
3745                 *"-l$thislib "*);;
3746                 *) dflt="$dflt -l$thislib"
3747                    libsfound="$libsfound $xxx"
3748                    yyy=`basename $xxx`
3749                    libsfiles="$libsfiles $yyy"
3750                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3751                    case " $libsdirs " in
3752                    *" $yyy "*) ;;
3753                    *) libsdirs="$libsdirs $yyy" ;;
3754                    esac
3755                    ;;
3756                 esac
3757                 break
3758             fi  
3759         done
3760         if $test ! -f "$xxx"; then
3761             echo "No -l$thislib."
3762         fi
3763 done
3764 set X $dflt
3765 shift
3766 dflt="$*"
3767 case "$libs" in
3768 '') dflt="$dflt";;
3769 *) dflt="$libs";;
3770 esac
3771 case "$dflt" in
3772 ' '|'') dflt='none';;
3773 esac
3774
3775 $cat <<EOM
3776
3777 In order to compile $package on your machine, a number of libraries
3778 are usually needed.  Include any other special libraries here as well.
3779 Say "none" for none.  The default list is almost always right.
3780 EOM
3781
3782 echo " "
3783 rp="What libraries to use?"
3784 . ./myread
3785 case "$ans" in
3786 none) libs=' ';;
3787 *) libs="$ans";;
3788 esac
3789
3790 : determine optimization, if desired, or use for debug flag also
3791 case "$optimize" in
3792 ' '|$undef) dflt='none';;
3793 '') dflt='-O';;
3794 *) dflt="$optimize";;
3795 esac
3796 $cat <<EOH
3797
3798 By default, $package compiles with the -O flag to use the optimizer.
3799 Alternately, you might want to use the symbolic debugger, which uses
3800 the -g flag (on traditional Unix systems).  Either flag can be
3801 specified here.  To use neither flag, specify the word "none".
3802
3803 EOH
3804 rp="What optimizer/debugger flag should be used?"
3805 . ./myread
3806 optimize="$ans"
3807 case "$optimize" in
3808 'none') optimize=" ";;
3809 esac
3810
3811 dflt=''
3812 : We will not override a previous value, but we might want to
3813 : augment a hint file
3814 case "$hint" in
3815 default|recommended)
3816         case "$gccversion" in
3817         1*) dflt='-fpcc-struct-return' ;;
3818         esac
3819         case "$optimize" in
3820         *-g*) dflt="$dflt -DDEBUGGING";;
3821         esac
3822         case "$gccversion" in
3823         2*) if test -d /etc/conf/kconfig.d &&
3824                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3825                 then
3826                         dflt="$dflt -posix"
3827                 fi
3828                 ;;
3829         esac
3830         case "$gccversion" in
3831         1*) ;;
3832         2.[0-8]*) ;;
3833         ?*)     echo " "
3834                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3835                 echo 'int main(void) { return 0; }' > gcctest.c
3836                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3837                         echo "Yes, it does." 2>&1
3838                         case "$ccflags" in
3839                         *strict-aliasing*) 
3840                                 echo "Leaving current flags $ccflags alone." 2>&1
3841                                 ;;
3842                         *) dflt="$dflt -fno-strict-aliasing" ;;
3843                         esac
3844                 else
3845                         echo "Nope, it doesn't, but that's ok." 2>&1
3846                 fi
3847                 ;;
3848         esac
3849         ;;
3850 esac
3851
3852 case "$mips_type" in
3853 *BSD*|'') inclwanted="$locincpth $usrinc";;
3854 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3855 esac
3856 for thisincl in $inclwanted; do
3857         if $test -d $thisincl; then
3858                 if $test x$thisincl != x$usrinc; then
3859                         case "$dflt" in
3860                         *" -I$thisincl "*);;
3861                         *) dflt="$dflt -I$thisincl ";;
3862                         esac
3863                 fi
3864         fi
3865 done
3866
3867 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3868         xxx=true;
3869 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3870         xxx=true;
3871 else
3872         xxx=false;
3873 fi;
3874 if $xxx; then
3875         case "$dflt" in
3876         *$2*);;
3877         *) dflt="$dflt -D$2";;
3878         esac;
3879 fi'
3880
3881 set signal.h LANGUAGE_C; eval $inctest
3882
3883 case "$usesocks" in
3884 $define)
3885         ccflags="$ccflags -DSOCKS"
3886         ;;
3887 esac
3888
3889 case "$hint" in
3890 default|recommended) dflt="$ccflags $dflt" ;;
3891 *) dflt="$ccflags";;
3892 esac
3893
3894 case "$dflt" in
3895 ''|' ') dflt=none;;
3896 esac
3897
3898 $cat <<EOH
3899
3900 Your C compiler may want other flags.  For this question you should include
3901 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3902 but you should NOT include libraries or ld flags like -lwhatever.  If you
3903 want $package to honor its debug switch, you should include -DDEBUGGING here.
3904 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3905
3906 To use no flags, specify the word "none".
3907
3908 EOH
3909 set X $dflt
3910 shift
3911 dflt=${1+"$@"}
3912 rp="Any additional cc flags?"
3913 . ./myread
3914 case "$ans" in
3915 none) ccflags='';;
3916 *) ccflags="$ans";;
3917 esac
3918
3919 : the following weeds options from ccflags that are of no interest to cpp
3920 cppflags="$ccflags"
3921 case "$gccversion" in
3922 1*) cppflags="$cppflags -D__GNUC__"
3923 esac
3924 case "$mips_type" in
3925 '');;
3926 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3927 esac
3928 case "$cppflags" in
3929 '');;
3930 *)
3931         echo " "
3932         echo "Let me guess what the preprocessor flags are..." >&4
3933         set X $cppflags
3934         shift
3935         cppflags=''
3936         $cat >cpp.c <<'EOM'
3937 #define BLURFL foo
3938
3939 BLURFL xx LFRULB
3940 EOM
3941         previous=''
3942         for flag in $*
3943         do
3944                 case "$flag" in
3945                 -*) ftry="$flag";;
3946                 *) ftry="$previous $flag";;
3947                 esac
3948                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3949                         >cpp1.out 2>/dev/null && \
3950                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3951                         >cpp2.out 2>/dev/null && \
3952                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3953                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3954                 then
3955                         cppflags="$cppflags $ftry"
3956                         previous=''
3957                 else
3958                         previous="$flag"
3959                 fi
3960         done
3961         set X $cppflags
3962         shift
3963         cppflags=${1+"$@"}
3964         case "$cppflags" in
3965         *-*)  echo "They appear to be: $cppflags";;
3966         esac
3967         $rm -f cpp.c cpp?.out
3968         ;;
3969 esac
3970
3971 : flags used in final linking phase
3972 case "$ldflags" in
3973 '') if ./venix; then
3974                 dflt='-i -z'
3975         else
3976                 dflt=''
3977         fi
3978         case "$ccflags" in
3979         *-posix*) dflt="$dflt -posix" ;;
3980         esac
3981         ;;
3982 *) dflt="$ldflags";;
3983 esac
3984
3985 : Try to guess additional flags to pick up local libraries.
3986 for thislibdir in $libpth; do
3987         case " $loclibpth " in
3988         *" $thislibdir "*)
3989                 case "$dflt " in 
3990                 *"-L$thislibdir "*) ;;
3991                 *)  dflt="$dflt -L$thislibdir" ;;
3992                 esac
3993                 ;;
3994         esac
3995 done
3996
3997 case "$dflt" in
3998 '') dflt='none' ;;
3999 esac
4000
4001 $cat <<EOH
4002
4003 Your C linker may need flags.  For this question you should
4004 include -L/whatever and any other flags used by the C linker, but you
4005 should NOT include libraries like -lwhatever.
4006
4007 Make sure you include the appropriate -L/path flags if your C linker
4008 does not normally search all of the directories you specified above,
4009 namely
4010         $libpth
4011 To use no flags, specify the word "none".
4012
4013 EOH
4014
4015 rp="Any additional ld flags (NOT including libraries)?"
4016 . ./myread
4017 case "$ans" in
4018 none) ldflags='';;
4019 *) ldflags="$ans";;
4020 esac
4021 rmlist="$rmlist pdp11"
4022
4023 : coherency check
4024 echo " "
4025 echo "Checking your choice of C compiler and flags for coherency..." >&4
4026 $cat > try.c <<'EOF'
4027 #include <stdio.h>
4028 int main() { printf("Ok\n"); exit(0); }
4029 EOF
4030 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4031 shift
4032 $cat >try.msg <<'EOM'
4033 I've tried to compile and run the following simple program:
4034
4035 EOM
4036 $cat try.c >> try.msg
4037
4038 $cat >> try.msg <<EOM
4039
4040 I used the command:
4041
4042         $*
4043         ./try
4044
4045 and I got the following output:
4046
4047 EOM
4048 dflt=y
4049 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4050         if sh -c './try' >>try.msg 2>&1; then
4051                 xxx=`./try`
4052                 case "$xxx" in
4053                 "Ok") dflt=n ;;
4054                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4055                         case " $libs " in
4056                         *" -lsfio "*)
4057                                 cat >> try.msg <<'EOQS'
4058 If $libs contains -lsfio, and sfio is mis-configured, then it
4059 sometimes (apparently) runs and exits with a 0 status, but with no
4060 output!  It may have to do with sfio's use of _exit vs. exit.
4061
4062 EOQS
4063                                 rp="You have a big problem.  Shall I abort Configure"
4064                                 dflt=y
4065                                 ;;
4066                         esac
4067                         ;;
4068                 esac
4069         else
4070                 echo "The program compiled OK, but exited with status $?." >>try.msg
4071                 rp="You have a problem.  Shall I abort Configure"
4072                 dflt=y
4073         fi
4074 else
4075         echo "I can't compile the test program." >>try.msg
4076         rp="You have a BIG problem.  Shall I abort Configure"
4077         dflt=y
4078 fi
4079 case "$dflt" in
4080 y)
4081         $cat try.msg >&4
4082         case "$knowitall" in
4083         '')
4084                 echo "(The supplied flags or libraries might be incorrect.)"
4085                 ;;
4086         *) dflt=n;;
4087         esac
4088         echo " "
4089         . ./myread
4090         case "$ans" in
4091         n*|N*) ;;
4092         *)      echo "Ok.  Stopping Configure." >&4
4093                 exit 1
4094                 ;;
4095         esac
4096         ;;
4097 n) echo "OK, that should do.";;
4098 esac
4099 $rm -f try try.* core
4100
4101 : define an is-a-typedef? function
4102 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4103 case "$inclist" in
4104 "") inclist="sys/types.h";;
4105 esac;
4106 eval "varval=\$$var";
4107 case "$varval" in
4108 "")
4109         $rm -f temp.c;
4110         for inc in $inclist; do
4111                 echo "#include <$inc>" >>temp.c;
4112         done;
4113         echo "#ifdef $type" >> temp.c;
4114         echo "printf(\"We have $type\");" >> temp.c;
4115         echo "#endif" >> temp.c;
4116         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4117         if $contains $type temp.E >/dev/null 2>&1; then
4118                 eval "$var=\$type";
4119         else
4120                 eval "$var=\$def";
4121         fi;
4122         $rm -f temp.?;;
4123 *) eval "$var=\$varval";;
4124 esac'
4125
4126 : define an is-a-typedef? function that prompts if the type is not available.
4127 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4128 case "$inclist" in
4129 "") inclist="sys/types.h";;
4130 esac;
4131 eval "varval=\$$var";
4132 case "$varval" in
4133 "")
4134         $rm -f temp.c;
4135         for inc in $inclist; do
4136                 echo "#include <$inc>" >>temp.c;
4137         done;
4138         echo "#ifdef $type" >> temp.c;
4139         echo "printf(\"We have $type\");" >> temp.c;
4140         echo "#endif" >> temp.c;
4141         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4142         echo " " ;
4143         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4144         if $contains $type temp.E >/dev/null 2>&1; then
4145                 echo "$type found." >&4;
4146                 eval "$var=\$type";
4147         else
4148                 echo "$type NOT found." >&4;
4149                 dflt="$def";
4150                 . ./myread ;
4151                 eval "$var=\$ans";
4152         fi;
4153         $rm -f temp.?;;
4154 *) eval "$var=\$varval";;
4155 esac'
4156
4157 : define a shorthand compile call
4158 compile='
4159 mc_file=$1;
4160 shift;
4161 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4162 : define a shorthand compile call for compilations that should be ok.
4163 compile_ok='
4164 mc_file=$1;
4165 shift;
4166 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4167
4168 : check for lengths of integral types
4169 echo " "
4170 case "$intsize" in
4171 '')
4172         echo "Checking to see how big your integers are..." >&4
4173         $cat >intsize.c <<'EOCP'
4174 #include <stdio.h>
4175 int main()
4176 {
4177         printf("intsize=%d;\n", (int)sizeof(int));
4178         printf("longsize=%d;\n", (int)sizeof(long));
4179         printf("shortsize=%d;\n", (int)sizeof(short));
4180         exit(0);
4181 }
4182 EOCP
4183         set intsize
4184         if eval $compile_ok && ./intsize > /dev/null; then
4185                 eval `./intsize`
4186                 echo "Your integers are $intsize bytes long."
4187                 echo "Your long integers are $longsize bytes long."
4188                 echo "Your short integers are $shortsize bytes long."
4189         else
4190                 $cat >&4 <<EOM
4191 !
4192 Help! I can't compile and run the intsize test program: please enlighten me!
4193 (This is probably a misconfiguration in your system or libraries, and
4194 you really ought to fix it.  Still, I'll try anyway.)
4195 !
4196 EOM
4197                 dflt=4
4198                 rp="What is the size of an integer (in bytes)?"
4199                 . ./myread
4200                 intsize="$ans"
4201                 dflt=$intsize
4202                 rp="What is the size of a long integer (in bytes)?"
4203                 . ./myread
4204                 longsize="$ans"
4205                 dflt=2
4206                 rp="What is the size of a short integer (in bytes)?"
4207                 . ./myread
4208                 shortsize="$ans"
4209         fi
4210         ;;
4211 esac
4212 $rm -f intsize intsize.*
4213
4214 : see what type lseek is declared as in the kernel
4215 rp="What is the type used for lseek's offset on this system?"
4216 set off_t lseektype long stdio.h sys/types.h
4217 eval $typedef_ask
4218
4219 echo " "
4220 echo "Checking to see how big your file offsets are..." >&4
4221 $cat >try.c <<EOCP
4222 #include <sys/types.h>
4223 #include <stdio.h>
4224 int main()
4225 {
4226     printf("%d\n", (int)sizeof($lseektype));
4227     return(0); 
4228 }
4229 EOCP
4230 set try
4231 if eval $compile_ok; then
4232         lseeksize=`./try`
4233         echo "Your file offsets are $lseeksize bytes long."
4234 else
4235         dflt=$longsize
4236         echo " "
4237         echo "(I can't seem to compile the test program.  Guessing...)"
4238         rp="What is the size of your file offsets (in bytes)?"
4239         . ./myread
4240         lseeksize="$ans"
4241 fi
4242 $rm -f try.c try
4243
4244 : see what type file positions are declared as in the library
4245 rp="What is the type for file position used by fsetpos()?"
4246 set fpos_t fpostype long stdio.h sys/types.h
4247 eval $typedef_ask
4248
4249 echo " "
4250 case "$fpostype" in
4251 *_t) zzz="$fpostype"    ;;
4252 *)   zzz="fpos_t"       ;;
4253 esac
4254 echo "Checking the size of $zzz..." >&4 
4255 cat > try.c <<EOCP
4256 #include <sys/types.h>
4257 #include <stdio.h>
4258 int main() {
4259     printf("%d\n", (int)sizeof($fpostype));
4260     exit(0);
4261 }
4262 EOCP
4263 set try
4264 if eval $compile_ok; then
4265         yyy=`./try`
4266         case "$yyy" in
4267         '')     fpossize=4
4268                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4269                 ;;
4270         *)      fpossize=$yyy
4271                 echo "Your $zzz is $fpossize bytes long."
4272                 ;;
4273         esac
4274 else
4275         dflt="$longsize"
4276         echo " " >&4
4277         echo "(I can't compile the test program.  Guessing...)" >&4
4278         rp="What is the size of your file positions (in bytes)?"
4279         . ./myread
4280         fpossize="$ans"
4281 fi
4282
4283
4284
4285 # Backward compatibility (uselfs is deprecated).
4286 case "$uselfs" in
4287 "$define"|true|[yY]*)
4288         cat <<EOM >&4
4289
4290 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4291 EOM
4292         uselargefiles="$define"
4293         ;;
4294 esac                          
4295
4296 case "$lseeksize:$fpossize" in
4297 8:8) cat <<EOM
4298
4299 You can have files larger than 2 gigabytes.
4300 EOM
4301    val="$define" ;;
4302 *)    case "$uselargefiles" in
4303    "$undef"|false|[nN]*) dflt='n' ;;
4304    *)   dflt='y' ;;
4305    esac
4306    cat <<EOM
4307
4308 Perl can be built to understand large files (files larger than 2 gigabytes)
4309 on some systems.  To do so, Configure can be run with -Duselargefiles.
4310
4311 If this doesn't make any sense to you, just accept the default '$dflt'.
4312 EOM
4313    rp='Try to understand large files, if available?'
4314    . ./myread
4315    case "$ans" in
4316    y|Y)         val="$define" ;;
4317    *)           val="$undef"  ;;
4318    esac
4319    ;;
4320 esac
4321 set uselargefiles
4322 eval $setvar
4323 case "$uselargefiles" in
4324 "$define")
4325 : Look for a hint-file generated 'call-back-unit'.  If the
4326 : user has specified that a large files perl is to be built,
4327 : we may need to set or change some other defaults.
4328         if $test -f uselargefiles.cbu; then
4329                 echo "Your platform has some specific hints for large file builds, using them..."
4330                 . ./uselargefiles.cbu
4331                 echo " "
4332                 echo "Rechecking to see how big your file offsets are..." >&4
4333                 $cat >try.c <<EOCP
4334 #include <sys/types.h>
4335 #include <stdio.h>
4336 int main()
4337 {
4338     printf("%d\n", (int)sizeof($lseektype));
4339     return(0); 
4340 }
4341 EOCP
4342                 set try
4343                 if eval $compile_ok; then
4344                         lseeksize=`./try`
4345                         $echo "Your file offsets are now $lseeksize bytes long."
4346                 else
4347                         dflt="$lseeksize"
4348                         echo " "
4349                         echo "(I can't seem to compile the test program.  Guessing...)"
4350                         rp="What is the size of your file offsets (in bytes)?"
4351                         . ./myread
4352                         lseeksize="$ans"
4353                 fi
4354                 case "$fpostype" in
4355                 *_t) zzz="$fpostype"    ;;
4356                 *)   zzz="fpos_t"       ;;
4357                 esac
4358                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4359                 $cat > try.c <<EOCP
4360 #include <sys/types.h>
4361 #include <stdio.h>
4362 int main() {
4363     printf("%d\n", (int)sizeof($fpostype));
4364     exit(0);
4365 }
4366 EOCP
4367                 set try
4368                 if eval $compile_ok; then
4369                         yyy=`./try`
4370                         dflt="$lseeksize"
4371                         case "$yyy" in
4372                         '')     echo " "
4373                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4374                                 ;;
4375                         *)      fpossize=$yyy
4376                                 echo " $fpossize bytes." >&4
4377                                 ;;
4378                         esac
4379                 else
4380                         dflt="$fpossize"
4381                         echo " "
4382                         echo "(I can't compile the test program.  Guessing...)" >&4
4383                         rp="What is the size of your file positions (in bytes)?"
4384                         . ./myread
4385                         fpossize="$ans"
4386                 fi
4387                 $rm -f try.c try
4388         fi
4389         ;;
4390 esac
4391
4392
4393 case "$usemorebits" in
4394 "$define"|true|[yY]*)
4395         use64bitint="$define"
4396         uselongdouble="$define"
4397         usemorebits="$define"
4398         ;;
4399 *)      usemorebits="$undef"
4400         ;;
4401 esac
4402
4403
4404 case "$uselonglong" in
4405 "$define"|true|[yY]*)
4406         cat <<EOM >&4
4407
4408 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4409 EOM
4410         use64bitint="$define"
4411         ;;
4412 esac                          
4413 case "$use64bits" in
4414 "$define"|true|[yY]*)
4415         cat <<EOM >&4
4416
4417 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4418 EOM
4419         use64bitint="$define"
4420         ;;
4421 esac                          
4422 case "$use64bitints" in
4423 "$define"|true|[yY]*)
4424         cat <<EOM >&4
4425
4426 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4427 EOM
4428         use64bitint="$define"
4429         ;;
4430 esac                          
4431 case "$use64bitsint" in
4432 "$define"|true|[yY]*)
4433         cat <<EOM >&4
4434
4435 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4436 EOM
4437         use64bitint="$define"
4438         ;;
4439 esac                          
4440 case "$uselonglongs" in
4441 "$define"|true|[yY]*)
4442         cat <<EOM >&4
4443
4444 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4445 EOM
4446         use64bitint="$define"
4447         ;;
4448 esac                          
4449 case "$use64bitsall" in
4450 "$define"|true|[yY]*)
4451         cat <<EOM >&4
4452
4453 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4454 EOM
4455         use64bitall="$define"
4456         ;;
4457 esac                          
4458
4459 case "$ccflags" in
4460 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4461 esac
4462 case "$use64bitall" in
4463 "$define"|true|[yY]*) use64bitint="$define" ;;
4464 esac
4465
4466 case "$longsize" in
4467 8) cat <<EOM
4468
4469 You have natively 64-bit long integers.
4470 EOM
4471    val="$define"
4472    ;;
4473 *) case "$use64bitint" in
4474    "$define"|true|[yY]*) dflt='y';;
4475    *) dflt='n';;
4476    esac
4477    cat <<EOM
4478
4479 Perl can be built to take advantage of 64-bit integer types
4480 on some systems.  To do so, Configure can be run with -Duse64bitint.
4481 Choosing this option will most probably introduce binary incompatibilities.
4482
4483 If this doesn't make any sense to you, just accept the default '$dflt'.
4484 EOM
4485    rp='Try to use 64-bit integers, if available?'
4486    . ./myread
4487    case "$ans" in
4488    [yY]*) val="$define" ;;
4489    *)     val="$undef"  ;;
4490    esac
4491    ;;
4492 esac
4493 set use64bitint
4494 eval $setvar
4495
4496 case "$use64bitall" in
4497 "$define"|true|[yY]*) dflt='y' ;;
4498 *) case "$longsize" in
4499    8) dflt='y' ;;
4500    *) dflt='n' ;;
4501    esac
4502    ;;
4503 esac    
4504 cat <<EOM
4505
4506 You may also choose to try maximal 64-bitness.  It means using as much
4507 64-bitness as possible on the platform.  This in turn means even more
4508 binary incompatibilities.  On the other hand, your platform may not
4509 have any more 64-bitness available than what you already have chosen.
4510
4511 If this doesn't make any sense to you, just accept the default '$dflt'.
4512 EOM
4513 rp='Try to use maximal 64-bit support, if available?'
4514 . ./myread
4515 case "$ans" in
4516 [yY]*) val="$define" ;;
4517 *)     val="$undef"  ;;
4518 esac
4519 set use64bitall
4520 eval $setvar
4521 case "$use64bitall" in
4522 "$define")
4523         case "$use64bitint" in
4524         "$undef")
4525                 cat <<EOM
4526
4527 Since you have chosen a maximally 64-bit build, I'm also turning on
4528 the use of 64-bit integers.
4529 EOM
4530                 use64bitint="$define" ;;
4531         esac
4532         ;;
4533 esac
4534
4535 case "$use64bitint" in
4536 "$define"|true|[yY]*)
4537 : Look for a hint-file generated 'call-back-unit'.  If the
4538 : user has specified that a 64-bit perl is to be built,
4539 : we may need to set or change some other defaults.
4540         if $test -f use64bitint.cbu; then
4541                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4542                 . ./use64bitint.cbu
4543         fi
4544         case "$longsize" in
4545         4) case "$archname64" in
4546            '') archname64=64int ;;
4547            esac
4548            ;;
4549         esac
4550         ;;
4551 esac
4552
4553 case "$use64bitall" in
4554 "$define"|true|[yY]*)
4555 : Look for a hint-file generated 'call-back-unit'.  If the
4556 : user has specified that a maximally 64-bit perl is to be built,
4557 : we may need to set or change some other defaults.
4558         if $test -f use64bitall.cbu; then
4559                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4560                 . ./use64bitall.cbu
4561         fi
4562         case "$longsize" in
4563         4) case "$archname64" in
4564            ''|64int) archname64=64all ;;
4565            esac
4566            ;;
4567         esac
4568         ;;
4569 esac
4570
4571 echo " "
4572 echo "Checking for GNU C Library..." >&4
4573 cat >gnulibc.c <<EOM
4574 #include <stdio.h>
4575 int main()
4576 {
4577 #ifdef __GLIBC__
4578     exit(0);
4579 #else
4580     exit(1);
4581 #endif
4582 }
4583 EOM
4584 set gnulibc
4585 if eval $compile_ok && ./gnulibc; then
4586         val="$define"
4587         echo "You are using the GNU C Library"
4588 else
4589         val="$undef"
4590         echo "You are not using the GNU C Library"
4591 fi
4592 $rm -f gnulibc*
4593 set d_gnulibc
4594 eval $setvar
4595
4596 : see if nm is to be used to determine whether a symbol is defined or not
4597 case "$usenm" in
4598 '')
4599         dflt=''
4600         case "$d_gnulibc" in
4601         "$define")
4602                 echo " "
4603                 echo "nm probably won't work on the GNU C Library." >&4
4604                 dflt=n
4605                 ;;
4606         esac
4607         case "$dflt" in
4608         '') 
4609                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4610                         echo " "
4611                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4612                         echo "'nm' won't be sufficient on this sytem." >&4
4613                         dflt=n
4614                 fi
4615                 ;;
4616         esac
4617         case "$dflt" in
4618         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4619                 if $test $dflt -gt 20; then
4620                         dflt=y
4621                 else
4622                         dflt=n
4623                 fi
4624                 ;;
4625         esac
4626         ;;
4627 *)
4628         case "$usenm" in
4629         true|$define) dflt=y;;
4630         *) dflt=n;;
4631         esac
4632         ;;
4633 esac
4634 $cat <<EOM
4635
4636 I can use $nm to extract the symbols from your C libraries. This
4637 is a time consuming task which may generate huge output on the disk (up
4638 to 3 megabytes) but that should make the symbols extraction faster. The
4639 alternative is to skip the 'nm' extraction part and to compile a small
4640 test program instead to determine whether each symbol is present. If
4641 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4642 this may be the best solution.
4643
4644 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4645
4646 EOM
4647 rp="Shall I use $nm to extract C symbols from the libraries?"
4648 . ./myread
4649 case "$ans" in
4650 [Nn]*) usenm=false;;
4651 *) usenm=true;;
4652 esac
4653
4654 runnm=$usenm
4655 case "$reuseval" in
4656 true) runnm=false;;
4657 esac
4658
4659 : nm options which may be necessary
4660 case "$nm_opt" in
4661 '') if $test -f /mach_boot; then
4662                 nm_opt=''       # Mach
4663         elif $test -d /usr/ccs/lib; then
4664                 nm_opt='-p'     # Solaris (and SunOS?)
4665         elif $test -f /dgux; then
4666                 nm_opt='-p'     # DG-UX
4667         elif $test -f /lib64/rld; then
4668                 nm_opt='-p'     # 64-bit Irix
4669         else
4670                 nm_opt=''
4671         fi;;
4672 esac
4673
4674 : nm options which may be necessary for shared libraries but illegal
4675 : for archive libraries.  Thank you, Linux.
4676 case "$nm_so_opt" in
4677 '')     case "$myuname" in
4678         *linux*)
4679                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4680                         nm_so_opt='--dynamic'
4681                 fi
4682                 ;;
4683         esac
4684         ;;
4685 esac
4686
4687 case "$runnm" in
4688 true)
4689 : get list of predefined functions in a handy place
4690 echo " "
4691 case "$libc" in
4692 '') libc=unknown
4693         case "$libs" in
4694         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4695         esac
4696         ;;
4697 esac
4698 libnames='';
4699 case "$libs" in
4700 '') ;;
4701 *)  for thislib in $libs; do
4702         case "$thislib" in
4703         -lc|-lc_s)
4704                 : Handle C library specially below.
4705                 ;;
4706         -l*)
4707                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4708                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4709                         :
4710                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4711                         :
4712                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4713                         :
4714                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4715                         :
4716                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4717                         :
4718                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4719                         :
4720                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4721                         :
4722                 else
4723                         try=''
4724                 fi
4725                 libnames="$libnames $try"
4726                 ;;
4727         *) libnames="$libnames $thislib" ;;
4728         esac
4729         done
4730         ;;
4731 esac
4732 xxx=normal
4733 case "$libc" in
4734 unknown)
4735         set /lib/libc.$so
4736         for xxx in $libpth; do
4737                 $test -r $1 || set $xxx/libc.$so
4738                 : The messy sed command sorts on library version numbers.
4739                 $test -r $1 || \
4740                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4741                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4742                                 h
4743                                 s/[0-9][0-9]*/0000&/g
4744                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4745                                 G
4746                                 s/\n/ /' | \
4747                          $sort | $sed -e 's/^.* //'`
4748                 eval set \$$#
4749         done
4750         $test -r $1 || set /usr/ccs/lib/libc.$so
4751         $test -r $1 || set /lib/libsys_s$_a
4752         ;;
4753 *)
4754         set blurfl
4755         ;;
4756 esac
4757 if $test -r "$1"; then
4758         echo "Your (shared) C library seems to be in $1."
4759         libc="$1"
4760 elif $test -r /lib/libc && $test -r /lib/clib; then
4761         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4762         xxx=apollo
4763         libc='/lib/clib /lib/libc'
4764         if $test -r /lib/syslib; then
4765                 echo "(Your math library is in /lib/syslib.)"
4766                 libc="$libc /lib/syslib"
4767         fi
4768 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4769         echo "Your C library seems to be in $libc, as you said before."
4770 elif $test -r $incpath/usr/lib/libc$_a; then
4771         libc=$incpath/usr/lib/libc$_a;
4772         echo "Your C library seems to be in $libc.  That's fine."
4773 elif $test -r /lib/libc$_a; then
4774         libc=/lib/libc$_a;
4775         echo "Your C library seems to be in $libc.  You're normal."
4776 else
4777         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4778                 :
4779         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4780                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4781         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4782                 :
4783         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4784                 :
4785         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4786                 :
4787         else
4788                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4789         fi
4790         if $test -r "$tans"; then
4791                 echo "Your C library seems to be in $tans, of all places."
4792                 libc=$tans
4793         else
4794                 libc='blurfl'
4795         fi
4796 fi
4797 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4798         dflt="$libc"
4799         cat <<EOM
4800
4801 If the guess above is wrong (which it might be if you're using a strange
4802 compiler, or your machine supports multiple models), you can override it here.
4803
4804 EOM
4805 else
4806         dflt=''
4807         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4808         cat >&4 <<EOM
4809 I can't seem to find your C library.  I've looked in the following places:
4810
4811 EOM
4812         $sed 's/^/      /' libpath
4813         cat <<EOM
4814
4815 None of these seems to contain your C library. I need to get its name...
4816
4817 EOM
4818 fi
4819 fn=f
4820 rp='Where is your C library?'
4821 . ./getfile
4822 libc="$ans"
4823
4824 echo " "
4825 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4826 set X `cat libnames`
4827 shift
4828 xxx=files
4829 case $# in 1) xxx=file; esac
4830 echo "Extracting names from the following $xxx for later perusal:" >&4
4831 echo " "
4832 $sed 's/^/      /' libnames >&4
4833 echo " "
4834 $echo $n "This may take a while...$c" >&4
4835
4836 for file in $*; do
4837         case $file in
4838         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4839         *) $nm $nm_opt $file 2>/dev/null;;
4840         esac
4841 done >libc.tmp
4842
4843 $echo $n ".$c"
4844 $grep fprintf libc.tmp > libc.ptf
4845 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4846 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4847 xxx='[ADTSIW]'
4848 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4849         eval $xscan;\
4850         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4851                 eval $xrun
4852 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4853         eval $xscan;\
4854         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4855                 eval $xrun
4856 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4857         eval $xscan;\
4858         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4859                 eval $xrun
4860 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4861         eval $xscan;\
4862         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4863                 eval $xrun
4864 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4865         eval $xscan;\
4866         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4867                 eval $xrun
4868 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4869         eval $xscan;\
4870         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4871                 eval $xrun
4872 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4873                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4874         eval $xscan;\
4875         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4876                 eval $xrun
4877 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4878         eval $xscan;\
4879         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4880                 eval $xrun
4881 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4882         eval $xscan;\
4883         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4884                 eval $xrun
4885 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4886         eval $xscan;\
4887         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4888                 eval $xrun
4889 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4890         eval $xscan;\
4891         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4892                 eval $xrun
4893 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4894         eval $xscan;\
4895         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4896                 eval $xrun
4897 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4898         eval $xscan;\
4899         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4900                 eval $xrun
4901 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4902         eval $xscan;\
4903         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4904                 eval $xrun
4905 else
4906         $nm -p $* 2>/dev/null >libc.tmp
4907         $grep fprintf libc.tmp > libc.ptf
4908         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4909                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4910         then
4911                 nm_opt='-p'
4912                 eval $xrun
4913         else
4914                 echo " "
4915                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4916                 com=''
4917                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4918                         for thisname in $libnames $libc; do
4919                                 $ar t $thisname >>libc.tmp
4920                         done
4921                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4922                         echo "Ok." >&4
4923                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4924                         # Repeat libc to extract forwarders to DLL entries too
4925                         for thisname in $libnames $libc; do
4926                                 $ar tv $thisname >>libc.tmp
4927                                 # Revision 50 of EMX has bug in $ar.
4928                                 # it will not extract forwarders to DLL entries
4929                                 # Use emximp which will extract exactly them.
4930                                 emximp -o tmp.imp $thisname \
4931                                     2>/dev/null && \
4932                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4933                                     < tmp.imp >>libc.tmp
4934                                 $rm tmp.imp
4935                         done
4936                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4937                         echo "Ok." >&4
4938                 else
4939                         echo "$ar didn't seem to work right." >&4
4940                         echo "Maybe this is a Cray...trying bld instead..." >&4
4941                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4942                         then
4943                                 for thisname in $libnames; do
4944                                         bld t $libnames | \
4945                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4946                                         $ar t $thisname >>libc.tmp
4947                                 done
4948                                 echo "Ok." >&4
4949                         else
4950                                 echo "That didn't work either.  Giving up." >&4
4951                                 exit 1
4952                         fi
4953                 fi
4954         fi
4955 fi
4956 nm_extract="$com"
4957 if $test -f /lib/syscalls.exp; then
4958         echo " "
4959         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4960         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4961 fi
4962 ;;
4963 esac
4964 $rm -f libnames libpath
4965
4966 : is a C symbol defined?
4967 csym='tlook=$1;
4968 case "$3" in
4969 -v) tf=libc.tmp; tc=""; tdc="";;
4970 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4971 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4972 esac;
4973 tx=yes;
4974 case "$reuseval-$4" in
4975 true-) ;;
4976 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4977 esac;
4978 case "$tx" in
4979 yes)
4980         case "$runnm" in
4981         true)
4982                 if $contains $tlook $tf >/dev/null 2>&1;
4983                 then tval=true;
4984                 else tval=false;
4985                 fi;;
4986         *)
4987                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4988                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
4989                 then tval=true;
4990                 else tval=false;
4991                 fi;
4992                 $rm -f t t.c;;
4993         esac;;
4994 *)
4995         case "$tval" in
4996         $define) tval=true;;
4997         *) tval=false;;
4998         esac;;
4999 esac;
5000 eval "$2=$tval"'
5001
5002 : define an is-in-libc? function
5003 inlibc='echo " "; td=$define; tu=$undef;
5004 sym=$1; var=$2; eval "was=\$$2";
5005 tx=yes;
5006 case "$reuseval$was" in
5007 true) ;;
5008 true*) tx=no;;
5009 esac;
5010 case "$tx" in
5011 yes)
5012         set $sym tres -f;
5013         eval $csym;
5014         case "$tres" in
5015         true)
5016                 echo "$sym() found." >&4;
5017                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5018         *)
5019                 echo "$sym() NOT found." >&4;
5020                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5021         esac;;
5022 *)
5023         case "$was" in
5024         $define) echo "$sym() found." >&4;;
5025         *) echo "$sym() NOT found." >&4;;
5026         esac;;
5027 esac'
5028
5029 : see if sqrtl exists
5030 set sqrtl d_sqrtl
5031 eval $inlibc
5032
5033 case "$ccflags" in
5034 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5035 esac
5036
5037 case "$uselongdouble" in
5038 $define|true|[yY]*)     dflt='y';;
5039 *) dflt='n';;
5040 esac
5041 cat <<EOM
5042
5043 Perl can be built to take advantage of long doubles which
5044 (if available) may give more accuracy and range for floating point numbers.
5045
5046 If this doesn't make any sense to you, just accept the default '$dflt'.
5047 EOM
5048 rp='Try to use long doubles if available?'
5049 . ./myread
5050 case "$ans" in
5051 y|Y)    val="$define"   ;;
5052 *)      val="$undef"    ;;
5053 esac
5054 set uselongdouble
5055 eval $setvar
5056
5057 case "$uselongdouble" in
5058 true|[yY]*) uselongdouble="$define" ;;
5059 esac
5060
5061 case "$uselongdouble" in
5062 $define)
5063 : Look for a hint-file generated 'call-back-unit'.  If the
5064 : user has specified that long doubles should be used,
5065 : we may need to set or change some other defaults.
5066         if $test -f uselongdouble.cbu; then
5067                 echo "Your platform has some specific hints for long doubles, using them..."
5068                 . ./uselongdouble.cbu
5069         else
5070                 $cat <<EOM
5071 (Your platform doesn't have any specific hints for long doubles.)
5072 EOM
5073         fi
5074         ;;
5075 esac
5076
5077 case "$uselongdouble:$d_sqrtl" in
5078 $define:$undef)
5079                 $cat <<EOM >&4
5080
5081 *** You requested the use of long doubles but you do not seem to have
5082 *** the mathematic functions for long doubles.  I'm disabling the use
5083 *** of long doubles.
5084
5085 EOM
5086         uselongdouble=$undef
5087         ;;
5088 esac
5089
5090 : check for length of double
5091 echo " "
5092 case "$doublesize" in
5093 '')
5094         echo "Checking to see how big your double precision numbers are..." >&4
5095         $cat >try.c <<'EOCP'
5096 #include <stdio.h>
5097 int main()
5098 {
5099     printf("%d\n", (int)sizeof(double));
5100     exit(0);
5101 }
5102 EOCP
5103         set try
5104         if eval $compile_ok; then
5105                 doublesize=`./try`
5106                 echo "Your double is $doublesize bytes long."
5107         else
5108                 dflt='8'
5109                 echo "(I can't seem to compile the test program.  Guessing...)"
5110                 rp="What is the size of a double precision number (in bytes)?"
5111                 . ./myread
5112                 doublesize="$ans"
5113         fi
5114         ;;
5115 esac
5116 $rm -f try.c try
5117
5118 : check for long doubles
5119 echo " "
5120 echo "Checking to see if you have long double..." >&4
5121 echo 'int main() { long double x = 7.0; }' > try.c
5122 set try
5123 if eval $compile; then
5124         val="$define"
5125         echo "You have long double."
5126 else
5127         val="$undef"
5128         echo "You do not have long double."
5129 fi
5130 $rm try.*
5131 set d_longdbl
5132 eval $setvar
5133
5134 : check for length of long double
5135 case "${d_longdbl}${longdblsize}" in
5136 $define)
5137         echo " "
5138         echo "Checking to see how big your long doubles are..." >&4
5139         $cat >try.c <<'EOCP'
5140 #include <stdio.h>
5141 int main()
5142 {
5143         printf("%d\n", sizeof(long double));
5144 }
5145 EOCP
5146         set try
5147         set try
5148         if eval $compile; then
5149                 longdblsize=`./try$exe_ext`
5150                 echo "Your long doubles are $longdblsize bytes long."
5151         else
5152                 dflt='8'
5153                 echo " "
5154                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5155                 rp="What is the size of a long double (in bytes)?"
5156                 . ./myread
5157                 longdblsize="$ans"
5158         fi
5159         if $test "X$doublesize" = "X$longdblsize"; then
5160                 echo "(That isn't any different from an ordinary double.)"
5161         fi      
5162         ;;
5163 esac
5164 $rm -f try.* try
5165
5166 : determine the architecture name
5167 echo " "
5168 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5169         tarch=`arch`"-$osname"
5170 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5171         if uname -m > tmparch 2>&1 ; then
5172                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5173                         -e 's/$/'"-$osname/" tmparch`
5174         else
5175                 tarch="$osname"
5176         fi
5177         $rm -f tmparch
5178 else
5179         tarch="$osname"
5180 fi
5181 case "$myarchname" in
5182 ''|"$tarch") ;;
5183 *)
5184         echo "(Your architecture name used to be $myarchname.)"
5185         archname=''
5186         ;;
5187 esac
5188 myarchname="$tarch"
5189 case "$archname" in
5190 '') dflt="$tarch";;
5191 *) dflt="$archname";;
5192 esac
5193 rp='What is your architecture name'
5194 . ./myread
5195 archname="$ans"
5196 case "$usethreads" in
5197 $define)
5198         echo "Threads selected." >&4
5199         case "$archname" in
5200         *-thread*) echo "...and architecture name already has -thread." >&4
5201                 ;;
5202         *)      archname="$archname-thread"
5203                 echo "...setting architecture name to $archname." >&4
5204                 ;;
5205         esac
5206         ;;
5207 esac
5208 case "$usemultiplicity" in
5209 $define)
5210         echo "Multiplicity selected." >&4
5211         case "$archname" in
5212         *-multi*) echo "...and architecture name already has -multi." >&4
5213                 ;;
5214         *)      archname="$archname-multi"
5215                 echo "...setting architecture name to $archname." >&4
5216                 ;;
5217         esac
5218         ;;
5219 esac
5220 case "$use64bitint$use64bitall" in
5221 *"$define"*)
5222         case "$archname64" in
5223         '')
5224                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5225                 ;;
5226         *)
5227                 case "$use64bitint" in
5228                 "$define") echo "64 bit integers selected." >&4 ;;
5229                 esac
5230                 case "$use64bitall" in
5231                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5232                 esac
5233                 case "$archname" in
5234                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5235                         ;;
5236                 *)      archname="$archname-$archname64"
5237                         echo "...setting architecture name to $archname." >&4
5238                         ;;
5239                 esac
5240                 ;;
5241         esac
5242 esac
5243 case "$uselongdouble" in
5244 $define)
5245         echo "Long doubles selected." >&4
5246         case "$longdblsize" in
5247         $doublesize)
5248                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5249                 ;;
5250         *)
5251                 case "$archname" in
5252                 *-ld*) echo "...and architecture name already has -ld." >&4
5253                         ;;
5254                 *)      archname="$archname-ld"
5255                         echo "...setting architecture name to $archname." >&4
5256                         ;;
5257                 esac
5258                 ;;
5259         esac
5260         ;;
5261 esac
5262
5263 : determine root of directory hierarchy where package will be installed.
5264 case "$prefix" in
5265 '')
5266         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5267         ;;
5268 *)
5269         dflt="$prefix"
5270         ;;
5271 esac
5272 $cat <<EOM
5273
5274 By default, $package will be installed in $dflt/bin, manual pages
5275 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5276 installation directories. Typically this is something like /usr/local.
5277 If you wish to have binaries under /usr/bin but other parts of the
5278 installation under /usr/local, that's ok: you will be prompted
5279 separately for each of the installation directories, the prefix being
5280 only used to set the defaults.
5281
5282 EOM
5283 fn=d~
5284 rp='Installation prefix to use?'
5285 . ./getfile
5286 oldprefix=''
5287 case "$prefix" in
5288 '') ;;
5289 *)
5290         case "$ans" in
5291         "$prefix") ;;
5292         *) oldprefix="$prefix";;
5293         esac
5294         ;;
5295 esac
5296 prefix="$ans"
5297 prefixexp="$ansexp"
5298
5299 : is AFS running?
5300 echo " "
5301 case "$afs" in
5302 $define|true)   afs=true ;;
5303 $undef|false)   afs=false ;;
5304 *)      if test -d /afs; then
5305                 afs=true
5306         else
5307                 afs=false
5308         fi
5309         ;;
5310 esac
5311 if $afs; then
5312         echo "AFS may be running... I'll be extra cautious then..." >&4
5313 else
5314         echo "AFS does not seem to be running..." >&4
5315 fi
5316
5317 : determine installation prefix for where package is to be installed.
5318 if $afs; then 
5319 $cat <<EOM
5320
5321 Since you are running AFS, I need to distinguish the directory in which
5322 files will reside from the directory in which they are installed (and from
5323 which they are presumably copied to the former directory by occult means).
5324
5325 EOM
5326         case "$installprefix" in
5327         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5328         *) dflt="$installprefix";;
5329         esac
5330 else
5331 $cat <<EOM
5332
5333 In some special cases, particularly when building $package for distribution,
5334 it is convenient to distinguish between the directory in which files should 
5335 be installed from the directory ($prefix) in which they 
5336 will eventually reside.  For most users, these two directories are the same.
5337
5338 EOM
5339         case "$installprefix" in
5340         '') dflt=$prefix ;;
5341         *) dflt=$installprefix;;
5342         esac
5343 fi
5344 fn=d~
5345 rp='What installation prefix should I use for installing files?'
5346 . ./getfile
5347 installprefix="$ans"
5348 installprefixexp="$ansexp"
5349
5350 : set the prefixit variable, to compute a suitable default value
5351 prefixit='case "$3" in
5352 ""|none)
5353         case "$oldprefix" in
5354         "") eval "$1=\"\$$2\"";;
5355         *)
5356                 case "$3" in
5357                 "") eval "$1=";;
5358                 none)
5359                         eval "tp=\"\$$2\"";
5360                         case "$tp" in
5361                         ""|" ") eval "$1=\"\$$2\"";;
5362                         *) eval "$1=";;
5363                         esac;;
5364                 esac;;
5365         esac;;
5366 *)
5367         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5368         case "$tp" in
5369         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5370         /*-$oldprefix/*|\~*-$oldprefix/*)
5371                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5372         *) eval "$1=\"\$$2\"";;
5373         esac;;
5374 esac'
5375
5376
5377 : get the patchlevel
5378 echo " "
5379 echo "Getting the current patchlevel..." >&4
5380 if $test -r $rsrc/patchlevel.h;then
5381         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5382         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5383         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5384         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5385         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5386         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5387 else
5388         revision=0
5389         patchlevel=0
5390         subversion=0
5391         api_revision=0
5392         api_version=0
5393         api_subversion=0
5394 fi
5395 $echo "(You have $package version $patchlevel subversion $subversion.)"
5396 case "$osname" in
5397 dos|vms)
5398         : XXX Should be a Configure test for double-dots in filenames.
5399         version=`echo $revision $patchlevel $subversion | \
5400                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5401         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5402                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5403         ;;
5404 *)
5405         version=`echo $revision $patchlevel $subversion | \
5406                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5407         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5408                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5409         ;;
5410 esac
5411 : Special case the 5.005_xx maintenance series, which used 5.005
5412 : without any subversion label as a subdirectory in $sitelib
5413 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5414         api_versionstring='5.005'
5415 fi
5416
5417 : determine installation style
5418 : For now, try to deduce it from prefix unless it is already set.
5419 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5420 case "$installstyle" in
5421 '')     case "$prefix" in
5422                 *perl*) dflt='lib';;
5423                 *) dflt='lib/perl5' ;;
5424         esac
5425         ;;
5426 *)      dflt="$installstyle" ;;
5427 esac
5428 : Probably not worth prompting for this since we prompt for all
5429 : the directories individually, and the prompt would be too long and
5430 : confusing anyway.
5431 installstyle=$dflt
5432
5433 : determine where private library files go
5434 : Usual default is /usr/local/lib/perl5/$version.
5435 : Also allow things like /opt/perl/lib/$version, since 
5436 : /opt/perl/lib/perl5... would be redundant.
5437 : The default "style" setting is made in installstyle.U
5438 case "$installstyle" in
5439 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5440 *)       set dflt privlib lib/$version ;;
5441 esac
5442 eval $prefixit
5443 $cat <<EOM
5444
5445 There are some auxiliary files for $package that need to be put into a
5446 private library directory that is accessible by everyone.
5447
5448 EOM
5449 fn=d~+
5450 rp='Pathname where the private library files will reside?'
5451 . ./getfile
5452 privlib="$ans"
5453 privlibexp="$ansexp"
5454 : Change installation prefix, if necessary.
5455 if $test X"$prefix" != X"$installprefix"; then
5456         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5457 else
5458         installprivlib="$privlibexp"
5459 fi
5460
5461 : set the prefixup variable, to restore leading tilda escape
5462 prefixup='case "$prefixexp" in
5463 "$prefix") ;;
5464 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5465 esac'
5466
5467 : determine where public architecture dependent libraries go
5468 set archlib archlib
5469 eval $prefixit
5470 : privlib default is /usr/local/lib/$package/$version
5471 : archlib default is /usr/local/lib/$package/$version/$archname
5472 : privlib may have an optional trailing /share.
5473 tdflt=`echo $privlib | $sed 's,/share$,,'`
5474 tdflt=$tdflt/$archname
5475 case "$archlib" in
5476 '')     dflt=$tdflt
5477         ;;
5478 *)      dflt="$archlib"
5479     ;;
5480 esac
5481 $cat <<EOM
5482
5483 $spackage contains architecture-dependent library files.  If you are
5484 sharing libraries in a heterogeneous environment, you might store
5485 these files in a separate location.  Otherwise, you can just include
5486 them with the rest of the public library files.
5487
5488 EOM
5489 fn=d+~
5490 rp='Where do you want to put the public architecture-dependent libraries?'
5491 . ./getfile
5492 archlib="$ans"
5493 archlibexp="$ansexp"
5494 if $test X"$archlib" = X"$privlib"; then
5495         d_archlib="$undef"
5496 else
5497         d_archlib="$define"
5498 fi
5499 : Change installation prefix, if necessary.
5500 if $test X"$prefix" != X"$installprefix"; then
5501         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5502 else
5503         installarchlib="$archlibexp"
5504 fi
5505
5506
5507 : Binary compatibility with 5.005 is not possible for builds
5508 : with advanced features
5509 case "$usethreads$usemultiplicity" in
5510 *define*)
5511         bincompat5005="$undef"
5512         d_bincompat5005="$undef"
5513         ;;
5514 *)      $cat <<EOM
5515
5516 This version of Perl can be compiled for binary compatibility with 5.005.
5517 If you decide to do so, you will be able to continue using most of the
5518 extensions that were compiled for Perl 5.005.
5519
5520 EOM
5521         case "$bincompat5005$d_bincompat5005" in
5522         *"$undef"*) dflt=n ;;
5523         *) dflt=y ;;
5524         esac
5525         rp='Binary compatibility with Perl 5.005?'
5526         . ./myread
5527         case "$ans" in
5528         y*) val="$define" ;;
5529         *)  val="$undef" ;;
5530         esac
5531         set d_bincompat5005
5532         eval $setvar
5533         case "$d_bincompat5005" in
5534         "$define")
5535                 bincompat5005="$define"
5536                 ;;
5537         *)      bincompat5005="$undef"
5538                 d_bincompat5005="$undef"
5539                 ;;
5540         esac
5541         ;;
5542 esac
5543
5544
5545 : see if setuid scripts can be secure
5546 $cat <<EOM
5547
5548 Some kernels have a bug that prevents setuid #! scripts from being
5549 secure.  Some sites have disabled setuid #! scripts because of this.
5550
5551 First let's decide if your kernel supports secure setuid #! scripts.
5552 (If setuid #! scripts would be secure but have been disabled anyway,
5553 don't say that they are secure if asked.)
5554
5555 EOM
5556
5557 val="$undef"
5558 if $test -d /dev/fd; then
5559         echo "#!$ls" >reflect
5560         chmod +x,u+s reflect
5561         ./reflect >flect 2>&1
5562         if $contains "/dev/fd" flect >/dev/null; then
5563                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5564                 val="$define"
5565         else
5566                 $cat <<EOM
5567 If you are not sure if they are secure, I can check but I'll need a
5568 username and password different from the one you are using right now.
5569 If you don't have such a username or don't want me to test, simply
5570 enter 'none'.
5571
5572 EOM
5573                 rp='Other username to test security of setuid scripts with?'
5574                 dflt='none'
5575                 . ./myread
5576                 case "$ans" in
5577                 n|none)
5578                         case "$d_suidsafe" in
5579                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5580                                 dflt=n;;
5581                         "$undef")
5582                                 echo "Well, the $hint value is *not* secure." >&4
5583                                 dflt=n;;
5584                         *)      echo "Well, the $hint value *is* secure." >&4
5585                                 dflt=y;;
5586                         esac
5587                         ;;
5588                 *)
5589                         $rm -f reflect flect
5590                         echo "#!$ls" >reflect
5591                         chmod +x,u+s reflect
5592                         echo >flect
5593                         chmod a+w flect
5594                         echo '"su" will (probably) prompt you for '"$ans's password."
5595                         su $ans -c './reflect >flect'
5596                         if $contains "/dev/fd" flect >/dev/null; then
5597                                 echo "Okay, it looks like setuid scripts are secure." >&4
5598                                 dflt=y
5599                         else
5600                                 echo "I don't think setuid scripts are secure." >&4
5601                                 dflt=n
5602                         fi
5603                         ;;
5604                 esac
5605                 rp='Does your kernel have *secure* setuid scripts?'
5606                 . ./myread
5607                 case "$ans" in
5608                 [yY]*)  val="$define";;
5609                 *)      val="$undef";;
5610                 esac
5611         fi
5612 else
5613         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5614         echo "(That's for file descriptors, not floppy disks.)"
5615         val="$undef"
5616 fi
5617 set d_suidsafe
5618 eval $setvar
5619
5620 $rm -f reflect flect
5621
5622 : now see if they want to do setuid emulation
5623 echo " "
5624 val="$undef"
5625 case "$d_suidsafe" in
5626 "$define")
5627         val="$undef"
5628         echo "No need to emulate SUID scripts since they are secure here." >& 4
5629         ;;
5630 *)
5631         $cat <<EOM
5632 Some systems have disabled setuid scripts, especially systems where
5633 setuid scripts cannot be secure.  On systems where setuid scripts have
5634 been disabled, the setuid/setgid bits on scripts are currently
5635 useless.  It is possible for $package to detect those bits and emulate
5636 setuid/setgid in a secure fashion.  This emulation will only work if
5637 setuid scripts have been disabled in your kernel.
5638
5639 EOM
5640         case "$d_dosuid" in
5641         "$define") dflt=y ;;
5642         *) dflt=n ;;
5643         esac
5644         rp="Do you want to do setuid/setgid emulation?"
5645         . ./myread
5646         case "$ans" in
5647         [yY]*)  val="$define";;
5648         *)      val="$undef";;
5649         esac
5650         ;;
5651 esac
5652 set d_dosuid
5653 eval $setvar
5654
5655 : determine filename position in cpp output
5656 echo " "
5657 echo "Computing filename position in cpp output for #include directives..." >&4
5658 echo '#include <stdio.h>' > foo.c
5659 $cat >fieldn <<EOF
5660 $startsh
5661 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5662 $grep '^[       ]*#.*stdio\.h' | \
5663 while read cline; do
5664         pos=1
5665         set \$cline
5666         while $test \$# -gt 0; do
5667                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5668                         echo "\$pos"
5669                         exit 0
5670                 fi
5671                 shift
5672                 pos=\`expr \$pos + 1\`
5673         done
5674 done
5675 EOF
5676 chmod +x fieldn
5677 fieldn=`./fieldn`
5678 $rm -f foo.c fieldn
5679 case $fieldn in
5680 '') pos='???';;
5681 1) pos=first;;
5682 2) pos=second;;
5683 3) pos=third;;
5684 *) pos="${fieldn}th";;
5685 esac
5686 echo "Your cpp writes the filename in the $pos field of the line."
5687
5688 : locate header file
5689 $cat >findhdr <<EOF
5690 $startsh
5691 wanted=\$1
5692 name=''
5693 for usrincdir in $usrinc
5694 do
5695         if test -f \$usrincdir/\$wanted; then
5696                 echo "\$usrincdir/\$wanted"
5697                 exit 0
5698         fi
5699 done
5700 awkprg='{ print \$$fieldn }'
5701 echo "#include <\$wanted>" > foo\$\$.c
5702 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5703 $grep "^[       ]*#.*\$wanted" | \
5704 while read cline; do
5705         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5706         case "\$name" in
5707         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5708         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5709         *) exit 2;;
5710         esac;
5711 done;
5712 #
5713 # status = 0: grep returned 0 lines, case statement not executed
5714 # status = 1: headerfile found
5715 # status = 2: while loop executed, no headerfile found
5716 #
5717 status=\$?
5718 $rm -f foo\$\$.c;
5719 if test \$status -eq 1; then
5720         exit 0;
5721 fi
5722 exit 1
5723 EOF
5724 chmod +x findhdr
5725
5726 : define an alternate in-header-list? function
5727 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5728 cont=true; xxf="echo \"<\$1> found.\" >&4";
5729 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5730 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5731 esac;
5732 case $# in 4) instead=instead;; *) instead="at last";; esac;
5733 while $test "$cont"; do
5734         xxx=`./findhdr $1`
5735         var=$2; eval "was=\$$2";
5736         if $test "$xxx" && $test -r "$xxx";
5737         then eval $xxf;
5738         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5739                 cont="";
5740         else eval $xxnf;
5741         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5742         set $yyy; shift; shift; yyy=$@;
5743         case $# in 0) cont="";;
5744         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5745                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5746         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5747                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5748         esac;
5749 done;
5750 while $test "$yyy";
5751 do set $yyy; var=$2; eval "was=\$$2";
5752         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5753         set $yyy; shift; shift; yyy=$@;
5754 done'
5755
5756 : see if this is a malloc.h system
5757 set malloc.h i_malloc
5758 eval $inhdr
5759
5760 : see if stdlib is available
5761 set stdlib.h i_stdlib
5762 eval $inhdr
5763
5764 : determine which malloc to compile in
5765 echo " "
5766 case "$usemymalloc" in
5767 ''|[yY]*|true|$define)  dflt='y' ;;
5768 *)      dflt='n' ;;
5769 esac
5770 rp="Do you wish to attempt to use the malloc that comes with $package?"
5771 . ./myread
5772 usemymalloc="$ans"
5773 case "$ans" in
5774 y*|true)
5775         usemymalloc='y'
5776         mallocsrc='malloc.c'
5777         mallocobj="malloc$_o"
5778         d_mymalloc="$define"
5779         case "$libs" in
5780         *-lmalloc*)
5781                 : Remove malloc from list of libraries to use
5782                 echo "Removing unneeded -lmalloc from library list" >&4
5783                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5784                 shift
5785                 libs="$*"
5786                 echo "libs = $libs" >&4
5787                 ;;
5788         esac
5789         ;;
5790 *)
5791         usemymalloc='n'
5792         mallocsrc=''
5793         mallocobj=''
5794         d_mymalloc="$undef"
5795         ;;
5796 esac
5797
5798 : compute the return types of malloc and free
5799 echo " "
5800 $cat >malloc.c <<END
5801 #$i_malloc I_MALLOC
5802 #$i_stdlib I_STDLIB
5803 #include <stdio.h>
5804 #include <sys/types.h>
5805 #ifdef I_MALLOC
5806 #include <malloc.h>
5807 #endif
5808 #ifdef I_STDLIB
5809 #include <stdlib.h>
5810 #endif
5811 #ifdef TRY_MALLOC
5812 void *malloc();
5813 #endif
5814 #ifdef TRY_FREE
5815 void free();
5816 #endif
5817 END
5818 case "$malloctype" in
5819 '')
5820         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5821                 malloctype='void *'
5822         else
5823                 malloctype='char *'
5824         fi
5825         ;;
5826 esac
5827 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5828
5829 case "$freetype" in
5830 '')
5831         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5832                 freetype='void'
5833         else
5834                 freetype='int'
5835         fi
5836         ;;
5837 esac
5838 echo "Your system uses $freetype free(), it would seem." >&4
5839 $rm -f malloc.[co]
5840 $cat <<EOM
5841
5842 After $package is installed, you may wish to install various
5843 add-on modules and utilities.  Typically, these add-ons will
5844 be installed under $prefix with the rest
5845 of this package.  However, you may wish to install such add-ons
5846 elsewhere under a different prefix.
5847
5848 If you do not wish to put everything under a single prefix, that's
5849 ok.  You will be prompted for the individual locations; this siteprefix
5850 is only used to suggest the defaults.
5851
5852 The default should be fine for most people.
5853
5854 EOM
5855 fn=d~+
5856 rp='Installation prefix to use for add-on modules and utilities?'
5857 : XXX Here might be another good place for an installstyle setting.
5858 case "$siteprefix" in
5859 '') dflt=$prefix ;;
5860 *)  dflt=$siteprefix ;;
5861 esac
5862 . ./getfile
5863 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5864 oldsiteprefix=''
5865 case "$siteprefix" in
5866 '') ;;
5867 *)      case "$ans" in
5868         "$prefix") ;;
5869         *) oldsiteprefix="$prefix";;
5870         esac
5871         ;;
5872 esac
5873 siteprefix="$ans"
5874 siteprefixexp="$ansexp"
5875
5876 : determine where site specific libraries go.
5877 : Usual default is /usr/local/lib/perl5/site_perl/$version
5878 : The default "style" setting is made in installstyle.U
5879 : XXX No longer works with Prefixit stuff.
5880 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5881 case "$sitelib" in
5882 '') case "$installstyle" in
5883         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5884         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5885         esac
5886         ;;
5887 *)      dflt="$sitelib"
5888         ;;
5889 esac
5890 $cat <<EOM
5891
5892 The installation process will create a directory for
5893 site-specific extensions and modules.  Most users find it convenient
5894 to place all site-specific files in this directory rather than in the
5895 main distribution directory.
5896
5897 EOM
5898 fn=d~+
5899 rp='Pathname for the site-specific library files?'
5900 . ./getfile
5901 sitelib="$ans"
5902 sitelibexp="$ansexp"
5903 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5904 : Change installation prefix, if necessary.
5905 if $test X"$prefix" != X"$installprefix"; then
5906         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5907 else
5908         installsitelib="$sitelibexp"
5909 fi
5910
5911 : determine where site specific architecture-dependent libraries go.
5912 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5913 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5914 : sitelib may have an optional trailing /share.
5915 case "$sitearch" in
5916 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5917         dflt="$dflt/$archname"
5918         ;;
5919 *)      dflt="$sitearch"
5920         ;;
5921 esac
5922 set sitearch sitearch none
5923 eval $prefixit
5924 $cat <<EOM
5925
5926 The installation process will also create a directory for
5927 architecture-dependent site-specific extensions and modules.
5928
5929 EOM
5930 fn=d~+
5931 rp='Pathname for the site-specific architecture-dependent library files?'
5932 . ./getfile
5933 sitearch="$ans"
5934 sitearchexp="$ansexp"
5935 : Change installation prefix, if necessary.
5936 if $test X"$prefix" != X"$installprefix"; then
5937         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5938 else
5939         installsitearch="$sitearchexp"
5940 fi
5941
5942 $cat <<EOM
5943
5944 The installation process will also create a directory for
5945 vendor-supplied add-ons.  Vendors who supply perl with their system
5946 may find it convenient to place all vendor-supplied files in this
5947 directory rather than in the main distribution directory.  This will
5948 ease upgrades between binary-compatible maintenance versions of perl.
5949
5950 Of course you may also use these directories in whatever way you see
5951 fit.  For example, you might use them to access modules shared over a
5952 company-wide network.
5953
5954 The default answer should be fine for most people.
5955 This causes further questions about vendor add-ons to be skipped
5956 and no vendor-specific directories will be configured for perl.
5957
5958 EOM
5959 rp='Do you want to configure vendor-specific add-on directories?'
5960 case "$usevendorprefix" in
5961 define|true|[yY]*) dflt=y ;;
5962 *)      : User may have set vendorprefix directly on Configure command line.
5963         case "$vendorprefix" in
5964         ''|' ') dflt=n ;;
5965         *)      dflt=y ;;
5966         esac
5967         ;;
5968 esac
5969 . ./myread
5970 case "$ans" in
5971 [yY]*)  fn=d~+
5972         rp='Installation prefix to use for vendor-supplied add-ons?'
5973         case "$vendorprefix" in
5974         '') dflt='' ;;
5975         *)  dflt=$vendorprefix ;;
5976         esac
5977         . ./getfile
5978         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5979         oldvendorprefix=''
5980         case "$vendorprefix" in
5981         '') ;;
5982         *)      case "$ans" in
5983                 "$prefix") ;;
5984                 *) oldvendorprefix="$prefix";;
5985                 esac
5986                 ;;
5987         esac
5988         usevendorprefix="$define"
5989         vendorprefix="$ans"
5990         vendorprefixexp="$ansexp"
5991         ;;
5992 *)      usevendorprefix="$undef"
5993         vendorprefix=''
5994         vendorprefixexp=''
5995         ;;
5996 esac
5997
5998 case "$vendorprefix" in
5999 '')     d_vendorlib="$undef"
6000         vendorlib=''
6001         vendorlibexp=''
6002         ;;
6003 *)      d_vendorlib="$define"
6004         : determine where vendor-supplied modules go.
6005         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6006         case "$vendorlib" in
6007         '')
6008                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6009                 case "$installstyle" in
6010                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6011                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6012                 esac
6013                 ;;
6014         *)      dflt="$vendorlib"
6015                 ;;
6016         esac
6017         fn=d~+
6018         rp='Pathname for the vendor-supplied library files?'
6019         . ./getfile
6020         vendorlib="$ans"
6021         vendorlibexp="$ansexp"
6022         ;;
6023 esac
6024 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6025 : Change installation prefix, if necessary.
6026 if $test X"$prefix" != X"$installprefix"; then
6027         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6028 else
6029         installvendorlib="$vendorlibexp"
6030 fi
6031
6032 case "$vendorprefix" in
6033 '')     d_vendorarch="$undef"
6034         vendorarch=''
6035         vendorarchexp=''
6036         ;;
6037 *)      d_vendorarch="$define"
6038         : determine where vendor-supplied architecture-dependent libraries go.
6039         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6040         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6041         : vendorlib may have an optional trailing /share.
6042         case "$vendorarch" in
6043         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6044                 dflt="$dflt/$archname"
6045                 ;;
6046         *)      dflt="$vendorarch" ;;
6047         esac
6048         fn=d~+
6049         rp='Pathname for vendor-supplied architecture-dependent files?'
6050         . ./getfile
6051         vendorarch="$ans"
6052         vendorarchexp="$ansexp"
6053         ;;
6054 esac
6055 : Change installation prefix, if necessary.
6056 if $test X"$prefix" != X"$installprefix"; then
6057         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6058 else
6059         installvendorarch="$vendorarchexp"
6060 fi
6061
6062 : Final catch-all directories to search
6063 $cat <<EOM
6064
6065 Lastly, you can have perl look in other directories for extensions and
6066 modules in addition to those already specified.
6067 These directories will be searched after 
6068         $sitearch 
6069         $sitelib 
6070 EOM
6071 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6072 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6073 echo ' '
6074 case "$otherlibdirs" in
6075 ''|' ') dflt='none' ;;
6076 *)      dflt="$otherlibdirs" ;;
6077 esac
6078 $cat <<EOM
6079 Enter a colon-separated set of extra paths to include in perl's @INC
6080 search path, or enter 'none' for no extra paths.
6081
6082 EOM
6083
6084 rp='Colon-separated list of additional directories for perl to search?'
6085 . ./myread
6086 case "$ans" in
6087 ' '|''|none)    otherlibdirs=' ' ;;     
6088 *)      otherlibdirs="$ans" ;;
6089 esac
6090 case "$otherlibdirs" in
6091 ' ') val=$undef ;;
6092 *)      val=$define ;;
6093 esac
6094 set d_perl_otherlibdirs
6095 eval $setvar
6096
6097 : Cruising for prototypes
6098 echo " "
6099 echo "Checking out function prototypes..." >&4
6100 $cat >prototype.c <<'EOCP'
6101 int main(int argc, char *argv[]) {
6102         exit(0);}
6103 EOCP
6104 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6105         echo "Your C compiler appears to support function prototypes."
6106         val="$define"
6107 else
6108         echo "Your C compiler doesn't seem to understand function prototypes."
6109         val="$undef"
6110 fi
6111 set prototype
6112 eval $setvar
6113 $rm -f prototype*
6114
6115 case "$prototype" in
6116 "$define") ;;
6117 *)      ansi2knr='ansi2knr'
6118         echo " "
6119         cat <<EOM >&4
6120
6121 $me:  FATAL ERROR:
6122 This version of $package can only be compiled by a compiler that 
6123 understands function prototypes.  Unfortunately, your C compiler 
6124         $cc $ccflags
6125 doesn't seem to understand them.  Sorry about that.
6126
6127 If GNU cc is available for your system, perhaps you could try that instead.  
6128
6129 Eventually, we hope to support building Perl with pre-ANSI compilers.
6130 If you would like to help in that effort, please contact <perlbug@perl.org>.
6131
6132 Aborting Configure now.
6133 EOM
6134         exit 2
6135         ;;
6136 esac
6137
6138 : determine where public executables go
6139 echo " "
6140 set dflt bin bin
6141 eval $prefixit
6142 fn=d~
6143 rp='Pathname where the public executables will reside?'
6144 . ./getfile
6145 if $test "X$ansexp" != "X$binexp"; then
6146         installbin=''
6147 fi
6148 bin="$ans"
6149 binexp="$ansexp"
6150 : Change installation prefix, if necessary.
6151 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6152 if $test X"$prefix" != X"$installprefix"; then
6153         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6154 else
6155         installbin="$binexp"
6156 fi
6157
6158 : Find perl5.005 or later.
6159 echo "Looking for a previously installed perl5.005 or later... "
6160 case "$perl5" in
6161 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6162                 : Check if this perl is recent and can load a simple module
6163                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6164                         perl5=$tdir/perl
6165                         break;
6166                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6167                         perl5=$tdir/perl
6168                         break;
6169                 fi
6170         done
6171         ;;
6172 *)      perl5="$perl5"
6173         ;;
6174 esac
6175 case "$perl5" in
6176 '')     echo "None found.  That's ok.";;
6177 *)      echo "Using $perl5." ;;
6178 esac
6179
6180 : Determine list of previous versions to include in @INC
6181 $cat > getverlist <<EOPL
6182 #!$perl5 -w
6183 use File::Basename;
6184 \$api_versionstring = "$api_versionstring";
6185 \$version = "$version";
6186 \$stem = "$sitelib_stem";
6187 \$archname = "$archname";
6188 EOPL
6189         $cat >> getverlist <<'EOPL'
6190 # Can't have leading @ because metaconfig interprets it as a command!
6191 ;@inc_version_list=();
6192 # XXX Redo to do opendir/readdir? 
6193 if (-d $stem) {
6194     chdir($stem);
6195     ;@candidates = glob("5.*");
6196 }
6197 else {
6198     ;@candidates = ();
6199 }
6200
6201 # XXX ToDo:  These comparisons must be reworked when two-digit
6202 # subversions come along, so that 5.7.10 compares as greater than
6203 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6204 # widespread that we can use the built-in version vectors rather
6205 # than reinventing them here.  For 5.6.0, however, we must
6206 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6207 foreach $d (@candidates) {
6208     if ($d lt $version) {
6209         if ($d ge $api_versionstring) {
6210             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6211         }
6212         elsif ($d ge "5.005") {
6213             unshift(@inc_version_list, grep { -d } $d);
6214         }
6215     }
6216     else {
6217         # Skip newer version.  I.e. don't look in
6218         # 5.7.0 if we're installing 5.6.1.
6219     }
6220 }
6221
6222 if (@inc_version_list) {
6223     print join(' ', @inc_version_list);
6224 }
6225 else {
6226     # Blank space to preserve value for next Configure run.
6227     print " ";
6228 }
6229 EOPL
6230 chmod +x getverlist
6231 case "$inc_version_list" in
6232 '')     if test -x "$perl5"; then
6233                 dflt=`$perl5 getverlist`
6234         else
6235                 dflt='none'
6236         fi
6237         ;;
6238 $undef) dflt='none' ;;
6239 *)  dflt="$inc_version_list" ;;
6240 esac
6241 case "$dflt" in
6242 ''|' ') dflt=none ;;
6243 esac
6244 case "$dflt" in
6245 5.005) case "$bincompat5005" in
6246        $define|true|[yY]*) ;;
6247        *) dflt=none ;;
6248        esac
6249        ;;
6250 esac
6251 $cat <<'EOM'
6252
6253 In order to ease the process of upgrading, this version of perl 
6254 can be configured to use modules built and installed with earlier 
6255 versions of perl that were installed under $prefix.  Specify here
6256 the list of earlier versions that this version of perl should check.
6257 If Configure detected no earlier versions of perl installed under
6258 $prefix, then the list will be empty.  Answer 'none' to tell perl
6259 to not search earlier versions.
6260
6261 The default should almost always be sensible, so if you're not sure,
6262 just accept the default.
6263 EOM
6264
6265 rp='List of earlier versions to include in @INC?'
6266 . ./myread
6267 case "$ans" in
6268 [Nn]one|''|' ') inc_version_list=' ' ;;
6269 *) inc_version_list="$ans" ;;
6270 esac
6271 case "$inc_version_list" in
6272 ''|' ') 
6273         inc_version_list_init='0';;
6274 *)      inc_version_list_init=`echo $inc_version_list |
6275                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6276         ;;
6277 esac
6278 $rm -f getverlist
6279
6280 : determine whether to install perl also as /usr/bin/perl
6281
6282 echo " "
6283 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6284         $cat <<EOM
6285 Many scripts expect perl to be installed as /usr/bin/perl.
6286 I can install the perl you are about to compile also as /usr/bin/perl
6287 (in addition to $installbin/perl).
6288 EOM
6289         case "$installusrbinperl" in
6290         "$undef"|[nN]*) dflt='n';;
6291         *)              dflt='y';;
6292         esac
6293         rp="Do you want to install perl as /usr/bin/perl?"
6294         . ./myread
6295         case "$ans" in
6296         [yY]*)  val="$define";;
6297         *)      val="$undef" ;;
6298         esac
6299 else
6300         val="$undef"
6301 fi
6302 set installusrbinperl
6303 eval $setvar
6304
6305 : see if dld is available
6306 set dld.h i_dld
6307 eval $inhdr
6308
6309 : see if dlopen exists
6310 xxx_runnm="$runnm"
6311 runnm=false
6312 set dlopen d_dlopen
6313 eval $inlibc
6314 runnm="$xxx_runnm"
6315
6316 : determine which dynamic loading, if any, to compile in
6317 echo " "
6318 dldir="ext/DynaLoader"
6319 case "$usedl" in
6320 $define|y|true)
6321         dflt='y'
6322         usedl="$define"
6323         ;;
6324 $undef|n|false)
6325         dflt='n'
6326         usedl="$undef"
6327         ;;
6328 *) 
6329         dflt='n'
6330         case "$d_dlopen" in
6331             $define) dflt='y' ;;
6332         esac
6333         case "$i_dld" in
6334             $define) dflt='y' ;;
6335         esac
6336         : Does a dl_xxx.xs file exist for this operating system
6337         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6338         ;;
6339 esac
6340 rp="Do you wish to use dynamic loading?"
6341 . ./myread
6342 usedl="$ans"
6343 case "$ans" in
6344 y*) usedl="$define"
6345         case "$dlsrc" in
6346         '')
6347                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6348                         dflt="$dldir/dl_${osname}.xs"
6349                 elif $test "$d_dlopen" = "$define" ; then
6350                         dflt="$dldir/dl_dlopen.xs"
6351                 elif $test "$i_dld" = "$define" ; then
6352                         dflt="$dldir/dl_dld.xs"
6353                 else
6354                         dflt=''
6355                 fi
6356                 ;;
6357         *)      dflt="$dldir/$dlsrc"
6358                 ;;
6359         esac
6360     echo "The following dynamic loading files are available:"
6361         : Can not go over to $dldir because getfile has path hard-coded in.
6362         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6363         rp="Source file to use for dynamic loading"
6364         fn="fne"
6365         gfpth="$src"
6366         . ./getfile
6367         usedl="$define"
6368         : emulate basename
6369         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6370
6371         $cat << EOM
6372
6373 Some systems may require passing special flags to $cc -c to
6374 compile modules that will be used to create a shared library.
6375 To use no flags, say "none".
6376
6377 EOM
6378     case "$cccdlflags" in
6379     '') case "$gccversion" in
6380                 '') case "$osname" in
6381                         hpux)   dflt='+z' ;;
6382                         next)   dflt='none' ;;
6383                         irix*)  dflt='-KPIC' ;;
6384                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6385                         sunos)  dflt='-pic' ;;
6386                         *)      dflt='none' ;;
6387                     esac
6388                         ;;
6389                 *)  case "$osname" in
6390                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6391                         *)      dflt='-fpic' ;;
6392                     esac ;;
6393             esac ;;
6394         ' ') dflt='none' ;;
6395     *)  dflt="$cccdlflags" ;;
6396     esac
6397     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6398     . ./myread
6399     case "$ans" in
6400     none) cccdlflags=' ' ;;
6401     *) cccdlflags="$ans" ;;
6402     esac
6403
6404     cat << EOM
6405
6406 Some systems use ld to create libraries that can be dynamically loaded,
6407 while other systems (such as those using ELF) use $cc.
6408
6409 EOM
6410         case "$ld" in
6411         '')     $cat >try.c <<'EOM'
6412 /* Test for whether ELF binaries are produced */
6413 #include <fcntl.h>
6414 #include <stdlib.h>
6415 int main() {
6416         char b[4];
6417         int i = open("a.out",O_RDONLY);
6418         if(i == -1) 
6419                 exit(1); /* fail */
6420         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6421                 exit(0); /* succeed (yes, it's ELF) */
6422         else
6423                 exit(1); /* fail */
6424 }
6425 EOM
6426                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6427                         cat <<EOM
6428 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6429 EOM
6430                         dflt="$cc"
6431                 else
6432                         echo "I'll use ld to build dynamic libraries."
6433                         dflt='ld'
6434                 fi
6435                 rm -f try.c a.out
6436                 ;;
6437         *)      dflt="$ld"
6438                 ;;
6439         esac
6440
6441     rp="What command should be used to create dynamic libraries?"
6442     . ./myread
6443         ld="$ans"
6444
6445     cat << EOM
6446
6447 Some systems may require passing special flags to $ld to create a
6448 library that can be dynamically loaded.  If your ld flags include
6449 -L/other/path options to locate libraries outside your loader's normal
6450 search path, you may need to specify those -L options here as well.  To
6451 use no flags, say "none".
6452
6453 EOM
6454     case "$lddlflags" in
6455     '') case "$osname" in
6456                         beos) dflt='-nostart' ;;
6457                         hpux) dflt='-b';
6458                               case "$gccversion" in
6459                               '') dflt="$dflt +vnocompatwarnings" ;;
6460                               esac
6461                               ;;        
6462                         linux|irix*)    dflt='-shared' ;;
6463                         next)  dflt='none' ;;
6464                         solaris) dflt='-G' ;;
6465                         sunos) dflt='-assert nodefinitions' ;;
6466                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6467                 *)     dflt='none' ;;
6468                         esac
6469                         ;;
6470     *) dflt="$lddlflags" ;;
6471     esac
6472
6473         : Try to guess additional flags to pick up local libraries.
6474         : Be careful not to append to a plain 'none'
6475         case "$dflt" in
6476         none) dflt='' ;;
6477         esac
6478         for thisflag in $ldflags; do
6479                 case "$thisflag" in
6480                 -L*|-R*)
6481                         case " $dflt " in
6482                         *" $thisflag "*) ;;
6483                         *) dflt="$dflt $thisflag" ;;
6484                         esac
6485                         ;;
6486                 esac
6487         done
6488
6489         case "$dflt" in
6490         ''|' ') dflt='none' ;;
6491         esac
6492
6493     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6494     . ./myread
6495     case "$ans" in
6496     none) lddlflags=' ' ;;
6497     *) lddlflags="$ans" ;;
6498     esac
6499
6500         cat <<EOM
6501
6502 Some systems may require passing special flags to $cc to indicate that
6503 the resulting executable will use dynamic linking.  To use no flags,
6504 say "none".
6505
6506 EOM
6507     case "$ccdlflags" in
6508     '') case "$osname" in
6509                 hpux)   dflt='-Wl,-E' ;;
6510                 linux)  dflt='-rdynamic' ;;
6511                 next)   dflt='none' ;;
6512                 sunos)  dflt='none' ;;
6513                 *)      dflt='none' ;;
6514             esac ;;
6515     ' ')  dflt='none' ;;
6516     *)  dflt="$ccdlflags" ;;
6517     esac
6518     rp="Any special flags to pass to $cc to use dynamic linking?"
6519     . ./myread
6520     case "$ans" in
6521     none) ccdlflags=' ' ;;
6522     *) ccdlflags="$ans" ;;
6523     esac
6524     ;;
6525 *)  usedl="$undef"
6526         ld='ld'
6527     dlsrc='dl_none.xs'
6528     lddlflags=''
6529     ccdlflags=''
6530     ;;
6531 esac
6532
6533 also=''
6534 case "$usedl" in
6535 $undef)
6536         # No dynamic loading being used, so don't bother even to prompt.
6537         useshrplib='false'
6538         ;;
6539 *)      case "$useshrplib" in
6540         '')     case "$osname" in
6541                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6542                         dflt=y
6543                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6544                         ;;
6545                 next*)
6546                         case "$osvers" in
6547                         4*)     dflt=y
6548                                 also='Building a shared libperl is needed for MAB support.'
6549                                 ;;
6550                         *)      dflt=n
6551                                 ;;
6552                         esac
6553                         ;;
6554                 *)      dflt=n
6555                         ;;
6556                 esac
6557                 ;;
6558         $define|true|[Yy]*)
6559                 dflt=y
6560                 ;;
6561         *)      dflt=n
6562                 ;;
6563         esac
6564         $cat << EOM
6565
6566 The perl executable is normally obtained by linking perlmain.c with
6567 libperl${_a}, any static extensions (usually just DynaLoader), and
6568 any other libraries needed on this system (such as -lm, etc.).  Since
6569 your system supports dynamic loading, it is probably possible to build
6570 a shared libperl.$so.  If you will have more than one executable linked
6571 to libperl.$so, this will significantly reduce the size of each
6572 executable, but it may have a noticeable affect on performance.  The
6573 default is probably sensible for your system.
6574 $also
6575
6576 EOM
6577         rp="Build a shared libperl.$so (y/n)"
6578         . ./myread
6579         case "$ans" in
6580         true|$define|[Yy]*)
6581                 useshrplib='true'  ;;
6582         *)      useshrplib='false' ;;
6583         esac
6584         ;;
6585 esac
6586
6587 case "$useshrplib" in
6588 true)
6589         case "$libperl" in
6590         '')
6591                 # Figure out a good name for libperl.so.  Since it gets stored in
6592                 # a version-specific architecture-dependent library, the version
6593                 # number isn't really that important, except for making cc/ld happy.
6594                 #
6595                 # A name such as libperl.so.3.1
6596                 majmin="libperl.$so.$patchlevel.$subversion"
6597                 # A name such as libperl.so.301
6598                 majonly=`echo $patchlevel $subversion |
6599                         $awk '{printf "%d%02d", $1, $2}'`
6600                 majonly=libperl.$so.$majonly
6601                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6602                 # rely on figuring it out from the naming of libc.
6603                 case "${osname}${osvers}" in
6604                 next4*)
6605                         dflt=libperl.5.$so
6606                         # XXX How handle the --version stuff for MAB?
6607                         ;;
6608                 linux*)  # ld won't link with a bare -lperl otherwise.
6609                         dflt=libperl.$so
6610                         ;;
6611                 cygwin*) # include version
6612                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6613                         ;;
6614                 *)      # Try to guess based on whether libc has major.minor.
6615                         case "$libc" in
6616                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6617                         *libc.$so.[0-9]*) dflt=$majonly ;;
6618                         *)      dflt=libperl.$so ;;
6619                         esac
6620                         ;;
6621                 esac
6622                 ;;
6623         *)      dflt=$libperl
6624                 ;;
6625         esac
6626         cat << EOM
6627
6628 I need to select a good name for the shared libperl.  If your system uses
6629 library names with major and minor numbers, then you might want something
6630 like $majmin.  Alternatively, if your system uses a single version
6631 number for shared libraries, then you might want to use $majonly.
6632 Or, your system might be quite happy with a simple libperl.$so.
6633
6634 Since the shared libperl will get installed into a version-specific
6635 architecture-dependent directory, the version number of the shared perl
6636 library probably isn't important, so the default should be o.k.
6637
6638 EOM
6639         rp='What name do you want to give to the shared libperl?'
6640         . ./myread
6641         libperl=$ans
6642         echo "Ok, I'll use $libperl"
6643         ;;
6644 *)
6645         libperl="libperl${_a}"
6646         ;;
6647 esac
6648
6649 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6650 case "$shrpdir" in
6651 '') ;;
6652 *)      $cat >&4 <<EOM
6653 WARNING:  Use of the shrpdir variable for the installation location of
6654 the shared $libperl is not supported.  It was never documented and
6655 will not work in this version.  Let me (perlbug@perl.org)
6656 know of any problems this may cause.
6657
6658 EOM
6659         case "$shrpdir" in
6660         "$archlibexp/CORE")
6661                 $cat >&4 <<EOM
6662 But your current setting of $shrpdir is
6663 the default anyway, so it's harmless.
6664 EOM
6665                 ;;
6666         *)
6667                 $cat >&4 <<EOM
6668 Further, your current attempted setting of $shrpdir
6669 conflicts with the value of $archlibexp/CORE
6670 that installperl will use.
6671 EOM
6672                 ;;
6673         esac
6674         ;;
6675 esac
6676
6677 # How will the perl executable find the installed shared $libperl?
6678 # Add $xxx to ccdlflags.
6679 # If we can't figure out a command-line option, use $shrpenv to
6680 # set env LD_RUN_PATH.  The main perl makefile uses this.
6681 shrpdir=$archlibexp/CORE
6682 xxx=''
6683 tmp_shrpenv=''
6684 if "$useshrplib"; then
6685     case "$osname" in 
6686         aix)
6687                 # We'll set it in Makefile.SH...
6688                 ;;
6689         solaris|netbsd)
6690                 xxx="-R $shrpdir"
6691                 ;;
6692         freebsd)
6693                 xxx="-Wl,-R$shrpdir"
6694                 ;;
6695         linux|irix*|dec_osf)
6696                 xxx="-Wl,-rpath,$shrpdir"
6697                 ;;
6698         next)
6699                 # next doesn't like the default...
6700                 ;;
6701         beos)
6702                 # beos doesn't like the default, either.
6703                 ;;
6704         hpux*)
6705                 # hpux doesn't like the default, either.
6706                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6707                 ;;
6708         *)
6709                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6710                 ;;
6711         esac
6712         case "$xxx" in
6713         '') ;;
6714         *)      
6715                 # Only add $xxx if it isn't already in ccdlflags.
6716                 case " $ccdlflags " in
6717                 *" $xxx "*)     ;;
6718                 *)      ccdlflags="$ccdlflags $xxx"
6719                         cat <<EOM >&4
6720
6721 Adding $xxx to the flags
6722 passed to $ld so that the perl executable will find the 
6723 installed shared $libperl.
6724
6725 EOM
6726                         ;;
6727                 esac
6728                 ;;
6729         esac
6730 fi
6731 # Fix ccdlflags in AIX for building external extensions.
6732 # (For building Perl itself bare -bE:perl.exp is needed,
6733 #  Makefile.SH takes care of this.)
6734 case "$osname" in
6735 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6736 esac
6737 # Respect a hint or command-line value.
6738 case "$shrpenv" in
6739 '') shrpenv="$tmp_shrpenv" ;;
6740 esac
6741 case "$ldlibpthname" in
6742 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6743 none)   ldlibpthname='' ;;
6744 esac
6745
6746 : determine where manual pages are on this system
6747 echo " "
6748 case "$sysman" in
6749 '') 
6750         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6751         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6752         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6753         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6754         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6755         sysman=`./loc . /usr/man/man1 $syspath`
6756         ;;
6757 esac
6758 if $test -d "$sysman"; then
6759         echo "System manual is in $sysman." >&4
6760 else
6761         echo "Could not find manual pages in source form." >&4
6762 fi
6763
6764 : determine where manual pages go
6765 set man1dir man1dir none
6766 eval $prefixit
6767 $cat <<EOM
6768
6769 $spackage has manual pages available in source form.
6770 EOM
6771 case "$nroff" in
6772 nroff)
6773         echo "However, you don't have nroff, so they're probably useless to you."
6774         case "$man1dir" in
6775         '') man1dir="none";;
6776         esac;;
6777 esac
6778 echo "If you don't want the manual sources installed, answer 'none'."
6779 case "$man1dir" in
6780 ' ') dflt=none
6781         ;;
6782 '')
6783         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6784         lookpath="$lookpath $prefixexp/man/p_man/man1"
6785         lookpath="$lookpath $prefixexp/man/u_man/man1"
6786         lookpath="$lookpath $prefixexp/man/man.1"
6787         case "$sysman" in
6788         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6789         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6790         esac
6791         set dflt
6792         eval $prefixup
6793         ;;
6794 *)  dflt="$man1dir"
6795         ;;
6796 esac
6797 echo " "
6798 fn=dn+~
6799 rp="Where do the main $spackage manual pages (source) go?"
6800 . ./getfile
6801 if $test "X$man1direxp" != "X$ansexp"; then
6802         installman1dir=''
6803 fi
6804 man1dir="$ans"
6805 man1direxp="$ansexp"
6806 case "$man1dir" in
6807 '')     man1dir=' '
6808         installman1dir='';;
6809 esac
6810
6811 : Change installation prefix, if necessary.
6812 if $test X"$prefix" != X"$installprefix"; then
6813         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6814 else
6815         installman1dir="$man1direxp"
6816 fi
6817
6818 : What suffix to use on installed man pages
6819
6820 case "$man1dir" in
6821 ' ')
6822         man1ext='0'
6823         ;;
6824 *)
6825         rp="What suffix should be used for the main $spackage man pages?"
6826         case "$man1ext" in
6827         '')     case "$man1dir" in
6828                 *1)  dflt=1 ;;
6829                 *1p) dflt=1p ;;
6830                 *1pm) dflt=1pm ;;
6831                 *l) dflt=l;;
6832                 *n) dflt=n;;
6833                 *o) dflt=o;;
6834                 *p) dflt=p;;
6835                 *C) dflt=C;;
6836                 *L) dflt=L;;
6837                 *L1) dflt=L1;;
6838                 *) dflt=1;;
6839                 esac
6840                 ;;
6841         *)      dflt="$man1ext";;
6842         esac
6843         . ./myread
6844         man1ext="$ans"
6845         ;;
6846 esac
6847
6848 : see if we can have long filenames
6849 echo " "
6850 first=123456789abcdef
6851 $rm -f $first
6852 if (echo hi >$first) 2>/dev/null; then
6853         if $test -f 123456789abcde; then
6854                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6855                 val="$undef"
6856         else
6857                 echo 'You can have filenames longer than 14 characters.'>&4
6858                 val="$define"
6859         fi
6860 else
6861         $cat <<'EOM'
6862 You can't have filenames longer than 14 chars.
6863 You can't even think about them!
6864 EOM
6865         val="$undef"
6866 fi 
6867 set d_flexfnam
6868 eval $setvar
6869 $rm -rf 123456789abcde*
6870
6871 : determine where library module manual pages go
6872 set man3dir man3dir none
6873 eval $prefixit
6874 $cat <<EOM
6875
6876 $spackage has manual pages for many of the library modules.
6877 EOM
6878
6879 case "$nroff" in
6880 nroff)
6881         $cat <<'EOM'
6882 However, you don't have nroff, so they're probably useless to you.
6883 EOM
6884         case "$man3dir" in
6885         '') man3dir="none";;
6886         esac;;
6887 esac
6888
6889 case "$d_flexfnam" in
6890 undef)
6891         $cat <<'EOM'
6892 However, your system can't handle the long file names like File::Basename.3. 
6893 EOM
6894         case "$man3dir" in
6895         '') man3dir="none";;
6896         esac;;
6897 esac
6898
6899 echo "If you don't want the manual sources installed, answer 'none'."
6900 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6901 case "$man3dir" in
6902 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6903         if $test -d "$privlib/man/man3"; then
6904                 cat <<EOM >&4
6905
6906 WARNING:  Previous versions of perl installed man3 pages into
6907 $privlib/man/man3.  This version will suggest a 
6908 new default of $dflt.  
6909 EOM
6910                 tdflt=$dflt
6911                 dflt='n'
6912                 rp='Do you wish to preserve the old behavior?(y/n)'
6913                 . ./myread
6914                 case "$ans" in
6915                 y*) dflt="$privlib/man/man3" ;;
6916                 *)  dflt=$tdflt ;;
6917                 esac
6918     fi
6919         ;;
6920 *)      dflt="$man3dir" ;;
6921 esac
6922 case "$dflt" in
6923 ' ') dflt=none ;;
6924 esac
6925 echo " "
6926 fn=dn+~
6927 rp="Where do the $package library man pages (source) go?"
6928 . ./getfile
6929 man3dir="$ans"
6930 man3direxp="$ansexp"
6931 case "$man3dir" in
6932 '')     man3dir=' '
6933         installman3dir='';;
6934 esac
6935
6936 : Change installation prefix, if necessary.
6937 if $test X"$prefix" != X"$installprefix"; then
6938         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6939 else
6940         installman3dir="$man3direxp"
6941 fi
6942
6943 : What suffix to use on installed man pages
6944 case "$man3dir" in
6945 ' ')
6946         man3ext='0'
6947         ;;
6948 *)
6949         rp="What suffix should be used for the $package library man pages?"
6950         case "$man3ext" in
6951         '')     case "$man3dir" in
6952                 *3)  dflt=3 ;;
6953                 *3p) dflt=3p ;;
6954                 *3pm) dflt=3pm ;;
6955                 *l) dflt=l;;
6956                 *n) dflt=n;;
6957                 *o) dflt=o;;
6958                 *p) dflt=p;;
6959                 *C) dflt=C;;
6960                 *L) dflt=L;;
6961                 *L3) dflt=L3;;
6962                 *) dflt=3;;
6963                 esac
6964                 ;;
6965         *)      dflt="$man3ext";;
6966         esac
6967         . ./myread
6968         man3ext="$ans"
6969         ;;
6970 esac
6971
6972 : see if we have to deal with yellow pages, now NIS.
6973 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6974         if $test -f /usr/etc/nibindd; then
6975                 echo " "
6976                 echo "I'm fairly confident you're on a NeXT."
6977                 echo " "
6978                 rp='Do you get the hosts file via NetInfo?'
6979                 dflt=y
6980                 case "$hostcat" in
6981                 nidump*) ;;
6982                 '') ;;
6983                 *) dflt=n;;
6984                 esac
6985                 . ./myread
6986                 case "$ans" in
6987                 y*) hostcat='nidump hosts .';;
6988                 *)      case "$hostcat" in
6989                         nidump*) hostcat='';;
6990                         esac
6991                         ;;
6992                 esac
6993         fi
6994         case "$hostcat" in
6995         nidump*) ;;
6996         *)
6997                 case "$hostcat" in
6998                 *ypcat*) dflt=y;;
6999                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7000                                 dflt=y
7001                         else
7002                                 dflt=n
7003                         fi;;
7004                 *) dflt=n;;
7005                 esac
7006                 echo " "
7007                 rp='Are you getting the hosts file via yellow pages?'
7008                 . ./myread
7009                 case "$ans" in
7010                 y*) hostcat='ypcat hosts';;
7011                 *) hostcat='cat /etc/hosts';;
7012                 esac
7013                 ;;
7014         esac
7015 fi
7016 case "$hostcat" in
7017 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7018 esac
7019 case "$groupcat" in
7020 '') test -f /etc/group && groupcat='cat /etc/group';;
7021 esac
7022 case "$passcat" in
7023 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7024 esac
7025
7026 : now get the host name
7027 echo " "
7028 echo "Figuring out host name..." >&4
7029 case "$myhostname" in
7030 '') cont=true
7031         echo 'Maybe "hostname" will work...'
7032         if tans=`sh -c hostname 2>&1` ; then
7033                 myhostname=$tans
7034                 phostname=hostname
7035                 cont=''
7036         fi
7037         ;;
7038 *) cont='';;
7039 esac
7040 if $test "$cont"; then
7041         if ./xenix; then
7042                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7043                 if tans=`cat /etc/systemid 2>&1` ; then
7044                         myhostname=$tans
7045                         phostname='cat /etc/systemid'
7046                         echo "Whadyaknow.  Xenix always was a bit strange..."
7047                         cont=''
7048                 fi
7049         elif $test -r /etc/systemid; then
7050                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7051         fi
7052 fi
7053 if $test "$cont"; then
7054         echo 'No, maybe "uuname -l" will work...'
7055         if tans=`sh -c 'uuname -l' 2>&1` ; then
7056                 myhostname=$tans
7057                 phostname='uuname -l'
7058         else
7059                 echo 'Strange.  Maybe "uname -n" will work...'
7060                 if tans=`sh -c 'uname -n' 2>&1` ; then
7061                         myhostname=$tans
7062                         phostname='uname -n'
7063                 else
7064                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7065                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7066                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7067                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7068                         else
7069                                 case "$myhostname" in
7070                                 '') echo "Does this machine have an identity crisis or something?"
7071                                         phostname='';;
7072                                 *)
7073                                         echo "Well, you said $myhostname before..."
7074                                         phostname='echo $myhostname';;
7075                                 esac
7076                         fi
7077                 fi
7078         fi
7079 fi
7080 : you do not want to know about this
7081 set $myhostname
7082 myhostname=$1
7083
7084 : verify guess
7085 if $test "$myhostname" ; then
7086         dflt=y
7087         rp='Your host name appears to be "'$myhostname'".'" Right?"
7088         . ./myread
7089         case "$ans" in
7090         y*) ;;
7091         *) myhostname='';;
7092         esac
7093 fi
7094
7095 : bad guess or no guess
7096 while $test "X$myhostname" = X ; do
7097         dflt=''
7098         rp="Please type the (one word) name of your host:"
7099         . ./myread
7100         myhostname="$ans"
7101 done
7102
7103 : translate upper to lower if necessary
7104 case "$myhostname" in
7105 *[A-Z]*)
7106         echo "(Normalizing case in your host name)"
7107         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7108         ;;
7109 esac
7110
7111 case "$myhostname" in
7112 *.*)
7113         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7114         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7115         echo "(Trimming domain name from host name--host name is now $myhostname)"
7116         ;;
7117 *) case "$mydomain" in
7118         '')
7119                 {
7120                         test "X$hostcat" = "Xypcat hosts" &&
7121                         ypmatch "$myhostname" hosts 2>/dev/null |\
7122                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7123                         $test -s hosts
7124                 } || {
7125                         test "X$hostcat" != "X" &&
7126                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7127                                         /[       ]$myhostname[  . ]/p" > hosts
7128                 }
7129                 tmp_re="[       . ]"
7130                 if $test -f hosts; then
7131                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7132                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7133                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7134                                 hosts | $sort | $uniq | \
7135                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7136                         case `$echo X$dflt` in
7137                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7138                                 dflt=.
7139                                 ;;
7140                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7141                                 ;;
7142                         esac
7143                 else
7144                         echo "(I cannot locate a hosts database anywhere)"
7145                         dflt=.
7146                 fi
7147                 case "$dflt" in
7148                 .)
7149                         tans=`./loc resolv.conf X /etc /usr/etc`
7150                         if $test -f "$tans"; then
7151                                 echo "(Attempting domain name extraction from $tans)"
7152                                 dflt=.`$sed -n -e 's/   / /g' \
7153                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7154                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7155                                 case "$dflt" in
7156                                 .) dflt=.`$sed -n -e 's/        / /g' \
7157                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7158                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7159                                         ;;
7160                                 esac
7161                         fi
7162                         ;;
7163                 esac
7164                 case "$dflt" in
7165                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7166                         dflt=.`sh -c domainname 2>/dev/null`
7167                         case "$dflt" in
7168                         '') dflt='.';;
7169                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7170                         esac
7171                         ;;
7172                 esac
7173                 case "$dflt" in
7174                 .) echo "(Lost all hope -- silly guess then)"
7175                         dflt='.uucp'
7176                         ;;
7177                 esac
7178                 $rm -f hosts
7179                 ;;
7180         *) dflt="$mydomain";;
7181         esac;;
7182 esac
7183 echo " "
7184 rp="What is your domain name?"
7185 . ./myread
7186 tans="$ans"
7187 case "$ans" in
7188 '') ;;
7189 .*) ;;
7190 *) tans=".$tans";;
7191 esac
7192 mydomain="$tans"
7193
7194 : translate upper to lower if necessary
7195 case "$mydomain" in
7196 *[A-Z]*)
7197         echo "(Normalizing case in your domain name)"
7198         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7199         ;;
7200 esac
7201
7202 : a little sanity check here
7203 case "$phostname" in
7204 '') ;;
7205 *)
7206         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7207         $myhostname$mydomain|$myhostname) ;;
7208         *)
7209                 case "$phostname" in
7210                 sed*)
7211                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7212                         ;;
7213                 *)
7214                         echo "(That doesn't agree with your $phostname command, by the way.)"
7215                         ;;
7216                 esac
7217         ;;
7218         esac
7219         ;;
7220 esac
7221
7222 $cat <<EOM
7223
7224 I need to get your e-mail address in Internet format if possible, i.e.
7225 something like user@host.domain. Please answer accurately since I have
7226 no easy means to double check it. The default value provided below
7227 is most probably close to reality but may not be valid from outside
7228 your organization...
7229
7230 EOM
7231 cont=x
7232 while test "$cont"; do
7233         case "$cf_email" in
7234         '') dflt="$cf_by@$myhostname$mydomain";;
7235         *) dflt="$cf_email";;
7236         esac
7237         rp='What is your e-mail address?'
7238         . ./myread
7239         cf_email="$ans"
7240         case "$cf_email" in
7241         *@*.*) cont='' ;;
7242         *)
7243                 rp='Address does not look like an Internet one.  Use it anyway?'
7244                 case "$fastread" in
7245                 yes) dflt=y ;;
7246                 *) dflt=n ;;
7247                 esac
7248                 . ./myread
7249                 case "$ans" in
7250                 y*) cont='' ;;
7251                 *) echo " " ;;
7252                 esac
7253                 ;;
7254         esac
7255 done
7256
7257 $cat <<EOM
7258
7259 If you or somebody else will be maintaining perl at your site, please
7260 fill in the correct e-mail address here so that they may be contacted
7261 if necessary. Currently, the "perlbug" program included with perl
7262 will send mail to this address in addition to perlbug@perl.org. You may
7263 enter "none" for no administrator.
7264
7265 EOM
7266 case "$perladmin" in
7267 '') dflt="$cf_email";;
7268 *) dflt="$perladmin";;
7269 esac
7270 rp='Perl administrator e-mail address'
7271 . ./myread
7272 perladmin="$ans"
7273
7274 : determine whether to only install version-specific parts.
7275 echo " "
7276 $cat <<EOM
7277 Do you want to install only the version-specific parts of the perl
7278 distribution?  Usually you do *not* want to do this.
7279 EOM
7280 case "$versiononly" in
7281 "$define"|[Yy]*|true) dflt='y' ;;
7282 *) dflt='n';
7283 esac
7284 rp="Do you want to install only the version-specific parts of perl?"
7285 . ./myread
7286 case "$ans" in
7287 [yY]*)  val="$define";;
7288 *)      val="$undef" ;;
7289 esac
7290 set versiononly
7291 eval $setvar
7292
7293 : figure out how to guarantee perl startup
7294 case "$startperl" in
7295 '')
7296         case "$sharpbang" in
7297         *!)
7298                 $cat <<EOH
7299
7300 I can use the #! construct to start perl on your system. This will
7301 make startup of perl scripts faster, but may cause problems if you
7302 want to share those scripts and perl is not in a standard place
7303 ($binexp/perl) on all your platforms. The alternative is to force
7304 a shell by starting the script with a single ':' character.
7305
7306 EOH
7307                 case "$versiononly" in
7308                 "$define")      dflt="$binexp/perl$version";;  
7309                 *)              dflt="$binexp/perl";;
7310                 esac
7311                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7312                 . ./myread
7313                 case "$ans" in
7314                 none)   startperl=": # use perl";;
7315                 *)      startperl="#!$ans"
7316                         if $test 30 -lt `echo "$ans" | wc -c`; then
7317                                 $cat >&4 <<EOM
7318
7319 WARNING:  Some systems limit the #! command to 32 characters.
7320 If you experience difficulty running Perl scripts with #!, try
7321 installing Perl in a directory with a shorter pathname.
7322
7323 EOM
7324                         fi ;;
7325                 esac
7326                 ;;
7327         *) startperl=": # use perl"
7328                 ;;
7329         esac
7330         ;;
7331 esac
7332 echo "I'll use $startperl to start perl scripts."
7333
7334 : figure best path for perl in scripts
7335 case "$perlpath" in
7336 '')
7337         perlpath="$binexp/perl"
7338         case "$startperl" in
7339         *!*) ;;
7340         *)
7341                 $cat <<EOH
7342
7343 I will use the "eval 'exec'" idiom to start Perl on your system.
7344 I can use the full path of your Perl binary for this purpose, but
7345 doing so may cause problems if you want to share those scripts and
7346 Perl is not always in a standard place ($binexp/perl).
7347
7348 EOH
7349                 dflt="$binexp/perl"
7350                 rp="What path shall I use in \"eval 'exec'\"?"
7351                 . ./myread
7352                 perlpath="$ans"
7353                 ;;
7354         esac
7355         ;;
7356 esac
7357 case "$startperl" in
7358 *!*)    ;;
7359 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7360 esac
7361
7362 : determine where public executable scripts go
7363 set scriptdir scriptdir
7364 eval $prefixit
7365 case "$scriptdir" in
7366 '')
7367         dflt="$bin"
7368         : guess some guesses
7369         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7370         $test -d /usr/share/bin     && dflt=/usr/share/bin
7371         $test -d /usr/local/script  && dflt=/usr/local/script
7372         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7373         $test -d $prefixexp/script  && dflt=$prefixexp/script
7374         set dflt
7375         eval $prefixup
7376         ;;
7377 *)  dflt="$scriptdir"
7378         ;;
7379 esac
7380 $cat <<EOM
7381  
7382 Some installations have a separate directory just for executable scripts so
7383 that they can mount it across multiple architectures but keep the scripts in
7384 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7385 Or you might just lump your scripts in with all your other executables.
7386  
7387 EOM
7388 fn=d~
7389 rp='Where do you keep publicly executable scripts?'
7390 . ./getfile
7391 if $test "X$ansexp" != "X$scriptdirexp"; then
7392         installscript=''
7393 fi
7394 scriptdir="$ans"
7395 scriptdirexp="$ansexp"
7396 : Change installation prefix, if necessary.
7397 if $test X"$prefix" != X"$installprefix"; then
7398         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7399 else
7400         installscript="$scriptdirexp"
7401 fi
7402
7403 : determine where add-on public executables go
7404 case "$sitebin" in
7405 '')     dflt=$siteprefix/bin ;;
7406 *)      dflt=$sitebin ;;
7407 esac
7408 fn=d~
7409 rp='Pathname where the add-on public executables should be installed?'
7410 . ./getfile
7411 sitebin="$ans"
7412 sitebinexp="$ansexp"
7413 : Change installation prefix, if necessary.
7414 if $test X"$prefix" != X"$installprefix"; then
7415         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7416 else
7417         installsitebin="$sitebinexp"
7418 fi
7419
7420 case "$useperlio" in
7421 $define|true|[yY]*)     dflt='y';;
7422 *) dflt='n';;
7423 esac
7424 cat <<EOM
7425
7426 Previous version of $package used the standard IO mechanisms as defined
7427 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7428 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7429 the default.  This abstraction layer can use AT&T's sfio (if you already
7430 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7431 problems with some extension modules.  Using PerlIO with stdio is safe,
7432 but it is slower than plain stdio and therefore is not the default.
7433
7434 If this doesn't make any sense to you, just accept the default '$dflt'.
7435 EOM
7436 rp='Use the experimental PerlIO abstraction layer?'
7437 . ./myread
7438 case "$ans" in
7439 y|Y) 
7440         val="$define"
7441         ;;     
7442 *)      
7443         echo "Ok, doing things the stdio way"
7444         val="$undef"
7445         ;;
7446 esac
7447 set useperlio
7448 eval $setvar 
7449
7450 case "$vendorprefix" in
7451 '')     d_vendorbin="$undef"
7452         vendorbin=''
7453         vendorbinexp=''
7454         ;;
7455 *)      d_vendorbin="$define"
7456         : determine where vendor-supplied executables go.
7457         case "$vendorbin" in
7458         '') dflt=$vendorprefix/bin ;;
7459         *)      dflt="$vendorbin" ;;
7460         esac
7461         fn=d~+
7462         rp='Pathname for the vendor-supplied executables directory?'
7463         . ./getfile
7464         vendorbin="$ans"
7465         vendorbinexp="$ansexp"
7466         ;;
7467 esac
7468 : Change installation prefix, if necessary.
7469 if $test X"$prefix" != X"$installprefix"; then
7470         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7471 else
7472         installvendorbin="$vendorbinexp"
7473 fi
7474
7475 : see if qgcvt exists
7476 set qgcvt d_qgcvt
7477 eval $inlibc
7478
7479 echo " "
7480
7481 if $test X"$d_longdbl" = X"$define"; then
7482
7483 echo "Checking how to print long doubles..." >&4
7484
7485 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7486         $cat >try.c <<'EOCP'
7487 #include <sys/types.h>
7488 #include <stdio.h>
7489 int main() {
7490   double d = 123.456;
7491   printf("%.3f\n", d);
7492 }
7493 EOCP
7494         set try
7495         if eval $compile; then
7496                 yyy=`./try$exe_ext`
7497                 case "$yyy" in
7498                 123.456)
7499                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7500                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7501                         echo "We will use %f."
7502                         ;;
7503                 esac
7504         fi
7505 fi
7506
7507 if $test X"$sPRIfldbl" = X; then
7508         $cat >try.c <<'EOCP'
7509 #include <sys/types.h>
7510 #include <stdio.h>
7511 int main() {
7512   long double d = 123.456;
7513   printf("%.3llf\n", d);
7514 }
7515 EOCP
7516         set try
7517         if eval $compile; then
7518                 yyy=`./try$exe_ext`
7519                 case "$yyy" in
7520                 123.456)
7521                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7522                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7523                         echo "We will use %llf."
7524                         ;;
7525                 esac
7526         fi
7527 fi
7528
7529 if $test X"$sPRIfldbl" = X; then
7530         $cat >try.c <<'EOCP'
7531 #include <sys/types.h>
7532 #include <stdio.h>
7533 int main() {
7534   long double d = 123.456;
7535   printf("%.3Lf\n", d);
7536 }
7537 EOCP
7538         set try
7539         if eval $compile; then
7540                 yyy=`./try$exe_ext`
7541                 case "$yyy" in
7542                 123.456)
7543                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7544                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7545                         echo "We will use %Lf."
7546                         ;;
7547                 esac
7548         fi
7549 fi
7550
7551 if $test X"$sPRIfldbl" = X; then
7552         $cat >try.c <<'EOCP'
7553 #include <sys/types.h>
7554 #include <stdio.h>
7555 int main() {
7556   long double d = 123.456;
7557   printf("%.3lf\n", d);
7558 }
7559 EOCP
7560         set try
7561         if eval $compile; then
7562                 yyy=`./try$exe_ext`
7563                 case "$yyy" in
7564                 123.456)
7565                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7566                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7567                         echo "We will use %lf."
7568                         ;;
7569                 esac
7570         fi
7571 fi
7572
7573 if $test X"$sPRIfldbl" = X; then
7574         echo "Cannot figure out how to print long doubles." >&4
7575 else
7576         sSCNfldbl=$sPRIfldbl    # expect consistency
7577 fi
7578
7579 $rm -f try try.*
7580
7581 fi # d_longdbl
7582
7583 case "$sPRIfldbl" in
7584 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7585         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7586         d_SCNfldbl="$undef";
7587         ;;
7588 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7589         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7590         d_SCNfldbl="$define";
7591         ;;
7592 esac
7593
7594 : Check how to convert floats to strings.
7595 echo " "
7596 echo "Checking for an efficient way to convert floats to strings."
7597 echo " " > try.c
7598 case "$uselongdouble" in
7599 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7600 esac
7601 case "$d_longdbl" in
7602 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7603 esac
7604 case "$d_PRIgldbl" in
7605 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7606 esac
7607 $cat >>try.c <<EOP
7608 #ifdef TRY_gconvert
7609 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7610 char *myname = "gconvert";
7611 #endif
7612 #ifdef TRY_gcvt
7613 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7614 char *myname = "gcvt";
7615 #endif
7616 #ifdef TRY_qgcvt
7617 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7618 char *myname = "qgcvt";
7619 #define DOUBLETYPE long double
7620 #endif
7621 #ifdef TRY_sprintf
7622 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7623 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7624 #else
7625 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7626 #endif
7627 char *myname = "sprintf";
7628 #endif
7629
7630 #ifndef DOUBLETYPE
7631 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7632 #define DOUBLETYPE long double
7633 #else
7634 #define DOUBLETYPE double
7635 #endif
7636 #endif
7637
7638 #include <stdio.h>
7639
7640 #define I_STDLIB $i_stdlib
7641 #ifdef I_STDLIB
7642 #include <stdlib.h>
7643 #endif
7644
7645 int
7646 checkit(expect, got)
7647 char *expect;
7648 char *got;
7649 {
7650     if (strcmp(expect, got)) {
7651                 printf("%s oddity:  Expected %s, got %s\n",
7652                         myname, expect, got);
7653                 exit(1);
7654         }
7655 }
7656
7657 int main()
7658
7659         char buf[64]; 
7660         buf[63] = '\0';
7661
7662         /* This must be 1st test on (which?) platform */
7663         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7664         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7665         checkit("0.1", buf);
7666
7667         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7668         checkit("1", buf);
7669
7670         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7671         checkit("1.1", buf);
7672
7673         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7674         checkit("1.01", buf);
7675
7676         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7677         checkit("1.001", buf);
7678
7679         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7680         checkit("1.0001", buf);
7681
7682         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7683         checkit("1.00001", buf);
7684
7685         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7686         checkit("1.000001", buf);
7687
7688         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7689         checkit("0", buf);
7690
7691         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7692         checkit("-1", buf);
7693
7694         /* Some Linux gcvt's give 1.e+5 here. */
7695         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7696         checkit("100000", buf);
7697         
7698         /* Some Linux gcvt's give -1.e+5 here. */
7699         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7700         checkit("-100000", buf);
7701
7702         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7703         checkit("123.456", buf);
7704
7705         exit(0);
7706 }
7707 EOP
7708 case "$d_Gconvert" in
7709 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7710 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7711 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7712 *) xxx_list='gconvert gcvt sprintf' ;;
7713 esac
7714
7715 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7716 "$define$define$define")
7717     # for long doubles prefer first qgcvt, then sprintf
7718     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7719     xxx_list="sprintf $xxx_list"
7720     case "$d_qgcvt" in
7721     "$define") xxx_list="qgcvt $xxx_list" ;;
7722     esac
7723     ;;
7724 esac
7725
7726 for xxx_convert in $xxx_list; do
7727         echo "Trying $xxx_convert..."
7728         $rm -f try try$_o
7729         set try -DTRY_$xxx_convert
7730         if eval $compile; then
7731                 echo "$xxx_convert() found." >&4
7732                 if ./try; then
7733                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7734                         break;
7735                 else
7736                         echo "...But $xxx_convert didn't work as I expected."
7737                 fi
7738         else
7739                 echo "$xxx_convert NOT found." >&4
7740         fi
7741 done
7742         
7743 case "$xxx_convert" in
7744 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7745 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7746 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7747 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7748    "$define$define$define")
7749       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7750    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7751    esac
7752    ;;  
7753 esac
7754
7755 : Initialize h_fcntl
7756 h_fcntl=false
7757
7758 : Initialize h_sysfile
7759 h_sysfile=false
7760
7761 : access call always available on UNIX
7762 set access d_access
7763 eval $inlibc
7764
7765 : locate the flags for 'access()'
7766 case "$d_access" in
7767 "$define")
7768         echo " "
7769         $cat >access.c <<'EOCP'
7770 #include <sys/types.h>
7771 #ifdef I_FCNTL
7772 #include <fcntl.h>
7773 #endif
7774 #ifdef I_SYS_FILE
7775 #include <sys/file.h>
7776 #endif
7777 #ifdef I_UNISTD
7778 #include <unistd.h>
7779 #endif
7780 int main() {
7781         exit(R_OK);
7782 }
7783 EOCP
7784         : check sys/file.h first, no particular reason here
7785         if $test `./findhdr sys/file.h` && \
7786                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7787                 h_sysfile=true;
7788                 echo "<sys/file.h> defines the *_OK access constants." >&4
7789         elif $test `./findhdr fcntl.h` && \
7790                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7791                 h_fcntl=true;
7792                 echo "<fcntl.h> defines the *_OK access constants." >&4
7793         elif $test `./findhdr unistd.h` && \
7794                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7795                 echo "<unistd.h> defines the *_OK access constants." >&4
7796         else
7797                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7798         fi
7799         ;;
7800 esac
7801 $rm -f access*
7802
7803 : see if accessx exists
7804 set accessx d_accessx
7805 eval $inlibc
7806
7807 : see if alarm exists
7808 set alarm d_alarm
7809 eval $inlibc
7810
7811 : see if atolf exists
7812 set atolf d_atolf
7813 eval $inlibc
7814
7815 : see if atoll exists
7816 set atoll d_atoll
7817 eval $inlibc
7818
7819 : Look for GNU-cc style attribute checking
7820 echo " "
7821 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7822 $cat >attrib.c <<'EOCP'
7823 #include <stdio.h>
7824 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7825 EOCP
7826 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7827         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7828                 echo "Your C compiler doesn't fully support __attribute__."
7829                 val="$undef"
7830         else
7831                 echo "Your C compiler supports __attribute__."
7832                 val="$define"
7833         fi
7834 else
7835         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7836         val="$undef"
7837 fi
7838 set d_attribut
7839 eval $setvar
7840 $rm -f attrib*
7841
7842 : see if bcmp exists
7843 set bcmp d_bcmp
7844 eval $inlibc
7845
7846 : see if bcopy exists
7847 set bcopy d_bcopy
7848 eval $inlibc
7849
7850 : see if this is a unistd.h system
7851 set unistd.h i_unistd
7852 eval $inhdr
7853
7854 : see if getpgrp exists
7855 set getpgrp d_getpgrp
7856 eval $inlibc
7857
7858 case "$d_getpgrp" in
7859 "$define")
7860         echo " "
7861         echo "Checking to see which flavor of getpgrp is in use..."
7862         $cat >set.c <<EOP
7863 #$i_unistd I_UNISTD
7864 #include <sys/types.h>
7865 #ifdef I_UNISTD
7866 #  include <unistd.h>
7867 #endif
7868 int main()
7869 {
7870         if (getuid() == 0) {
7871                 printf("(I see you are running Configure as super-user...)\n");
7872                 setuid(1);
7873         }
7874 #ifdef TRY_BSD_PGRP
7875         if (getpgrp(1) == 0)
7876                 exit(0);
7877 #else
7878         if (getpgrp() > 0)
7879                 exit(0);
7880 #endif
7881         exit(1);
7882 }
7883 EOP
7884         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7885                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7886                 val="$define"
7887         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7888                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7889                 val="$undef"
7890         else
7891                 echo "I can't seem to compile and run the test program."
7892                 if ./usg; then
7893                         xxx="a USG one, i.e. you use getpgrp()."
7894                 else
7895                         # SVR4 systems can appear rather BSD-ish.
7896                         case "$i_unistd" in
7897                         $undef)
7898                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7899                                 val="$define"
7900                                 ;;
7901                         $define)
7902                                 xxx="probably a USG one, i.e. you use getpgrp()."
7903                                 val="$undef"
7904                                 ;;
7905                         esac
7906                 fi
7907                 echo "Assuming your getpgrp is $xxx" >&4
7908         fi
7909         ;;
7910 *) val="$undef";;
7911 esac
7912 set d_bsdgetpgrp
7913 eval $setvar
7914 $rm -f set set.c
7915
7916 : see if setpgrp exists
7917 set setpgrp d_setpgrp
7918 eval $inlibc
7919
7920 case "$d_setpgrp" in
7921 "$define")
7922         echo " "
7923         echo "Checking to see which flavor of setpgrp is in use..."
7924         $cat >set.c <<EOP
7925 #$i_unistd I_UNISTD
7926 #include <sys/types.h>
7927 #ifdef I_UNISTD
7928 #  include <unistd.h>
7929 #endif
7930 int main()
7931 {
7932         if (getuid() == 0) {
7933                 printf("(I see you are running Configure as super-user...)\n");
7934                 setuid(1);
7935         }
7936 #ifdef TRY_BSD_PGRP
7937         if (-1 == setpgrp(1, 1))
7938                 exit(0);
7939 #else
7940         if (setpgrp() != -1)
7941                 exit(0);
7942 #endif
7943         exit(1);
7944 }
7945 EOP
7946         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7947                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7948                 val="$define"
7949         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7950                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7951                 val="$undef"
7952         else
7953                 echo "(I can't seem to compile and run the test program.)"
7954                 if ./usg; then
7955                         xxx="a USG one, i.e. you use setpgrp()."
7956                 else
7957                         # SVR4 systems can appear rather BSD-ish.
7958                         case "$i_unistd" in
7959                         $undef)
7960                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7961                                 val="$define"
7962                                 ;;
7963                         $define)
7964                                 xxx="probably a USG one, i.e. you use setpgrp()."
7965                                 val="$undef"
7966                                 ;;
7967                         esac
7968                 fi
7969                 echo "Assuming your setpgrp is $xxx" >&4
7970         fi
7971         ;;
7972 *) val="$undef";;
7973 esac
7974 set d_bsdsetpgrp
7975 eval $setvar
7976 $rm -f set set.c
7977 : see if bzero exists
7978 set bzero d_bzero
7979 eval $inlibc
7980
7981 : see if signal is declared as pointer to function returning int or void
7982 echo " "
7983 xxx=`./findhdr signal.h`
7984 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7985 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7986         echo "You have int (*signal())() instead of void." >&4
7987         val="$undef"
7988 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7989         echo "You have void (*signal())()." >&4
7990         val="$define"
7991 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7992         echo "You have int (*signal())() instead of void." >&4
7993         val="$undef"
7994 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7995         echo "You have void (*signal())()." >&4
7996         val="$define"
7997 else
7998         case "$d_voidsig" in
7999         '')
8000         echo "I can't determine whether signal handler returns void or int..." >&4
8001                 dflt=void
8002                 rp="What type does your signal handler return?"
8003                 . ./myread
8004                 case "$ans" in
8005                 v*) val="$define";;
8006                 *) val="$undef";;
8007                 esac;;
8008         "$define")
8009                 echo "As you already told me, signal handler returns void." >&4
8010                 val="$define"
8011                 ;;
8012         *)      echo "As you already told me, signal handler returns int." >&4
8013                 val="$undef"
8014                 ;;
8015         esac
8016 fi
8017 set d_voidsig
8018 eval $setvar
8019 case "$d_voidsig" in
8020 "$define") signal_t="void";;
8021 *) signal_t="int";;
8022 esac
8023 $rm -f $$.tmp
8024
8025 : check for ability to cast large floats to 32-bit ints.
8026 echo " "
8027 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8028 if $test "$intsize" -ge 4; then
8029         xxx=int
8030 else
8031         xxx=long
8032 fi
8033 $cat >try.c <<EOCP
8034 #include <stdio.h>
8035 #include <sys/types.h>
8036 #include <signal.h>
8037 $signal_t blech(s) int s; { exit(3); }
8038 int main()
8039 {
8040         $xxx i32;
8041         double f, g;
8042         int result = 0;
8043         char str[16];
8044         signal(SIGFPE, blech);
8045
8046         /* Don't let compiler optimize the test away.  Store the number 
8047            in a writable string for gcc to pass to sscanf under HP/UX.
8048         */
8049         sprintf(str, "2147483647");
8050         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8051         g = 10 * f;
8052         i32  = ($xxx) g;
8053
8054         /* x86 processors will probably give 0x8000 0000, which is a
8055        sign change.  We don't want that.  We want to mimic SPARC
8056            behavior here, which is to preserve the sign and give
8057            back 0x7fff ffff.
8058         */
8059         if (i32 != ($xxx) f)
8060                 result |= 1;
8061         exit(result);
8062 }
8063 EOCP
8064 set try
8065 if eval $compile_ok; then
8066         ./try
8067         yyy=$?
8068 else
8069         echo "(I can't seem to compile the test program--assuming it can't)"
8070         yyy=1
8071 fi
8072 case "$yyy" in
8073 0)      val="$define"
8074         echo "Yup, it can."
8075         ;;
8076 *)      val="$undef"
8077         echo "Nope, it can't."
8078         ;;
8079 esac
8080 set d_casti32
8081 eval $setvar
8082 $rm -f try try.*
8083
8084 : check for ability to cast negative floats to unsigned
8085 echo " "
8086 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8087 $cat >try.c <<EOCP
8088 #include <stdio.h>
8089 #include <sys/types.h>
8090 #include <signal.h>
8091 $signal_t blech(s) int s; { exit(7); }
8092 $signal_t blech_in_list(s) int s; { exit(4); }
8093 unsigned long dummy_long(p) unsigned long p; { return p; }
8094 unsigned int dummy_int(p) unsigned int p; { return p; }
8095 unsigned short dummy_short(p) unsigned short p; { return p; }
8096 int main()
8097 {
8098         double f;
8099         unsigned long along;
8100         unsigned int aint;
8101         unsigned short ashort;
8102         int result = 0;
8103         char str[16];
8104         
8105         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8106            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8107            optimized the whole file away
8108         */
8109         /* Store the number in a writable string for gcc to pass to 
8110            sscanf under HP/UX.
8111         */
8112         sprintf(str, "-123");
8113         sscanf(str, "%lf", &f);  /* f = -123.; */
8114
8115         signal(SIGFPE, blech);
8116         along = (unsigned long)f;
8117         aint = (unsigned int)f;
8118         ashort = (unsigned short)f;
8119         if (along != (unsigned long)-123)
8120                 result |= 1;
8121         if (aint != (unsigned int)-123)
8122                 result |= 1;
8123         if (ashort != (unsigned short)-123)
8124                 result |= 1;
8125         sprintf(str, "1073741824.");
8126         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8127         f = f + f;
8128         along = 0;
8129         along = (unsigned long)f;
8130         if (along != 0x80000000)
8131                 result |= 2;
8132         f -= 1.;
8133         along = 0;
8134         along = (unsigned long)f;
8135         if (along != 0x7fffffff)
8136                 result |= 1;
8137         f += 2.;
8138         along = 0;
8139         along = (unsigned long)f;
8140         if (along != 0x80000001)
8141                 result |= 2;
8142         if (result)
8143                 exit(result);
8144         signal(SIGFPE, blech_in_list);
8145         sprintf(str, "123.");
8146         sscanf(str, "%lf", &f);  /* f = 123.; */
8147         along = dummy_long((unsigned long)f);
8148         aint = dummy_int((unsigned int)f);
8149         ashort = dummy_short((unsigned short)f);
8150         if (along != (unsigned long)123)
8151                 result |= 4;
8152         if (aint != (unsigned int)123)
8153                 result |= 4;
8154         if (ashort != (unsigned short)123)
8155                 result |= 4;
8156         exit(result);
8157
8158 }
8159 EOCP
8160 set try
8161 if eval $compile_ok; then
8162         ./try
8163         castflags=$?
8164 else
8165         echo "(I can't seem to compile the test program--assuming it can't)"
8166         castflags=7
8167 fi
8168 case "$castflags" in
8169 0)      val="$define"
8170         echo "Yup, it can."
8171         ;;
8172 *)      val="$undef"
8173         echo "Nope, it can't."
8174         ;;
8175 esac
8176 set d_castneg
8177 eval $setvar
8178 $rm -f try.*
8179
8180 : see if vprintf exists
8181 echo " "
8182 if set vprintf val -f d_vprintf; eval $csym; $val; then
8183         echo 'vprintf() found.' >&4
8184         val="$define"
8185         $cat >vprintf.c <<'EOF'
8186 #include <varargs.h>
8187
8188 int main() { xxx("foo"); }
8189
8190 xxx(va_alist)
8191 va_dcl
8192 {
8193         va_list args;
8194         char buf[10];
8195
8196         va_start(args);
8197         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8198 }
8199 EOF
8200         set vprintf
8201         if eval $compile && ./vprintf; then
8202                 echo "Your vsprintf() returns (int)." >&4
8203                 val2="$undef"
8204         else
8205                 echo "Your vsprintf() returns (char*)." >&4
8206                 val2="$define"
8207         fi
8208 else
8209         echo 'vprintf() NOT found.' >&4
8210                 val="$undef"
8211                 val2="$undef"
8212 fi
8213 set d_vprintf
8214 eval $setvar
8215 val=$val2
8216 set d_charvspr
8217 eval $setvar
8218
8219 : see if chown exists
8220 set chown d_chown
8221 eval $inlibc
8222
8223 : see if chroot exists
8224 set chroot d_chroot
8225 eval $inlibc
8226
8227 : see if chsize exists
8228 set chsize d_chsize
8229 eval $inlibc
8230
8231 : check for const keyword
8232 echo " "
8233 echo 'Checking to see if your C compiler knows about "const"...' >&4
8234 $cat >const.c <<'EOCP'
8235 typedef struct spug { int drokk; } spug;
8236 int main()
8237 {
8238         const char *foo;
8239         const spug y;
8240 }
8241 EOCP
8242 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8243         val="$define"
8244         echo "Yup, it does."
8245 else
8246         val="$undef"
8247         echo "Nope, it doesn't."
8248 fi
8249 set d_const
8250 eval $setvar
8251
8252 : see if crypt exists
8253 echo " "
8254 if set crypt val -f d_crypt; eval $csym; $val; then
8255         echo 'crypt() found.' >&4
8256         val="$define"
8257         cryptlib=''
8258 else
8259         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8260         if $test -z "$cryptlib"; then
8261                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8262         else
8263                 cryptlib=-lcrypt
8264         fi
8265         if $test -z "$cryptlib"; then
8266                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8267         else
8268                 cryptlib=-lcrypt
8269         fi
8270         if $test -z "$cryptlib"; then
8271                 cryptlib=`./loc libcrypt$_a "" $libpth`
8272         else
8273                 cryptlib=-lcrypt
8274         fi
8275         if $test -z "$cryptlib"; then
8276                 echo 'crypt() NOT found.' >&4
8277                 val="$undef"
8278         else
8279                 val="$define"
8280         fi
8281 fi
8282 set d_crypt
8283 eval $setvar
8284
8285 : get csh whereabouts
8286 case "$csh" in
8287 'csh') val="$undef" ;;
8288 *) val="$define" ;;
8289 esac
8290 set d_csh
8291 eval $setvar
8292 : Respect a hint or command line value for full_csh.
8293 case "$full_csh" in
8294 '') full_csh=$csh ;;
8295 esac
8296
8297 : see if cuserid exists
8298 set cuserid d_cuserid
8299 eval $inlibc
8300
8301 : see if this is a limits.h system
8302 set limits.h i_limits
8303 eval $inhdr
8304
8305 : see if this is a float.h system
8306 set float.h i_float
8307 eval $inhdr
8308
8309 : See if number of significant digits in a double precision number is known
8310 echo " "
8311 $cat >dbl_dig.c <<EOM
8312 #$i_limits I_LIMITS
8313 #$i_float I_FLOAT
8314 #ifdef I_LIMITS
8315 #include <limits.h>
8316 #endif
8317 #ifdef I_FLOAT
8318 #include <float.h>
8319 #endif
8320 #ifdef DBL_DIG
8321 printf("Contains DBL_DIG");
8322 #endif
8323 EOM
8324 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8325 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8326         echo "DBL_DIG found." >&4
8327         val="$define"
8328 else
8329         echo "DBL_DIG NOT found." >&4
8330         val="$undef"
8331 fi
8332 $rm -f dbl_dig.?
8333 set d_dbl_dig
8334 eval $setvar
8335
8336 : see if difftime exists
8337 set difftime d_difftime
8338 eval $inlibc
8339
8340 : see if this is a dirent system
8341 echo " "
8342 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8343         val="$define"
8344         echo "<dirent.h> found." >&4
8345 else
8346         val="$undef"
8347         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8348                 echo "<sys/dir.h> found." >&4
8349                 echo " "
8350         else
8351                 xinc=`./findhdr sys/ndir.h`
8352         fi
8353         echo "<dirent.h> NOT found." >&4
8354 fi
8355 set i_dirent
8356 eval $setvar
8357
8358 : Look for type of directory structure.
8359 echo " "
8360 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8361
8362 case "$direntrytype" in
8363 ''|' ')
8364         case "$i_dirent" in
8365         $define) guess1='struct dirent' ;;
8366         *) guess1='struct direct'  ;;
8367         esac
8368         ;;
8369 *)      guess1="$direntrytype"
8370         ;;
8371 esac
8372
8373 case "$guess1" in
8374 'struct dirent') guess2='struct direct' ;;
8375 *) guess2='struct dirent' ;;
8376 esac
8377                 
8378 if $contains "$guess1" try.c >/dev/null 2>&1; then
8379         direntrytype="$guess1"
8380         echo "Your directory entries are $direntrytype." >&4
8381 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8382         direntrytype="$guess2"
8383         echo "Your directory entries seem to be $direntrytype." >&4
8384 else
8385         echo "I don't recognize your system's directory entries." >&4
8386         rp="What type is used for directory entries on this system?"
8387         dflt="$guess1"
8388         . ./myread
8389         direntrytype="$ans"
8390 fi
8391 $rm -f try.c
8392
8393
8394 : see if the directory entry stores field length
8395 echo " "
8396 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8397 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8398         echo "Good, your directory entry keeps length information in d_namlen." >&4
8399         val="$define"
8400 else
8401         echo "Your directory entry does not know about the d_namlen field." >&4
8402         val="$undef"
8403 fi
8404 set d_dirnamlen
8405 eval $setvar
8406 $rm -f try.c
8407
8408 : see if dlerror exists
8409 xxx_runnm="$runnm"
8410 runnm=false
8411 set dlerror d_dlerror
8412 eval $inlibc
8413 runnm="$xxx_runnm"
8414
8415 : see if dlfcn is available
8416 set dlfcn.h i_dlfcn
8417 eval $inhdr
8418
8419 case "$usedl" in
8420 $define|y|true)
8421         $cat << EOM
8422
8423 On a few systems, the dynamically loaded modules that perl generates and uses
8424 will need a different extension than shared libs. The default will probably
8425 be appropriate.
8426
8427 EOM
8428         case "$dlext" in
8429         '')     dflt="$so" ;;
8430         *)      dflt="$dlext" ;;
8431         esac
8432         rp='What is the extension of dynamically loaded modules'
8433         . ./myread
8434         dlext="$ans"
8435         ;;
8436 *)
8437         dlext="none"
8438         ;;
8439 esac
8440
8441 : Check if dlsym need a leading underscore
8442 echo " "
8443 val="$undef"
8444
8445 case "$dlsrc" in
8446 dl_dlopen.xs)
8447         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8448         $cat >dyna.c <<'EOM'
8449 fred () { }
8450 EOM
8451
8452 $cat >fred.c<<EOM
8453
8454 #include <stdio.h>
8455 #$i_dlfcn I_DLFCN
8456 #ifdef I_DLFCN
8457 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8458 #else
8459 #include <sys/types.h>
8460 #include <nlist.h>
8461 #include <link.h>
8462 #endif
8463
8464 extern int fred() ;
8465
8466 int main()
8467 {
8468     void * handle ;
8469     void * symbol ;
8470 #ifndef RTLD_LAZY
8471     int mode = 1 ;
8472 #else
8473     int mode = RTLD_LAZY ;
8474 #endif
8475     handle = dlopen("./dyna.$dlext", mode) ;
8476     if (handle == NULL) {
8477         printf ("1\n") ;
8478         fflush (stdout) ;
8479         exit(0);
8480     }
8481     symbol = dlsym(handle, "fred") ;
8482     if (symbol == NULL) {
8483         /* try putting a leading underscore */
8484         symbol = dlsym(handle, "_fred") ;
8485         if (symbol == NULL) {
8486             printf ("2\n") ;
8487             fflush (stdout) ;
8488             exit(0);
8489         }
8490         printf ("3\n") ;
8491     }
8492     else
8493         printf ("4\n") ;
8494     fflush (stdout) ;
8495     exit(0);
8496 }
8497 EOM
8498         : Call the object file tmp-dyna.o in case dlext=o.
8499         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8500                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8501                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8502                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8503                 xxx=`./fred`
8504                 case $xxx in
8505                 1)      echo "Test program failed using dlopen." >&4
8506                         echo "Perhaps you should not use dynamic loading." >&4;;
8507                 2)      echo "Test program failed using dlsym." >&4
8508                         echo "Perhaps you should not use dynamic loading." >&4;;
8509                 3)      echo "dlsym needs a leading underscore" >&4
8510                         val="$define" ;;
8511                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8512                 esac
8513         else
8514                 echo "I can't compile and run the test program." >&4
8515                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8516         fi
8517         ;;
8518 esac
8519                 
8520 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8521
8522 set d_dlsymun
8523 eval $setvar
8524
8525 hasproto='varname=$1; func=$2; shift; shift;
8526 while $test $# -ge 2; do
8527         case "$1" in
8528         $define) echo "#include <$2>";;
8529         esac ;
8530     shift 2;
8531 done > try.c;
8532 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8533 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8534         echo "$func() prototype found.";
8535         val="$define";
8536 else
8537         echo "$func() prototype NOT found.";
8538         val="$undef";
8539 fi;
8540 set $varname;
8541 eval $setvar;
8542 $rm -f try.c tryout.c'
8543
8544 : see if prototype for drand48 is available
8545 echo " "
8546 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8547 eval $hasproto
8548
8549 : see if dup2 exists
8550 set dup2 d_dup2
8551 eval $inlibc
8552
8553 : see if eaccess exists
8554 set eaccess d_eaccess
8555 eval $inlibc
8556
8557 : see if endgrent exists
8558 set endgrent d_endgrent
8559 eval $inlibc
8560
8561 : see if endhostent exists
8562 set endhostent d_endhent
8563 eval $inlibc
8564
8565 : see if endnetent exists
8566 set endnetent d_endnent
8567 eval $inlibc
8568
8569 : see if endprotoent exists
8570 set endprotoent d_endpent
8571 eval $inlibc
8572
8573 : see if endpwent exists
8574 set endpwent d_endpwent
8575 eval $inlibc
8576
8577 : see if endservent exists
8578 set endservent d_endsent
8579 eval $inlibc
8580
8581 : Locate the flags for 'open()'
8582 echo " "
8583 $cat >open3.c <<'EOCP'
8584 #include <sys/types.h>
8585 #ifdef I_FCNTL
8586 #include <fcntl.h>
8587 #endif
8588 #ifdef I_SYS_FILE
8589 #include <sys/file.h>
8590 #endif
8591 int main() {
8592         if(O_RDONLY);
8593 #ifdef O_TRUNC
8594         exit(0);
8595 #else
8596         exit(1);
8597 #endif
8598 }
8599 EOCP
8600 : check sys/file.h first to get FREAD on Sun
8601 if $test `./findhdr sys/file.h` && \
8602                 set open3 -DI_SYS_FILE && eval $compile; then
8603         h_sysfile=true;
8604         echo "<sys/file.h> defines the O_* constants..." >&4
8605         if ./open3; then
8606                 echo "and you have the 3 argument form of open()." >&4
8607                 val="$define"
8608         else
8609                 echo "but not the 3 argument form of open().  Oh, well." >&4
8610                 val="$undef"
8611         fi
8612 elif $test `./findhdr fcntl.h` && \
8613                 set open3 -DI_FCNTL && eval $compile; then
8614         h_fcntl=true;
8615         echo "<fcntl.h> defines the O_* constants..." >&4
8616         if ./open3; then
8617                 echo "and you have the 3 argument form of open()." >&4
8618                 val="$define"
8619         else
8620                 echo "but not the 3 argument form of open().  Oh, well." >&4
8621                 val="$undef"
8622         fi
8623 else
8624         val="$undef"
8625         echo "I can't find the O_* constant definitions!  You got problems." >&4
8626 fi
8627 set d_open3
8628 eval $setvar
8629 $rm -f open3*
8630
8631 : see which of string.h or strings.h is needed
8632 echo " "
8633 strings=`./findhdr string.h`
8634 if $test "$strings" && $test -r "$strings"; then
8635         echo "Using <string.h> instead of <strings.h>." >&4
8636         val="$define"
8637 else
8638         val="$undef"
8639         strings=`./findhdr strings.h`
8640         if $test "$strings" && $test -r "$strings"; then
8641                 echo "Using <strings.h> instead of <string.h>." >&4
8642         else
8643                 echo "No string header found -- You'll surely have problems." >&4
8644         fi
8645 fi
8646 set i_string
8647 eval $setvar
8648 case "$i_string" in
8649 "$undef") strings=`./findhdr strings.h`;;
8650 *)        strings=`./findhdr string.h`;;
8651 esac
8652
8653 : check for non-blocking I/O stuff
8654 case "$h_sysfile" in
8655 true) echo "#include <sys/file.h>" > head.c;;
8656 *)
8657         case "$h_fcntl" in
8658         true) echo "#include <fcntl.h>" > head.c;;
8659         *) echo "#include <sys/fcntl.h>" > head.c;;
8660         esac
8661         ;;
8662 esac
8663 echo " "
8664 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8665 case "$o_nonblock" in
8666 '')
8667         $cat head.c > try.c
8668         $cat >>try.c <<'EOCP'
8669 #include <stdio.h>
8670 int main() {
8671 #ifdef O_NONBLOCK
8672         printf("O_NONBLOCK\n");
8673         exit(0);
8674 #endif
8675 #ifdef O_NDELAY
8676         printf("O_NDELAY\n");
8677         exit(0);
8678 #endif
8679 #ifdef FNDELAY
8680         printf("FNDELAY\n");
8681         exit(0);
8682 #endif
8683         exit(0);
8684 }
8685 EOCP
8686         set try
8687         if eval $compile_ok; then
8688                 o_nonblock=`./try`
8689                 case "$o_nonblock" in
8690                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8691                 *) echo "Seems like we can use $o_nonblock.";;
8692                 esac
8693         else
8694                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8695         fi
8696         ;;
8697 *) echo "Using $hint value $o_nonblock.";;
8698 esac
8699 $rm -f try try.* .out core
8700
8701 echo " "
8702 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8703 case "$eagain" in
8704 '')
8705         $cat head.c > try.c
8706         $cat >>try.c <<EOCP
8707 #include <errno.h>
8708 #include <sys/types.h>
8709 #include <signal.h>
8710 #include <stdio.h> 
8711 #define MY_O_NONBLOCK $o_nonblock
8712 #ifndef errno  /* XXX need better Configure test */
8713 extern int errno;
8714 #endif
8715 #$i_unistd I_UNISTD
8716 #ifdef I_UNISTD
8717 #include <unistd.h>
8718 #endif
8719 #$i_string I_STRING
8720 #ifdef I_STRING
8721 #include <string.h>
8722 #else
8723 #include <strings.h>
8724 #endif
8725 $signal_t blech(x) int x; { exit(3); }
8726 EOCP
8727         $cat >> try.c <<'EOCP'
8728 int main()
8729 {
8730         int pd[2];
8731         int pu[2];
8732         char buf[1];
8733         char string[100];
8734
8735         pipe(pd);       /* Down: child -> parent */
8736         pipe(pu);       /* Up: parent -> child */
8737         if (0 != fork()) {
8738                 int ret;
8739                 close(pd[1]);   /* Parent reads from pd[0] */
8740                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8741                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8742                         exit(1);
8743                 signal(SIGALRM, blech);
8744                 alarm(5);
8745                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8746                         exit(2);
8747                 sprintf(string, "%d\n", ret);
8748                 write(2, string, strlen(string));
8749                 alarm(0);
8750 #ifdef EAGAIN
8751                 if (errno == EAGAIN) {
8752                         printf("EAGAIN\n");
8753                         goto ok;
8754                 }
8755 #endif
8756 #ifdef EWOULDBLOCK
8757                 if (errno == EWOULDBLOCK)
8758                         printf("EWOULDBLOCK\n");
8759 #endif
8760         ok:
8761                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8762                 sleep(2);                               /* Give it time to close our pipe */
8763                 alarm(5);
8764                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8765                 alarm(0);
8766                 sprintf(string, "%d\n", ret);
8767                 write(3, string, strlen(string));
8768                 exit(0);
8769         }
8770
8771         close(pd[0]);                   /* We write to pd[1] */
8772         close(pu[1]);                   /* We read from pu[0] */
8773         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8774         close(pd[1]);                   /* Pipe pd is now fully closed! */
8775         exit(0);                                /* Bye bye, thank you for playing! */
8776 }
8777 EOCP
8778         set try
8779         if eval $compile_ok; then
8780                 echo "$startsh" >mtry
8781                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8782                 chmod +x mtry
8783                 ./mtry >/dev/null 2>&1
8784                 case $? in
8785                 0) eagain=`$cat try.out`;;
8786                 1) echo "Could not perform non-blocking setting!";;
8787                 2) echo "I did a successful read() for something that was not there!";;
8788                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8789                 *) echo "Something terribly wrong happened during testing.";;
8790                 esac
8791                 rd_nodata=`$cat try.ret`
8792                 echo "A read() system call with no data present returns $rd_nodata."
8793                 case "$rd_nodata" in
8794                 0|-1) ;;
8795                 *)
8796                         echo "(That's peculiar, fixing that to be -1.)"
8797                         rd_nodata=-1
8798                         ;;
8799                 esac
8800                 case "$eagain" in
8801                 '')
8802                         echo "Forcing errno EAGAIN on read() with no data available."
8803                         eagain=EAGAIN
8804                         ;;
8805                 *)
8806                         echo "Your read() sets errno to $eagain when no data is available."
8807                         ;;
8808                 esac
8809                 status=`$cat try.err`
8810                 case "$status" in
8811                 0) echo "And it correctly returns 0 to signal EOF.";;
8812                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8813                 *) echo "However, your read() returns '$status' on EOF??";;
8814                 esac
8815                 val="$define"
8816                 if test "$status" = "$rd_nodata"; then
8817                         echo "WARNING: you can't distinguish between EOF and no data!"
8818                         val="$undef"
8819                 fi
8820         else
8821                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8822                 eagain=EAGAIN
8823         fi
8824         set d_eofnblk
8825         eval $setvar
8826         ;;
8827 *)
8828         echo "Using $hint value $eagain."
8829         echo "Your read() returns $rd_nodata when no data is present."
8830         case "$d_eofnblk" in
8831         "$define") echo "And you can see EOF because read() returns 0.";;
8832         "$undef") echo "But you can't see EOF status from read() returned value.";;
8833         *)
8834                 echo "(Assuming you can't see EOF status from read anyway.)"
8835                 d_eofnblk=$undef
8836                 ;;
8837         esac
8838         ;;
8839 esac
8840 $rm -f try try.* .out core head.c mtry
8841
8842 : see if fchmod exists
8843 set fchmod d_fchmod
8844 eval $inlibc
8845
8846 : see if fchown exists
8847 set fchown d_fchown
8848 eval $inlibc
8849
8850 : see if this is an fcntl system
8851 set fcntl d_fcntl
8852 eval $inlibc
8853
8854 echo " "
8855 : See if fcntl-based locking works.
8856 $cat >try.c <<'EOCP'
8857 #include <stdlib.h>
8858 #include <unistd.h>
8859 #include <fcntl.h>
8860 int main() {
8861 #if defined(F_SETLK) && defined(F_SETLKW)
8862      struct flock flock;
8863      int retval, fd;
8864      fd = open("try.c", O_RDONLY);
8865      flock.l_type = F_RDLCK;
8866      flock.l_whence = SEEK_SET;
8867      flock.l_start = flock.l_len = 0;
8868      retval = fcntl(fd, F_SETLK, &flock);
8869      close(fd);
8870      (retval < 0 ? exit(2) : exit(0));
8871 #else
8872      exit(2);
8873 #endif
8874 }
8875 EOCP
8876 echo "Checking if fcntl-based file locking works... "
8877 case "$d_fcntl" in
8878 "$define")
8879         set try
8880         if eval $compile_ok; then
8881                 if ./try; then
8882                         echo "Yes, it seems to work."
8883                         val="$define"
8884                 else
8885                         echo "Nope, it didn't work."
8886                         val="$undef"
8887                 fi
8888         else
8889                 echo "I'm unable to compile the test program, so I'll assume not."
8890                 val="$undef"
8891         fi
8892         ;;
8893 *) val="$undef";
8894         echo "Nope, since you don't even have fcntl()."
8895         ;;
8896 esac
8897 set d_fcntl_can_lock
8898 eval $setvar
8899 $rm -f try*
8900
8901
8902 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8903 while $test $# -ge 2; do
8904         case "$1" in
8905         $define) echo "#include <$2>";;
8906         esac ;
8907     shift 2;
8908 done > try.c;
8909 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8910 set try;
8911 if eval $compile; then
8912         val="$define";
8913 else
8914         val="$undef";
8915 fi;
8916 set $varname;
8917 eval $setvar;
8918 $rm -f try.c try.o'
8919
8920 socketlib=''
8921 sockethdr=''
8922 : see whether socket exists
8923 echo " "
8924 $echo $n "Hmm... $c" >&4
8925 if set socket val -f d_socket; eval $csym; $val; then
8926         echo "Looks like you have Berkeley networking support." >&4
8927         d_socket="$define"
8928         if set setsockopt val -f; eval $csym; $val; then
8929                 d_oldsock="$undef"
8930         else
8931                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8932                 d_oldsock="$define"
8933         fi
8934 else
8935         if $contains socklib libc.list >/dev/null 2>&1; then
8936                 echo "Looks like you have Berkeley networking support." >&4
8937                 d_socket="$define"
8938                 : we will have to assume that it supports the 4.2 BSD interface
8939                 d_oldsock="$undef"
8940         else
8941                 echo "You don't have Berkeley networking in libc$_a..." >&4
8942                 if test "X$d_socket" = "X$define"; then
8943                    echo "...but you seem to believe that you have sockets." >&4
8944                 else
8945                         for net in net socket
8946                         do
8947                                 if test -f /usr/lib/lib$net$_a; then
8948                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8949                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8950                                         if $contains socket libc.list >/dev/null 2>&1; then
8951                                                 d_socket="$define"
8952                                                 socketlib="-l$net"
8953                                                 case "$net" in
8954                                                 net)
8955                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8956                                                         sockethdr="-I/usr/netinclude"
8957                                                         ;;
8958                                                 esac
8959                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8960                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8961                                                         d_oldsock="$undef"
8962                                                 else
8963                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8964                                                         d_oldsock="$define"
8965                                                 fi
8966                                                 break
8967                                         fi
8968                                 fi
8969                         done
8970                         if test "X$d_socket" != "X$define"; then
8971                            echo "or anywhere else I see." >&4
8972                            d_socket="$undef"
8973                            d_oldsock="$undef"
8974                         fi
8975                 fi
8976         fi
8977 fi
8978
8979 : see if socketpair exists
8980 set socketpair d_sockpair
8981 eval $inlibc
8982
8983
8984 echo " "
8985 echo "Checking the availability of certain socket constants..." >& 4
8986 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8987         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8988         $cat >try.c <<EOF
8989 #include <sys/types.h>
8990 #include <sys/socket.h>
8991 int main() {
8992     int i = $ENUM;
8993 }
8994 EOF
8995         val="$undef"
8996         set try; if eval $compile; then
8997                 val="$define"
8998         fi
8999         set d_${enum}; eval $setvar
9000         $rm -f try.c try
9001 done
9002
9003 : see if sys/select.h has to be included
9004 set sys/select.h i_sysselct
9005 eval $inhdr
9006
9007 : see if we should include time.h, sys/time.h, or both
9008 echo " "
9009 if test "X$timeincl" = X; then
9010         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9011         $echo $n "I'm now running the test program...$c"
9012         $cat >try.c <<'EOCP'
9013 #include <sys/types.h>
9014 #ifdef I_TIME
9015 #include <time.h>
9016 #endif
9017 #ifdef I_SYSTIME
9018 #ifdef SYSTIMEKERNEL
9019 #define KERNEL
9020 #endif
9021 #include <sys/time.h>
9022 #endif
9023 #ifdef I_SYSSELECT
9024 #include <sys/select.h>
9025 #endif
9026 int main()
9027 {
9028         struct tm foo;
9029 #ifdef S_TIMEVAL
9030         struct timeval bar;
9031 #endif
9032 #ifdef S_TIMEZONE
9033         struct timezone tzp;
9034 #endif
9035         if (foo.tm_sec == foo.tm_sec)
9036                 exit(0);
9037 #ifdef S_TIMEVAL
9038         if (bar.tv_sec == bar.tv_sec)
9039                 exit(0);
9040 #endif
9041         exit(1);
9042 }
9043 EOCP
9044         flags=''
9045         for s_timezone in '-DS_TIMEZONE' ''; do
9046         sysselect=''
9047         for s_timeval in '-DS_TIMEVAL' ''; do
9048         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9049         for i_time in '' '-DI_TIME'; do
9050         for i_systime in '-DI_SYSTIME' ''; do
9051                 case "$flags" in
9052                 '') $echo $n ".$c"
9053                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9054                         if eval $compile; then
9055                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9056                                 shift
9057                                 flags="$*"
9058                                 echo " "
9059                                 $echo $n "Succeeded with $flags$c"
9060                         fi
9061                         ;;
9062                 esac
9063         done
9064         done
9065         done
9066         done
9067         done
9068         timeincl=''
9069         echo " "
9070         case "$flags" in
9071         *SYSTIMEKERNEL*) i_systimek="$define"
9072                 timeincl=`./findhdr sys/time.h`
9073                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9074         *) i_systimek="$undef";;
9075         esac
9076         case "$flags" in
9077         *I_TIME*) i_time="$define"
9078                 timeincl=`./findhdr time.h`" $timeincl"
9079                 echo "We'll include <time.h>." >&4;;
9080         *) i_time="$undef";;
9081         esac
9082         case "$flags" in
9083         *I_SYSTIME*) i_systime="$define"
9084                 timeincl=`./findhdr sys/time.h`" $timeincl"
9085                 echo "We'll include <sys/time.h>." >&4;;
9086         *) i_systime="$undef";;
9087         esac
9088         $rm -f try.c try
9089 fi
9090
9091 : check for fd_set items
9092 $cat <<EOM
9093
9094 Checking to see how well your C compiler handles fd_set and friends ...
9095 EOM
9096 $cat >fd_set.c <<EOCP
9097 #$i_systime I_SYS_TIME
9098 #$i_sysselct I_SYS_SELECT
9099 #$d_socket HAS_SOCKET
9100 #include <sys/types.h>
9101 #ifdef HAS_SOCKET
9102 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9103 #endif
9104 #ifdef I_SYS_TIME
9105 #include <sys/time.h>
9106 #endif
9107 #ifdef I_SYS_SELECT
9108 #include <sys/select.h>
9109 #endif
9110 int main() {
9111         fd_set fds;
9112
9113 #ifdef TRYBITS
9114         if(fds.fds_bits);
9115 #endif
9116
9117 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9118         exit(0);
9119 #else
9120         exit(1);
9121 #endif
9122 }
9123 EOCP
9124 set fd_set -DTRYBITS
9125 if eval $compile; then
9126         d_fds_bits="$define"
9127         d_fd_set="$define"
9128         echo "Well, your system knows about the normal fd_set typedef..." >&4
9129         if ./fd_set; then
9130                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9131                 d_fd_macros="$define"
9132         else
9133                 $cat >&4 <<'EOM'
9134 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9135 EOM
9136                 d_fd_macros="$undef"
9137         fi
9138 else
9139         $cat <<'EOM'
9140 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9141 EOM
9142         set fd_set
9143         if eval $compile; then
9144                 d_fds_bits="$undef"
9145                 d_fd_set="$define"
9146                 echo "Well, your system has some sort of fd_set available..." >&4
9147                 if ./fd_set; then
9148                         echo "and you have the normal fd_set macros." >&4
9149                         d_fd_macros="$define"
9150                 else
9151                         $cat <<'EOM'
9152 but not the normal fd_set macros!  Gross!  More work for me...
9153 EOM
9154                         d_fd_macros="$undef"
9155                 fi
9156         else
9157         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9158                 d_fd_set="$undef"
9159                 d_fds_bits="$undef"
9160                 d_fd_macros="$undef"
9161         fi
9162 fi
9163 $rm -f fd_set*
9164
9165 : see if fgetpos exists
9166 set fgetpos d_fgetpos
9167 eval $inlibc
9168
9169 : see if flock exists
9170 set flock d_flock
9171 eval $inlibc
9172
9173 : see if fork exists
9174 set fork d_fork
9175 eval $inlibc
9176
9177 : see if pathconf exists
9178 set pathconf d_pathconf
9179 eval $inlibc
9180
9181 : see if fpathconf exists
9182 set fpathconf d_fpathconf
9183 eval $inlibc
9184
9185
9186 : check for fpos64_t
9187 echo " "
9188 echo "Checking to see if you have fpos64_t..." >&4
9189 $cat >try.c <<EOCP
9190 #include <stdio.h>
9191 int main() { fpos64_t x = 7; }
9192 EOCP
9193 set try
9194 if eval $compile; then
9195         val="$define"
9196         echo "You have fpos64_t."
9197 else
9198         val="$undef"
9199         echo "You do not have fpos64_t."
9200         case "$fpossize" in
9201         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9202         esac
9203 fi
9204 $rm -f try.* try
9205 set d_fpos64_t
9206 eval $setvar
9207
9208 : see if frexpl exists
9209 set frexpl d_frexpl
9210 eval $inlibc
9211
9212 hasstruct='varname=$1; struct=$2; shift; shift;
9213 while $test $# -ge 2; do
9214         case "$1" in
9215         $define) echo "#include <$2>";;
9216         esac ;
9217     shift 2;
9218 done > try.c;
9219 echo "int main () { struct $struct foo; }" >> try.c;
9220 set try;
9221 if eval $compile; then
9222         val="$define";
9223 else
9224         val="$undef";
9225 fi;
9226 set $varname;
9227 eval $setvar;
9228 $rm -f try.c try.o'
9229
9230 : see if this is a sys/param system
9231 set sys/param.h i_sysparam
9232 eval $inhdr
9233
9234 : see if this is a sys/mount.h system
9235 set sys/mount.h i_sysmount
9236 eval $inhdr
9237
9238 : see if sys/types.h has to be included
9239 set sys/types.h i_systypes
9240 eval $inhdr
9241
9242
9243 echo " "
9244 echo "Checking to see if your system supports struct fs_data..." >&4
9245 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9246 eval $hasstruct
9247 case "$d_fs_data_s" in
9248 "$define")      echo "Yes, it does."   ;;
9249 *)              echo "No, it doesn't." ;;
9250 esac
9251
9252 : see if fseeko exists
9253 set fseeko d_fseeko
9254 eval $inlibc
9255 case "$longsize" in
9256 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9257 esac
9258
9259 : see if fsetpos exists
9260 set fsetpos d_fsetpos
9261 eval $inlibc
9262
9263
9264 : see if fstatfs exists
9265 set fstatfs d_fstatfs
9266 eval $inlibc
9267
9268
9269 : see if statvfs exists
9270 set statvfs d_statvfs
9271 eval $inlibc
9272
9273 : see if fstatvfs exists
9274 set fstatvfs d_fstatvfs
9275 eval $inlibc
9276
9277
9278 : see if ftello exists
9279 set ftello d_ftello
9280 eval $inlibc
9281 case "$longsize" in
9282 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9283 esac
9284
9285 : see if getcwd exists
9286 set getcwd d_getcwd
9287 eval $inlibc
9288
9289 : see if getespwnam exists
9290 set getespwnam d_getespwnam
9291 eval $inlibc
9292
9293
9294 : see if getfsstat exists
9295 set getfsstat d_getfsstat
9296 eval $inlibc
9297
9298 : see if getgrent exists
9299 set getgrent d_getgrent
9300 eval $inlibc
9301
9302 : see if gethostbyaddr exists
9303 set gethostbyaddr d_gethbyaddr
9304 eval $inlibc
9305
9306 : see if gethostbyname exists
9307 set gethostbyname d_gethbyname
9308 eval $inlibc
9309
9310 : see if gethostent exists
9311 set gethostent d_gethent
9312 eval $inlibc
9313
9314 : see how we will look up host name
9315 echo " "
9316 call=''
9317 if set gethostname val -f d_gethname; eval $csym; $val; then
9318         echo 'gethostname() found.' >&4
9319         d_gethname="$define"
9320         call=gethostname
9321 fi
9322 if set uname val -f d_uname; eval $csym; $val; then
9323         if ./xenix; then
9324                 $cat <<'EOM'
9325 uname() was found, but you're running xenix, and older versions of xenix
9326 have a broken uname(). If you don't really know whether your xenix is old
9327 enough to have a broken system call, use the default answer.
9328
9329 EOM
9330                 dflt=y
9331                 case "$d_uname" in
9332                 "$define") dflt=n;;
9333                 esac
9334                 rp='Is your uname() broken?'
9335                 . ./myread
9336                 case "$ans" in
9337                 n*) d_uname="$define"; call=uname;;
9338                 esac
9339         else
9340                 echo 'uname() found.' >&4
9341                 d_uname="$define"
9342                 case "$call" in
9343                 '') call=uname ;;
9344                 esac
9345         fi
9346 fi
9347 case "$d_gethname" in
9348 '') d_gethname="$undef";;
9349 esac
9350 case "$d_uname" in
9351 '') d_uname="$undef";;
9352 esac
9353 case "$d_uname$d_gethname" in
9354 *define*)
9355         dflt=n
9356         cat <<EOM
9357  
9358 Every now and then someone has a $call() that lies about the hostname
9359 but can't be fixed for political or economic reasons.  If you wish, I can
9360 pretend $call() isn't there and maybe compute hostname at run-time
9361 thanks to the '$phostname' command.
9362
9363 EOM
9364         rp="Shall I ignore $call() from now on?"
9365         . ./myread
9366         case "$ans" in
9367         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9368         esac;;
9369 esac
9370 case "$phostname" in
9371 '') aphostname='';;
9372 *) case "$aphostname" in
9373         /*) ;;
9374         *) set X $phostname
9375                 shift
9376                 file=$1
9377                 shift
9378                 file=`./loc $file $file $pth`
9379                 aphostname=`echo $file $*`
9380                 ;;
9381         esac
9382         ;;
9383 esac
9384 case "$d_uname$d_gethname" in
9385 *define*) ;;
9386 *)
9387         case "$phostname" in
9388         '')
9389                 echo "There will be no way for $package to get your hostname." >&4;;
9390         *)
9391         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9392                 ;;
9393         esac;;
9394 esac
9395 case "$d_phostname" in
9396 '') d_phostname="$undef";;
9397 esac
9398
9399 : see if this is a netdb.h system
9400 set netdb.h i_netdb
9401 eval $inhdr
9402
9403 : see if prototypes for various gethostxxx netdb.h functions are available
9404 echo " "
9405 set d_gethostprotos gethostent $i_netdb netdb.h
9406 eval $hasproto
9407
9408 : see if getlogin exists
9409 set getlogin d_getlogin
9410 eval $inlibc
9411
9412 : see if getmnt exists
9413 set getmnt d_getmnt
9414 eval $inlibc
9415
9416 : see if getmntent exists
9417 set getmntent d_getmntent
9418 eval $inlibc
9419
9420 : see if getnetbyaddr exists
9421 set getnetbyaddr d_getnbyaddr
9422 eval $inlibc
9423
9424 : see if getnetbyname exists
9425 set getnetbyname d_getnbyname
9426 eval $inlibc
9427
9428 : see if getnetent exists
9429 set getnetent d_getnent
9430 eval $inlibc
9431
9432 : see if prototypes for various getnetxxx netdb.h functions are available
9433 echo " "
9434 set d_getnetprotos getnetent $i_netdb netdb.h
9435 eval $hasproto
9436
9437
9438 : see if getprotobyname exists
9439 set getprotobyname d_getpbyname
9440 eval $inlibc
9441
9442 : see if getprotobynumber exists
9443 set getprotobynumber d_getpbynumber
9444 eval $inlibc
9445
9446 : see if getprotoent exists
9447 set getprotoent d_getpent
9448 eval $inlibc
9449
9450 : see if getpgid exists
9451 set getpgid d_getpgid
9452 eval $inlibc
9453
9454 : see if getpgrp2 exists
9455 set getpgrp2 d_getpgrp2
9456 eval $inlibc
9457
9458 : see if getppid exists
9459 set getppid d_getppid
9460 eval $inlibc
9461
9462 : see if getpriority exists
9463 set getpriority d_getprior
9464 eval $inlibc
9465
9466 : see if prototypes for various getprotoxxx netdb.h functions are available
9467 echo " "
9468 set d_getprotoprotos getprotoent $i_netdb netdb.h
9469 eval $hasproto
9470
9471 : see if getprpwnam exists
9472 set getprpwnam d_getprpwnam
9473 eval $inlibc
9474
9475 : see if getpwent exists
9476 set getpwent d_getpwent
9477 eval $inlibc
9478
9479
9480 : see if getservbyname exists
9481 set getservbyname d_getsbyname
9482 eval $inlibc
9483
9484 : see if getservbyport exists
9485 set getservbyport d_getsbyport
9486 eval $inlibc
9487
9488 : see if getservent exists
9489 set getservent d_getsent
9490 eval $inlibc
9491
9492 : see if prototypes for various getservxxx netdb.h functions are available
9493 echo " "
9494 set d_getservprotos getservent $i_netdb netdb.h
9495 eval $hasproto
9496
9497 : see if getspnam exists
9498 set getspnam d_getspnam
9499 eval $inlibc
9500
9501 : see if gettimeofday or ftime exists
9502 set gettimeofday d_gettimeod
9503 eval $inlibc
9504 case "$d_gettimeod" in
9505 "$undef")
9506         set ftime d_ftime 
9507         eval $inlibc
9508         ;;
9509 *)
9510         val="$undef"; set d_ftime; eval $setvar
9511         ;;
9512 esac
9513 case "$d_gettimeod$d_ftime" in
9514 "$undef$undef")
9515         echo " "
9516         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9517         ;;
9518 esac
9519
9520 : see if this is an grp system
9521 set grp.h i_grp
9522 eval $inhdr
9523
9524 case "$i_grp" in
9525 $define)
9526         xxx=`./findhdr grp.h`
9527         $cppstdin $cppflags $cppminus < $xxx >$$.h
9528
9529         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9530                 val="$define"
9531         else
9532                 val="$undef"
9533         fi
9534         set d_grpasswd
9535         eval $setvar
9536
9537         $rm -f $$.h
9538         ;;
9539 *)
9540         val="$undef";
9541         set d_grpasswd; eval $setvar
9542         ;;
9543 esac
9544
9545 : see if hasmntopt exists
9546 set hasmntopt d_hasmntopt
9547 eval $inlibc
9548
9549 : see if this is a netinet/in.h or sys/in.h system
9550 set netinet/in.h i_niin sys/in.h i_sysin
9551 eval $inhdr
9552
9553 : see if arpa/inet.h has to be included
9554 set arpa/inet.h i_arpainet
9555 eval $inhdr
9556
9557 : see if htonl --and friends-- exists
9558 val=''
9559 set htonl val
9560 eval $inlibc
9561
9562 : Maybe they are macros.
9563 case "$val" in
9564 $undef)
9565         $cat >htonl.c <<EOM
9566 #include <stdio.h>
9567 #include <sys/types.h>
9568 #$i_niin I_NETINET_IN
9569 #$i_sysin I_SYS_IN
9570 #$i_arpainet I_ARPA_INET
9571 #ifdef I_NETINET_IN
9572 #include <netinet/in.h>
9573 #endif
9574 #ifdef I_SYS_IN
9575 #include <sys/in.h>
9576 #endif
9577 #ifdef I_ARPA_INET
9578 #include <arpa/inet.h>
9579 #endif
9580 #ifdef htonl
9581 printf("Defined as a macro.");
9582 #endif
9583 EOM
9584         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9585         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9586                 val="$define"
9587                 echo "But it seems to be defined as a macro." >&4
9588         fi
9589         $rm -f htonl.?
9590         ;;
9591 esac
9592 set d_htonl
9593 eval $setvar
9594
9595 : see if iconv exists
9596 set iconv d_iconv
9597 eval $inlibc
9598
9599 : index or strchr
9600 echo " "
9601 if set index val -f; eval $csym; $val; then
9602         if set strchr val -f d_strchr; eval $csym; $val; then
9603                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9604                         val="$define"
9605                         vali="$undef"
9606                         echo "strchr() found." >&4
9607                 else
9608                         val="$undef"
9609                         vali="$define"
9610                         echo "index() found." >&4
9611                 fi
9612         else
9613                 val="$undef"
9614                 vali="$define"
9615                 echo "index() found." >&4
9616         fi
9617 else
9618         if set strchr val -f d_strchr; eval $csym; $val; then
9619                 val="$define"
9620                 vali="$undef"
9621                 echo "strchr() found." >&4
9622         else
9623                 echo "No index() or strchr() found!" >&4
9624                 val="$undef"
9625                 vali="$undef"
9626         fi
9627 fi
9628 set d_strchr; eval $setvar
9629 val="$vali"
9630 set d_index; eval $setvar
9631
9632 : check whether inet_aton exists
9633 set inet_aton d_inetaton
9634 eval $inlibc
9635
9636 : see if inttypes.h is available
9637 : we want a real compile instead of Inhdr because some systems
9638 : have an inttypes.h which includes non-existent headers
9639 echo " "
9640 $cat >try.c <<EOCP
9641 #include <inttypes.h>
9642 int main() {
9643         static int32_t foo32 = 0x12345678;
9644 }
9645 EOCP
9646 set try
9647 if eval $compile; then
9648         echo "<inttypes.h> found." >&4
9649         val="$define"
9650 else
9651         echo "<inttypes.h> NOT found." >&4
9652         val="$undef"
9653 fi
9654 $rm -f try.c try
9655 set i_inttypes
9656 eval $setvar
9657
9658 : check for int64_t
9659 echo " "
9660 echo "Checking to see if you have int64_t..." >&4
9661 $cat >try.c <<EOCP
9662 #include <sys/types.h>
9663 #$i_inttypes I_INTTYPES
9664 #ifdef I_INTTYPES
9665 #include <inttypes.h>
9666 #endif
9667 int main() { int64_t x = 7; }
9668 EOCP
9669 set try
9670 if eval $compile; then
9671         val="$define"
9672         echo "You have int64_t."
9673 else
9674         val="$undef"
9675         echo "You do not have int64_t."
9676 fi
9677 $rm -f try try.*
9678 set d_int64_t
9679 eval $setvar
9680
9681 : Look for isascii
9682 echo " "
9683 $cat >isascii.c <<'EOCP'
9684 #include <stdio.h>
9685 #include <ctype.h>
9686 int main() {
9687         int c = 'A';
9688         if (isascii(c))
9689                 exit(0);
9690         else
9691                 exit(1);
9692 }
9693 EOCP
9694 set isascii
9695 if eval $compile; then
9696         echo "isascii() found." >&4
9697         val="$define"
9698 else
9699         echo "isascii() NOT found." >&4
9700         val="$undef"
9701 fi
9702 set d_isascii
9703 eval $setvar
9704 $rm -f isascii*
9705
9706 : see if isnan exists
9707 set isnan d_isnan
9708 eval $inlibc
9709
9710 : see if isnanl exists
9711 set isnanl d_isnanl
9712 eval $inlibc
9713
9714 : see if killpg exists
9715 set killpg d_killpg
9716 eval $inlibc
9717
9718 : see if lchown exists
9719 echo " "
9720 $cat > try.c <<'EOCP'
9721 /* System header to define __stub macros and hopefully few prototypes,
9722     which can conflict with char lchown(); below.  */
9723 #include <assert.h>
9724 /* Override any gcc2 internal prototype to avoid an error.  */
9725 /* We use char because int might match the return type of a gcc2
9726    builtin and then its argument prototype would still apply.  */
9727 char lchown();
9728 int main() {
9729     /*  The GNU C library defines this for functions which it implements
9730         to always fail with ENOSYS.  Some functions are actually named
9731         something starting with __ and the normal name is an alias.  */
9732 #if defined (__stub_lchown) || defined (__stub___lchown)
9733 choke me
9734 #else
9735 lchown();
9736 #endif
9737 ; return 0; }
9738 EOCP
9739 set try
9740 if eval $compile; then
9741     $echo "lchown() found." >&4
9742     val="$define"
9743 else
9744     $echo "lchown() NOT found." >&4
9745     val="$undef"
9746 fi
9747 set d_lchown
9748 eval $setvar
9749
9750 : See if number of significant digits in a double precision number is known
9751 echo " "
9752 $cat >ldbl_dig.c <<EOM
9753 #$i_limits I_LIMITS
9754 #$i_float I_FLOAT
9755 #ifdef I_LIMITS
9756 #include <limits.h>
9757 #endif
9758 #ifdef I_FLOAT
9759 #include <float.h>
9760 #endif
9761 #ifdef LDBL_DIG
9762 printf("Contains LDBL_DIG");
9763 #endif
9764 EOM
9765 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9766 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9767         echo "LDBL_DIG found." >&4
9768         val="$define"
9769 else
9770         echo "LDBL_DIG NOT found." >&4
9771         val="$undef"
9772 fi
9773 $rm -f ldbl_dig.?
9774 set d_ldbl_dig
9775 eval $setvar
9776
9777 : see if link exists
9778 set link d_link
9779 eval $inlibc
9780
9781 : see if localeconv exists
9782 set localeconv d_locconv
9783 eval $inlibc
9784
9785 : see if lockf exists
9786 set lockf d_lockf
9787 eval $inlibc
9788
9789 : check for long long
9790 echo " "
9791 echo "Checking to see if you have long long..." >&4
9792 echo 'int main() { long long x = 7; return 0; }' > try.c
9793 set try
9794 if eval $compile; then
9795         val="$define"
9796         echo "You have long long."
9797 else
9798         val="$undef"
9799         echo "You do not have long long."
9800 fi
9801 $rm try.*
9802 set d_longlong
9803 eval $setvar
9804
9805 : check for length of long long
9806 case "${d_longlong}${longlongsize}" in
9807 $define)
9808         echo " "
9809         echo "Checking to see how big your long longs are..." >&4
9810         $cat >try.c <<'EOCP'
9811 #include <stdio.h>
9812 int main()
9813 {
9814     printf("%d\n", (int)sizeof(long long));
9815     return(0);
9816 }
9817 EOCP
9818         set try
9819         if eval $compile_ok; then
9820                 longlongsize=`./try$exe_ext`
9821                 echo "Your long longs are $longlongsize bytes long."
9822         else
9823                 dflt='8'
9824                 echo " "
9825                 echo "(I can't seem to compile the test program.  Guessing...)"
9826                 rp="What is the size of a long long (in bytes)?"
9827                 . ./myread
9828                 longlongsize="$ans"
9829         fi
9830         if $test "X$longsize" = "X$longlongsize"; then
9831                 echo "(That isn't any different from an ordinary long.)"
9832         fi      
9833         ;;
9834 esac
9835 $rm -f try.* try
9836
9837 : see if prototype for lseek is available
9838 echo " "
9839 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9840 eval $hasproto
9841
9842 : see if lstat exists
9843 set lstat d_lstat
9844 eval $inlibc
9845
9846 : see if madvise exists
9847 set madvise d_madvise
9848 eval $inlibc
9849
9850 : see if mblen exists
9851 set mblen d_mblen
9852 eval $inlibc
9853
9854 : see if mbstowcs exists
9855 set mbstowcs d_mbstowcs
9856 eval $inlibc
9857
9858 : see if mbtowc exists
9859 set mbtowc d_mbtowc
9860 eval $inlibc
9861
9862 : see if memchr exists
9863 set memchr d_memchr
9864 eval $inlibc
9865
9866 : see if memcmp exists
9867 set memcmp d_memcmp
9868 eval $inlibc
9869
9870 : see if memcpy exists
9871 set memcpy d_memcpy
9872 eval $inlibc
9873
9874 : see if memmove exists
9875 set memmove d_memmove
9876 eval $inlibc
9877
9878 : see if memset exists
9879 set memset d_memset
9880 eval $inlibc
9881
9882 : see if mkdir exists
9883 set mkdir d_mkdir
9884 eval $inlibc
9885
9886 : see if mkdtemp exists
9887 set mkdtemp d_mkdtemp
9888 eval $inlibc
9889
9890 : see if mkfifo exists
9891 set mkfifo d_mkfifo
9892 eval $inlibc
9893
9894 : see if mkstemp exists
9895 set mkstemp d_mkstemp
9896 eval $inlibc
9897
9898 : see if mkstemps exists
9899 set mkstemps d_mkstemps
9900 eval $inlibc
9901
9902 : see if mktime exists
9903 set mktime d_mktime
9904 eval $inlibc
9905
9906 : see if this is a sys/mman.h system
9907 set sys/mman.h i_sysmman
9908 eval $inhdr
9909
9910 : see if mmap exists
9911 set mmap d_mmap
9912 eval $inlibc
9913 : see what shmat returns
9914 : default to something harmless
9915 mmaptype='void *'
9916 case "$i_sysmman$d_mmap" in
9917 "$define$define")
9918         $cat >mmap.c <<'END'
9919 #include <sys/mman.h>
9920 void *mmap();
9921 END
9922         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9923                 mmaptype='void *'
9924         else
9925                 mmaptype='caddr_t'
9926         fi
9927         echo "and it returns ($mmaptype)." >&4
9928         ;;
9929 esac
9930
9931
9932
9933 : see if modfl exists
9934 set modfl d_modfl
9935 eval $inlibc
9936
9937 : see if mprotect exists
9938 set mprotect d_mprotect
9939 eval $inlibc
9940
9941 : see if msgctl exists
9942 set msgctl d_msgctl
9943 eval $inlibc
9944
9945 : see if msgget exists
9946 set msgget d_msgget
9947 eval $inlibc
9948
9949 : see if msgsnd exists
9950 set msgsnd d_msgsnd
9951 eval $inlibc
9952
9953 : see if msgrcv exists
9954 set msgrcv d_msgrcv
9955 eval $inlibc
9956
9957 : see how much of the 'msg*(2)' library is present.
9958 h_msg=true
9959 echo " "
9960 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9961 *"$undef"*) h_msg=false;;
9962 esac
9963 case "$osname" in
9964 freebsd)
9965     case "`ipcs 2>&1`" in
9966     "SVID messages"*"not configured"*)
9967         echo "Your $osname does not have the msg*(2) configured." >&4
9968         h_msg=false
9969         val="$undef"
9970         set msgctl d_msgctl
9971         eval $setvar
9972         set msgget d_msgget
9973         eval $setvar
9974         set msgsnd d_msgsnd
9975         eval $setvar
9976         set msgrcv d_msgrcv
9977         eval $setvar
9978         ;;
9979     esac
9980     ;;
9981 esac
9982 : we could also check for sys/ipc.h ...
9983 if $h_msg && $test `./findhdr sys/msg.h`; then
9984         echo "You have the full msg*(2) library." >&4
9985         val="$define"
9986 else
9987         echo "You don't have the full msg*(2) library." >&4
9988         val="$undef"
9989 fi
9990 set d_msg
9991 eval $setvar
9992
9993 : see if msync exists
9994 set msync d_msync
9995 eval $inlibc
9996
9997 : see if munmap exists
9998 set munmap d_munmap
9999 eval $inlibc
10000
10001 : see if nice exists
10002 set nice d_nice
10003 eval $inlibc
10004
10005
10006 echo " "
10007 echo "Checking which 64-bit integer type we could use..." >&4
10008
10009 case "$intsize" in
10010 8) val=int
10011    set quadtype
10012    eval $setvar
10013    val='"unsigned int"'
10014    set uquadtype
10015    eval $setvar
10016    quadkind=1
10017    ;;
10018 *) case "$longsize" in
10019    8) val=long
10020       set quadtype
10021       eval $setvar
10022       val='"unsigned long"'
10023       set uquadtype
10024       eval $setvar
10025       quadkind=2
10026       ;;
10027    *) case "$d_longlong:$longlongsize" in
10028       define:8)
10029         val='"long long"'
10030         set quadtype
10031         eval $setvar
10032         val='"unsigned long long"'
10033         set uquadtype
10034         eval $setvar
10035         quadkind=3
10036         ;;
10037       *) case "$d_int64_t" in
10038          define)
10039            val=int64_t
10040            set quadtype
10041            eval $setvar
10042            val=uint64_t
10043            set uquadtype
10044            eval $setvar
10045            quadkind=4
10046            ;;
10047          esac
10048          ;;
10049       esac
10050       ;;
10051    esac
10052    ;;
10053 esac
10054
10055 case "$quadtype" in
10056 '')     echo "Alas, no 64-bit integer types in sight." >&4
10057         d_quad="$undef"
10058         ;;
10059 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10060             verb="will"
10061         else
10062             verb="could"
10063         fi
10064         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10065         d_quad="$define"
10066         ;;
10067 esac
10068
10069 : check for length of character
10070 echo " "
10071 case "$charsize" in
10072 '')
10073         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10074         $cat >try.c <<'EOCP'
10075 #include <stdio.h>
10076 int main()
10077 {
10078     printf("%d\n", (int)sizeof(char));
10079     exit(0);
10080 }
10081 EOCP
10082         set try
10083         if eval $compile_ok; then
10084                 dflt=`./try`
10085         else
10086                 dflt='1'
10087                 echo "(I can't seem to compile the test program.  Guessing...)"
10088         fi
10089         ;;
10090 *)
10091         dflt="$charsize"
10092         ;;
10093 esac
10094 rp="What is the size of a character (in bytes)?"
10095 . ./myread
10096 charsize="$ans"
10097 $rm -f try.c try
10098
10099
10100 echo " "
10101 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10102
10103 case "$use64bitint:$d_quad:$quadtype" in
10104 define:define:?*)
10105         ivtype="$quadtype"
10106         uvtype="$uquadtype"
10107         ivsize=8
10108         uvsize=8
10109         ;;
10110 *)      ivtype="long"
10111         uvtype="unsigned long"
10112         ivsize=$longsize
10113         uvsize=$longsize
10114         ;;
10115 esac
10116
10117 case "$uselongdouble:$d_longdbl" in
10118 define:define)
10119         nvtype="long double"
10120         nvsize=$longdblsize
10121         ;;
10122 *)      nvtype=double
10123         nvsize=$doublesize
10124         ;;
10125 esac
10126
10127 $echo "(IV will be "$ivtype", $ivsize bytes)"
10128 $echo "(UV will be "$uvtype", $uvsize bytes)"
10129 $echo "(NV will be "$nvtype", $nvsize bytes)"
10130
10131 $cat >try.c <<EOCP
10132 #$i_inttypes I_INTTYPES
10133 #ifdef I_INTTYPES
10134 #include <inttypes.h>
10135 #endif
10136 #include <stdio.h>
10137 int main() {
10138 #ifdef INT8
10139    int8_t i =  INT8_MAX;
10140   uint8_t u = UINT8_MAX;
10141   printf("int8_t\n");
10142 #endif
10143 #ifdef INT16
10144    int16_t i =  INT16_MAX;
10145   uint16_t i = UINT16_MAX;
10146   printf("int16_t\n");
10147 #endif
10148 #ifdef INT32
10149    int32_t i =  INT32_MAX;
10150   uint32_t u = UINT32_MAX;
10151   printf("int32_t\n");
10152 #endif
10153 }
10154 EOCP
10155
10156 case "$i8type" in
10157 '')     case "$charsize" in
10158         1)      i8type=char
10159                 u8type="unsigned char"
10160                 i8size=$charsize
10161                 u8size=$charsize
10162                 ;;
10163         esac
10164         ;;
10165 esac
10166 case "$i8type" in
10167 '')     set try -DINT8
10168         if eval $compile; then
10169                 case "`./try$exe_ext`" in
10170                 int8_t) i8type=int8_t
10171                         u8type=uint8_t
10172                         i8size=1
10173                         u8size=1
10174                         ;;
10175                 esac
10176         fi
10177         ;;
10178 esac
10179 case "$i8type" in
10180 '')     if $test $charsize -ge 1; then
10181                 i8type=char
10182                 u8type="unsigned char"
10183                 i8size=$charsize
10184                 u8size=$charsize
10185         fi
10186         ;;
10187 esac
10188
10189 case "$i16type" in
10190 '')     case "$shortsize" in
10191         2)      i16type=short
10192                 u16type="unsigned short"
10193                 i16size=$shortsize
10194                 u16size=$shortsize
10195                 ;;
10196         esac
10197         ;;
10198 esac
10199 case "$i16type" in
10200 '')     set try -DINT16
10201         if eval $compile; then
10202                 case "`./try$exe_ext`" in
10203                 int16_t)
10204                         i16type=int16_t
10205                         u16type=uint16_t
10206                         i16size=2
10207                         u16size=2
10208                         ;;
10209                 esac
10210         fi
10211         ;;
10212 esac
10213 case "$i16type" in
10214 '')     if $test $shortsize -ge 2; then
10215                 i16type=short
10216                 u16type="unsigned short"
10217                 i16size=$shortsize
10218                 u16size=$shortsize
10219         fi
10220         ;;
10221 esac
10222
10223 case "$i32type" in
10224 '')     case "$longsize" in
10225         4)      i32type=long
10226                 u32type="unsigned long"
10227                 i32size=$longsize
10228                 u32size=$longsize
10229                 ;;
10230         *)      case "$intsize" in
10231                 4)      i32type=int
10232                         u32type="unsigned int"
10233                         i32size=$intsize
10234                         u32size=$intsize
10235                         ;;
10236                 esac
10237                 ;;
10238         esac
10239         ;;
10240 esac
10241 case "$i32type" in
10242 '')     set try -DINT32
10243         if eval $compile; then
10244                 case "`./try$exe_ext`" in
10245                 int32_t)
10246                         i32type=int32_t
10247                         u32type=uint32_t
10248                         i32size=4
10249                         u32size=4
10250                         ;;
10251                 esac
10252         fi
10253         ;;
10254 esac
10255 case "$i32type" in
10256 '')     if $test $intsize -ge 4; then
10257                 i32type=int
10258                 u32type="unsigned int"
10259                 i32size=$intsize
10260                 u32size=$intsize
10261         fi
10262         ;;
10263 esac
10264
10265 case "$i64type" in
10266 '')     case "$d_quad:$quadtype" in
10267         define:?*)
10268                 i64type="$quadtype"
10269                 u64type="$uquadtype"
10270                 i64size=8
10271                 u64size=8
10272                 ;;
10273         esac
10274         ;;
10275 esac
10276
10277 $echo "Checking whether your NVs can preserve your UVs..." >&4
10278 $cat <<EOP >try.c
10279 #include <stdio.h>
10280 int main() {
10281     $uvtype k = ($uvtype)~0, l;
10282     $nvtype d;
10283     l = k;
10284     d = ($nvtype)l;
10285     l = ($uvtype)d;
10286     if (l == k)
10287        printf("preserve\n");
10288     exit(0);
10289 }
10290 EOP
10291 set try
10292 if eval $compile; then
10293         case "`./try$exe_ext`" in
10294         preserve) d_nv_preserves_uv="$define" ;;
10295         esac
10296 fi      
10297 case "$d_nv_preserves_uv" in
10298 $define) $echo "Yes, they can."  2>&1 ;;
10299 *)       $echo "No, they can't." 2>&1
10300          d_nv_preserves_uv="$undef"
10301          ;;
10302 esac
10303
10304 $rm -f try.* try
10305
10306 case "$d_nv_preserves_uv" in
10307 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10308 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10309         $cat <<EOP >try.c
10310 #include <stdio.h>
10311 int main() {
10312     $uvtype u = 0;
10313     int     n = 8 * $uvsize;
10314     int     i;
10315     for (i = 0; i < n; i++) {
10316       u = u << 1 | ($uvtype)1;
10317       if (($uvtype)($nvtype)u != u)
10318         break;
10319     }
10320     printf("%d\n", i);
10321     exit(0);
10322 }
10323 EOP
10324         set try
10325         if eval $compile; then
10326                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10327         fi
10328         case "$d_nv_preserves_uv_bits" in
10329         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10330         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10331                 d_nv_preserves_uv_bits="$undef"
10332                 ;;
10333         esac
10334         $rm -f try.* try
10335         ;;
10336 esac
10337
10338
10339 : check for off64_t
10340 echo " "
10341 echo "Checking to see if you have off64_t..." >&4
10342 $cat >try.c <<EOCP
10343 #include <sys/types.h>
10344 #include <unistd.h>
10345 int main() { off64_t x = 7; }
10346 EOCP
10347 set try
10348 if eval $compile; then
10349         val="$define"
10350         echo "You have off64_t."
10351 else
10352         val="$undef"
10353         echo "You do not have off64_t."
10354         case "$lseeksize" in
10355         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10356         esac
10357 fi
10358 $rm -f try.* try
10359 set d_off64_t
10360 eval $setvar
10361
10362 : see if POSIX threads are available
10363 set pthread.h i_pthread
10364 eval $inhdr
10365
10366
10367
10368
10369 : how to create joinable pthreads
10370 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10371         echo " "
10372         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10373         $cat >try.c <<'EOCP'
10374 #include <pthread.h>
10375 int main() {
10376     int detachstate = JOINABLE;
10377 }
10378 EOCP
10379         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10380         if eval $compile; then
10381                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10382                 val="$undef" # Yes, undef.
10383                 set d_old_pthread_create_joinable
10384                 eval $setvar
10385                 val=""
10386                 set old_pthread_create_joinable
10387                 eval $setvar
10388         else
10389                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10390                 if eval $compile; then
10391                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10392                         val="$define"
10393                         set d_old_pthread_create_joinable
10394                         eval $setvar
10395                         val=PTHREAD_CREATE_UNDETACHED
10396                         set old_pthread_create_joinable
10397                         eval $setvar
10398                 else            
10399                         set try -DJOINABLE=__UNDETACHED
10400                         if eval $compile; then
10401                                 echo "You seem to use __UNDETACHED." >&4
10402                                 val="$define"
10403                                 set d_old_pthread_create_joinable
10404                                 eval $setvar
10405                                 val=__UNDETACHED
10406                                 set old_pthread_create_joinable
10407                                 eval $setvar
10408                         else
10409                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10410                                 val="$define"
10411                                 set d_old_pthread_create_joinable
10412                                 eval $setvar
10413                                 val=0
10414                                 set old_pthread_create_joinable
10415                                 eval $setvar
10416                         fi
10417                 fi
10418         fi
10419         $rm -f try try.*
10420 else
10421     d_old_pthread_create_joinable="$undef"
10422     old_pthread_create_joinable=""
10423 fi
10424
10425 : see if pause exists
10426 set pause d_pause
10427 eval $inlibc
10428
10429 : see if pipe exists
10430 set pipe d_pipe
10431 eval $inlibc
10432
10433 : see if poll exists
10434 set poll d_poll
10435 eval $inlibc
10436
10437
10438 : see whether the various POSIXish _yields exist
10439 $cat >try.c <<EOP
10440 #include <pthread.h>
10441 #include <stdio.h>
10442 int main() {
10443 #ifdef SCHED_YIELD
10444         sched_yield();
10445 #else
10446 #ifdef PTHREAD_YIELD
10447         pthread_yield();
10448 #else
10449 #ifdef PTHREAD_YIELD_NULL
10450         pthread_yield(NULL);
10451 #endif
10452 #endif
10453 #endif
10454 }
10455 EOP
10456 : see if sched_yield exists
10457 set try -DSCHED_YIELD
10458 if eval $compile; then
10459     val="$define"
10460     sched_yield='sched_yield()'
10461 else
10462     val="$undef"
10463 fi
10464 case "$usethreads" in
10465 $define)
10466         case "$val" in
10467         $define) echo 'sched_yield() found.' >&4        ;;
10468         *)       echo 'sched_yield() NOT found.' >&4    ;;
10469         esac
10470 esac
10471 set d_sched_yield
10472 eval $setvar
10473
10474 : see if pthread_yield exists
10475 set try -DPTHREAD_YIELD
10476 if eval $compile; then
10477     val="$define"
10478     case "$sched_yield" in
10479     '') sched_yield='pthread_yield()' ;;
10480     esac
10481 else
10482     set try -DPTHREAD_YIELD_NULL
10483     if eval $compile; then
10484         val="$define"
10485         case "$sched_yield" in
10486         '') sched_yield='pthread_yield(NULL)' ;;
10487         esac
10488     else
10489         val="$undef"
10490     fi
10491 fi
10492 case "$usethreads" in
10493 $define)
10494         case "$val" in
10495         $define) echo 'pthread_yield() found.' >&4      ;;
10496         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10497         esac
10498         ;;
10499 esac
10500 set d_pthread_yield
10501 eval $setvar
10502
10503 case "$sched_yield" in
10504 '') sched_yield=undef ;;
10505 esac
10506
10507 $rm -f try try.*
10508
10509 : see if this is a pwd.h system
10510 set pwd.h i_pwd
10511 eval $inhdr
10512
10513 case "$i_pwd" in
10514 $define)
10515         xxx=`./findhdr pwd.h`
10516         $cppstdin $cppflags $cppminus < $xxx >$$.h
10517
10518         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10519                 val="$define"
10520         else
10521                 val="$undef"
10522         fi
10523         set d_pwquota
10524         eval $setvar
10525
10526         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10527                 val="$define"
10528         else
10529                 val="$undef"
10530         fi
10531         set d_pwage
10532         eval $setvar
10533
10534         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10535                 val="$define"
10536         else
10537                 val="$undef"
10538         fi
10539         set d_pwchange
10540         eval $setvar
10541
10542         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10543                 val="$define"
10544         else
10545                 val="$undef"
10546         fi
10547         set d_pwclass
10548         eval $setvar
10549
10550         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10551                 val="$define"
10552         else
10553                 val="$undef"
10554         fi
10555         set d_pwexpire
10556         eval $setvar
10557
10558         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10559                 val="$define"
10560         else
10561                 val="$undef"
10562         fi
10563         set d_pwcomment
10564         eval $setvar
10565
10566         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10567                 val="$define"
10568         else
10569                 val="$undef"
10570         fi
10571         set d_pwgecos
10572         eval $setvar
10573
10574         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10575                 val="$define"
10576         else
10577                 val="$undef"
10578         fi
10579         set d_pwpasswd
10580         eval $setvar
10581
10582         $rm -f $$.h
10583         ;;
10584 *)
10585         val="$undef"; 
10586         set d_pwquota; eval $setvar
10587         set d_pwage; eval $setvar
10588         set d_pwchange; eval $setvar
10589         set d_pwclass; eval $setvar
10590         set d_pwexpire; eval $setvar
10591         set d_pwcomment; eval $setvar
10592         set d_pwgecos; eval $setvar
10593         set d_pwpasswd; eval $setvar
10594         ;;
10595 esac
10596
10597 : see if readdir and friends exist
10598 set readdir d_readdir
10599 eval $inlibc
10600 set seekdir d_seekdir
10601 eval $inlibc
10602 set telldir d_telldir
10603 eval $inlibc
10604 set rewinddir d_rewinddir
10605 eval $inlibc
10606
10607 : see if readlink exists
10608 set readlink d_readlink
10609 eval $inlibc
10610
10611 : see if rename exists
10612 set rename d_rename
10613 eval $inlibc
10614
10615 : see if rmdir exists
10616 set rmdir d_rmdir
10617 eval $inlibc
10618
10619 : see if memory.h is available.
10620 val=''
10621 set memory.h val
10622 eval $inhdr
10623
10624 : See if it conflicts with string.h
10625 case "$val" in
10626 $define)
10627         case "$strings" in
10628         '') ;;
10629         *)
10630                 $cppstdin $cppflags $cppminus < $strings > mem.h
10631                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10632                         echo " "
10633                         echo "We won't be including <memory.h>."
10634                         val="$undef"
10635                 fi
10636                 $rm -f mem.h
10637                 ;;
10638         esac
10639 esac
10640 set i_memory
10641 eval $setvar
10642
10643 : can bcopy handle overlapping blocks?
10644 val="$undef"
10645 case "$d_bcopy" in
10646 "$define")
10647         echo " "
10648         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10649         $cat >try.c <<EOCP
10650 #$i_memory I_MEMORY
10651 #$i_stdlib I_STDLIB
10652 #$i_string I_STRING
10653 #$i_unistd I_UNISTD
10654 EOCP
10655         $cat >>try.c <<'EOCP'
10656 #include <stdio.h>
10657 #ifdef I_MEMORY
10658 #  include <memory.h>
10659 #endif
10660 #ifdef I_STDLIB
10661 #  include <stdlib.h>
10662 #endif
10663 #ifdef I_STRING
10664 #  include <string.h>
10665 #else
10666 #  include <strings.h>
10667 #endif
10668 #ifdef I_UNISTD
10669 #  include <unistd.h>  /* Needed for NetBSD */
10670 #endif
10671 int main()
10672 {
10673 char buf[128], abc[128];
10674 char *b;
10675 int len;
10676 int off;
10677 int align;
10678
10679 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10680
10681 for (align = 7; align >= 0; align--) {
10682         for (len = 36; len; len--) {
10683                 b = buf+align;
10684                 bcopy(abc, b, len);
10685                 for (off = 1; off <= len; off++) {
10686                         bcopy(b, b+off, len);
10687                         bcopy(b+off, b, len);
10688                         if (bcmp(b, abc, len))
10689                                 exit(1);
10690                 }
10691         }
10692 }
10693 exit(0);
10694 }
10695 EOCP
10696         set try
10697         if eval $compile_ok; then
10698                 if ./try 2>/dev/null; then
10699                         echo "Yes, it can."
10700                         val="$define"
10701                 else
10702                         echo "It can't, sorry."
10703                         case "$d_memmove" in
10704                         "$define") echo "But that's Ok since you have memmove()." ;;
10705                         esac
10706                 fi
10707         else
10708                 echo "(I can't compile the test program, so we'll assume not...)"
10709                 case "$d_memmove" in
10710                 "$define") echo "But that's Ok since you have memmove()." ;;
10711                 esac
10712         fi
10713         ;;
10714 esac
10715 $rm -f try.* try core
10716 set d_safebcpy
10717 eval $setvar
10718
10719 : can memcpy handle overlapping blocks?
10720 val="$undef"
10721 case "$d_memcpy" in
10722 "$define")
10723         echo " "
10724         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10725         $cat >try.c <<EOCP
10726 #$i_memory I_MEMORY
10727 #$i_stdlib I_STDLIB
10728 #$i_string I_STRING
10729 #$i_unistd I_UNISTD
10730 EOCP
10731         $cat >>try.c <<'EOCP'
10732 #include <stdio.h>
10733 #ifdef I_MEMORY
10734 #  include <memory.h>
10735 #endif
10736 #ifdef I_STDLIB
10737 #  include <stdlib.h>
10738 #endif
10739 #ifdef I_STRING
10740 #  include <string.h>
10741 #else
10742 #  include <strings.h>
10743 #endif
10744 #ifdef I_UNISTD
10745 #  include <unistd.h>  /* Needed for NetBSD */
10746 #endif
10747 int main()
10748 {
10749 char buf[128], abc[128];
10750 char *b;
10751 int len;
10752 int off;
10753 int align;
10754
10755 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10756    try to store the string in read-only memory. */
10757 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10758
10759 for (align = 7; align >= 0; align--) {
10760         for (len = 36; len; len--) {
10761                 b = buf+align;
10762                 memcpy(b, abc, len);
10763                 for (off = 1; off <= len; off++) {
10764                         memcpy(b+off, b, len);
10765                         memcpy(b, b+off, len);
10766                         if (memcmp(b, abc, len))
10767                                 exit(1);
10768                 }
10769         }
10770 }
10771 exit(0);
10772 }
10773 EOCP
10774         set try
10775         if eval $compile_ok; then
10776                 if ./try 2>/dev/null; then
10777                         echo "Yes, it can."
10778                         val="$define"
10779                 else
10780                         echo "It can't, sorry."
10781                         case "$d_memmove" in
10782                         "$define") echo "But that's Ok since you have memmove()." ;;
10783                         esac
10784                 fi
10785         else
10786                 echo "(I can't compile the test program, so we'll assume not...)"
10787                 case "$d_memmove" in
10788                 "$define") echo "But that's Ok since you have memmove()." ;;
10789                 esac
10790         fi
10791         ;;
10792 esac
10793 $rm -f try.* try core
10794 set d_safemcpy
10795 eval $setvar
10796
10797 : can memcmp be trusted to compare relative magnitude?
10798 val="$undef"
10799 case "$d_memcmp" in
10800 "$define")
10801         echo " "
10802         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10803         $cat >try.c <<EOCP
10804 #$i_memory I_MEMORY
10805 #$i_stdlib I_STDLIB
10806 #$i_string I_STRING
10807 #$i_unistd I_UNISTD
10808 EOCP
10809         $cat >>try.c <<'EOCP'
10810 #include <stdio.h>
10811 #ifdef I_MEMORY
10812 #  include <memory.h>
10813 #endif
10814 #ifdef I_STDLIB
10815 #  include <stdlib.h>
10816 #endif
10817 #ifdef I_STRING
10818 #  include <string.h>
10819 #else
10820 #  include <strings.h>
10821 #endif
10822 #ifdef I_UNISTD
10823 #  include <unistd.h>  /* Needed for NetBSD */
10824 #endif
10825 int main()
10826 {
10827 char a = -1;
10828 char b = 0;
10829 if ((a < b) && memcmp(&a, &b, 1) < 0)
10830         exit(1);
10831 exit(0);
10832 }
10833 EOCP
10834         set try
10835         if eval $compile_ok; then
10836                 if ./try 2>/dev/null; then
10837                         echo "Yes, it can."
10838                         val="$define"
10839                 else
10840                         echo "No, it can't (it uses signed chars)."
10841                 fi
10842         else
10843                 echo "(I can't compile the test program, so we'll assume not...)"
10844         fi
10845         ;;
10846 esac
10847 $rm -f try.* try core
10848 set d_sanemcmp
10849 eval $setvar
10850
10851 : see if select exists
10852 set select d_select
10853 eval $inlibc
10854
10855 : see if semctl exists
10856 set semctl d_semctl
10857 eval $inlibc
10858
10859 : see if semget exists
10860 set semget d_semget
10861 eval $inlibc
10862
10863 : see if semop exists
10864 set semop d_semop
10865 eval $inlibc
10866
10867 : see how much of the 'sem*(2)' library is present.
10868 h_sem=true
10869 echo " "
10870 case "$d_semctl$d_semget$d_semop" in
10871 *"$undef"*) h_sem=false;;
10872 esac
10873 case "$osname" in
10874 freebsd)
10875     case "`ipcs 2>&1`" in
10876     "SVID messages"*"not configured"*)
10877         echo "Your $osname does not have the sem*(2) configured." >&4
10878         h_sem=false
10879         val="$undef"
10880         set semctl d_semctl
10881         eval $setvar
10882         set semget d_semget
10883         eval $setvar
10884         set semop d_semop
10885         eval $setvar
10886         ;;
10887     esac
10888     ;;
10889 esac
10890 : we could also check for sys/ipc.h ...
10891 if $h_sem && $test `./findhdr sys/sem.h`; then
10892         echo "You have the full sem*(2) library." >&4
10893         val="$define"
10894 else
10895         echo "You don't have the full sem*(2) library." >&4
10896         val="$undef"
10897 fi
10898 set d_sem
10899 eval $setvar
10900
10901 : see whether sys/sem.h defines union semun
10902 echo " "
10903 $cat > try.c <<'END'
10904 #include <sys/types.h>
10905 #include <sys/ipc.h>
10906 #include <sys/sem.h>
10907 int main () { union semun semun; semun.buf = 0; }
10908 END
10909 set try
10910 if eval $compile; then
10911     echo "You have union semun in <sys/sem.h>." >&4
10912     val="$define"
10913 else
10914     echo "You do not have union semun in <sys/sem.h>." >&4
10915     val="$undef"
10916 fi
10917 $rm -f try try.c try.h
10918 set d_union_semun
10919 eval $setvar
10920
10921 : see how to do semctl IPC_STAT
10922 case "$d_sem" in
10923 $define)
10924     : see whether semctl IPC_STAT can use union semun
10925     echo " "
10926     $cat > try.h <<END
10927 #ifndef S_IRUSR
10928 #   ifdef S_IREAD
10929 #       define S_IRUSR S_IREAD
10930 #       define S_IWUSR S_IWRITE
10931 #       define S_IXUSR S_IEXEC
10932 #   else
10933 #       define S_IRUSR 0400
10934 #       define S_IWUSR 0200
10935 #       define S_IXUSR 0100
10936 #   endif
10937 #   define S_IRGRP (S_IRUSR>>3)
10938 #   define S_IWGRP (S_IWUSR>>3)
10939 #   define S_IXGRP (S_IXUSR>>3)
10940 #   define S_IROTH (S_IRUSR>>6)
10941 #   define S_IWOTH (S_IWUSR>>6)
10942 #   define S_IXOTH (S_IXUSR>>6)
10943 #endif
10944 #ifndef S_IRWXU
10945 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10946 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10947 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10948 #endif
10949 END
10950
10951     $cat > try.c <<END
10952 #include <sys/types.h>
10953 #include <sys/ipc.h>
10954 #include <sys/sem.h>
10955 #include <sys/stat.h>
10956 #include <stdio.h>
10957 #include <errno.h>
10958 #include "try.h"
10959 #ifndef errno
10960 extern int errno;
10961 #endif
10962 #$d_union_semun HAS_UNION_SEMUN
10963 int main() {
10964     union semun
10965 #ifndef HAS_UNION_SEMUN
10966     {
10967         int val;
10968         struct semid_ds *buf;
10969         unsigned short *array;
10970     }
10971 #endif
10972     arg;
10973     int sem, st;
10974
10975 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10976     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10977     if (sem > -1) {
10978         struct semid_ds argbuf;
10979         arg.buf = &argbuf;
10980 #       ifdef IPC_STAT
10981         st = semctl(sem, 0, IPC_STAT, arg);
10982         if (st == 0)
10983             printf("semun\n");
10984         else
10985 #       endif /* IPC_STAT */
10986             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10987 #       ifdef IPC_RMID
10988         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10989 #       endif /* IPC_RMID */
10990             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10991     } else
10992 #endif /* IPC_PRIVATE && ... */
10993         printf("semget failed: errno = %d\n", errno);
10994   return 0;
10995 }
10996 END
10997     val="$undef"
10998     set try
10999     if eval $compile; then
11000         xxx=`./try`
11001         case "$xxx" in
11002         semun) val="$define" ;;
11003         esac
11004     fi
11005     $rm -f try try.c
11006     set d_semctl_semun
11007     eval $setvar
11008     case "$d_semctl_semun" in
11009     $define)
11010         echo "You can use union semun for semctl IPC_STAT." >&4
11011         also='also'
11012         ;;
11013     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11014         also=''
11015         ;;
11016     esac
11017
11018     : see whether semctl IPC_STAT can use struct semid_ds pointer
11019     $cat > try.c <<'END'
11020 #include <sys/types.h>
11021 #include <sys/ipc.h>
11022 #include <sys/sem.h>
11023 #include <sys/stat.h>
11024 #include "try.h"
11025 #include <stdio.h>
11026 #include <errno.h>
11027 #ifndef errno
11028 extern int errno;
11029 #endif
11030 int main() {
11031     struct semid_ds arg;
11032     int sem, st;
11033
11034 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11035     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11036     if (sem > -1) {
11037 #       ifdef IPC_STAT
11038         st = semctl(sem, 0, IPC_STAT, &arg);
11039         if (st == 0)
11040             printf("semid_ds\n");
11041         else
11042 #       endif /* IPC_STAT */
11043             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11044 #       ifdef IPC_RMID
11045         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11046 #       endif /* IPC_RMID */
11047             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11048     } else
11049 #endif /* IPC_PRIVATE && ... */
11050         printf("semget failed: errno = %d\n", errno);
11051
11052     return 0;
11053 }
11054 END
11055     val="$undef"
11056     set try
11057     if eval $compile; then
11058         xxx=`./try`
11059         case "$xxx" in
11060         semid_ds) val="$define" ;;
11061         esac
11062     fi
11063     $rm -f try try.c
11064     set d_semctl_semid_ds
11065     eval $setvar
11066     case "$d_semctl_semid_ds" in
11067     $define)
11068         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11069         ;;
11070     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11071         ;;
11072     esac
11073     $rm -f try.h
11074     ;;
11075 *)  val="$undef"
11076
11077     # We do not have the full sem*(2) library, so assume we can not
11078     # use either.
11079
11080     set d_semctl_semun
11081     eval $setvar
11082
11083     set d_semctl_semid_ds
11084     eval $setvar
11085     ;;
11086 esac
11087
11088 : see if setegid exists
11089 set setegid d_setegid
11090 eval $inlibc
11091
11092 : see if seteuid exists
11093 set seteuid d_seteuid
11094 eval $inlibc
11095
11096 : see if setgrent exists
11097 set setgrent d_setgrent
11098 eval $inlibc
11099
11100 : see if sethostent exists
11101 set sethostent d_sethent
11102 eval $inlibc
11103
11104 : see if setlinebuf exists
11105 set setlinebuf d_setlinebuf
11106 eval $inlibc
11107
11108 : see if setlocale exists
11109 set setlocale d_setlocale
11110 eval $inlibc
11111
11112 : see if setnetent exists
11113 set setnetent d_setnent
11114 eval $inlibc
11115
11116 : see if setprotoent exists
11117 set setprotoent d_setpent
11118 eval $inlibc
11119
11120 : see if setpgid exists
11121 set setpgid d_setpgid
11122 eval $inlibc
11123
11124 : see if setpgrp2 exists
11125 set setpgrp2 d_setpgrp2
11126 eval $inlibc
11127
11128 : see if setpriority exists
11129 set setpriority d_setprior
11130 eval $inlibc
11131
11132 : see if setproctitle exists
11133 set setproctitle d_setproctitle
11134 eval $inlibc
11135
11136 : see if setpwent exists
11137 set setpwent d_setpwent
11138 eval $inlibc
11139
11140 : see if setregid exists
11141 set setregid d_setregid
11142 eval $inlibc
11143 set setresgid d_setresgid
11144 eval $inlibc
11145
11146 : see if setreuid exists
11147 set setreuid d_setreuid
11148 eval $inlibc
11149 set setresuid d_setresuid
11150 eval $inlibc
11151
11152 : see if setrgid exists
11153 set setrgid d_setrgid
11154 eval $inlibc
11155
11156 : see if setruid exists
11157 set setruid d_setruid
11158 eval $inlibc
11159
11160 : see if setservent exists
11161 set setservent d_setsent
11162 eval $inlibc
11163
11164 : see if setsid exists
11165 set setsid d_setsid
11166 eval $inlibc
11167
11168 : see if setvbuf exists
11169 set setvbuf d_setvbuf
11170 eval $inlibc
11171
11172 : see if sfio.h is available
11173 set sfio.h i_sfio
11174 eval $inhdr
11175
11176
11177 : see if sfio library is available
11178 case "$i_sfio" in
11179 $define)
11180         val=''
11181         set sfreserve val
11182         eval $inlibc
11183         ;;
11184 *)
11185         val="$undef"
11186         ;;
11187 esac
11188 : Ok, but do we want to use it.
11189 case "$val" in
11190 $define)
11191         case "$usesfio" in
11192         true|$define|[yY]*) dflt='y';;
11193         *) dflt='n';;
11194         esac
11195         echo "$package can use the sfio library, but it is experimental."
11196         case "$useperlio" in
11197         "$undef")
11198             echo "For sfio also the PerlIO abstraction layer is needed."
11199             echo "Earlier you said you wouldn't want that."
11200             ;;
11201         esac
11202         rp="You seem to have sfio available, do you want to try using it?"
11203         . ./myread
11204         case "$ans" in
11205         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11206                 useperlio="$define"
11207                 val="$define"
11208                 ;;
11209         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11210                 val="$undef"
11211                 : Remove sfio from list of libraries to use
11212                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11213                 shift
11214                 libs="$*"
11215                 echo "libs = $libs" >&4
11216                 ;;
11217         esac
11218         ;;
11219 *)      case "$usesfio" in
11220         true|$define|[yY]*)
11221                 echo "Sorry, cannot find sfio on this machine." >&4
11222                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11223                 val="$undef"
11224                 ;;
11225         esac
11226         ;;
11227 esac
11228 set d_sfio
11229 eval $setvar
11230 case "$d_sfio" in
11231 $define) usesfio='true';;
11232 *) usesfio='false';;
11233 esac
11234
11235 : see if shmctl exists
11236 set shmctl d_shmctl
11237 eval $inlibc
11238
11239 : see if shmget exists
11240 set shmget d_shmget
11241 eval $inlibc
11242
11243 : see if shmat exists
11244 set shmat d_shmat
11245 eval $inlibc
11246 : see what shmat returns
11247 case "$d_shmat" in
11248 "$define")
11249         $cat >shmat.c <<'END'
11250 #include <sys/shm.h>
11251 void *shmat();
11252 END
11253         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11254                 shmattype='void *'
11255         else
11256                 shmattype='char *'
11257         fi
11258         echo "and it returns ($shmattype)." >&4
11259         : see if a prototype for shmat is available
11260         xxx=`./findhdr sys/shm.h`
11261         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11262         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11263                 val="$define"
11264         else
11265                 val="$undef"
11266         fi
11267         $rm -f shmat.[co]
11268         ;;
11269 *)
11270         val="$undef"
11271         ;;
11272 esac
11273 set d_shmatprototype
11274 eval $setvar
11275
11276 : see if shmdt exists
11277 set shmdt d_shmdt
11278 eval $inlibc
11279
11280 : see how much of the 'shm*(2)' library is present.
11281 h_shm=true
11282 echo " "
11283 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11284 *"$undef"*) h_shm=false;;
11285 esac
11286 case "$osname" in
11287 freebsd)
11288     case "`ipcs 2>&1`" in
11289     "SVID shared memory"*"not configured"*)
11290         echo "Your $osname does not have the shm*(2) configured." >&4
11291         h_shm=false
11292         val="$undef"
11293         set shmctl d_shmctl
11294         evat $setvar
11295         set shmget d_shmget
11296         evat $setvar
11297         set shmat d_shmat
11298         evat $setvar
11299         set shmdt d_shmdt
11300         evat $setvar
11301         ;;
11302     esac
11303     ;;
11304 esac
11305 : we could also check for sys/ipc.h ...
11306 if $h_shm && $test `./findhdr sys/shm.h`; then
11307         echo "You have the full shm*(2) library." >&4
11308         val="$define"
11309 else
11310         echo "You don't have the full shm*(2) library." >&4
11311         val="$undef"
11312 fi
11313 set d_shm
11314 eval $setvar
11315
11316 echo " "
11317 : see if we have sigaction
11318 if set sigaction val -f d_sigaction; eval $csym; $val; then
11319         echo 'sigaction() found.' >&4
11320         $cat > try.c <<'EOP'
11321 #include <stdio.h>
11322 #include <sys/types.h>
11323 #include <signal.h>
11324 int main()
11325 {
11326     struct sigaction act, oact;
11327     act.sa_flags = 0;
11328     oact.sa_handler = 0;
11329     /* so that act and oact are used */
11330     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11331 }
11332 EOP
11333         set try
11334         if eval $compile_ok; then
11335                 val="$define"
11336         else
11337                 echo "But you don't seem to have a useable struct sigaction." >&4
11338                 val="$undef"
11339         fi
11340 else
11341         echo 'sigaction NOT found.' >&4
11342         val="$undef"
11343 fi
11344 set d_sigaction; eval $setvar
11345 $rm -f try try$_o try.c
11346
11347 : see if sigsetjmp exists
11348 echo " "
11349 case "$d_sigsetjmp" in
11350 '')
11351         $cat >try.c <<'EOP'
11352 #include <setjmp.h>
11353 sigjmp_buf env;
11354 int set = 1;
11355 int main()
11356 {
11357         if (sigsetjmp(env,1))
11358                 exit(set);
11359         set = 0;
11360         siglongjmp(env, 1);
11361         exit(1);
11362 }
11363 EOP
11364         set try
11365         if eval $compile; then
11366                 if ./try >/dev/null 2>&1; then
11367                         echo "POSIX sigsetjmp found." >&4
11368                         val="$define"
11369                 else
11370                         $cat >&4 <<EOM
11371 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11372 I'll ignore them.
11373 EOM
11374                         val="$undef"
11375                 fi
11376         else
11377                 echo "sigsetjmp not found." >&4
11378                 val="$undef"
11379         fi
11380         ;;
11381 *) val="$d_sigsetjmp"
11382         case "$d_sigsetjmp" in
11383         $define) echo "POSIX sigsetjmp found." >&4;;
11384         $undef) echo "sigsetjmp not found." >&4;;
11385         esac
11386         ;;
11387 esac
11388 set d_sigsetjmp
11389 eval $setvar
11390 $rm -f try.c try
11391
11392 : see if socks5_init exists
11393 set socks5_init d_socks5_init
11394 eval $inlibc
11395
11396 : see if sys/stat.h is available
11397 set sys/stat.h i_sysstat
11398 eval $inhdr
11399
11400
11401 : see if stat knows about block sizes
11402 echo " "
11403 echo "Checking to see if your struct stat has st_blocks field..." >&4
11404 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11405 eval $hasfield
11406
11407
11408 : see if this is a sys/vfs.h system
11409 set sys/vfs.h i_sysvfs
11410 eval $inhdr
11411
11412
11413 : see if this is a sys/statfs.h system
11414 set sys/statfs.h i_sysstatfs
11415 eval $inhdr
11416
11417
11418 echo " "
11419 echo "Checking to see if your system supports struct statfs..." >&4
11420 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
11421 eval $hasstruct
11422 case "$d_statfs_s" in
11423 "$define")      echo "Yes, it does."   ;;
11424 *)              echo "No, it doesn't." ;;
11425 esac
11426
11427
11428
11429 : see if struct statfs knows about f_flags
11430 case "$d_statfs_s" in
11431 define) 
11432         echo " "
11433         echo "Checking to see if your struct statfs has f_flags field..." >&4
11434         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
11435         eval $hasfield
11436         ;;
11437 *)      val="$undef"
11438         set d_statfs_f_flags
11439         eval $setvar
11440         ;;
11441 esac
11442 case "$d_statfs_f_flags" in
11443 "$define")      echo "Yes, it does."   ;;
11444 *)              echo "No, it doesn't." ;;
11445 esac
11446
11447 : see if _ptr and _cnt from stdio act std
11448 echo " "
11449 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11450         echo "(Looks like you have stdio.h from Linux.)"
11451         case "$stdio_ptr" in
11452         '') stdio_ptr='((fp)->_IO_read_ptr)'
11453                 ptr_lval=$define
11454                 ;;
11455         *)      ptr_lval=$d_stdio_ptr_lval;;
11456         esac
11457         case "$stdio_cnt" in
11458         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11459                 cnt_lval=$undef
11460                 ;;
11461         *)      cnt_lval=$d_stdio_cnt_lval;;
11462         esac
11463         case "$stdio_base" in
11464         '') stdio_base='((fp)->_IO_read_base)';;
11465         esac
11466         case "$stdio_bufsiz" in
11467         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11468         esac
11469 else
11470         case "$stdio_ptr" in
11471         '') stdio_ptr='((fp)->_ptr)'
11472                 ptr_lval=$define
11473                 ;;
11474         *)      ptr_lval=$d_stdio_ptr_lval;;
11475         esac
11476         case "$stdio_cnt" in
11477         '') stdio_cnt='((fp)->_cnt)'
11478                 cnt_lval=$define
11479                 ;;
11480         *)      cnt_lval=$d_stdio_cnt_lval;;
11481         esac
11482         case "$stdio_base" in
11483         '') stdio_base='((fp)->_base)';;
11484         esac
11485         case "$stdio_bufsiz" in
11486         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11487         esac
11488 fi
11489 : test whether _ptr and _cnt really work
11490 echo "Checking how std your stdio is..." >&4
11491 $cat >try.c <<EOP
11492 #include <stdio.h>
11493 #define FILE_ptr(fp)    $stdio_ptr
11494 #define FILE_cnt(fp)    $stdio_cnt
11495 int main() {
11496         FILE *fp = fopen("try.c", "r");
11497         char c = getc(fp);
11498         if (
11499                 18 <= FILE_cnt(fp) &&
11500                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11501         )
11502                 exit(0);
11503         exit(1);
11504 }
11505 EOP
11506 val="$undef"
11507 set try
11508 if eval $compile; then
11509         if ./try; then
11510                 echo "Your stdio acts pretty std."
11511                 val="$define"
11512         else
11513                 echo "Your stdio isn't very std."
11514         fi
11515 else
11516         echo "Your stdio doesn't appear very std."
11517 fi
11518 $rm -f try.c try
11519 set d_stdstdio
11520 eval $setvar
11521
11522 : Can _ptr be used as an lvalue?
11523 case "$d_stdstdio$ptr_lval" in
11524 $define$define) val=$define ;;
11525 *) val=$undef ;;
11526 esac
11527 set d_stdio_ptr_lval
11528 eval $setvar
11529
11530 : Can _cnt be used as an lvalue?
11531 case "$d_stdstdio$cnt_lval" in
11532 $define$define) val=$define ;;
11533 *) val=$undef ;;
11534 esac
11535 set d_stdio_cnt_lval
11536 eval $setvar
11537
11538
11539 : test whether setting _ptr sets _cnt as a side effect
11540 d_stdio_ptr_lval_sets_cnt="$undef"
11541 d_stdio_ptr_lval_nochange_cnt="$undef"
11542 case "$d_stdio_ptr_lval$d_stdstdio" in
11543 $define$define)
11544         echo "Checking to see what happens if we set the stdio ptr..." >&4
11545 $cat >try.c <<EOP
11546 #include <stdio.h>
11547 /* Can we scream? */
11548 /* Eat dust sed :-) */
11549 /* In the buffer space, no one can hear you scream. */
11550 #define FILE_ptr(fp)    $stdio_ptr
11551 #define FILE_cnt(fp)    $stdio_cnt
11552 #include <sys/types.h>
11553 int main() {
11554         FILE *fp = fopen("try.c", "r");
11555         int c;
11556         char *ptr;
11557         size_t cnt;
11558         if (!fp) {
11559             puts("Fail even to read");
11560             exit(1);
11561         }
11562         c = getc(fp); /* Read away the first # */
11563         if (c == EOF) {
11564             puts("Fail even to read");
11565             exit(1);
11566         }
11567         if (!(
11568                 18 <= FILE_cnt(fp) &&
11569                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11570         )) {
11571                 puts("Fail even to read");
11572                 exit (1);
11573         }
11574         ptr = (char*) FILE_ptr(fp);
11575         cnt = (size_t)FILE_cnt(fp);
11576
11577         FILE_ptr(fp) += 42;
11578
11579         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11580                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11581                 exit (1);
11582         }
11583         if (FILE_cnt(fp) <= 20) {
11584                 printf ("Fail (<20 chars to test)");
11585                 exit (1);
11586         }
11587         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11588                 puts("Fail compare");
11589                 exit (1);
11590         }
11591         if (cnt == FILE_cnt(fp)) {
11592                 puts("Pass_unchanged");
11593                 exit (0);
11594         }       
11595         if (FILE_cnt(fp) == (cnt - 42)) {
11596                 puts("Pass_changed");
11597                 exit (0);
11598         }
11599         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11600         return 1;
11601
11602 }
11603 EOP
11604         set try
11605         if eval $compile; then
11606                 case `./try$exe_ext` in
11607                 Pass_changed)
11608                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11609                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11610                 Pass_unchanged)
11611                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11612                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11613                 Fail*)
11614                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11615                 *)
11616                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11617         esac
11618         else
11619                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11620         fi
11621         $rm -f try.c try
11622         ;;
11623 esac
11624
11625 : see if _base is also standard
11626 val="$undef"
11627 case "$d_stdstdio" in
11628 $define)
11629         $cat >try.c <<EOP
11630 #include <stdio.h>
11631 #define FILE_base(fp)   $stdio_base
11632 #define FILE_bufsiz(fp) $stdio_bufsiz
11633 int main() {
11634         FILE *fp = fopen("try.c", "r");
11635         char c = getc(fp);
11636         if (
11637                 19 <= FILE_bufsiz(fp) &&
11638                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11639         )
11640                 exit(0);
11641         exit(1);
11642 }
11643 EOP
11644         set try
11645         if eval $compile; then
11646                 if ./try; then
11647                         echo "And its _base field acts std."
11648                         val="$define"
11649                 else
11650                         echo "But its _base field isn't std."
11651                 fi
11652         else
11653                 echo "However, it seems to be lacking the _base field."
11654         fi
11655         $rm -f try.c try
11656         ;;
11657 esac
11658 set d_stdiobase
11659 eval $setvar
11660
11661 $cat >&4 <<EOM
11662 Checking how to access stdio streams by file descriptor number...
11663 EOM
11664 case "$stdio_stream_array" in
11665 '')     $cat >try.c <<EOCP
11666 #include <stdio.h>
11667 int main() {
11668   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11669     printf("yes\n");
11670 }
11671 EOCP
11672         for s in _iob __iob __sF
11673         do
11674                 set try -DSTDIO_STREAM_ARRAY=$s
11675                 if eval $compile; then
11676                         case "`./try$exe_ext`" in
11677                         yes)    stdio_stream_array=$s; break ;;
11678                         esac
11679                 fi
11680         done
11681         $rm -f try.* try$exe_ext
11682 esac
11683 case "$stdio_stream_array" in
11684 '')     $cat >&4 <<EOM
11685 I can't figure out how to access stdio streams by file descriptor number.
11686 EOM
11687         d_stdio_stream_array="$undef"
11688         ;;
11689 *)      $cat >&4 <<EOM
11690 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11691 EOM
11692         d_stdio_stream_array="$define"
11693         ;;
11694 esac
11695
11696 : see if strcoll exists
11697 set strcoll d_strcoll
11698 eval $inlibc
11699
11700 : check for structure copying
11701 echo " "
11702 echo "Checking to see if your C compiler can copy structs..." >&4
11703 $cat >try.c <<'EOCP'
11704 int main()
11705 {
11706         struct blurfl {
11707                 int dyick;
11708         } foo, bar;
11709
11710         foo = bar;
11711 }
11712 EOCP
11713 if $cc -c try.c >/dev/null 2>&1 ; then
11714         val="$define"
11715         echo "Yup, it can."
11716 else
11717         val="$undef"
11718         echo "Nope, it can't."
11719 fi
11720 set d_strctcpy
11721 eval $setvar
11722 $rm -f try.*
11723
11724 : see if strerror and/or sys_errlist[] exist
11725 echo " "
11726 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11727     if set strerror val -f d_strerror; eval $csym; $val; then
11728                 echo 'strerror() found.' >&4
11729                 d_strerror="$define"
11730                 d_strerrm='strerror(e)'
11731                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11732                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11733                         d_syserrlst="$define"
11734                 else
11735                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11736                         d_syserrlst="$undef"
11737                 fi
11738     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11739                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11740                 echo 'strerror() found in string header.' >&4
11741                 d_strerror="$define"
11742                 d_strerrm='strerror(e)'
11743                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11744                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11745                                 d_syserrlst="$define"
11746                 else
11747                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11748                         d_syserrlst="$undef"
11749                 fi
11750     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11751                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11752                 d_strerror="$undef"
11753                 d_syserrlst="$define"
11754                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11755     else
11756                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11757                 d_strerror="$undef"
11758                 d_syserrlst="$undef"
11759                 d_strerrm='"unknown"'
11760     fi
11761 fi
11762
11763 : see if strtod exists
11764 set strtod d_strtod
11765 eval $inlibc
11766
11767 : see if strtol exists
11768 set strtol d_strtol
11769 eval $inlibc
11770
11771 : see if strtold exists
11772 set strtold d_strtold
11773 eval $inlibc
11774
11775 : see if strtoll exists
11776 set strtoll d_strtoll
11777 eval $inlibc
11778
11779 case "$d_longlong-$d_strtoll" in
11780 "$define-$define")
11781         $cat <<EOM
11782 Checking whether your strtoll() works okay...
11783 EOM
11784         $cat >try.c <<'EOCP'
11785 #include <errno.h>
11786 #ifdef __hpux
11787 #define strtoll __strtoll
11788 #endif
11789 #ifdef __EMX__
11790 #define strtoll _strtoll
11791 #endif
11792 #include <stdio.h>
11793 extern long long int strtoll(char *s, char **, int); 
11794 static int bad = 0;
11795 int check(char *s, long long ell, int een) {
11796         long long gll;
11797         errno = 0;
11798         gll = strtoll(s, 0, 10);
11799         if (!((gll == ell) && (errno == een)))
11800                 bad++;
11801 }
11802 int main() {
11803         check(" 1",                                      1LL, 0);
11804         check(" 0",                                      0LL, 0);
11805         check("-1",                                     -1LL, 0);
11806         check("-9223372036854775808", -9223372036854775808LL, 0);
11807         check("-9223372036854775808", -9223372036854775808LL, 0);
11808         check(" 9223372036854775807",  9223372036854775807LL, 0);
11809         check("-9223372036854775808", -9223372036854775808LL, 0);
11810         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11811         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11812         if (!bad)
11813                 printf("ok\n");
11814 }
11815 EOCP
11816         set try
11817         if eval $compile; then
11818                 yyy=`./try`
11819                 case "$yyy" in
11820                 ok) echo "Your strtoll() seems to be working okay." ;;
11821                 *) cat <<EOM >&4
11822 Your strtoll() doesn't seem to be working okay.
11823 EOM
11824                    d_strtoll="$undef"
11825                    ;;
11826                 esac
11827         else
11828                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11829                 d_strtoll="$undef"
11830         fi
11831         ;;
11832 esac
11833
11834 : see if strtoul exists
11835 set strtoul d_strtoul
11836 eval $inlibc
11837
11838 : see if strtoull exists
11839 set strtoull d_strtoull
11840 eval $inlibc
11841
11842 case "$d_longlong-$d_strtoull" in
11843 "$define-$define")
11844         $cat <<EOM
11845 Checking whether your strtoull() works okay...
11846 EOM
11847         $cat >try.c <<'EOCP'
11848 #include <errno.h>
11849 #ifdef __hpux
11850 #define strtoull __strtoull
11851 #endif
11852 #include <stdio.h>
11853 extern unsigned long long int strtoull(char *s, char **, int); 
11854 static int bad = 0;
11855 int check(char *s, long long eull, int een) {
11856         long long gull;
11857         errno = 0;
11858         gull = strtoull(s, 0, 10);
11859         if (!((gull == eull) && (errno == een)))
11860                 bad++;
11861 }
11862 int main() {
11863         check(" 1",                                       1LL, 0);
11864         check(" 0",                                       0LL, 0);
11865         check("18446744073709551615", 18446744073709551615ULL, 0);
11866         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11867         if (!bad)
11868                 printf("ok\n");
11869 }
11870 EOCP
11871         set try
11872         if eval $compile; then
11873                 case "`./try`" in
11874                 ok) echo "Your strtoull() seems to be working okay." ;;
11875                 *) cat <<EOM >&4
11876 Your strtoull() doesn't seem to be working okay.
11877 EOM
11878                    d_strtoull="$undef"
11879                    ;;
11880                 esac
11881         fi
11882         ;;
11883 esac
11884
11885 : see if strtouq exists
11886 set strtouq d_strtouq
11887 eval $inlibc
11888
11889 : see if strxfrm exists
11890 set strxfrm d_strxfrm
11891 eval $inlibc
11892
11893 : see if symlink exists
11894 set symlink d_symlink
11895 eval $inlibc
11896
11897 : see if syscall exists
11898 set syscall d_syscall
11899 eval $inlibc
11900
11901 : see if sysconf exists
11902 set sysconf d_sysconf
11903 eval $inlibc
11904
11905 : see if system exists
11906 set system d_system
11907 eval $inlibc
11908
11909 : see if tcgetpgrp exists
11910 set tcgetpgrp d_tcgetpgrp
11911 eval $inlibc
11912
11913 : see if tcsetpgrp exists
11914 set tcsetpgrp d_tcsetpgrp
11915 eval $inlibc
11916
11917 : see if prototype for telldir is available
11918 echo " "
11919 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11920 eval $hasproto
11921
11922 : see if this is a sys/times.h system
11923 set sys/times.h i_systimes
11924 eval $inhdr
11925
11926 : see if times exists
11927 echo " "
11928 if set times val -f d_times; eval $csym; $val; then
11929         echo 'times() found.' >&4
11930         d_times="$define"
11931         inc=''
11932         case "$i_systimes" in
11933         "$define") inc='sys/times.h';;
11934         esac
11935         rp="What is the type returned by times() on this system?"
11936         set clock_t clocktype long stdio.h sys/types.h $inc
11937         eval $typedef_ask
11938 else
11939         echo 'times() NOT found, hope that will do.' >&4
11940         d_times="$undef"
11941         clocktype='int'
11942 fi
11943
11944 : see if truncate exists
11945 set truncate d_truncate
11946 eval $inlibc
11947
11948 : see if tzname[] exists
11949 echo " "
11950 if set tzname val -a d_tzname; eval $csym; $val; then
11951         val="$define"
11952         echo 'tzname[] found.' >&4
11953 else
11954         val="$undef"
11955         echo 'tzname[] NOT found.' >&4
11956 fi
11957 set d_tzname
11958 eval $setvar
11959
11960 : see if umask exists
11961 set umask d_umask
11962 eval $inlibc
11963
11964 : see if ustat exists
11965 set ustat d_ustat
11966 eval $inlibc
11967
11968 : backward compatibility for d_hvfork
11969 if test X$d_hvfork != X; then
11970         d_vfork="$d_hvfork"
11971         d_hvfork=''
11972 fi
11973 : see if there is a vfork
11974 val=''
11975 set vfork val
11976 eval $inlibc
11977
11978 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11979 : perl on Solaris 2.x, and probably elsewhere.
11980 case "$val" in
11981 $define)
11982         echo " "
11983         case "$usevfork" in
11984         false) dflt='n';;
11985         *) dflt='y';;
11986         esac
11987         cat <<'EOM'
11988  
11989 Perl can only use a vfork() that doesn't suffer from strict
11990 restrictions on calling functions or modifying global data in
11991 the child.  For example, glibc-2.1 contains such a vfork()
11992 that is unsuitable.  If your system provides a proper fork()
11993 call, chances are that you do NOT want perl to use vfork().
11994
11995 EOM
11996         rp="Do you still want to use vfork()?"
11997         . ./myread
11998         case "$ans" in
11999         y|Y) ;;
12000         *)
12001                 echo "Ok, we won't use vfork()."
12002                 val="$undef"
12003                 ;;
12004         esac
12005         ;;
12006 esac
12007 set d_vfork
12008 eval $setvar
12009 case "$d_vfork" in
12010 $define) usevfork='true';;
12011 *) usevfork='false';;
12012 esac
12013
12014 : see if this is an sysdir system
12015 set sys/dir.h i_sysdir
12016 eval $inhdr
12017
12018 : see if this is an sysndir system
12019 set sys/ndir.h i_sysndir
12020 eval $inhdr
12021
12022 : see if closedir exists
12023 set closedir d_closedir
12024 eval $inlibc
12025
12026 case "$d_closedir" in
12027 "$define")
12028         echo " "
12029         echo "Checking whether closedir() returns a status..." >&4
12030         cat > closedir.c <<EOM
12031 #$i_dirent I_DIRENT             /**/
12032 #$i_sysdir I_SYS_DIR            /**/
12033 #$i_sysndir I_SYS_NDIR          /**/
12034 #$i_systypes I_SYS_TYPES        /**/
12035
12036 #if defined(I_SYS_TYPES)
12037 #include <sys/types.h>
12038 #endif
12039 #if defined(I_DIRENT)
12040 #include <dirent.h>
12041 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12042 #include <sys/dir.h>
12043 #endif
12044 #else
12045 #ifdef I_SYS_NDIR
12046 #include <sys/ndir.h>
12047 #else
12048 #ifdef I_SYS_DIR
12049 #ifdef hp9000s500
12050 #include <ndir.h>       /* may be wrong in the future */
12051 #else
12052 #include <sys/dir.h>
12053 #endif
12054 #endif
12055 #endif
12056 #endif 
12057 int main() { return closedir(opendir(".")); }
12058 EOM
12059         set closedir
12060         if eval $compile_ok; then
12061                 if ./closedir > /dev/null 2>&1 ; then
12062                         echo "Yes, it does."
12063                         val="$undef"
12064                 else
12065                         echo "No, it doesn't."
12066                         val="$define"
12067                 fi
12068         else
12069                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12070                 val="$define"
12071         fi
12072         ;;
12073 *)
12074         val="$undef";
12075         ;;
12076 esac
12077 set d_void_closedir
12078 eval $setvar
12079 $rm -f closedir*
12080 : check for volatile keyword
12081 echo " "
12082 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12083 $cat >try.c <<'EOCP'
12084 int main()
12085 {
12086         typedef struct _goo_struct goo_struct;
12087         goo_struct * volatile goo = ((goo_struct *)0);
12088         struct _goo_struct {
12089                 long long_int;
12090                 int reg_int;
12091                 char char_var;
12092         };
12093         typedef unsigned short foo_t;
12094         char *volatile foo;
12095         volatile int bar;
12096         volatile foo_t blech;
12097         foo = foo;
12098 }
12099 EOCP
12100 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12101         val="$define"
12102         echo "Yup, it does."
12103 else
12104         val="$undef"
12105         echo "Nope, it doesn't."
12106 fi
12107 set d_volatile
12108 eval $setvar
12109 $rm -f try.*
12110
12111 : see if there is a wait4
12112 set wait4 d_wait4
12113 eval $inlibc
12114
12115 : see if waitpid exists
12116 set waitpid d_waitpid
12117 eval $inlibc
12118
12119 : see if wcstombs exists
12120 set wcstombs d_wcstombs
12121 eval $inlibc
12122
12123 : see if wctomb exists
12124 set wctomb d_wctomb
12125 eval $inlibc
12126
12127 : preserve RCS keywords in files with variable substitution, grrr
12128 Date='$Date'
12129 Id='$Id'
12130 Log='$Log'
12131 RCSfile='$RCSfile'
12132 Revision='$Revision'
12133
12134 case "$crosscompile" in
12135 ''|[nN]*) crosscompile="$undef" ;;
12136 esac
12137
12138 case "$osname" in
12139 next|rhapsody|darwin) multiarch="$define" ;;
12140 esac
12141 case "$multiarch" in
12142 ''|[nN]*) multiarch="$undef" ;;
12143 esac
12144
12145 : check for alignment requirements
12146 echo " "
12147 case "$crosscompile$multiarch" in
12148 *$define*)
12149         $cat <<EOM
12150 You seem to be either cross-compiling or doing a multiarchitecture build,
12151 skipping the memory alignment check.
12152
12153 EOM
12154         case "$alignbytes" in
12155         '') alignbytes=8 ;;
12156         esac
12157         ;;
12158 *)
12159         case "$alignbytes" in
12160         '') echo "Checking alignment constraints..." >&4
12161                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12162                         $cat >try.c <<'EOCP'
12163 typedef long double NV;
12164 EOCP
12165                 else
12166                         $cat >try.c <<'EOCP'
12167 typedef double NV;
12168 EOCP
12169                 fi
12170                 $cat >>try.c <<'EOCP'
12171 #include <stdio.h>
12172 struct foobar {
12173         char foo;
12174         NV bar;
12175 } try_algn;
12176 int main()
12177 {
12178     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12179     return(0);
12180 }
12181 EOCP
12182                 set try
12183                 if eval $compile_ok; then
12184                         dflt=`./try`
12185                 else
12186                         dflt='8'
12187                         echo "(I can't seem to compile the test program...)"
12188                 fi
12189                 ;;
12190         *) dflt="$alignbytes"
12191                 ;;
12192         esac
12193         rp="Doubles must be aligned on a how-many-byte boundary?"
12194         . ./myread
12195         alignbytes="$ans"
12196         $rm -f try.c try
12197         ;;
12198 esac
12199
12200
12201 : set the base revision
12202 baserev=5.0
12203
12204 : check for ordering of bytes in a long
12205 echo " "
12206 case "$crosscompile$multiarch" in
12207 *$define*)
12208         $cat <<EOM
12209 You seem to be either cross-compiling or doing a multiarchitecture build,
12210 skipping the byteorder check.
12211
12212 EOM
12213         byteorder='0xffff'
12214         ;;
12215 *)
12216         case "$byteorder" in
12217         '')
12218                 $cat <<'EOM'
12219 In the following, larger digits indicate more significance.  A big-endian
12220 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12221 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12222 machines may have weird orders like 3412.  A Cray will report 87654321,
12223 an Alpha will report 12345678. If the test program works the default is
12224 probably right.
12225 I'm now running the test program...
12226 EOM
12227                 $cat >try.c <<'EOCP'
12228 #include <stdio.h>
12229 int main()
12230 {
12231         int i;
12232         union {
12233                 unsigned long l;
12234                 char c[sizeof(long)];
12235         } u;
12236
12237         if (sizeof(long) > 4)
12238                 u.l = (0x08070605L << 32) | 0x04030201L;
12239         else
12240                 u.l = 0x04030201L;
12241         for (i = 0; i < sizeof(long); i++)
12242                 printf("%c", u.c[i]+'0');
12243         printf("\n");
12244         exit(0);
12245 }
12246 EOCP
12247                 xxx_prompt=y
12248                 set try
12249                 if eval $compile && ./try > /dev/null; then
12250                         dflt=`./try`
12251                         case "$dflt" in
12252                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12253                                 echo "(The test program ran ok.)"
12254                                 echo "byteorder=$dflt"
12255                                 xxx_prompt=n
12256                         ;;
12257                         ????|????????) echo "(The test program ran ok.)" ;;
12258                         *) echo "(The test program didn't run right for some reason.)" ;;
12259                         esac
12260                 else
12261                         dflt='4321'
12262                         cat <<'EOM'
12263 (I can't seem to compile the test program.  Guessing big-endian...)
12264 EOM
12265                 fi
12266                 case "$xxx_prompt" in
12267                 y)
12268                         rp="What is the order of bytes in a long?"
12269                         . ./myread
12270                         byteorder="$ans"
12271                         ;;
12272                 *)      byteorder=$dflt
12273                         ;;
12274                 esac
12275                 ;;
12276         esac
12277         $rm -f try.c try
12278         ;;
12279 esac
12280
12281
12282 : how do we catenate cpp tokens here?
12283 echo " "
12284 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12285 $cat >cpp_stuff.c <<'EOCP'
12286 #define RCAT(a,b)a/**/b
12287 #define ACAT(a,b)a ## b
12288 RCAT(Rei,ser)
12289 ACAT(Cir,cus)
12290 EOCP
12291 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12292 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12293         echo "Oh!  Smells like ANSI's been here." >&4
12294         echo "We can catify or stringify, separately or together!"
12295         cpp_stuff=42
12296 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12297         echo "Ah, yes!  The good old days!" >&4
12298         echo "However, in the good old days we don't know how to stringify and"
12299         echo "catify at the same time."
12300         cpp_stuff=1
12301 else
12302         $cat >&4 <<EOM
12303 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12304 to have to edit the values of CAT[2-5] in config.h...
12305 EOM
12306         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12307 fi
12308 $rm -f cpp_stuff.*
12309
12310 : see if this is a db.h system
12311 set db.h i_db
12312 eval $inhdr
12313
12314 case "$i_db" in
12315 $define)
12316         : Check db version.
12317         echo " "
12318         echo "Checking Berkeley DB version ..." >&4
12319         $cat >try.c <<EOCP
12320 #$d_const HASCONST
12321 #ifndef HASCONST
12322 #define const
12323 #endif
12324 #include <sys/types.h>
12325 #include <stdio.h>
12326 #include <db.h>
12327 int main()
12328 {
12329 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12330     int Major, Minor, Patch ;
12331     unsigned long Version ;
12332     (void)db_version(&Major, &Minor, &Patch) ;
12333     printf("You have Berkeley DB Version 2 or greater\n");
12334
12335     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12336                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12337     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12338                 Major, Minor, Patch) ;
12339
12340     /* check that db.h & libdb are compatible */
12341     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12342         printf("db.h and libdb are incompatible\n") ;
12343         exit(3);        
12344     }
12345
12346     printf("db.h and libdb are compatible\n") ;
12347
12348     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12349                 + DB_VERSION_PATCH ;
12350
12351     /* needs to be >= 2.3.4 */
12352     if (Version < 2003004) {
12353     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12354         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12355         exit(2);        
12356     }
12357
12358     exit(0);
12359 #else
12360 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12361     printf("You have Berkeley DB Version 1\n");
12362     exit(0);    /* DB version < 2: the coast is clear. */
12363 #else
12364     exit(1);    /* <db.h> not Berkeley DB? */
12365 #endif
12366 #endif
12367 }
12368 EOCP
12369         set try
12370         if eval $compile_ok && ./try; then
12371                 echo 'Looks OK.' >&4
12372         else
12373                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12374                 i_db=$undef
12375                 case " $libs " in
12376                 *"-ldb "*)
12377                         : Remove db from list of libraries to use
12378                         echo "Removing unusable -ldb from library list" >&4
12379                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12380                         shift
12381                         libs="$*"
12382                         echo "libs = $libs" >&4
12383                         ;;
12384                 esac
12385         fi
12386         $rm -f try.*
12387         ;;
12388 esac
12389
12390 case "$i_db" in
12391 define)
12392         : Check the return type needed for hash 
12393         echo " "
12394         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12395         $cat >try.c <<EOCP
12396 #$d_const HASCONST
12397 #ifndef HASCONST
12398 #define const
12399 #endif
12400 #include <sys/types.h>
12401 #include <db.h>
12402
12403 #ifndef DB_VERSION_MAJOR
12404 u_int32_t hash_cb (ptr, size)
12405 const void *ptr;
12406 size_t size;
12407 {
12408 }
12409 HASHINFO info;
12410 int main()
12411 {
12412         info.hash = hash_cb;
12413 }
12414 #endif
12415 EOCP
12416         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12417                 if $contains warning try.out >>/dev/null 2>&1 ; then
12418                         db_hashtype='int'
12419                 else
12420                         db_hashtype='u_int32_t'
12421                 fi
12422         else
12423                 : XXX Maybe we should just give up here.
12424                 db_hashtype=u_int32_t
12425                 $cat try.out >&4
12426                 echo "Help:  I can't seem to compile the db test program." >&4
12427                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12428         fi
12429         $rm -f try.*
12430         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12431         ;;
12432 *)      db_hashtype=u_int32_t
12433         ;;
12434 esac
12435 case "$i_db" in
12436 define)
12437         : Check the return type needed for prefix 
12438         echo " "
12439         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12440         cat >try.c <<EOCP
12441 #$d_const HASCONST
12442 #ifndef HASCONST
12443 #define const
12444 #endif
12445 #include <sys/types.h>
12446 #include <db.h>
12447
12448 #ifndef DB_VERSION_MAJOR
12449 size_t prefix_cb (key1, key2)
12450 const DBT *key1;
12451 const DBT *key2;
12452 {
12453 }
12454 BTREEINFO info;
12455 int main()
12456 {
12457         info.prefix = prefix_cb;
12458 }
12459 #endif
12460 EOCP
12461         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12462                 if $contains warning try.out >>/dev/null 2>&1 ; then
12463                         db_prefixtype='int'
12464                 else
12465                         db_prefixtype='size_t'
12466                 fi
12467         else
12468                 db_prefixtype='size_t'
12469                 : XXX Maybe we should just give up here.
12470                 $cat try.out >&4
12471                 echo "Help:  I can't seem to compile the db test program." >&4
12472                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12473         fi
12474         $rm -f try.*
12475         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12476         ;;
12477 *)      db_prefixtype='size_t'
12478         ;;
12479 esac
12480
12481 : check for void type
12482 echo " "
12483 echo "Checking to see how well your C compiler groks the void type..." >&4
12484 case "$voidflags" in
12485 '')
12486         $cat >try.c <<'EOCP'
12487 #if TRY & 1
12488 void sub() {
12489 #else
12490 sub() {
12491 #endif
12492         extern void moo();      /* function returning void */
12493         void (*goo)();          /* ptr to func returning void */
12494 #if TRY & 8
12495         void *hue;              /* generic ptr */
12496 #endif
12497 #if TRY & 2
12498         void (*foo[10])();
12499 #endif
12500
12501 #if TRY & 4
12502         if(goo == moo) {
12503                 exit(0);
12504         }
12505 #endif
12506         exit(0);
12507 }
12508 int main() { sub(); }
12509 EOCP
12510         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12511                 voidflags=$defvoidused
12512         echo "Good.  It appears to support void to the level $package wants.">&4
12513                 if $contains warning .out >/dev/null 2>&1; then
12514                         echo "However, you might get some warnings that look like this:"
12515                         $cat .out
12516                 fi
12517         else
12518 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12519                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12520                         echo "It supports 1..."
12521                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12522                                 echo "It also supports 2..."
12523                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12524                                         voidflags=7
12525                                         echo "And it supports 4 but not 8 definitely."
12526                                 else
12527                                         echo "It doesn't support 4..."
12528                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12529                                                 voidflags=11
12530                                                 echo "But it supports 8."
12531                                         else
12532                                                 voidflags=3
12533                                                 echo "Neither does it support 8."
12534                                         fi
12535                                 fi
12536                         else
12537                                 echo "It does not support 2..."
12538                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12539                                         voidflags=13
12540                                         echo "But it supports 4 and 8."
12541                                 else
12542                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12543                                                 voidflags=5
12544                                                 echo "And it supports 4 but has not heard about 8."
12545                                         else
12546                                                 echo "However it supports 8 but not 4."
12547                                         fi
12548                                 fi
12549                         fi
12550                 else
12551                         echo "There is no support at all for void."
12552                         voidflags=0
12553                 fi
12554         fi
12555 esac
12556 case "$voidflags" in
12557 "$defvoidused") ;;
12558 *)      $cat >&4 <<'EOM'
12559   Support flag bits are:
12560     1: basic void declarations.
12561     2: arrays of pointers to functions returning void.
12562     4: operations between pointers to and addresses of void functions.
12563     8: generic void pointers.
12564 EOM
12565         dflt="$voidflags";
12566         rp="Your void support flags add up to what?"
12567         . ./myread
12568         voidflags="$ans"
12569         ;;
12570 esac
12571 $rm -f try.* .out
12572
12573
12574 : How can we generate normalized random numbers ?
12575 echo " "
12576 echo "Looking for a random number function..." >&4
12577 case "$randfunc" in
12578 '')
12579         if set drand48 val -f; eval $csym; $val; then
12580                 dflt="drand48"
12581                 echo "Good, found drand48()." >&4
12582         elif set random val -f; eval $csym; $val; then
12583                 dflt="random"
12584                 echo "OK, found random()." >&4
12585         else
12586                 dflt="rand"
12587                 echo "Yick, looks like I have to use rand()." >&4
12588         fi
12589         echo " "
12590         ;;
12591 *)
12592         dflt="$randfunc"
12593         ;;
12594 esac
12595 cont=true
12596
12597 case "$ccflags" in
12598 *-Dmy_rand=*|*-Dmy_srand=*)
12599         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12600         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12601         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12602         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12603         ;;
12604 esac
12605
12606 while $test "$cont"; do
12607         rp="Use which function to generate random numbers?"
12608         . ./myread
12609         if $test "$ans" = "$dflt"; then
12610                 : null
12611         else
12612                 randbits=''
12613         fi
12614         randfunc="$ans"
12615         if set $ans val -f; eval $csym; $val; then
12616                 cont=''
12617         else
12618                 dflt=y
12619                 rp="I cannot find function $ans. Use that name anyway?"
12620                 . ./myread
12621                 dflt=rand
12622                 case "$ans" in
12623                         [yY]*) cont='';;
12624                 esac
12625         fi
12626         case "$cont" in
12627         '')
12628                 case "$randfunc" in
12629                 drand48)
12630                         drand01="drand48()"
12631                         seedfunc="srand48"
12632                         randbits=48
12633                         randseedtype=long
12634                         ;;
12635                 rand|random)
12636                         case "$randbits" in
12637                         '')
12638 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12639                                 $cat >try.c <<EOCP
12640 #$i_unistd I_UNISTD
12641 #$i_stdlib I_STDLIB
12642 #include <stdio.h>
12643 #ifdef I_UNISTD
12644 #  include <unistd.h>
12645 #endif
12646 #ifdef I_STDLIB
12647 #  include <stdlib.h>
12648 #endif
12649 int main()
12650 {
12651         register int i;
12652         register unsigned long tmp;
12653         register unsigned long max = 0L;
12654
12655         for (i = 1000; i; i--) {
12656                 tmp = (unsigned long) $randfunc();
12657                 if (tmp > max) max = tmp;
12658         }
12659         for (i = 0; max; i++)
12660                 max /= 2;
12661         printf("%d\n",i);
12662 }
12663 EOCP
12664                                 set try
12665                                 if eval $compile_ok; then
12666                                         dflt=`try`
12667                                 else
12668                                         dflt='?'
12669                                         echo "(I can't seem to compile the test program...)"
12670                                 fi
12671                                 ;;
12672                         *)
12673                                 dflt="$randbits"
12674                                 ;;
12675                         esac
12676                         rp="How many bits does your $randfunc() function produce?"
12677                         . ./myread
12678                         randbits="$ans"
12679                         $rm -f try.c try
12680                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12681                         seedfunc="s$randfunc"
12682                         randseedtype=unsigned
12683                         ;;
12684                 *)
12685                         dflt="31"
12686                         rp="How many bits does your $randfunc() function produce?"
12687                         . ./myread
12688                         randbits="$ans"
12689                         seedfunc="s$randfunc"
12690                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12691                         if set $seedfunc val -f; eval $csym; $val; then
12692                                 echo "(Using $seedfunc() to seed random generator)"
12693                         else
12694                                 echo "(Warning: no $seedfunc() to seed random generator)"
12695                                 seedfunc=rand
12696                         fi
12697                         randseedtype=unsigned
12698                         ;;
12699                 esac
12700                 ;;
12701         esac
12702 done
12703
12704 echo " "
12705 echo "Determining whether or not we are on an EBCDIC system..." >&4
12706 $cat >tebcdic.c <<'EOM'
12707 int main()
12708 {
12709   if ('M'==0xd4) return 0;
12710   return 1;
12711 }
12712 EOM
12713
12714 val=$undef
12715 set tebcdic
12716 if eval $compile_ok; then
12717         if ./tebcdic; then
12718                 echo "You seem to speak EBCDIC." >&4
12719                 val="$define"
12720         else
12721                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12722         fi
12723 else
12724         echo "I'm unable to compile the test program." >&4
12725         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12726 fi
12727 $rm -f tebcdic.c tebcdic
12728 set ebcdic
12729 eval $setvar
12730
12731 echo " "
12732 $cat >&4 <<EOM
12733 Checking how to flush all pending stdio output...
12734 EOM
12735 # I only know how to find the first 32 possibly open files on SunOS.
12736 # See also hints/sunos_4_1.sh and util.c  --AD
12737 case "$osname" in
12738 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12739 esac
12740 $cat >>try.c <<EOCP
12741 #include <stdio.h>
12742 #$i_unistd I_UNISTD
12743 #ifdef I_UNISTD
12744 # include <unistd.h>
12745 #endif
12746 #$d_sysconf HAS_SYSCONF
12747 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12748 #ifdef HAS_STDIO_STREAM_ARRAY
12749 # define STDIO_STREAM_ARRAY $stdio_stream_array
12750 #endif
12751 int main() {
12752   FILE* p = fopen("try.out", "w");
12753 #ifdef TRY_FPUTC
12754   fputc('x', p);
12755 #else
12756 # ifdef TRY_FPRINTF
12757   fprintf(p, "x");
12758 # endif
12759 #endif
12760 #ifdef TRY_FFLUSH_NULL
12761   fflush(NULL);
12762 #endif
12763 #ifdef TRY_FFLUSH_ALL
12764   {
12765     long open_max = -1;
12766 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12767     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12768 # else
12769 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12770     open_max = sysconf(_SC_OPEN_MAX);
12771 #  else
12772 #   ifdef FOPEN_MAX
12773     open_max = FOPEN_MAX;
12774 #   else
12775 #    ifdef OPEN_MAX
12776     open_max = OPEN_MAX;
12777 #    else
12778 #     ifdef _NFILE
12779     open_max = _NFILE;
12780 #     endif
12781 #    endif
12782 #   endif
12783 #  endif
12784 # endif 
12785 # ifdef HAS_STDIO_STREAM_ARRAY
12786     if (open_max > 0) {
12787       long i;
12788       for (i = 0; i < open_max; i++)
12789             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12790                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12791                 STDIO_STREAM_ARRAY[i]._flag)
12792                 fflush(&STDIO_STREAM_ARRAY[i]);
12793     }   
12794   }
12795 # endif
12796 #endif
12797   _exit(42);
12798 }
12799 EOCP
12800 : first we have to find out how _not_ to flush
12801 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12802     output=''
12803     set try -DTRY_FPUTC
12804     if eval $compile; then
12805             $rm -f try.out
12806             ./try$exe_ext 2>/dev/null
12807             if $test ! -s try.out -a "X$?" = X42; then
12808                 output=-DTRY_FPUTC
12809             fi
12810     fi
12811     case "$output" in
12812     '')
12813             set try -DTRY_FPRINTF
12814             $rm -f try.out
12815             if eval $compile; then
12816                     $rm -f try.out
12817                     ./try$exe_ext 2>/dev/null
12818                     if $test ! -s try.out -a "X$?" = X42; then
12819                         output=-DTRY_FPRINTF
12820                     fi
12821             fi
12822         ;;
12823     esac
12824 fi
12825 : check for fflush NULL behaviour
12826 case "$fflushNULL" in
12827 '')     set try -DTRY_FFLUSH_NULL $output
12828         if eval $compile; then
12829                 $rm -f try.out
12830                 ./try$exe_ext 2>/dev/null
12831                 code="$?"
12832                 if $test -s try.out -a "X$code" = X42; then
12833                         fflushNULL="`$cat try.out`"
12834                 else
12835                         if $test "X$code" != X42; then
12836                                 $cat >&4 <<EOM
12837 (If this test failed, don't worry, we'll try another method shortly.)
12838 EOM
12839                         fi
12840                 fi
12841         fi
12842         $rm -f core try.core core.try.*
12843         case "$fflushNULL" in
12844         x)      $cat >&4 <<EOM
12845 Your fflush(NULL) works okay for output streams.
12846 Let's see if it clobbers input pipes...
12847 EOM
12848 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12849 # bug that improperly flushes the input end of pipes.  So we avoid the
12850 # autoflush on fork/system/exec support for now. :-(
12851 $cat >tryp.c <<EOCP
12852 #include <stdio.h>
12853 int
12854 main(int argc, char **argv)
12855 {
12856     char buf[1024];
12857     int i;
12858     char *bp = buf;
12859     while (1) {
12860         while ((i = getc(stdin)) != -1
12861                && (*bp++ = i) != '\n'
12862                && bp < &buf[1024])
12863         /* DO NOTHING */ ;
12864         *bp = '\0';
12865         fprintf(stdout, "%s", buf);
12866         fflush(NULL);
12867         if (i == -1)
12868             return 0;
12869         bp = buf;
12870     }
12871 }
12872 EOCP
12873                 fflushNULL="$define"
12874                 set tryp
12875                 if eval $compile; then
12876                     $rm -f tryp.out
12877                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12878                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12879                        $cat >&4 <<EOM
12880 fflush(NULL) seems to behave okay with input streams.
12881 EOM
12882                         fflushNULL="$define"
12883                     else
12884                         $cat >&4 <<EOM
12885 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12886 EOM
12887                         fflushNULL="$undef"
12888                     fi
12889                 fi
12890                 $rm -f core tryp.c tryp.core core.tryp.*
12891                 ;;
12892         '')     $cat >&4 <<EOM
12893 Your fflush(NULL) isn't working (contrary to ANSI C).
12894 EOM
12895                 fflushNULL="$undef"
12896                 ;;
12897         *)      $cat >&4 <<EOM
12898 Cannot figure out whether your fflush(NULL) works or not.
12899 I'm assuming it doesn't (contrary to ANSI C).
12900 EOM
12901                 fflushNULL="$undef"
12902                 ;;
12903         esac
12904         ;;
12905 $define|true|[yY]*)
12906         fflushNULL="$define"
12907         ;;
12908 *)
12909         fflushNULL="$undef"
12910         ;;
12911 esac
12912 : check explicit looping only if NULL did not work, and if the pipe
12913 : bug does not show up on an explicit flush too
12914 case "$fflushNULL" in
12915 "$undef")
12916         $cat >tryp.c <<EOCP
12917 #include <stdio.h>
12918 int
12919 main(int argc, char **argv)
12920 {
12921     char buf[1024];
12922     int i;
12923     char *bp = buf;
12924     while (1) {
12925         while ((i = getc(stdin)) != -1
12926                && (*bp++ = i) != '\n'
12927                && bp < &buf[1024])
12928         /* DO NOTHING */ ;
12929         *bp = '\0';
12930         fprintf(stdout, "%s", buf);
12931         fflush(stdin);
12932         if (i == -1)
12933             return 0;
12934         bp = buf;
12935     }
12936 }
12937 EOCP
12938         set tryp
12939         if eval $compile; then
12940             $rm -f tryp.out
12941             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12942             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12943                $cat >&4 <<EOM
12944 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12945 EOM
12946                 : now check for fflushall behaviour
12947                 case "$fflushall" in
12948                 '')     set try -DTRY_FFLUSH_ALL $output
12949                         if eval $compile; then
12950                                 $cat >&4 <<EOM
12951 (Now testing the other method--but note that this also may fail.)
12952 EOM
12953                                 $rm -f try.out
12954                                 ./try$exe_ext 2>/dev/null
12955                                 if $test -s try.out -a "X$?" = X42; then
12956                                         fflushall="`$cat try.out`"
12957                                 fi
12958                         fi
12959                         $rm -f core try.core core.try.*
12960                         case "$fflushall" in
12961                         x)      $cat >&4 <<EOM
12962 Whew. Flushing explicitly all the stdio streams works.
12963 EOM
12964                                 fflushall="$define"
12965                                 ;;
12966                         '')     $cat >&4 <<EOM
12967 Sigh. Flushing explicitly all the stdio streams doesn't work.
12968 EOM
12969                                 fflushall="$undef"
12970                                 ;;
12971                         *)      $cat >&4 <<EOM
12972 Cannot figure out whether flushing stdio streams explicitly works or not.
12973 I'm assuming it doesn't.
12974 EOM
12975                                 fflushall="$undef"
12976                                 ;;
12977                         esac
12978                         ;;
12979                 "$define"|true|[yY]*)
12980                         fflushall="$define"
12981                         ;;
12982                 *)
12983                         fflushall="$undef"
12984                         ;;
12985                 esac
12986             else
12987                 $cat >&4 <<EOM
12988 All is futile.  Even fflush(stdin) clobbers input pipes!
12989 EOM
12990                 fflushall="$undef"
12991             fi
12992         else
12993             fflushall="$undef"
12994         fi
12995         $rm -f core tryp.c tryp.core core.tryp.*
12996         ;;
12997 *)      fflushall="$undef"
12998         ;;
12999 esac
13000
13001 case "$fflushNULL$fflushall" in
13002 undefundef)
13003         $cat <<EOM
13004 OK, I give up.  I cannot figure out how to flush pending stdio output.
13005 We won't be flushing handles at all before fork/exec/popen.
13006 EOM
13007         ;;
13008 esac
13009 $rm -f try.* try$exe_ext
13010
13011 : Store the full pathname to the ar program for use in the C program
13012 : Respect a hint or command line value for full_ar.
13013 case "$full_ar" in
13014 '') full_ar=$ar ;;
13015 esac
13016
13017 : Store the full pathname to the sed program for use in the C program
13018 full_sed=$sed
13019
13020 : see what type gids are declared as in the kernel
13021 echo " "
13022 echo "Looking for the type for group ids returned by getgid()."
13023 set gid_t gidtype xxx stdio.h sys/types.h
13024 eval $typedef
13025 case "$gidtype" in
13026 xxx)
13027         xxx=`./findhdr sys/user.h`
13028         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13029         case $1 in
13030         unsigned) dflt="$1 $2" ;;
13031         *) dflt="$1" ;;
13032         esac
13033         ;;
13034 *) dflt="$gidtype";;
13035 esac
13036 case "$gidtype" in
13037 gid_t) echo "gid_t found." ;;
13038 *)      rp="What is the type for group ids returned by getgid()?"
13039         . ./myread
13040         gidtype="$ans"
13041         ;;
13042 esac
13043
13044 echo " "
13045 case "$gidtype" in
13046 *_t) zzz="$gidtype"     ;;
13047 *)   zzz="gid"          ;;
13048 esac
13049 echo "Checking the size of $zzz..." >&4 
13050 cat > try.c <<EOCP
13051 #include <sys/types.h>
13052 #include <stdio.h>
13053 int main() {
13054     printf("%d\n", (int)sizeof($gidtype));
13055     exit(0);
13056 }
13057 EOCP
13058 set try
13059 if eval $compile_ok; then
13060         yyy=`./try`
13061         case "$yyy" in
13062         '')     gidsize=4
13063                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13064                 ;;
13065         *)      gidsize=$yyy
13066                 echo "Your $zzz is $gidsize bytes long."
13067                 ;;
13068         esac
13069 else
13070         gidsize=4
13071         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13072 fi
13073
13074
13075 echo " "
13076 case "$gidtype" in
13077 *_t) zzz="$gidtype"     ;;
13078 *)   zzz="gid"          ;;
13079 esac
13080 echo "Checking the sign of $zzz..." >&4 
13081 cat > try.c <<EOCP
13082 #include <sys/types.h>
13083 #include <stdio.h>
13084 int main() {
13085         $gidtype foo = -1;
13086         if (foo < 0)
13087                 printf("-1\n");
13088         else
13089                 printf("1\n");
13090 }
13091 EOCP
13092 set try
13093 if eval $compile; then
13094         yyy=`./try`
13095         case "$yyy" in
13096         '')     gidsign=1
13097                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13098                 ;;
13099         *)      gidsign=$yyy
13100                 case "$gidsign" in
13101                  1) echo "Your $zzz is unsigned." ;;
13102                 -1) echo "Your $zzz is signed."   ;;
13103                 esac
13104                 ;;
13105         esac
13106 else
13107         gidsign=1
13108         echo "(I can't compile the test program--guessing unsigned.)" >&4
13109 fi
13110
13111
13112 echo " "
13113
13114 if $test X"$quadtype" != X; then
13115
13116 echo "Checking how to print 64-bit integers..." >&4
13117
13118 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13119         $cat >try.c <<'EOCP'
13120 #include <sys/types.h>
13121 #include <stdio.h>
13122 int main() {
13123   int q = 12345678901;
13124   printf("%ld\n", q);
13125 }
13126 EOCP
13127         set try
13128         if eval $compile; then
13129                 yyy=`./try$exe_ext`
13130                 case "$yyy" in
13131                 12345678901)
13132                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13133                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13134                         echo "We will use %d."
13135                         ;;
13136                 esac
13137         fi
13138 fi
13139
13140 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13141         $cat >try.c <<'EOCP'
13142 #include <sys/types.h>
13143 #include <stdio.h>
13144 int main() {
13145   long q = 12345678901;
13146   printf("%ld\n", q);
13147 }
13148 EOCP
13149         set try
13150         if eval $compile; then
13151                 yyy=`./try$exe_ext`
13152                 case "$yyy" in
13153                 12345678901)
13154                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13155                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13156                         echo "We will use %ld."
13157                         ;;
13158                 esac
13159         fi
13160 fi
13161
13162 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13163         $cat >try.c <<'EOCP'
13164 #include <sys/types.h>
13165 #include <inttypes.h>
13166 #include <stdio.h>
13167 int main() {
13168   int64_t q = 12345678901;
13169   printf("%" PRId64 "\n", q);
13170 }
13171 EOCP
13172         set try
13173         if eval $compile; then
13174                 yyy=`./try$exe_ext`
13175                 case "$yyy" in
13176                 12345678901)
13177                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13178                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13179                         echo "We will use the C9X style."
13180                         ;;
13181                 esac
13182         fi
13183 fi
13184
13185 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13186         $cat >try.c <<'EOCP'
13187 #include <sys/types.h>
13188 #include <stdio.h>
13189 int main() {
13190   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13191   printf("%lld\n", q);
13192 }
13193 EOCP
13194         set try
13195         if eval $compile; then
13196                 yyy=`./try$exe_ext`
13197                 case "$yyy" in
13198                 12345678901)
13199                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13200                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13201                         echo "We will use the %lld style."
13202                         ;;
13203                 esac
13204         fi
13205 fi
13206
13207 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13208         $cat >try.c <<EOCP
13209 #include <sys/types.h>
13210 #include <stdio.h>
13211 int main() {
13212   $quadtype q = 12345678901;
13213   printf("%Ld\n", q);
13214 }
13215 EOCP
13216         set try
13217         if eval $compile; then
13218                 yyy=`./try$exe_ext`
13219                 case "$yyy" in
13220                 12345678901)
13221                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13222                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13223                         echo "We will use %Ld."
13224                         ;;
13225                 esac
13226         fi
13227 fi
13228
13229 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13230         $cat >try.c <<EOCP
13231 #include <sys/types.h>
13232 #include <stdio.h>
13233 int main() {
13234   $quadtype q = 12345678901;
13235   printf("%qd\n", q);
13236 }
13237 EOCP
13238         set try
13239         if eval $compile; then
13240                 yyy=`./try$exe_ext`
13241                 case "$yyy" in
13242                 12345678901)
13243                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13244                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13245                         echo "We will use %qd."
13246                         ;;
13247                 esac
13248         fi
13249 fi
13250
13251 if $test X"$sPRId64" = X; then
13252         echo "Cannot figure out how to print 64-bit integers." >&4
13253 fi
13254
13255 $rm -f try try.*
13256
13257 fi
13258
13259 case "$sPRId64" in
13260 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13261         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13262         ;;
13263 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13264         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13265         ;;
13266 esac
13267
13268
13269 echo " "
13270 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13271
13272 if $test X"$ivsize" = X8; then
13273         ivdformat="$sPRId64"
13274         uvuformat="$sPRIu64"
13275         uvoformat="$sPRIo64"
13276         uvxformat="$sPRIx64"
13277         uvXUformat="$sPRIXU64"
13278 else
13279         if $test X"$ivsize" = X"$longsize"; then
13280                 ivdformat='"ld"'
13281                 uvuformat='"lu"'
13282                 uvoformat='"lo"'
13283                 uvxformat='"lx"'
13284                 uvXUformat='"lX"'
13285         else
13286                 if $test X"$ivsize" = X"$intsize"; then
13287                         ivdformat='"d"'
13288                         uvuformat='"u"'
13289                         uvoformat='"o"'
13290                         uvxformat='"x"'
13291                         uvXUformat='"X"'
13292                 else
13293                         : far out
13294                         if $test X"$ivsize" = X"$shortsize"; then
13295                                 ivdformat='"hd"'
13296                                 uvuformat='"hu"'
13297                                 uvoformat='"ho"'
13298                                 uvxformat='"hx"'
13299                                 uvXUformat='"hX"'
13300                         fi
13301                 fi
13302         fi
13303 fi
13304
13305 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13306         nveformat="$sPRIeldbl"
13307         nvfformat="$sPRIfldbl"
13308         nvgformat="$sPRIgldbl"
13309         nvEUformat="$sPRIEUldbl"
13310         nvFUformat="$sPRIFUldbl"
13311         nvGUformat="$sPRIGUldbl"
13312 else
13313         nveformat='"e"'
13314         nvfformat='"f"'
13315         nvgformat='"g"'
13316         nvEUformat='"E"'
13317         nvFUformat='"F"'
13318         nvGUformat='"G"'
13319 fi
13320
13321 case "$ivdformat" in
13322 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13323     exit 1
13324     ;;
13325 esac
13326
13327
13328 echo " "
13329 $echo "Checking the format string to be used for gids..." >&4
13330
13331 case "$gidsign" in
13332 -1)     if $test X"$gidsize" = X"$ivsize"; then
13333                 gidformat="$ivdformat"
13334         else
13335                 if $test X"$gidsize" = X"$longsize"; then
13336                         gidformat='"ld"'
13337                 else
13338                         if $test X"$gidsize" = X"$intsize"; then
13339                                 gidformat='"d"'
13340                         else
13341                                 if $test X"$gidsize" = X"$shortsize"; then
13342                                         gidformat='"hd"'
13343                                 fi
13344                         fi
13345                 fi
13346         fi
13347         ;;
13348 *)      if $test X"$gidsize" = X"$uvsize"; then
13349                 gidformat="$uvuformat"
13350         else
13351                 if $test X"$gidsize" = X"$longsize"; then
13352                         gidformat='"lu"'
13353                 else
13354                         if $test X"$gidsize" = X"$intsize"; then
13355                                 gidformat='"u"'
13356                         else
13357                                 if $test X"$gidsize" = X"$shortsize"; then
13358                                         gidformat='"hu"'
13359                                 fi
13360                         fi
13361                 fi
13362         fi
13363         ;;
13364 esac
13365
13366 : see if getgroups exists
13367 set getgroups d_getgrps
13368 eval $inlibc
13369
13370 : see if setgroups exists
13371 set setgroups d_setgrps
13372 eval $inlibc
13373
13374
13375 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13376 echo " "
13377 case "$d_getgrps$d_setgrps" in
13378 *define*)
13379         case "$groupstype" in
13380         '') dflt="$gidtype" ;;
13381         *)  dflt="$groupstype" ;;
13382         esac
13383         $cat <<EOM
13384 What type of pointer is the second argument to getgroups() and setgroups()?
13385 Usually this is the same as group ids, $gidtype, but not always.
13386
13387 EOM
13388         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13389         . ./myread
13390         groupstype="$ans"
13391         ;;
13392 *)  groupstype="$gidtype";;
13393 esac
13394
13395 echo " "
13396 echo "Checking if your $make program sets \$(MAKE)..." >&4
13397 case "$make_set_make" in
13398 '')
13399         $sed 's/^X //' > testmake.mak << 'EOF'
13400 Xall:
13401 X       @echo 'maketemp="$(MAKE)"'
13402 EOF
13403         case "`$make -f testmake.mak 2>/dev/null`" in
13404         *maketemp=*) make_set_make='#' ;;
13405         *)      make_set_make="MAKE=$make" ;;
13406         esac
13407         $rm -f testmake.mak
13408         ;;
13409 esac
13410 case "$make_set_make" in
13411 '#') echo "Yup, it does.";;
13412 *) echo "Nope, it doesn't.";;
13413 esac
13414
13415 : see what type is used for mode_t
13416 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13417 set mode_t modetype int stdio.h sys/types.h
13418 eval $typedef_ask
13419
13420 : define a fucntion to check prototypes
13421 $cat > protochk <<EOSH
13422 $startsh
13423 cc="$cc"
13424 optimize="$optimize"
13425 ccflags="$ccflags"
13426 prototype="$prototype"
13427 define="$define"
13428 rm=$rm
13429 EOSH
13430
13431 $cat >> protochk <<'EOSH'
13432
13433 $rm -f try.c
13434 foo="$1"
13435 shift
13436 while test $# -ge 2; do
13437         case "$1" in
13438                 $define) echo "#include <$2>" >> try.c ;;
13439                 literal) echo "$2" >> try.c ;;
13440         esac
13441     shift 2
13442 done
13443 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13444 cat >> try.c <<'EOCP'
13445 #ifdef CAN_PROTOTYPE
13446 #define _(args) args
13447 #else
13448 #define _(args) ()
13449 #endif
13450 EOCP
13451 echo "$foo" >> try.c
13452 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13453 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13454 status=$?
13455 $rm -f try.[co]
13456 exit $status
13457 EOSH
13458 chmod +x protochk
13459 $eunicefix protochk
13460
13461 : see what type is used for size_t
13462 rp="What is the type used for the length parameter for string functions?"
13463 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13464 eval $typedef_ask
13465
13466 : check for type of arguments to gethostbyaddr. 
13467 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13468         case "$d_gethbyaddr" in
13469         $define)
13470                 $cat <<EOM
13471
13472 Checking to see what type of arguments are accepted by gethostbyaddr().
13473 EOM
13474                 hdrs="$define sys/types.h
13475                         $d_socket sys/socket.h 
13476                         $i_niin netinet/in.h 
13477                         $i_netdb netdb.h
13478                         $i_unistd unistd.h"
13479                 : The first arg can 'char *' or 'void *'
13480                 : The second arg is some of integral type
13481                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13482                         for yyy in size_t long int; do
13483                                 case "$netdb_host_type" in
13484                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13485                                         if ./protochk "$try" $hdrs; then
13486                                                 echo "Your system accepts $xxx for the first arg."
13487                                                 echo "...and $yyy for the second arg."
13488                                                 netdb_host_type="$xxx"
13489                                                 netdb_hlen_type="$yyy"
13490                                         fi
13491                                         ;;
13492                                 esac
13493                         done
13494                 done
13495                 : In case none of those worked, prompt the user.
13496                 case "$netdb_host_type" in
13497                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13498                         dflt='char *'
13499                         . ./myread
13500                         netdb_host_type=$ans
13501                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13502                         dflt="$sizetype"
13503                         . ./myread
13504                         netdb_hlen_type=$ans
13505                         ;;
13506                 esac
13507                 ;;
13508         *)      : no gethostbyaddr, so pick harmless defaults
13509                 netdb_host_type='char *'
13510                 netdb_hlen_type="$sizetype"
13511                 ;;
13512         esac
13513         # Remove the "const" if needed. -- but then we'll have a 
13514         # prototype clash!
13515         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13516 fi
13517
13518 : check for type of argument to gethostbyname. 
13519 if test "X$netdb_name_type" = X ; then
13520         case "$d_gethbyname" in
13521         $define)
13522                 $cat <<EOM
13523
13524 Checking to see what type of argument is accepted by gethostbyname().
13525 EOM
13526                 hdrs="$define sys/types.h
13527                         $d_socket sys/socket.h 
13528                         $i_niin netinet/in.h 
13529                         $i_netdb netdb.h
13530                         $i_unistd unistd.h"
13531                 for xxx in "const char *" "char *"; do
13532                         case "$netdb_name_type" in
13533                         '')     try="extern struct hostent *gethostbyname($xxx);"
13534                                 if ./protochk "$try" $hdrs; then
13535                                         echo "Your system accepts $xxx."
13536                                         netdb_name_type="$xxx"
13537                                 fi
13538                                 ;;
13539                         esac
13540                 done
13541                 : In case none of those worked, prompt the user.
13542                 case "$netdb_name_type" in
13543                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13544                         dflt='char *'
13545                         . ./myread
13546                         netdb_name_type=$ans
13547                         ;;
13548                 esac
13549                 ;;
13550         *)      : no gethostbyname, so pick harmless default
13551                 netdb_name_type='char *'
13552                 ;;
13553         esac
13554 fi
13555
13556 : check for type of 1st argument to getnetbyaddr. 
13557 if test "X$netdb_net_type" = X ; then
13558         case "$d_getnbyaddr" in
13559         $define)
13560                 $cat <<EOM
13561
13562 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13563 EOM
13564                 hdrs="$define sys/types.h
13565                         $d_socket sys/socket.h 
13566                         $i_niin netinet/in.h 
13567                         $i_netdb netdb.h
13568                         $i_unistd unistd.h"
13569                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13570                         case "$netdb_net_type" in
13571                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13572                                 if ./protochk "$try" $hdrs; then
13573                                         echo "Your system accepts $xxx."
13574                                         netdb_net_type="$xxx"
13575                                 fi
13576                                 ;;
13577                         esac
13578                 done
13579                 : In case none of those worked, prompt the user.
13580                 case "$netdb_net_type" in
13581                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13582                         dflt='long'
13583                         . ./myread
13584                         netdb_net_type=$ans
13585                         ;;
13586                 esac
13587                 ;;
13588         *)      : no getnetbyaddr, so pick harmless default
13589                 netdb_net_type='long'
13590                 ;;
13591         esac
13592 fi
13593 : locate the preferred pager for this system
13594 case "$pager" in
13595 '')
13596         dflt=''
13597         case "$pg" in
13598         /*) dflt=$pg;;
13599         [a-zA-Z]:/*) dflt=$pg;;
13600         esac
13601         case "$more" in
13602         /*) dflt=$more;;
13603         [a-zA-Z]:/*) dflt=$more;;
13604         esac
13605         case "$less" in
13606         /*) dflt=$less;;
13607         [a-zA-Z]:/*) dflt=$less;;
13608         esac
13609         case "$dflt" in
13610         '') dflt=/usr/ucb/more;;
13611         esac
13612         ;;
13613 *) dflt="$pager";;
13614 esac
13615 echo " "
13616 fn=f/
13617 rp='What pager is used on your system?'
13618 . ./getfile
13619 pager="$ans"
13620
13621 : see what type pids are declared as in the kernel
13622 rp="What is the type of process ids on this system?"
13623 set pid_t pidtype int stdio.h sys/types.h
13624 eval $typedef_ask
13625
13626 : Find earliest binary compatible site_perl subdirectory perl can use.
13627 case "$bincompat5005" in
13628 "$define") xs_apiversion='5.005' ;;
13629 *) xs_apiversion=$version ;;   # The current site_perl version.
13630 esac
13631 : Find earliest pure perl site_perl subdirectory perl can use.
13632 : The versioned directories started at 5.005.
13633 pm_apiversion='5.005'
13634
13635 : check for length of pointer
13636 echo " "
13637 case "$ptrsize" in
13638 '')
13639         echo "Checking to see how big your pointers are..." >&4
13640         if test "$voidflags" -gt 7; then
13641                 echo '#define VOID_PTR char *' > try.c
13642         else
13643                 echo '#define VOID_PTR void *' > try.c
13644         fi
13645         $cat >>try.c <<'EOCP'
13646 #include <stdio.h>
13647 int main()
13648 {
13649     printf("%d\n", (int)sizeof(VOID_PTR));
13650     exit(0);
13651 }
13652 EOCP
13653         set try
13654         if eval $compile_ok; then
13655                 ptrsize=`./try`
13656                 echo "Your pointers are $ptrsize bytes long."
13657         else
13658                 dflt='4'
13659                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13660                 rp="What is the size of a pointer (in bytes)?"
13661                 . ./myread
13662                 ptrsize="$ans"
13663         fi
13664         ;;
13665 esac
13666 $rm -f try.c try
13667
13668 : see if ar generates random libraries by itself
13669 echo " "
13670 echo "Checking how to generate random libraries on your machine..." >&4
13671 echo 'int bar1() { return bar2(); }' > bar1.c
13672 echo 'int bar2() { return 2; }' > bar2.c
13673 $cat > foo.c <<'EOP'
13674 int main() { printf("%d\n", bar1()); exit(0); }
13675 EOP
13676 $cc $ccflags -c bar1.c >/dev/null 2>&1
13677 $cc $ccflags -c bar2.c >/dev/null 2>&1
13678 $cc $ccflags -c foo.c >/dev/null 2>&1
13679 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13680 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13681         ./foobar >/dev/null 2>&1; then
13682         echo "$ar appears to generate random libraries itself."
13683         orderlib=false
13684         ranlib=":"
13685 elif $ar ts bar$_a >/dev/null 2>&1 &&
13686         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13687         ./foobar >/dev/null 2>&1; then
13688                 echo "a table of contents needs to be added with '$ar ts'."
13689                 orderlib=false
13690                 ranlib="$ar ts"
13691 else
13692         case "$ranlib" in
13693         :) ranlib='';;
13694         '')
13695                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13696                 $test -f $ranlib || ranlib=''
13697                 ;;
13698         esac
13699         if $test -n "$ranlib"; then
13700                 echo "your system has '$ranlib'; we'll use that."
13701                 orderlib=false
13702         else
13703                 echo "your system doesn't seem to support random libraries"
13704                 echo "so we'll use lorder and tsort to order the libraries."
13705                 orderlib=true
13706                 ranlib=":"
13707         fi
13708 fi
13709 $rm -f foo* bar* 
13710
13711 : check for type of arguments to select. 
13712 case "$selecttype" in
13713 '') case "$d_select" in
13714         $define)
13715                 echo " "
13716                 $cat <<EOM
13717 Checking to see what type of arguments are accepted by select().
13718 EOM
13719                 hdrs="$define sys/types.h
13720                         $i_systime sys/time.h 
13721                         $i_sysselct sys/select.h
13722                         $d_socket sys/socket.h"
13723                 : The first arg can be int, unsigned, or size_t
13724                 : The last arg may or may not be 'const'
13725                 val=''
13726                 : void pointer has been seen but using that
13727                 : breaks the selectminbits test
13728                 for xxx in 'fd_set *' 'int *'; do
13729                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13730                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13731                                         case "$val" in
13732                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13733                                                 if ./protochk "$try" $hdrs; then
13734                                                         echo "Your system accepts $xxx."
13735                                                         val="$xxx"
13736                                                 fi
13737                                                 ;;
13738                                         esac
13739                                 done
13740                         done
13741                 done
13742                 case "$val" in
13743                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13744                         case "$d_fd_set" in
13745                                 $define) dflt="fd_set *" ;;
13746                                 *)              dflt="int *" ;;
13747                         esac
13748                         . ./myread
13749                         val=$ans
13750                         ;;
13751                 esac
13752                 selecttype="$val"
13753                 ;;
13754         *)      : no select, so pick a harmless default
13755                 selecttype='int *'
13756                 ;;
13757         esac
13758         ;;
13759 esac
13760
13761 : check for the select 'width'
13762 case "$selectminbits" in
13763 '') case "$d_select" in
13764         $define)
13765                 $cat <<EOM
13766
13767 Checking to see on how many bits at a time your select() operates...
13768 EOM
13769                 $cat >try.c <<EOCP
13770 #include <sys/types.h>
13771 #$i_time I_TIME
13772 #$i_systime I_SYS_TIME
13773 #$i_systimek I_SYS_TIME_KERNEL
13774 #ifdef I_TIME
13775 #   include <time.h>
13776 #endif
13777 #ifdef I_SYS_TIME
13778 #   ifdef I_SYS_TIME_KERNEL
13779 #       define KERNEL
13780 #   endif
13781 #   include <sys/time.h>
13782 #   ifdef I_SYS_TIME_KERNEL
13783 #       undef KERNEL
13784 #   endif
13785 #endif
13786 #$i_sysselct I_SYS_SELECT
13787 #ifdef I_SYS_SELECT
13788 #include <sys/select.h>
13789 #endif
13790 #$d_socket HAS_SOCKET
13791 #ifdef HAS_SOCKET
13792 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13793 #endif
13794 #include <stdio.h>
13795 $selecttype b;
13796 #define S sizeof(*(b))
13797 #define MINBITS 64
13798 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13799 #define NBITS  (NBYTES * 8)
13800 int main() {
13801     char s[NBYTES];
13802     struct timeval t;
13803     int i;
13804     FILE* fp;
13805     int fd;
13806
13807     fclose(stdin);
13808     fp = fopen("try.c", "r");
13809     if (fp == 0)
13810       exit(1);
13811     fd = fileno(fp);
13812     if (fd < 0)
13813       exit(2);
13814     b = ($selecttype)s;
13815     for (i = 0; i < NBITS; i++)
13816         FD_SET(i, b);
13817     t.tv_sec  = 0;
13818     t.tv_usec = 0;
13819     select(fd + 1, b, 0, 0, &t);
13820     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13821     printf("%d\n", i + 1);
13822     return 0;
13823 }
13824 EOCP
13825                 set try
13826                 if eval $compile_ok; then
13827                         selectminbits=`./try`
13828                         case "$selectminbits" in
13829                         '')     cat >&4 <<EOM
13830 Cannot figure out on how many bits at a time your select() operates.
13831 I'll play safe and guess it is 32 bits.
13832 EOM
13833                                 selectminbits=32
13834                                 bits="32 bits"
13835                                 ;;
13836                         1)      bits="1 bit" ;;
13837                         *)      bits="$selectminbits bits" ;;
13838                         esac
13839                         echo "Your select() operates on $bits at a time." >&4
13840                 else
13841                         rp='What is the minimum number of bits your select() operates on?'
13842                         case "$byteorder" in
13843                         1234|12345678)  dflt=32 ;;
13844                         *)              dflt=1  ;;
13845                         esac
13846                         . ./myread
13847                         val=$ans
13848                         selectminbits="$val"
13849                 fi
13850                 $rm -f try.* try
13851                 ;;
13852         *)      : no select, so pick a harmless default
13853                 selectminbits='32'
13854                 ;;
13855         esac
13856         ;;
13857 esac
13858
13859 : Trace out the files included by signal.h, then look for SIGxxx names.
13860 : Remove SIGARRAYSIZE used by HPUX.
13861 : Remove SIGSTKSIZE used by Linux.
13862 : Remove SIGSTKSZ used by Posix.
13863 : Remove SIGTYP void lines used by OS2.
13864 : Some cpps, like os390, dont give the file name anywhere
13865 if [ "X$fieldn" = X ]; then
13866         : Just make some guesses.  We check them later.
13867         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13868 else
13869         xxx=`echo '#include <signal.h>' |
13870         $cppstdin $cppminus $cppflags 2>/dev/null |
13871         $grep '^[       ]*#.*include' | 
13872         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13873 fi
13874 : Check this list of files to be sure we have parsed the cpp output ok.
13875 : This will also avoid potentially non-existent files, such 
13876 : as ../foo/bar.h
13877 xxxfiles=''
13878 for xx in $xxx /dev/null ; do
13879         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13880 done
13881 : If we have found no files, at least try signal.h
13882 case "$xxxfiles" in
13883 '')     xxxfiles=`./findhdr signal.h` ;;
13884 esac
13885 xxx=`awk '
13886 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13887         print substr($2, 4, 20)
13888 }
13889 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13890         print substr($3, 4, 20)
13891 }' $xxxfiles`
13892 : Append some common names just in case the awk scan failed.
13893 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13894 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13895 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13896 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13897 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13898
13899 : generate a few handy files for later
13900 $cat > signal.c <<'EOCP'
13901 #include <sys/types.h>
13902 #include <signal.h>
13903 #include <stdio.h>
13904 int main() {
13905
13906 /* Strange style to avoid deeply-nested #if/#else/#endif */
13907 #ifndef NSIG
13908 #  ifdef _NSIG
13909 #    define NSIG (_NSIG)
13910 #  endif
13911 #endif
13912
13913 #ifndef NSIG
13914 #  ifdef SIGMAX
13915 #    define NSIG (SIGMAX+1)
13916 #  endif
13917 #endif
13918
13919 #ifndef NSIG
13920 #  ifdef SIG_MAX
13921 #    define NSIG (SIG_MAX+1)
13922 #  endif
13923 #endif
13924
13925 #ifndef NSIG
13926 #  ifdef MAXSIG
13927 #    define NSIG (MAXSIG+1)
13928 #  endif
13929 #endif
13930
13931 #ifndef NSIG
13932 #  ifdef MAX_SIG
13933 #    define NSIG (MAX_SIG+1)
13934 #  endif
13935 #endif
13936
13937 #ifndef NSIG
13938 #  ifdef SIGARRAYSIZE
13939 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13940 #  endif
13941 #endif
13942
13943 #ifndef NSIG
13944 #  ifdef _sys_nsig
13945 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13946 #  endif
13947 #endif
13948
13949 /* Default to some arbitrary number that's big enough to get most
13950    of the common signals.
13951 */
13952 #ifndef NSIG
13953 #    define NSIG 50
13954 #endif
13955
13956 printf("NSIG %d\n", NSIG);
13957
13958 #ifndef JUST_NSIG
13959
13960 EOCP
13961
13962 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13963 {
13964         printf "#ifdef SIG"; printf $1; printf "\n"
13965         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13966         printf $1; printf ");\n"
13967         printf "#endif\n"
13968 }
13969 END {
13970         printf "#endif /* JUST_NSIG */\n";
13971         printf "exit(0);\n}\n";
13972 }
13973 ' >>signal.c
13974 $cat >signal.awk <<'EOP'
13975 BEGIN { ndups = 0 }
13976 $1 ~ /^NSIG$/ { nsig = $2 }
13977 ($1 !~ /^NSIG$/) && (NF == 2) {
13978     if ($2 > maxsig) { maxsig = $2 }
13979     if (sig_name[$2]) {
13980         dup_name[ndups] = $1
13981         dup_num[ndups] = $2
13982         ndups++ 
13983     }
13984     else {
13985         sig_name[$2] = $1
13986         sig_num[$2] = $2
13987     }
13988 }
13989 END { 
13990     if (nsig == 0) {
13991         nsig = maxsig + 1
13992     }
13993     printf("NSIG %d\n", nsig);
13994     for (n = 1; n < nsig; n++) {
13995         if (sig_name[n]) {
13996             printf("%s %d\n", sig_name[n], sig_num[n])
13997         }
13998         else {
13999             printf("NUM%d %d\n", n, n) 
14000         }
14001     }
14002     for (n = 0; n < ndups; n++) {
14003         printf("%s %d\n", dup_name[n], dup_num[n])
14004     }
14005 }
14006 EOP
14007 $cat >signal_cmd <<EOS
14008 $startsh
14009 if $test -s signal.lst; then
14010     echo "Using your existing signal.lst file"
14011         exit 0
14012 fi
14013 xxx="$xxx"
14014 EOS
14015 $cat >>signal_cmd <<'EOS'
14016
14017 set signal
14018 if eval $compile_ok; then
14019         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14020 else
14021         echo "(I can't seem be able to compile the whole test program)" >&4
14022         echo "(I'll try it in little pieces.)" >&4
14023         set signal -DJUST_NSIG
14024         if eval $compile_ok; then
14025                 ./signal$_exe > signal.nsg
14026                 $cat signal.nsg
14027         else
14028                 echo "I can't seem to figure out how many signals you have." >&4
14029                 echo "Guessing 50." >&4
14030                 echo 'NSIG 50' > signal.nsg
14031         fi
14032         : Now look at all the signal names, one at a time.
14033         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14034                 $cat > signal.c <<EOCP
14035 #include <sys/types.h>
14036 #include <signal.h>
14037 #include <stdio.h>
14038 int main() {
14039 printf("$xx %d\n", SIG${xx});
14040 return 0;
14041 }
14042 EOCP
14043                 set signal
14044                 if eval $compile; then
14045                         echo "SIG${xx} found."
14046                         ./signal$_exe  >> signal.ls1
14047                 else
14048                         echo "SIG${xx} NOT found."
14049                 fi
14050         done
14051         if $test -s signal.ls1; then
14052                 $cat signal.nsg signal.ls1 |
14053                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14054         fi
14055
14056 fi
14057 if $test -s signal.lst; then
14058         :
14059 else
14060         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14061         echo 'kill -l' >signal
14062         set X `csh -f <signal`
14063         $rm -f signal
14064         shift
14065         case $# in
14066         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14067         esac
14068         echo $@ | $tr ' ' $trnl | \
14069             $awk '{ printf "%s %d\n", $1, ++s; }
14070                   END { printf "NSIG %d\n", ++s }' >signal.lst
14071 fi
14072 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14073 EOS
14074 chmod a+x signal_cmd
14075 $eunicefix signal_cmd
14076
14077 : generate list of signal names
14078 echo " "
14079 case "$sig_name_init" in
14080 '') doinit=yes ;;
14081 *)  case "$sig_num_init" in
14082     ''|*,*) doinit=yes ;;
14083     esac ;;
14084 esac
14085 case "$doinit" in
14086 yes)
14087         echo "Generating a list of signal names and numbers..." >&4
14088         . ./signal_cmd
14089         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14090         sig_name=`$awk 'BEGIN { printf "ZERO " }
14091                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14092         sig_num=`$awk  'BEGIN { printf "0 " }
14093                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14094         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14095                              !/^NSIG/   { printf "\"%s\", ", $1 }
14096                              END        { printf "0\n" }' signal.lst`
14097         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14098                              !/^NSIG/   { printf "%d, ", $2}
14099                              END        { printf "0\n"}' signal.lst`
14100         ;;
14101 esac
14102 echo "The following $sig_count signals are available:"
14103 echo " "
14104 echo $sig_name | $awk \
14105 'BEGIN { linelen = 0 }
14106 {
14107         for (i = 1; i <= NF; i++) {
14108                 name = "SIG" $i " "
14109                 linelen = linelen + length(name)
14110                 if (linelen > 70) {
14111                         printf "\n"
14112                         linelen = length(name)
14113                 }
14114                 printf "%s", name
14115         }
14116         printf "\n"
14117 }'
14118 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14119
14120 echo " "
14121 case "$sizetype" in
14122 *_t) zzz="$sizetype"    ;;
14123 *)   zzz="filesize"     ;;
14124 esac
14125 echo "Checking the size of $zzz..." >&4 
14126 cat > try.c <<EOCP
14127 #include <sys/types.h>
14128 #include <stdio.h>
14129 int main() {
14130     printf("%d\n", (int)sizeof($sizetype));
14131     exit(0);
14132 }
14133 EOCP
14134 set try
14135 if eval $compile_ok; then
14136         yyy=`./try`
14137         case "$yyy" in
14138         '')     sizesize=4
14139                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14140                 ;;
14141         *)      sizesize=$yyy
14142                 echo "Your $zzz size is $sizesize bytes."
14143                 ;;
14144         esac
14145 else
14146         sizesize=4
14147         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14148 fi
14149
14150
14151 : check for socklen_t
14152 echo " "
14153 echo "Checking to see if you have socklen_t..." >&4
14154 $cat >try.c <<EOCP
14155 #include <sys/types.h>
14156 #$d_socket HAS_SOCKET
14157 #ifdef HAS_SOCKET
14158 #include <sys/socket.h>
14159 #endif
14160 int main() { socklen_t x = 16; }
14161 EOCP
14162 set try
14163 if eval $compile; then
14164         val="$define"
14165         echo "You have socklen_t."
14166 else
14167         val="$undef"
14168         echo "You do not have socklen_t."
14169         case "$sizetype" in
14170         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14171         esac
14172 fi
14173 $rm -f try try.*
14174 set d_socklen_t
14175 eval $setvar
14176
14177 : check for type of the size argument to socket calls
14178 case "$d_socket" in
14179 "$define")
14180         $cat <<EOM
14181
14182 Checking to see what type is the last argument of accept().
14183 EOM
14184         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14185         yyy=''
14186         case "$d_socklen_t" in
14187         "$define") yyy="$yyy socklen_t"
14188         esac
14189         yyy="$yyy $sizetype int long unsigned"
14190         for xxx in $yyy; do
14191                 case "$socksizetype" in
14192                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14193                         if ./protochk "$try" $hdrs; then
14194                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14195                                 socksizetype="$xxx"
14196                         fi
14197                         ;;
14198                 esac
14199         done
14200 : In case none of those worked, prompt the user.
14201         case "$socksizetype" in
14202         '')     rp='What is the type for socket address structure sizes?'
14203                 dflt='int'
14204                 . ./myread
14205                 socksizetype=$ans
14206                 ;;
14207         esac
14208         ;;
14209 *)      : no sockets, so pick relatively harmless default
14210         socksizetype='int'
14211         ;;
14212 esac
14213
14214 : see what type is used for signed size_t
14215 set ssize_t ssizetype int stdio.h sys/types.h
14216 eval $typedef
14217 dflt="$ssizetype"
14218 $cat > ssize.c <<EOM
14219 #include <stdio.h>
14220 #include <sys/types.h>
14221 #define Size_t $sizetype
14222 #define SSize_t $dflt
14223 int main()
14224 {
14225         if (sizeof(Size_t) == sizeof(SSize_t))
14226                 printf("$dflt\n");
14227         else if (sizeof(Size_t) == sizeof(int))
14228                 printf("int\n");
14229         else 
14230                 printf("long\n");
14231         exit(0);
14232 }
14233 EOM
14234 echo " "
14235 set ssize
14236 if eval $compile_ok && ./ssize > /dev/null; then
14237         ssizetype=`./ssize`
14238         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14239 else
14240         $cat >&4 <<EOM
14241 Help! I can't compile and run the ssize_t test program: please enlighten me!
14242 (This is probably a misconfiguration in your system or libraries, and
14243 you really ought to fix it.  Still, I'll try anyway.)
14244
14245 I need a type that is the same size as $sizetype, but is guaranteed to
14246 be signed.  Common values are ssize_t, int and long.
14247
14248 EOM
14249         rp="What signed type is the same size as $sizetype?"
14250         . ./myread
14251         ssizetype="$ans"
14252 fi
14253 $rm -f ssize ssize.*
14254
14255 : see what type of char stdio uses.
14256 echo " "
14257 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14258         echo "Your stdio uses unsigned chars." >&4
14259         stdchar="unsigned char"
14260 else
14261         echo "Your stdio uses signed chars." >&4
14262         stdchar="char"
14263 fi
14264
14265 : see if time exists
14266 echo " "
14267 if test "X$d_time" = X -o X"$timetype" = X; then
14268     if set time val -f d_time; eval $csym; $val; then
14269                 echo 'time() found.' >&4
14270                 val="$define"
14271                 rp="What is the type returned by time() on this system?"
14272                 set time_t timetype long stdio.h sys/types.h
14273                 eval $typedef_ask
14274     else
14275                 echo 'time() not found, hope that will do.' >&4
14276                 val="$undef"
14277                 timetype='int';
14278     fi
14279     set d_time
14280     eval $setvar
14281 fi
14282
14283 : see what type uids are declared as in the kernel
14284 echo " "
14285 echo "Looking for the type for user ids returned by getuid()."
14286 set uid_t uidtype xxx stdio.h sys/types.h
14287 eval $typedef
14288 case "$uidtype" in
14289 xxx)
14290         xxx=`./findhdr sys/user.h`
14291         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14292         case $1 in
14293         unsigned) dflt="$1 $2" ;;
14294         *) dflt="$1" ;;
14295         esac
14296         ;;
14297 *) dflt="$uidtype";;
14298 esac
14299 case "$uidtype" in
14300 uid_t)  echo "uid_t found." ;;
14301 *)      rp="What is the type for user ids returned by getuid()?"
14302         . ./myread
14303         uidtype="$ans"
14304         ;;
14305 esac
14306
14307 echo " "
14308 case "$uidtype" in
14309 *_t) zzz="$uidtype"     ;;
14310 *)   zzz="uid"          ;;
14311 esac
14312 echo "Checking the size of $zzz..." >&4 
14313 cat > try.c <<EOCP
14314 #include <sys/types.h>
14315 #include <stdio.h>
14316 int main() {
14317     printf("%d\n", (int)sizeof($uidtype));
14318     exit(0);
14319 }
14320 EOCP
14321 set try
14322 if eval $compile_ok; then
14323         yyy=`./try`
14324         case "$yyy" in
14325         '')     uidsize=4
14326                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14327                 ;;
14328         *)      uidsize=$yyy
14329                 echo "Your $zzz is $uidsize bytes long."
14330                 ;;
14331         esac
14332 else
14333         uidsize=4
14334         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14335 fi
14336
14337 echo " "
14338 case "$uidtype" in
14339 *_t) zzz="$uidtype"     ;;
14340 *)   zzz="uid"          ;;
14341 esac
14342 echo "Checking the sign of $zzz..." >&4
14343 cat > try.c <<EOCP
14344 #include <sys/types.h>
14345 #include <stdio.h>
14346 int main() {
14347         $uidtype foo = -1;
14348         if (foo < 0)
14349                 printf("-1\n");
14350         else
14351                 printf("1\n");
14352 }
14353 EOCP
14354 set try
14355 if eval $compile; then
14356         yyy=`./try`
14357         case "$yyy" in
14358         '')     uidsign=1
14359                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14360                 ;;
14361         *)      uidsign=$yyy
14362                 case "$uidsign" in
14363                  1) echo "Your $zzz is unsigned." ;;
14364                 -1) echo "Your $zzz is signed."   ;;
14365                 esac
14366                 ;;
14367         esac
14368 else
14369         uidsign=1
14370         echo "(I can't compile the test program--guessing unsigned.)" >&4
14371 fi
14372
14373
14374
14375 echo " "
14376 $echo "Checking the format string to be used for uids..." >&4
14377
14378 case "$uidsign" in
14379 -1)     if $test X"$uidsize" = X"$ivsize"; then
14380                 uidformat="$ivdformat"
14381         else
14382                 if $test X"$uidsize" = X"$longsize"; then
14383                         uidformat='"ld"'
14384                 else
14385                         if $test X"$uidsize" = X"$intsize"; then
14386                                 uidformat='"d"'
14387                         else
14388                                 if $test X"$uidsize" = X"$shortsize"; then
14389                                         uidformat='"hd"'
14390                                 fi
14391                         fi
14392                 fi
14393         fi
14394         ;;
14395 *)      if $test X"$uidsize" = X"$uvsize"; then
14396                 uidformat="$uvuformat"
14397         else
14398                 if $test X"$uidsize" = X"$longsize"; then
14399                         uidformat='"lu"'
14400                 else
14401                         if $test X"$uidsize" = X"$intsize"; then
14402                                 uidformat='"u"'
14403                         else
14404                                 if $test X"$uidsize" = X"$shortsize"; then
14405                                         uidformat='"hu"'
14406                                 fi
14407                         fi
14408                 fi
14409         fi
14410         ;;
14411 esac
14412
14413 : see if dbm.h is available
14414 : see if dbmclose exists
14415 set dbmclose d_dbmclose
14416 eval $inlibc
14417
14418 case "$d_dbmclose" in
14419 $define)
14420         set dbm.h i_dbm
14421         eval $inhdr
14422         case "$i_dbm" in
14423         $define)
14424                 val="$undef"
14425                 set i_rpcsvcdbm
14426                 eval $setvar
14427                 ;;
14428         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14429                 eval $inhdr
14430                 ;;
14431         esac
14432         ;;
14433 *)      echo "We won't be including <dbm.h>"
14434         val="$undef"
14435         set i_dbm
14436         eval $setvar
14437         val="$undef"
14438         set i_rpcsvcdbm
14439         eval $setvar
14440         ;;
14441 esac
14442
14443 : see if this is a sys/file.h system
14444 val=''
14445 set sys/file.h val
14446 eval $inhdr
14447
14448 : do we need to include sys/file.h ?
14449 case "$val" in
14450 "$define")
14451         echo " "
14452         if $h_sysfile; then
14453                 val="$define"
14454                 echo "We'll be including <sys/file.h>." >&4
14455         else
14456                 val="$undef"
14457                 echo "We won't be including <sys/file.h>." >&4
14458         fi
14459         ;;
14460 *)
14461         h_sysfile=false
14462         ;;
14463 esac
14464 set i_sysfile
14465 eval $setvar
14466
14467 : see if fcntl.h is there
14468 val=''
14469 set fcntl.h val
14470 eval $inhdr
14471
14472 : see if we can include fcntl.h
14473 case "$val" in
14474 "$define")
14475         echo " "
14476         if $h_fcntl; then
14477                 val="$define"
14478                 echo "We'll be including <fcntl.h>." >&4
14479         else
14480                 val="$undef"
14481                 if $h_sysfile; then
14482         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14483                 else
14484                         echo "We won't be including <fcntl.h>." >&4
14485                 fi
14486         fi
14487         ;;
14488 *)
14489         h_fcntl=false
14490         val="$undef"
14491         ;;
14492 esac
14493 set i_fcntl
14494 eval $setvar
14495
14496 : see if this is a iconv.h system
14497 set iconv.h i_iconv
14498 eval $inhdr
14499
14500 : see if this is a ieeefp.h system
14501 set ieeefp.h i_ieeefp
14502 eval $inhdr
14503
14504 : see if this is a libutil.h system
14505 set libutil.h i_libutil
14506 eval $inhdr
14507
14508 : see if locale.h is available
14509 set locale.h i_locale
14510 eval $inhdr
14511
14512 : see if mach cthreads are available
14513 if test "X$usethreads" = "X$define"; then
14514         set mach/cthreads.h i_machcthr
14515         eval $inhdr
14516 else
14517         i_machcthr="$undef"
14518 fi
14519
14520
14521
14522 : see if this is a math.h system
14523 set math.h i_math
14524 eval $inhdr
14525
14526 : see if this is a mntent.h system
14527 set mntent.h i_mntent
14528 eval $inhdr
14529
14530 : see if ndbm.h is available
14531 set ndbm.h t_ndbm
14532 eval $inhdr
14533 case "$t_ndbm" in
14534 $define)
14535         : see if dbm_open exists
14536         set dbm_open d_dbm_open
14537         eval $inlibc
14538         case "$d_dbm_open" in
14539         $undef)
14540                 t_ndbm="$undef"
14541                 echo "We won't be including <ndbm.h>"
14542                 ;;
14543         esac
14544         ;;
14545 esac
14546 val="$t_ndbm"
14547 set i_ndbm
14548 eval $setvar
14549
14550 : see if net/errno.h is available
14551 val=''
14552 set net/errno.h val
14553 eval $inhdr
14554
14555 : Unfortunately, it causes problems on some systems.  Arrgh.
14556 case "$val" in
14557 $define)
14558         cat > try.c <<'EOM'
14559 #include <stdio.h>
14560 #include <errno.h>
14561 #include <net/errno.h>
14562 int func()
14563 {
14564         return ENOTSOCK;
14565 }
14566 EOM
14567         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14568                 echo "We'll be including <net/errno.h>." >&4
14569         else
14570                 echo "We won't be including <net/errno.h>." >&4
14571                 val="$undef"
14572         fi
14573         $rm -f try.* try
14574         ;;
14575 esac
14576 set i_neterrno
14577 eval $setvar
14578
14579 : see if netinet/tcp.h is available
14580 set netinet/tcp.h i_netinettcp
14581 eval $inhdr
14582
14583 : see if this is a poll.h system
14584 set poll.h i_poll
14585 eval $inhdr
14586
14587 : see if this is a prot.h system
14588 set prot.h i_prot
14589 eval $inhdr
14590
14591 echo " "
14592 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14593 $cat <<'EOSH' > Cppsym.know
14594 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14595 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14596 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14597 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14598 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14599 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14600 bull c cadmus clipper CMU COFF COMPILER_VERSION
14601 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14602 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14603 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14604 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14605 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14606 H3050R H3050RX hbullx20 hcx host_mips
14607 hp200 hp300 hp700 HP700 hp800 hp9000
14608 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14609 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14610 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14611 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14612 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14613 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14614 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14615 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14616 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14617 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14618 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14619 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14620 MATH_HAS_NO_SIDE_EFFECTS
14621 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14622 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14623 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14624 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14625 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14626 NetBSD news1500 news1700 news1800 news1900 news3700
14627 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
14628 ns32016 ns32332 ns32k nsc32000
14629 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14630 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14631 pc532 pdp11 PGC PIC plexus PORTAR posix
14632 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14633 POSIX_C_SOURCE POSIX_SOURCE POWER
14634 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14635 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14636 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14637 sony sony_news sonyrisc sparc sparclite spectrum
14638 stardent stdc STDC_EXT stratos sun sun3 sun386
14639 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14640 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14641 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14642 sysV68 sysV88 Tek4132 Tek4300 titan
14643 tower tower32 tower32_200 tower32_600 tower32_700
14644 tower32_800 tower32_850 tss
14645 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14646 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14647 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14648 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14649 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14650 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14651 z8000
14652 EOSH
14653 # Maybe put other stuff here too.
14654 cat <<EOSH >>Cppsym.know
14655 $osname
14656 EOSH
14657 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14658 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14659 $cat Cppsym.know > Cppsym.c
14660 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
14661 $rm -f Cppsym.a Cppsym.b Cppsym.c
14662 cat <<EOSH > Cppsym
14663 $startsh
14664 if $test \$# -gt 0; then
14665     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14666     if $test -s Cppsym.got; then
14667         $rm -f Cppsym.got
14668         exit 0
14669     fi
14670     $rm -f Cppsym.got
14671     exit 1
14672 else
14673     $tr " " "$trnl" | ./Cppsym.try
14674     exit 0
14675 fi
14676 EOSH
14677 chmod +x Cppsym
14678 $eunicefix Cppsym
14679 cat <<EOSH > Cppsym.try
14680 $startsh
14681 cat <<'EOCP' > try.c
14682 #include <stdio.h>
14683 int main() {
14684 EOCP
14685 $awk \\
14686 EOSH
14687 cat <<'EOSH' >> Cppsym.try
14688 'length($1) > 0 {
14689     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
14690     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
14691     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
14692     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
14693 }'       >> try.c
14694 echo '}' >> try.c
14695 EOSH
14696 cat <<EOSH >> Cppsym.try
14697 ccflags="$ccflags"
14698 case "$osname-$gccversion" in
14699 irix-) ccflags="\$ccflags -woff 1178" ;;
14700 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14701 esac
14702 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
14703 EOSH
14704 chmod +x Cppsym.try
14705 $eunicefix Cppsym.try
14706 ./Cppsym < Cppsym.know > Cppsym.true
14707 : now check the C compiler for additional symbols
14708 postprocess_cc_v=''
14709 case "$osname" in
14710 aix) postprocess_cc_v="|$tr , ' '" ;;
14711 esac
14712 $cat >ccsym <<EOS
14713 $startsh
14714 $cat >tmp.c <<EOF
14715 extern int foo;
14716 EOF
14717 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14718 do
14719         case "\$i" in
14720         -D*) echo "\$i" | $sed 's/^-D//';;
14721         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14722         esac
14723 done
14724 $rm -f try.c
14725 EOS
14726 postprocess_cc_v=''
14727 chmod +x ccsym
14728 $eunicefix ccsym
14729 ./ccsym > ccsym1.raw
14730 if $test -s ccsym1.raw; then
14731        $sort ccsym1.raw | $uniq >ccsym.raw
14732 else
14733        mv ccsym1.raw ccsym.raw
14734 fi
14735
14736 $awk '/\=/ { print $0; next }
14737         { print $0"=1" }' ccsym.raw >ccsym.list
14738 $awk '/\=/ { print $0; next }
14739         { print $0"=1" }' Cppsym.true >ccsym.true
14740 $comm -13 ccsym.true ccsym.list >ccsym.own
14741 $comm -12 ccsym.true ccsym.list >ccsym.com
14742 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14743 also=''
14744 if $test -z ccsym.raw; then
14745         echo "Your C compiler doesn't seem to define any symbols!" >&4
14746         echo " "
14747         echo "However, your C preprocessor defines the following symbols:"
14748         $cat Cppsym.true
14749         ccsymbols=''
14750         cppsymbols=`$cat Cppsym.true`
14751         cppsymbols=`echo $cppsymbols`
14752         cppccsymbols="$cppsymbols"
14753 else
14754         if $test -s ccsym.com; then
14755                 echo "Your C compiler and pre-processor define these symbols:"
14756                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14757                 also='also '
14758                 symbols='ones'
14759                 cppccsymbols=`$cat ccsym.com`
14760                 cppccsymbols=`echo $cppccsymbols`
14761                 $test "$silent" || sleep 1
14762         fi
14763         if $test -s ccsym.cpp; then
14764                 $test "$also" && echo " "
14765                 echo "Your C pre-processor ${also}defines the following symbols:"
14766                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14767                 also='further '
14768                 cppsymbols=`$cat ccsym.cpp`
14769                 cppsymbols=`echo $cppsymbols`
14770                 $test "$silent" || sleep 1
14771         fi
14772         if $test -s ccsym.own; then
14773                 $test "$also" && echo " "
14774                 echo "Your C compiler ${also}defines the following cpp symbols:"
14775                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14776                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14777                 ccsymbols=`$cat ccsym.own`
14778                 ccsymbols=`echo $ccsymbols`
14779                 $test "$silent" || sleep 1
14780         fi
14781 fi
14782 $rm -f ccsym* Cppsym.*
14783
14784 : see if this is a termio system
14785 val="$undef"
14786 val2="$undef"
14787 val3="$undef"
14788 if $test `./findhdr termios.h`; then
14789         set tcsetattr i_termios
14790         eval $inlibc
14791         val3="$i_termios"
14792 fi
14793 echo " "
14794 case "$val3" in
14795 "$define") echo "You have POSIX termios.h... good!" >&4;;
14796 *) if ./Cppsym pyr; then
14797                 case "`/bin/universe`" in
14798                 ucb) if $test `./findhdr sgtty.h`; then
14799                                 val2="$define"
14800                                 echo "<sgtty.h> found." >&4
14801                         else
14802                                 echo "System is pyramid with BSD universe."
14803                                 echo "<sgtty.h> not found--you could have problems." >&4
14804                         fi;;
14805                 *) if $test `./findhdr termio.h`; then
14806                                 val="$define"
14807                                 echo "<termio.h> found." >&4
14808                         else
14809                                 echo "System is pyramid with USG universe."
14810                                 echo "<termio.h> not found--you could have problems." >&4
14811                         fi;;
14812                 esac
14813         elif ./usg; then
14814                 if $test `./findhdr termio.h`; then
14815                         echo "<termio.h> found." >&4
14816                         val="$define"
14817                 elif $test `./findhdr sgtty.h`; then
14818                         echo "<sgtty.h> found." >&4
14819                         val2="$define"
14820                 else
14821 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14822                 fi
14823         else
14824                 if $test `./findhdr sgtty.h`; then
14825                         echo "<sgtty.h> found." >&4
14826                         val2="$define"
14827                 elif $test `./findhdr termio.h`; then
14828                         echo "<termio.h> found." >&4
14829                         val="$define"
14830                 else
14831 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14832                 fi
14833         fi;;
14834 esac
14835 set i_termio; eval $setvar
14836 val=$val2; set i_sgtty; eval $setvar
14837 val=$val3; set i_termios; eval $setvar
14838
14839 : see if this is a shadow.h system
14840 set shadow.h i_shadow
14841 eval $inhdr
14842
14843 : see if this is a socks.h system
14844 set socks.h i_socks
14845 eval $inhdr
14846
14847 : see if stdarg is available
14848 echo " "
14849 if $test `./findhdr stdarg.h`; then
14850         echo "<stdarg.h> found." >&4
14851         valstd="$define"
14852 else
14853         echo "<stdarg.h> NOT found." >&4
14854         valstd="$undef"
14855 fi
14856
14857 : see if varags is available
14858 echo " "
14859 if $test `./findhdr varargs.h`; then
14860         echo "<varargs.h> found." >&4
14861 else
14862         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14863 fi
14864
14865 : set up the varargs testing programs
14866 $cat > varargs.c <<EOP
14867 #ifdef I_STDARG
14868 #include <stdarg.h>
14869 #endif
14870 #ifdef I_VARARGS
14871 #include <varargs.h>
14872 #endif
14873
14874 #ifdef I_STDARG
14875 int f(char *p, ...)
14876 #else
14877 int f(va_alist)
14878 va_dcl
14879 #endif
14880 {
14881         va_list ap;
14882 #ifndef I_STDARG
14883         char *p;
14884 #endif
14885 #ifdef I_STDARG
14886         va_start(ap,p);
14887 #else
14888         va_start(ap);
14889         p = va_arg(ap, char *);
14890 #endif
14891         va_end(ap);
14892 }
14893 EOP
14894 $cat > varargs <<EOP
14895 $startsh
14896 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14897         echo "true"
14898 else
14899         echo "false"
14900 fi
14901 $rm -f varargs$_o
14902 EOP
14903 chmod +x varargs
14904
14905 : now check which varargs header should be included
14906 echo " "
14907 i_varhdr=''
14908 case "$valstd" in
14909 "$define")
14910         if `./varargs I_STDARG`; then
14911                 val='stdarg.h'
14912         elif `./varargs I_VARARGS`; then
14913                 val='varargs.h'
14914         fi
14915         ;;
14916 *)
14917         if `./varargs I_VARARGS`; then
14918                 val='varargs.h'
14919         fi
14920         ;;
14921 esac
14922 case "$val" in
14923 '')
14924 echo "I could not find the definition for va_dcl... You have problems..." >&4
14925         val="$undef"; set i_stdarg; eval $setvar
14926         val="$undef"; set i_varargs; eval $setvar
14927         ;;
14928 *) 
14929         set i_varhdr
14930         eval $setvar
14931         case "$i_varhdr" in
14932         stdarg.h)
14933                 val="$define"; set i_stdarg; eval $setvar
14934                 val="$undef"; set i_varargs; eval $setvar
14935                 ;;
14936         varargs.h)
14937                 val="$undef"; set i_stdarg; eval $setvar
14938                 val="$define"; set i_varargs; eval $setvar
14939                 ;;
14940         esac
14941         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14942 esac
14943 $rm -f varargs*
14944
14945 : see if stddef is available
14946 set stddef.h i_stddef
14947 eval $inhdr
14948
14949 : see if this is a sunmath.h system
14950 set sunmath.h i_sunmath
14951 eval $inhdr
14952
14953 : see if sys/access.h is available
14954 set sys/access.h i_sysaccess
14955 eval $inhdr
14956
14957 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14958 set sys/filio.h i_sysfilio
14959 eval $inhdr
14960 echo " "
14961 if $test `./findhdr sys/ioctl.h`; then
14962         val="$define"
14963         echo '<sys/ioctl.h> found.' >&4
14964 else
14965         val="$undef"
14966         if $test $i_sysfilio = "$define"; then
14967             echo '<sys/ioctl.h> NOT found.' >&4
14968         else
14969                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14970                 $test $i_termio = "$define" && xxx="termio.h"
14971                 $test $i_termios = "$define" && xxx="termios.h"
14972 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14973         fi
14974 fi
14975 set i_sysioctl
14976 eval $setvar
14977
14978
14979 : see if this is a syslog.h system
14980 set syslog.h i_syslog
14981 eval $inhdr
14982
14983
14984 : see if this is a sys/mode.h system
14985 set sys/mode.h i_sysmode
14986 eval $inhdr
14987
14988 : see if sys/resource.h has to be included
14989 set sys/resource.h i_sysresrc
14990 eval $inhdr
14991
14992 : see if sys/security.h is available
14993 set sys/security.h i_syssecrt
14994 eval $inhdr
14995
14996 : see if this is a sys/statvfs.h system
14997 set sys/statvfs.h i_sysstatvfs
14998 eval $inhdr
14999
15000 : see if this is a sys/uio.h system
15001 set sys/uio.h i_sysuio
15002 eval $inhdr
15003
15004 : see if this is a sys/un.h system
15005 set sys/un.h i_sysun
15006 eval $inhdr
15007
15008
15009 : see if this is a sys/utsname.h system
15010 set sys/utsname.h i_sysutsname
15011 eval $inhdr
15012
15013 : see if this is a syswait system
15014 set sys/wait.h i_syswait
15015 eval $inhdr
15016
15017 : see if this is a ustat.h system
15018 set ustat.h i_ustat
15019 eval $inhdr
15020
15021 : see if this is an utime system
15022 set utime.h i_utime
15023 eval $inhdr
15024
15025 : see if this is a values.h system
15026 set values.h i_values
15027 eval $inhdr
15028
15029 : see if this is a vfork system
15030 case "$d_vfork" in
15031 "$define")
15032         set vfork.h i_vfork
15033         eval $inhdr
15034         ;;
15035 *)
15036         i_vfork="$undef"
15037         ;;
15038 esac
15039
15040 : see if gdbm.h is available
15041 set gdbm.h t_gdbm
15042 eval $inhdr
15043 case "$t_gdbm" in
15044 $define)
15045         : see if gdbm_open exists
15046         set gdbm_open d_gdbm_open
15047         eval $inlibc
15048         case "$d_gdbm_open" in
15049         $undef)
15050                 t_gdbm="$undef"
15051                 echo "We won't be including <gdbm.h>"
15052                 ;;
15053         esac
15054         ;;
15055 esac
15056 val="$t_gdbm"
15057 set i_gdbm
15058 eval $setvar
15059
15060 echo " "
15061 echo "Looking for extensions..." >&4
15062 : If we are using the old config.sh, known_extensions may contain
15063 : old or inaccurate or duplicate values.
15064 known_extensions=''
15065 nonxs_extensions=''
15066 : We do not use find because it might not be available.
15067 : We do not just use MANIFEST because the user may have dropped
15068 : some additional extensions into the source tree and expect them
15069 : to be built.
15070
15071 : Function to recursively find available extensions, ignoring DynaLoader
15072 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15073 find_extensions='
15074     for xxx in *; do
15075        case "$xxx" in
15076            DynaLoader|dynaload) ;;
15077            *)
15078            if $test -f $xxx/$xxx.xs; then
15079                known_extensions="$known_extensions $1$xxx";
15080            elif $test -f $xxx/Makefile.PL; then
15081                nonxs_extensions="$nonxs_extensions $1$xxx";
15082            else
15083                if $test -d $xxx -a $# -lt 10; then
15084                    set $1$xxx/ $*;
15085                    cd $xxx;
15086                    eval $find_extensions;
15087                    cd ..;
15088                    shift;
15089                fi;
15090            fi
15091            ;;
15092        esac;
15093     done'
15094 tdir=`pwd`
15095 cd $rsrc/ext
15096 set X
15097 shift
15098 eval $find_extensions
15099 set X $nonxs_extensions
15100 shift
15101 nonxs_extensions="$*"
15102 set X $known_extensions
15103 shift
15104 known_extensions="$*"
15105 cd $tdir
15106
15107 : Now see which are supported on this system.
15108 avail_ext=''
15109 for xxx in $known_extensions ; do
15110         case "$xxx" in
15111         DB_File|db_file)
15112                 case "$i_db" in
15113                 $define) avail_ext="$avail_ext $xxx" ;;
15114                 esac
15115                 ;;
15116         GDBM_File|gdbm_fil)
15117                 case "$i_gdbm" in 
15118                 $define) avail_ext="$avail_ext $xxx" ;;
15119                 esac
15120                 ;;
15121         NDBM_File|ndbm_fil)
15122                 case "$i_ndbm" in
15123                 $define)
15124                     case "$osname-$use64bitint" in
15125                     hpux-define)
15126                         case "$libs" in
15127                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15128                         esac
15129                         ;;
15130                     *) avail_ext="$avail_ext $xxx" ;;
15131                     esac
15132                     ;;
15133                 esac
15134                 ;;
15135         ODBM_File|odbm_fil) 
15136                 case "${i_dbm}${i_rpcsvcdbm}" in
15137                 *"${define}"*)
15138                     case "$osname-$use64bitint" in
15139                     hpux-define)
15140                         case "$libs" in
15141                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15142                         esac
15143                         ;;
15144                     *) avail_ext="$avail_ext $xxx" ;;
15145                     esac
15146                     ;;
15147                 esac
15148                 ;;
15149         POSIX|posix)
15150                 case "$useposix" in
15151                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15152                 esac
15153                 ;;
15154         Opcode|opcode)
15155                 case "$useopcode" in
15156                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15157                 esac
15158                 ;;
15159         Socket|socket)
15160                 case "$d_socket" in 
15161                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15162                 esac
15163                 ;;
15164         Sys/Syslog|sys/syslog)
15165                 : XXX syslog requires socket
15166                 case "$d_socket" in 
15167                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15168                 esac
15169                 ;;
15170         Thread|thread)
15171                 case "$usethreads" in 
15172                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15173                 esac
15174                 ;;
15175         IPC/SysV|ipc/sysv)
15176                 : XXX Do we need a useipcsysv variable here
15177                 case "${d_msg}${d_sem}${d_shm}" in 
15178                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15179                 esac
15180                 ;;
15181         *)      avail_ext="$avail_ext $xxx"
15182                 ;;
15183         esac
15184 done
15185
15186 set X $avail_ext
15187 shift
15188 avail_ext="$*"
15189
15190 : Now see which nonxs extensions are supported on this system.
15191 : For now assume all are.
15192 nonxs_ext=''
15193 for xxx in $nonxs_extensions ; do
15194         case "$xxx" in
15195         *)      nonxs_ext="$nonxs_ext $xxx"
15196                 ;;
15197         esac
15198 done
15199
15200 set X $nonxs_ext
15201 shift
15202 nonxs_ext="$*"
15203
15204 case $usedl in
15205 $define)
15206         $cat <<EOM
15207 A number of extensions are supplied with $package.  You may choose to
15208 compile these extensions for dynamic loading (the default), compile
15209 them into the $package executable (static loading), or not include
15210 them at all.  Answer "none" to include no extensions.
15211 Note that DynaLoader is always built and need not be mentioned here.
15212
15213 EOM
15214         case "$dynamic_ext" in
15215         '') dflt="$avail_ext" ;;
15216         *)      dflt="$dynamic_ext"
15217                 # Perhaps we are reusing an old out-of-date config.sh.
15218                 case "$hint" in
15219                 previous)
15220                         if test X"$dynamic_ext" != X"$avail_ext"; then
15221                                 $cat <<EOM
15222 NOTICE:  Your previous config.sh list may be incorrect. 
15223 The extensions now available to you are 
15224         ${avail_ext}
15225 but the default list from your previous config.sh is
15226         ${dynamic_ext} 
15227
15228 EOM
15229                         fi
15230                         ;;
15231                 esac
15232                 ;;
15233         esac
15234         case "$dflt" in
15235         '')     dflt=none;;
15236         esac
15237         rp="What extensions do you wish to load dynamically?"
15238         . ./myread
15239         case "$ans" in
15240         none) dynamic_ext=' ' ;;
15241         *) dynamic_ext="$ans" ;;
15242         esac
15243
15244         case "$static_ext" in
15245         '')
15246                 : Exclude those already listed in dynamic linking
15247                 dflt=''
15248                 for xxx in $avail_ext; do
15249                         case " $dynamic_ext " in
15250                         *" $xxx "*) ;;
15251                         *) dflt="$dflt $xxx" ;;
15252                         esac
15253                 done
15254                 set X $dflt
15255                 shift
15256                 dflt="$*"
15257                 ;;
15258         *)  dflt="$static_ext" 
15259                 ;;
15260         esac
15261
15262         case "$dflt" in
15263         '')     dflt=none;;
15264         esac
15265         rp="What extensions do you wish to load statically?"
15266         . ./myread
15267         case "$ans" in
15268         none) static_ext=' ' ;;
15269         *) static_ext="$ans" ;;
15270         esac
15271         ;;
15272 *)
15273         $cat <<EOM
15274 A number of extensions are supplied with $package.  Answer "none" 
15275 to include no extensions. 
15276 Note that DynaLoader is always built and need not be mentioned here.
15277
15278 EOM
15279         case "$static_ext" in
15280         '') dflt="$avail_ext" ;;
15281         *)      dflt="$static_ext"
15282                 # Perhaps we are reusing an old out-of-date config.sh.
15283                 case "$hint" in
15284                 previous)
15285                         if test X"$static_ext" != X"$avail_ext"; then
15286                                 $cat <<EOM
15287 NOTICE:  Your previous config.sh list may be incorrect. 
15288 The extensions now available to you are 
15289         ${avail_ext}
15290 but the default list from your previous config.sh is
15291         ${static_ext} 
15292
15293 EOM
15294                         fi
15295                         ;;
15296                 esac
15297                 ;;
15298         esac
15299         : Exclude those that are not xs extensions
15300         case "$dflt" in
15301         '')     dflt=none;;
15302         esac
15303         rp="What extensions do you wish to include?"
15304         . ./myread
15305         case "$ans" in
15306         none) static_ext=' ' ;;
15307         *) static_ext="$ans" ;;
15308         esac
15309         ;;
15310 esac
15311
15312 set X $dynamic_ext $static_ext $nonxs_ext
15313 shift
15314 extensions="$*"
15315
15316 : Remove libraries needed only for extensions
15317 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15318 : The exception is SunOS 4.x, which needs them.
15319 case "${osname}X${osvers}" in
15320 sunos*X4*)
15321     perllibs="$libs"
15322     ;;
15323 *) case "$usedl" in
15324     $define|true|[yY]*)
15325             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15326             shift
15327             perllibs="$*"
15328             ;;
15329     *)  perllibs="$libs"
15330             ;;
15331     esac
15332     ;;
15333 esac
15334
15335 : Remove build directory name from cppstdin so it can be used from
15336 : either the present location or the final installed location.
15337 echo " "
15338 : Get out of the UU directory to get correct path name.
15339 cd ..
15340 case "$cppstdin" in
15341 `pwd`/cppstdin)
15342         echo "Stripping down cppstdin path name"
15343         cppstdin=cppstdin
15344         ;;
15345 esac
15346 cd UU
15347
15348 : end of configuration questions
15349 echo " "
15350 echo "End of configuration questions."
15351 echo " "
15352
15353 : back to where it started
15354 if test -d ../UU; then
15355         cd ..
15356 fi
15357
15358 : configuration may be patched via a 'config.over' file
15359 if $test -f config.over; then
15360         echo " "
15361         dflt=y
15362         rp='I see a config.over file.  Do you wish to load it?'
15363         . UU/myread
15364         case "$ans" in
15365         n*) echo "OK, I'll ignore it.";;
15366         *)      . ./config.over
15367                 echo "Configuration override changes have been loaded."
15368                 ;;
15369         esac
15370 fi
15371
15372 : in case they want portability, strip down executable paths
15373 case "$d_portable" in
15374 "$define")
15375         echo " "
15376         echo "Stripping down executable paths..." >&4
15377         for file in $loclist $trylist; do
15378                 eval temp=\$$file
15379                 eval $file=`basename $temp`
15380         done
15381         ;;
15382 esac
15383
15384 : create config.sh file
15385 echo " "
15386 echo "Creating config.sh..." >&4
15387 $spitshell <<EOT >config.sh
15388 $startsh
15389 #
15390 # This file was produced by running the Configure script. It holds all the
15391 # definitions figured out by Configure. Should you modify one of these values,
15392 # do not forget to propagate your changes by running "Configure -der". You may
15393 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15394 #
15395
15396 # Package name      : $package
15397 # Source directory  : $src
15398 # Configuration time: $cf_time
15399 # Configured by     : $cf_by
15400 # Target system     : $myuname
15401
15402 Author='$Author'
15403 Date='$Date'
15404 Header='$Header'
15405 Id='$Id'
15406 Locker='$Locker'
15407 Log='$Log'
15408 Mcc='$Mcc'
15409 RCSfile='$RCSfile'
15410 Revision='$Revision'
15411 Source='$Source'
15412 State='$State'
15413 _a='$_a'
15414 _exe='$_exe'
15415 _o='$_o'
15416 afs='$afs'
15417 alignbytes='$alignbytes'
15418 ansi2knr='$ansi2knr'
15419 aphostname='$aphostname'
15420 api_revision='$api_revision'
15421 api_subversion='$api_subversion'
15422 api_version='$api_version'
15423 api_versionstring='$api_versionstring'
15424 ar='$ar'
15425 archlib='$archlib'
15426 archlibexp='$archlibexp'
15427 archname64='$archname64'
15428 archname='$archname'
15429 archobjs='$archobjs'
15430 awk='$awk'
15431 baserev='$baserev'
15432 bash='$bash'
15433 bin='$bin'
15434 bincompat5005='$bincompat5005'
15435 binexp='$binexp'
15436 bison='$bison'
15437 byacc='$byacc'
15438 byteorder='$byteorder'
15439 c='$c'
15440 castflags='$castflags'
15441 cat='$cat'
15442 cc='$cc'
15443 cccdlflags='$cccdlflags'
15444 ccdlflags='$ccdlflags'
15445 ccflags='$ccflags'
15446 ccflags_uselargefiles='$ccflags_uselargefiles'
15447 ccname='$ccname'
15448 ccsymbols='$ccsymbols'
15449 ccversion='$ccversion'
15450 cf_by='$cf_by'
15451 cf_email='$cf_email'
15452 cf_time='$cf_time'
15453 charsize='$charsize'
15454 chgrp='$chgrp'
15455 chmod='$chmod'
15456 chown='$chown'
15457 clocktype='$clocktype'
15458 comm='$comm'
15459 compress='$compress'
15460 contains='$contains'
15461 cp='$cp'
15462 cpio='$cpio'
15463 cpp='$cpp'
15464 cpp_stuff='$cpp_stuff'
15465 cppccsymbols='$cppccsymbols'
15466 cppflags='$cppflags'
15467 cpplast='$cpplast'
15468 cppminus='$cppminus'
15469 cpprun='$cpprun'
15470 cppstdin='$cppstdin'
15471 cppsymbols='$cppsymbols'
15472 crosscompile='$crosscompile'
15473 cryptlib='$cryptlib'
15474 csh='$csh'
15475 d_Gconvert='$d_Gconvert'
15476 d_PRIEUldbl='$d_PRIEUldbl'
15477 d_PRIFUldbl='$d_PRIFUldbl'
15478 d_PRIGUldbl='$d_PRIGUldbl'
15479 d_PRIXU64='$d_PRIXU64'
15480 d_PRId64='$d_PRId64'
15481 d_PRIeldbl='$d_PRIeldbl'
15482 d_PRIfldbl='$d_PRIfldbl'
15483 d_PRIgldbl='$d_PRIgldbl'
15484 d_PRIi64='$d_PRIi64'
15485 d_PRIo64='$d_PRIo64'
15486 d_PRIu64='$d_PRIu64'
15487 d_PRIx64='$d_PRIx64'
15488 d_SCNfldbl='$d_SCNfldbl'
15489 d_access='$d_access'
15490 d_accessx='$d_accessx'
15491 d_alarm='$d_alarm'
15492 d_archlib='$d_archlib'
15493 d_atolf='$d_atolf'
15494 d_atoll='$d_atoll'
15495 d_attribut='$d_attribut'
15496 d_bcmp='$d_bcmp'
15497 d_bcopy='$d_bcopy'
15498 d_bincompat5005='$d_bincompat5005'
15499 d_bsd='$d_bsd'
15500 d_bsdgetpgrp='$d_bsdgetpgrp'
15501 d_bsdsetpgrp='$d_bsdsetpgrp'
15502 d_bzero='$d_bzero'
15503 d_casti32='$d_casti32'
15504 d_castneg='$d_castneg'
15505 d_charvspr='$d_charvspr'
15506 d_chown='$d_chown'
15507 d_chroot='$d_chroot'
15508 d_chsize='$d_chsize'
15509 d_closedir='$d_closedir'
15510 d_const='$d_const'
15511 d_crypt='$d_crypt'
15512 d_csh='$d_csh'
15513 d_cuserid='$d_cuserid'
15514 d_dbl_dig='$d_dbl_dig'
15515 d_difftime='$d_difftime'
15516 d_dirnamlen='$d_dirnamlen'
15517 d_dlerror='$d_dlerror'
15518 d_dlopen='$d_dlopen'
15519 d_dlsymun='$d_dlsymun'
15520 d_dosuid='$d_dosuid'
15521 d_drand48proto='$d_drand48proto'
15522 d_dup2='$d_dup2'
15523 d_eaccess='$d_eaccess'
15524 d_endgrent='$d_endgrent'
15525 d_endhent='$d_endhent'
15526 d_endnent='$d_endnent'
15527 d_endpent='$d_endpent'
15528 d_endpwent='$d_endpwent'
15529 d_endsent='$d_endsent'
15530 d_eofnblk='$d_eofnblk'
15531 d_eunice='$d_eunice'
15532 d_fchmod='$d_fchmod'
15533 d_fchown='$d_fchown'
15534 d_fcntl='$d_fcntl'
15535 d_fcntl_can_lock='$d_fcntl_can_lock'
15536 d_fd_macros='$d_fd_macros'
15537 d_fd_set='$d_fd_set'
15538 d_fds_bits='$d_fds_bits'
15539 d_fgetpos='$d_fgetpos'
15540 d_flexfnam='$d_flexfnam'
15541 d_flock='$d_flock'
15542 d_fork='$d_fork'
15543 d_fpathconf='$d_fpathconf'
15544 d_fpos64_t='$d_fpos64_t'
15545 d_frexpl='$d_frexpl'
15546 d_fs_data_s='$d_fs_data_s'
15547 d_fseeko='$d_fseeko'
15548 d_fsetpos='$d_fsetpos'
15549 d_fstatfs='$d_fstatfs'
15550 d_fstatvfs='$d_fstatvfs'
15551 d_ftello='$d_ftello'
15552 d_ftime='$d_ftime'
15553 d_getcwd='$d_getcwd'
15554 d_getespwnam='$d_getespwnam'
15555 d_getfsstat='$d_getfsstat'
15556 d_getgrent='$d_getgrent'
15557 d_getgrps='$d_getgrps'
15558 d_gethbyaddr='$d_gethbyaddr'
15559 d_gethbyname='$d_gethbyname'
15560 d_gethent='$d_gethent'
15561 d_gethname='$d_gethname'
15562 d_gethostprotos='$d_gethostprotos'
15563 d_getlogin='$d_getlogin'
15564 d_getmnt='$d_getmnt'
15565 d_getmntent='$d_getmntent'
15566 d_getnbyaddr='$d_getnbyaddr'
15567 d_getnbyname='$d_getnbyname'
15568 d_getnent='$d_getnent'
15569 d_getnetprotos='$d_getnetprotos'
15570 d_getpbyname='$d_getpbyname'
15571 d_getpbynumber='$d_getpbynumber'
15572 d_getpent='$d_getpent'
15573 d_getpgid='$d_getpgid'
15574 d_getpgrp2='$d_getpgrp2'
15575 d_getpgrp='$d_getpgrp'
15576 d_getppid='$d_getppid'
15577 d_getprior='$d_getprior'
15578 d_getprotoprotos='$d_getprotoprotos'
15579 d_getprpwnam='$d_getprpwnam'
15580 d_getpwent='$d_getpwent'
15581 d_getsbyname='$d_getsbyname'
15582 d_getsbyport='$d_getsbyport'
15583 d_getsent='$d_getsent'
15584 d_getservprotos='$d_getservprotos'
15585 d_getspnam='$d_getspnam'
15586 d_gettimeod='$d_gettimeod'
15587 d_gnulibc='$d_gnulibc'
15588 d_grpasswd='$d_grpasswd'
15589 d_hasmntopt='$d_hasmntopt'
15590 d_htonl='$d_htonl'
15591 d_iconv='$d_iconv'
15592 d_index='$d_index'
15593 d_inetaton='$d_inetaton'
15594 d_int64_t='$d_int64_t'
15595 d_isascii='$d_isascii'
15596 d_isnan='$d_isnan'
15597 d_isnanl='$d_isnanl'
15598 d_killpg='$d_killpg'
15599 d_lchown='$d_lchown'
15600 d_ldbl_dig='$d_ldbl_dig'
15601 d_link='$d_link'
15602 d_locconv='$d_locconv'
15603 d_lockf='$d_lockf'
15604 d_longdbl='$d_longdbl'
15605 d_longlong='$d_longlong'
15606 d_lseekproto='$d_lseekproto'
15607 d_lstat='$d_lstat'
15608 d_madvise='$d_madvise'
15609 d_mblen='$d_mblen'
15610 d_mbstowcs='$d_mbstowcs'
15611 d_mbtowc='$d_mbtowc'
15612 d_memchr='$d_memchr'
15613 d_memcmp='$d_memcmp'
15614 d_memcpy='$d_memcpy'
15615 d_memmove='$d_memmove'
15616 d_memset='$d_memset'
15617 d_mkdir='$d_mkdir'
15618 d_mkdtemp='$d_mkdtemp'
15619 d_mkfifo='$d_mkfifo'
15620 d_mkstemp='$d_mkstemp'
15621 d_mkstemps='$d_mkstemps'
15622 d_mktime='$d_mktime'
15623 d_mmap='$d_mmap'
15624 d_modfl='$d_modfl'
15625 d_mprotect='$d_mprotect'
15626 d_msg='$d_msg'
15627 d_msg_ctrunc='$d_msg_ctrunc'
15628 d_msg_dontroute='$d_msg_dontroute'
15629 d_msg_oob='$d_msg_oob'
15630 d_msg_peek='$d_msg_peek'
15631 d_msg_proxy='$d_msg_proxy'
15632 d_msgctl='$d_msgctl'
15633 d_msgget='$d_msgget'
15634 d_msgrcv='$d_msgrcv'
15635 d_msgsnd='$d_msgsnd'
15636 d_msync='$d_msync'
15637 d_munmap='$d_munmap'
15638 d_mymalloc='$d_mymalloc'
15639 d_nice='$d_nice'
15640 d_nv_preserves_uv='$d_nv_preserves_uv'
15641 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15642 d_off64_t='$d_off64_t'
15643 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15644 d_oldpthreads='$d_oldpthreads'
15645 d_oldsock='$d_oldsock'
15646 d_open3='$d_open3'
15647 d_pathconf='$d_pathconf'
15648 d_pause='$d_pause'
15649 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15650 d_phostname='$d_phostname'
15651 d_pipe='$d_pipe'
15652 d_poll='$d_poll'
15653 d_portable='$d_portable'
15654 d_pthread_yield='$d_pthread_yield'
15655 d_pwage='$d_pwage'
15656 d_pwchange='$d_pwchange'
15657 d_pwclass='$d_pwclass'
15658 d_pwcomment='$d_pwcomment'
15659 d_pwexpire='$d_pwexpire'
15660 d_pwgecos='$d_pwgecos'
15661 d_pwpasswd='$d_pwpasswd'
15662 d_pwquota='$d_pwquota'
15663 d_qgcvt='$d_qgcvt'
15664 d_quad='$d_quad'
15665 d_readdir='$d_readdir'
15666 d_readlink='$d_readlink'
15667 d_rename='$d_rename'
15668 d_rewinddir='$d_rewinddir'
15669 d_rmdir='$d_rmdir'
15670 d_safebcpy='$d_safebcpy'
15671 d_safemcpy='$d_safemcpy'
15672 d_sanemcmp='$d_sanemcmp'
15673 d_sched_yield='$d_sched_yield'
15674 d_scm_rights='$d_scm_rights'
15675 d_seekdir='$d_seekdir'
15676 d_select='$d_select'
15677 d_sem='$d_sem'
15678 d_semctl='$d_semctl'
15679 d_semctl_semid_ds='$d_semctl_semid_ds'
15680 d_semctl_semun='$d_semctl_semun'
15681 d_semget='$d_semget'
15682 d_semop='$d_semop'
15683 d_setegid='$d_setegid'
15684 d_seteuid='$d_seteuid'
15685 d_setgrent='$d_setgrent'
15686 d_setgrps='$d_setgrps'
15687 d_sethent='$d_sethent'
15688 d_setlinebuf='$d_setlinebuf'
15689 d_setlocale='$d_setlocale'
15690 d_setnent='$d_setnent'
15691 d_setpent='$d_setpent'
15692 d_setpgid='$d_setpgid'
15693 d_setpgrp2='$d_setpgrp2'
15694 d_setpgrp='$d_setpgrp'
15695 d_setprior='$d_setprior'
15696 d_setproctitle='$d_setproctitle'
15697 d_setpwent='$d_setpwent'
15698 d_setregid='$d_setregid'
15699 d_setresgid='$d_setresgid'
15700 d_setresuid='$d_setresuid'
15701 d_setreuid='$d_setreuid'
15702 d_setrgid='$d_setrgid'
15703 d_setruid='$d_setruid'
15704 d_setsent='$d_setsent'
15705 d_setsid='$d_setsid'
15706 d_setvbuf='$d_setvbuf'
15707 d_sfio='$d_sfio'
15708 d_shm='$d_shm'
15709 d_shmat='$d_shmat'
15710 d_shmatprototype='$d_shmatprototype'
15711 d_shmctl='$d_shmctl'
15712 d_shmdt='$d_shmdt'
15713 d_shmget='$d_shmget'
15714 d_sigaction='$d_sigaction'
15715 d_sigsetjmp='$d_sigsetjmp'
15716 d_socket='$d_socket'
15717 d_socklen_t='$d_socklen_t'
15718 d_sockpair='$d_sockpair'
15719 d_socks5_init='$d_socks5_init'
15720 d_sqrtl='$d_sqrtl'
15721 d_statblks='$d_statblks'
15722 d_statfs_f_flags='$d_statfs_f_flags'
15723 d_statfs_s='$d_statfs_s'
15724 d_statvfs='$d_statvfs'
15725 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15726 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15727 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15728 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
15729 d_stdio_stream_array='$d_stdio_stream_array'
15730 d_stdiobase='$d_stdiobase'
15731 d_stdstdio='$d_stdstdio'
15732 d_strchr='$d_strchr'
15733 d_strcoll='$d_strcoll'
15734 d_strctcpy='$d_strctcpy'
15735 d_strerrm='$d_strerrm'
15736 d_strerror='$d_strerror'
15737 d_strtod='$d_strtod'
15738 d_strtol='$d_strtol'
15739 d_strtold='$d_strtold'
15740 d_strtoll='$d_strtoll'
15741 d_strtoul='$d_strtoul'
15742 d_strtoull='$d_strtoull'
15743 d_strtouq='$d_strtouq'
15744 d_strxfrm='$d_strxfrm'
15745 d_suidsafe='$d_suidsafe'
15746 d_symlink='$d_symlink'
15747 d_syscall='$d_syscall'
15748 d_sysconf='$d_sysconf'
15749 d_sysernlst='$d_sysernlst'
15750 d_syserrlst='$d_syserrlst'
15751 d_system='$d_system'
15752 d_tcgetpgrp='$d_tcgetpgrp'
15753 d_tcsetpgrp='$d_tcsetpgrp'
15754 d_telldir='$d_telldir'
15755 d_telldirproto='$d_telldirproto'
15756 d_time='$d_time'
15757 d_times='$d_times'
15758 d_truncate='$d_truncate'
15759 d_tzname='$d_tzname'
15760 d_umask='$d_umask'
15761 d_uname='$d_uname'
15762 d_union_semun='$d_union_semun'
15763 d_ustat='$d_ustat'
15764 d_vendorarch='$d_vendorarch'
15765 d_vendorbin='$d_vendorbin'
15766 d_vendorlib='$d_vendorlib'
15767 d_vfork='$d_vfork'
15768 d_void_closedir='$d_void_closedir'
15769 d_voidsig='$d_voidsig'
15770 d_voidtty='$d_voidtty'
15771 d_volatile='$d_volatile'
15772 d_vprintf='$d_vprintf'
15773 d_wait4='$d_wait4'
15774 d_waitpid='$d_waitpid'
15775 d_wcstombs='$d_wcstombs'
15776 d_wctomb='$d_wctomb'
15777 d_xenix='$d_xenix'
15778 date='$date'
15779 db_hashtype='$db_hashtype'
15780 db_prefixtype='$db_prefixtype'
15781 defvoidused='$defvoidused'
15782 direntrytype='$direntrytype'
15783 dlext='$dlext'
15784 dlsrc='$dlsrc'
15785 doublesize='$doublesize'
15786 drand01='$drand01'
15787 dynamic_ext='$dynamic_ext'
15788 eagain='$eagain'
15789 ebcdic='$ebcdic'
15790 echo='$echo'
15791 egrep='$egrep'
15792 emacs='$emacs'
15793 eunicefix='$eunicefix'
15794 exe_ext='$exe_ext'
15795 expr='$expr'
15796 extensions='$extensions'
15797 fflushNULL='$fflushNULL'
15798 fflushall='$fflushall'
15799 find='$find'
15800 firstmakefile='$firstmakefile'
15801 flex='$flex'
15802 fpossize='$fpossize'
15803 fpostype='$fpostype'
15804 freetype='$freetype'
15805 full_ar='$full_ar'
15806 full_csh='$full_csh'
15807 full_sed='$full_sed'
15808 gccosandvers='$gccosandvers'
15809 gccversion='$gccversion'
15810 gidformat='$gidformat'
15811 gidsign='$gidsign'
15812 gidsize='$gidsize'
15813 gidtype='$gidtype'
15814 glibpth='$glibpth'
15815 grep='$grep'
15816 groupcat='$groupcat'
15817 groupstype='$groupstype'
15818 gzip='$gzip'
15819 h_fcntl='$h_fcntl'
15820 h_sysfile='$h_sysfile'
15821 hint='$hint'
15822 hostcat='$hostcat'
15823 i16size='$i16size'
15824 i16type='$i16type'
15825 i32size='$i32size'
15826 i32type='$i32type'
15827 i64size='$i64size'
15828 i64type='$i64type'
15829 i8size='$i8size'
15830 i8type='$i8type'
15831 i_arpainet='$i_arpainet'
15832 i_bsdioctl='$i_bsdioctl'
15833 i_db='$i_db'
15834 i_dbm='$i_dbm'
15835 i_dirent='$i_dirent'
15836 i_dld='$i_dld'
15837 i_dlfcn='$i_dlfcn'
15838 i_fcntl='$i_fcntl'
15839 i_float='$i_float'
15840 i_gdbm='$i_gdbm'
15841 i_grp='$i_grp'
15842 i_iconv='$i_iconv'
15843 i_ieeefp='$i_ieeefp'
15844 i_inttypes='$i_inttypes'
15845 i_libutil='$i_libutil'
15846 i_limits='$i_limits'
15847 i_locale='$i_locale'
15848 i_machcthr='$i_machcthr'
15849 i_malloc='$i_malloc'
15850 i_math='$i_math'
15851 i_memory='$i_memory'
15852 i_mntent='$i_mntent'
15853 i_ndbm='$i_ndbm'
15854 i_netdb='$i_netdb'
15855 i_neterrno='$i_neterrno'
15856 i_netinettcp='$i_netinettcp'
15857 i_niin='$i_niin'
15858 i_poll='$i_poll'
15859 i_prot='$i_prot'
15860 i_pthread='$i_pthread'
15861 i_pwd='$i_pwd'
15862 i_rpcsvcdbm='$i_rpcsvcdbm'
15863 i_sfio='$i_sfio'
15864 i_sgtty='$i_sgtty'
15865 i_shadow='$i_shadow'
15866 i_socks='$i_socks'
15867 i_stdarg='$i_stdarg'
15868 i_stddef='$i_stddef'
15869 i_stdlib='$i_stdlib'
15870 i_string='$i_string'
15871 i_sunmath='$i_sunmath'
15872 i_sysaccess='$i_sysaccess'
15873 i_sysdir='$i_sysdir'
15874 i_sysfile='$i_sysfile'
15875 i_sysfilio='$i_sysfilio'
15876 i_sysin='$i_sysin'
15877 i_sysioctl='$i_sysioctl'
15878 i_syslog='$i_syslog'
15879 i_sysmman='$i_sysmman'
15880 i_sysmode='$i_sysmode'
15881 i_sysmount='$i_sysmount'
15882 i_sysndir='$i_sysndir'
15883 i_sysparam='$i_sysparam'
15884 i_sysresrc='$i_sysresrc'
15885 i_syssecrt='$i_syssecrt'
15886 i_sysselct='$i_sysselct'
15887 i_syssockio='$i_syssockio'
15888 i_sysstat='$i_sysstat'
15889 i_sysstatfs='$i_sysstatfs'
15890 i_sysstatvfs='$i_sysstatvfs'
15891 i_systime='$i_systime'
15892 i_systimek='$i_systimek'
15893 i_systimes='$i_systimes'
15894 i_systypes='$i_systypes'
15895 i_sysuio='$i_sysuio'
15896 i_sysun='$i_sysun'
15897 i_sysutsname='$i_sysutsname'
15898 i_sysvfs='$i_sysvfs'
15899 i_syswait='$i_syswait'
15900 i_termio='$i_termio'
15901 i_termios='$i_termios'
15902 i_time='$i_time'
15903 i_unistd='$i_unistd'
15904 i_ustat='$i_ustat'
15905 i_utime='$i_utime'
15906 i_values='$i_values'
15907 i_varargs='$i_varargs'
15908 i_varhdr='$i_varhdr'
15909 i_vfork='$i_vfork'
15910 ignore_versioned_solibs='$ignore_versioned_solibs'
15911 inc_version_list='$inc_version_list'
15912 inc_version_list_init='$inc_version_list_init'
15913 incpath='$incpath'
15914 inews='$inews'
15915 installarchlib='$installarchlib'
15916 installbin='$installbin'
15917 installman1dir='$installman1dir'
15918 installman3dir='$installman3dir'
15919 installprefix='$installprefix'
15920 installprefixexp='$installprefixexp'
15921 installprivlib='$installprivlib'
15922 installscript='$installscript'
15923 installsitearch='$installsitearch'
15924 installsitebin='$installsitebin'
15925 installsitelib='$installsitelib'
15926 installstyle='$installstyle'
15927 installusrbinperl='$installusrbinperl'
15928 installvendorarch='$installvendorarch'
15929 installvendorbin='$installvendorbin'
15930 installvendorlib='$installvendorlib'
15931 intsize='$intsize'
15932 ivdformat='$ivdformat'
15933 ivsize='$ivsize'
15934 ivtype='$ivtype'
15935 known_extensions='$known_extensions'
15936 ksh='$ksh'
15937 ld='$ld'
15938 lddlflags='$lddlflags'
15939 ldflags='$ldflags'
15940 ldflags_uselargefiles='$ldflags_uselargefiles'
15941 ldlibpthname='$ldlibpthname'
15942 less='$less'
15943 lib_ext='$lib_ext'
15944 libc='$libc'
15945 libperl='$libperl'
15946 libpth='$libpth'
15947 libs='$libs'
15948 libsdirs='$libsdirs'
15949 libsfiles='$libsfiles'
15950 libsfound='$libsfound'
15951 libspath='$libspath'
15952 libswanted='$libswanted'
15953 libswanted_uselargefiles='$libswanted_uselargefiles'
15954 line='$line'
15955 lint='$lint'
15956 lkflags='$lkflags'
15957 ln='$ln'
15958 lns='$lns'
15959 locincpth='$locincpth'
15960 loclibpth='$loclibpth'
15961 longdblsize='$longdblsize'
15962 longlongsize='$longlongsize'
15963 longsize='$longsize'
15964 lp='$lp'
15965 lpr='$lpr'
15966 ls='$ls'
15967 lseeksize='$lseeksize'
15968 lseektype='$lseektype'
15969 mail='$mail'
15970 mailx='$mailx'
15971 make='$make'
15972 make_set_make='$make_set_make'
15973 mallocobj='$mallocobj'
15974 mallocsrc='$mallocsrc'
15975 malloctype='$malloctype'
15976 man1dir='$man1dir'
15977 man1direxp='$man1direxp'
15978 man1ext='$man1ext'
15979 man3dir='$man3dir'
15980 man3direxp='$man3direxp'
15981 man3ext='$man3ext'
15982 mips_type='$mips_type'
15983 mkdir='$mkdir'
15984 mmaptype='$mmaptype'
15985 modetype='$modetype'
15986 more='$more'
15987 multiarch='$multiarch'
15988 mv='$mv'
15989 myarchname='$myarchname'
15990 mydomain='$mydomain'
15991 myhostname='$myhostname'
15992 myuname='$myuname'
15993 n='$n'
15994 netdb_hlen_type='$netdb_hlen_type'
15995 netdb_host_type='$netdb_host_type'
15996 netdb_name_type='$netdb_name_type'
15997 netdb_net_type='$netdb_net_type'
15998 nm='$nm'
15999 nm_opt='$nm_opt'
16000 nm_so_opt='$nm_so_opt'
16001 nonxs_ext='$nonxs_ext'
16002 nroff='$nroff'
16003 nvEUformat='$nvEUformat'
16004 nvFUformat='$nvFUformat'
16005 nvGUformat='$nvGUformat'
16006 nveformat='$nveformat'
16007 nvfformat='$nvfformat'
16008 nvgformat='$nvgformat'
16009 nvsize='$nvsize'
16010 nvtype='$nvtype'
16011 o_nonblock='$o_nonblock'
16012 obj_ext='$obj_ext'
16013 old_pthread_create_joinable='$old_pthread_create_joinable'
16014 optimize='$optimize'
16015 orderlib='$orderlib'
16016 osname='$osname'
16017 osvers='$osvers'
16018 otherlibdirs='$otherlibdirs'
16019 package='$package'
16020 pager='$pager'
16021 passcat='$passcat'
16022 patchlevel='$patchlevel'
16023 path_sep='$path_sep'
16024 perl5='$perl5'
16025 perl='$perl'
16026 perladmin='$perladmin'
16027 perllibs='$perllibs'
16028 perlpath='$perlpath'
16029 pg='$pg'
16030 phostname='$phostname'
16031 pidtype='$pidtype'
16032 plibpth='$plibpth'
16033 pm_apiversion='$pm_apiversion'
16034 pmake='$pmake'
16035 pr='$pr'
16036 prefix='$prefix'
16037 prefixexp='$prefixexp'
16038 privlib='$privlib'
16039 privlibexp='$privlibexp'
16040 prototype='$prototype'
16041 ptrsize='$ptrsize'
16042 quadkind='$quadkind'
16043 quadtype='$quadtype'
16044 randbits='$randbits'
16045 randfunc='$randfunc'
16046 randseedtype='$randseedtype'
16047 ranlib='$ranlib'
16048 rd_nodata='$rd_nodata'
16049 revision='$revision'
16050 rm='$rm'
16051 rmail='$rmail'
16052 runnm='$runnm'
16053 sPRIEUldbl='$sPRIEUldbl'
16054 sPRIFUldbl='$sPRIFUldbl'
16055 sPRIGUldbl='$sPRIGUldbl'
16056 sPRIXU64='$sPRIXU64'
16057 sPRId64='$sPRId64'
16058 sPRIeldbl='$sPRIeldbl'
16059 sPRIfldbl='$sPRIfldbl'
16060 sPRIgldbl='$sPRIgldbl'
16061 sPRIi64='$sPRIi64'
16062 sPRIo64='$sPRIo64'
16063 sPRIu64='$sPRIu64'
16064 sPRIx64='$sPRIx64'
16065 sSCNfldbl='$sSCNfldbl'
16066 sched_yield='$sched_yield'
16067 scriptdir='$scriptdir'
16068 scriptdirexp='$scriptdirexp'
16069 sed='$sed'
16070 seedfunc='$seedfunc'
16071 selectminbits='$selectminbits'
16072 selecttype='$selecttype'
16073 sendmail='$sendmail'
16074 sh='$sh'
16075 shar='$shar'
16076 sharpbang='$sharpbang'
16077 shmattype='$shmattype'
16078 shortsize='$shortsize'
16079 shrpenv='$shrpenv'
16080 shsharp='$shsharp'
16081 sig_count='$sig_count'
16082 sig_name='$sig_name'
16083 sig_name_init='$sig_name_init'
16084 sig_num='$sig_num'
16085 sig_num_init='$sig_num_init'
16086 signal_t='$signal_t'
16087 sitearch='$sitearch'
16088 sitearchexp='$sitearchexp'
16089 sitebin='$sitebin'
16090 sitebinexp='$sitebinexp'
16091 sitelib='$sitelib'
16092 sitelib_stem='$sitelib_stem'
16093 sitelibexp='$sitelibexp'
16094 siteprefix='$siteprefix'
16095 siteprefixexp='$siteprefixexp'
16096 sizesize='$sizesize'
16097 sizetype='$sizetype'
16098 sleep='$sleep'
16099 smail='$smail'
16100 so='$so'
16101 sockethdr='$sockethdr'
16102 socketlib='$socketlib'
16103 socksizetype='$socksizetype'
16104 sort='$sort'
16105 spackage='$spackage'
16106 spitshell='$spitshell'
16107 src='$src'
16108 ssizetype='$ssizetype'
16109 startperl='$startperl'
16110 startsh='$startsh'
16111 static_ext='$static_ext'
16112 stdchar='$stdchar'
16113 stdio_base='$stdio_base'
16114 stdio_bufsiz='$stdio_bufsiz'
16115 stdio_cnt='$stdio_cnt'
16116 stdio_filbuf='$stdio_filbuf'
16117 stdio_ptr='$stdio_ptr'
16118 stdio_stream_array='$stdio_stream_array'
16119 strings='$strings'
16120 submit='$submit'
16121 subversion='$subversion'
16122 sysman='$sysman'
16123 tail='$tail'
16124 tar='$tar'
16125 tbl='$tbl'
16126 tee='$tee'
16127 test='$test'
16128 timeincl='$timeincl'
16129 timetype='$timetype'
16130 touch='$touch'
16131 tr='$tr'
16132 trnl='$trnl'
16133 troff='$troff'
16134 u16size='$u16size'
16135 u16type='$u16type'
16136 u32size='$u32size'
16137 u32type='$u32type'
16138 u64size='$u64size'
16139 u64type='$u64type'
16140 u8size='$u8size'
16141 u8type='$u8type'
16142 uidformat='$uidformat'
16143 uidsign='$uidsign'
16144 uidsize='$uidsize'
16145 uidtype='$uidtype'
16146 uname='$uname'
16147 uniq='$uniq'
16148 uquadtype='$uquadtype'
16149 use5005threads='$use5005threads'
16150 use64bitall='$use64bitall'
16151 use64bitint='$use64bitint'
16152 usedl='$usedl'
16153 useithreads='$useithreads'
16154 uselargefiles='$uselargefiles'
16155 uselongdouble='$uselongdouble'
16156 usemorebits='$usemorebits'
16157 usemultiplicity='$usemultiplicity'
16158 usemymalloc='$usemymalloc'
16159 usenm='$usenm'
16160 useopcode='$useopcode'
16161 useperlio='$useperlio'
16162 useposix='$useposix'
16163 usesfio='$usesfio'
16164 useshrplib='$useshrplib'
16165 usesocks='$usesocks'
16166 usethreads='$usethreads'
16167 usevendorprefix='$usevendorprefix'
16168 usevfork='$usevfork'
16169 usrinc='$usrinc'
16170 uuname='$uuname'
16171 uvXUformat='$uvXUformat'
16172 uvoformat='$uvoformat'
16173 uvsize='$uvsize'
16174 uvtype='$uvtype'
16175 uvuformat='$uvuformat'
16176 uvxformat='$uvxformat'
16177 vendorarch='$vendorarch'
16178 vendorarchexp='$vendorarchexp'
16179 vendorbin='$vendorbin'
16180 vendorbinexp='$vendorbinexp'
16181 vendorlib='$vendorlib'
16182 vendorlib_stem='$vendorlib_stem'
16183 vendorlibexp='$vendorlibexp'
16184 vendorprefix='$vendorprefix'
16185 vendorprefixexp='$vendorprefixexp'
16186 version='$version'
16187 versiononly='$versiononly'
16188 vi='$vi'
16189 voidflags='$voidflags'
16190 xlibpth='$xlibpth'
16191 xs_apiversion='$xs_apiversion'
16192 zcat='$zcat'
16193 zip='$zip'
16194 EOT
16195
16196 : Add in command line options if available
16197 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16198
16199 : add special variables
16200 $test -f $src/patchlevel.h && \
16201 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16202 echo "CONFIGDOTSH=true" >>config.sh
16203
16204 : propagate old symbols
16205 if $test -f UU/config.sh; then
16206         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16207         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16208         $sort | $uniq -u >UU/oldsyms
16209         set X `cat UU/oldsyms`
16210         shift
16211         case $# in
16212         0) ;;
16213         *)
16214                 cat <<EOM
16215 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16216 EOM
16217                 echo "# Variables propagated from previous config.sh file." >>config.sh
16218                 for sym in `cat UU/oldsyms`; do
16219                         echo "    Propagating $hint variable "'$'"$sym..."
16220                         eval 'tmp="$'"${sym}"'"'
16221                         echo "$tmp" | \
16222                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16223                 done
16224                 ;;
16225         esac
16226 fi
16227
16228 : Finish up by extracting the .SH files
16229 case "$alldone" in
16230 exit)
16231         $rm -rf UU
16232         echo "Done."
16233         exit 0
16234         ;;
16235 cont)
16236         ;;
16237 '')
16238         dflt=''
16239         nostick=true
16240         $cat <<EOM
16241
16242 If you'd like to make any changes to the config.sh file before I begin
16243 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16244
16245 EOM
16246         rp="Press return or use a shell escape to edit config.sh:"
16247         . UU/myread
16248         nostick=''
16249         case "$ans" in
16250         '') ;;
16251         *) : in case they cannot read
16252                 sh 1>&4 -c "$ans";;
16253         esac
16254         ;;
16255 esac
16256
16257 : if this fails, just run all the .SH files by hand
16258 . ./config.sh
16259
16260 echo " "
16261 exec 1>&4
16262 . ./UU/extract
16263
16264 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16265         dflt=y
16266         case "$silent" in
16267         true) ;;
16268         *)
16269                 $cat <<EOM
16270
16271 Now you need to generate make dependencies by running "$make depend".
16272 You might prefer to run it in background: "$make depend > makedepend.out &"
16273 It can take a while, so you might not want to run it right now.
16274
16275 EOM
16276                 ;;
16277         esac
16278         rp="Run $make depend now?"
16279         . UU/myread
16280         case "$ans" in
16281         y*)
16282                 $make depend && echo "Now you must run '$make'."
16283                 ;;
16284         *)
16285                 echo "You must run '$make depend' then '$make'."
16286                 ;;
16287         esac
16288 elif test -f [Mm]akefile; then
16289         echo " "
16290         echo "Now you must run a $make."
16291 else
16292         echo "Done."
16293 fi
16294
16295 if $test -f Policy.sh; then
16296     $cat <<EOM
16297
16298 If you compile $package on a different machine or from a different object
16299 directory, copy the Policy.sh file from this object directory to the
16300 new one before you run Configure -- this will help you with most of
16301 the policy defaults.
16302
16303 EOM
16304 fi
16305 if $test -f config.msg; then
16306     echo "Hmm.  I also noted the following information while running:"
16307     echo " "
16308     $cat config.msg >&4
16309     $rm -f config.msg
16310 fi
16311 $rm -f kit*isdone ark*isdone
16312 $rm -rf UU
16313
16314 : End of Configure
16315