Add FCNTL_CAN_LOCK.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Nov  4 01:58:40 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."; mv config.sh config.sh.old;;
2268         *)  echo "Fetching default answers from your old config.sh file..." >&4
2269                 tmp_n="$n"
2270                 tmp_c="$c"
2271                 tmp_sh="$sh"
2272                 . ./config.sh
2273                 cp config.sh UU
2274                 n="$tmp_n"
2275                 c="$tmp_c"
2276                 : Older versions did not always set $sh.  Catch re-use of such
2277                 : an old config.sh.
2278                 case "$sh" in
2279                 '') sh="$tmp_sh" ;;
2280                 esac
2281                 hint=previous
2282                 ;;
2283         esac
2284 fi
2285 . ./UU/checkcc
2286 if test ! -f config.sh; then
2287         $cat <<EOM
2288
2289 First time through, eh?  I have some defaults handy for some systems
2290 that need some extra help getting the Configure answers right:
2291
2292 EOM
2293         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2294         dflt=''
2295         : Half the following guesses are probably wrong... If you have better
2296         : tests or hints, please send them to perlbug@perl.org
2297         : The metaconfig authors would also appreciate a copy...
2298         $test -f /irix && osname=irix
2299         $test -f /xenix && osname=sco_xenix
2300         $test -f /dynix && osname=dynix
2301         $test -f /dnix && osname=dnix
2302         $test -f /lynx.os && osname=lynxos
2303         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2304         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2305         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2306         $test -f /bin/mips && /bin/mips && osname=mips
2307         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2308                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2309         $test -d /usr/apollo/bin && osname=apollo
2310         $test -f /etc/saf/_sactab && osname=svr4
2311         $test -d /usr/include/minix && osname=minix
2312         if $test -d /MachTen -o -d /MachTen_Folder; then
2313                 osname=machten
2314                 if $test -x /sbin/version; then
2315                         osvers=`/sbin/version | $awk '{print $2}' |
2316                         $sed -e 's/[A-Za-z]$//'`
2317                 elif $test -x /usr/etc/version; then
2318                         osvers=`/usr/etc/version | $awk '{print $2}' |
2319                         $sed -e 's/[A-Za-z]$//'`
2320                 else
2321                         osvers="$2.$3"
2322                 fi
2323         fi
2324
2325         $test -f /sys/posix.dll &&
2326                 $test -f /usr/bin/what &&
2327                 set X `/usr/bin/what /sys/posix.dll` &&
2328                 $test "$3" = UWIN &&
2329                 osname=uwin &&
2330                 osvers="$5"
2331
2332         if $test -f $uname; then
2333                 set X $myuname
2334                 shift
2335
2336                 case "$5" in
2337                 fps*) osname=fps ;;
2338                 mips*)
2339                         case "$4" in
2340                         umips) osname=umips ;;
2341                         *) osname=mips ;;
2342                         esac;;
2343                 [23]100) osname=mips ;;
2344                 next*) osname=next ;;
2345                 i386*)
2346                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2347                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2348                                 osname='sco'
2349                                 osvers=$tmp
2350                         elif $test -f /etc/kconfig; then
2351                                 osname=isc
2352                                 if test "$lns" = "$ln -s"; then
2353                                         osvers=4
2354                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2355                                         osvers=3
2356                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2357                                         osvers=2
2358                                 fi
2359                         fi
2360                         tmp=''
2361                         ;;
2362                 pc*)
2363                         if test -n "$DJGPP"; then
2364                                 osname=dos
2365                                 osvers=djgpp
2366                         fi
2367                         ;;
2368                 esac
2369
2370                 case "$1" in
2371                 aix) osname=aix
2372                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2373                         case "$tmp" in
2374                         'not found') osvers="$4"."$3" ;;
2375                         '<3240'|'<>3240') osvers=3.2.0 ;;
2376                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2377                         '=3250'|'>3250') osvers=3.2.5 ;;
2378                         *) osvers=$tmp;;
2379                         esac
2380                         ;;
2381                 bsd386) osname=bsd386
2382                         osvers=`$uname -r`
2383                         ;;
2384                 cygwin*) osname=cygwin
2385                         osvers="$3"
2386                         ;;
2387                 *dc.osx) osname=dcosx
2388                         osvers="$3"
2389                         ;;
2390                 dnix) osname=dnix
2391                         osvers="$3"
2392                         ;;
2393                 domainos) osname=apollo
2394                         osvers="$3"
2395                         ;;
2396                 dgux) osname=dgux 
2397                         osvers="$3"
2398                         ;;
2399                 dynixptx*) osname=dynixptx
2400                         osvers=`echo "$4"|sed 's/^v//'`
2401                         ;;
2402                 freebsd) osname=freebsd 
2403                         osvers="$3" ;;
2404                 genix) osname=genix ;;
2405                 hp*) osname=hpux 
2406                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2407                         ;;
2408                 irix*) osname=irix
2409                         case "$3" in
2410                         4*) osvers=4 ;;
2411                         5*) osvers=5 ;;
2412                         *)      osvers="$3" ;;
2413                         esac
2414                         ;;
2415                 linux) osname=linux
2416                         case "$3" in
2417                         *)      osvers="$3" ;;
2418                         esac
2419                         ;;
2420                 MiNT) osname=mint
2421                         ;;
2422                 netbsd*) osname=netbsd
2423                         osvers="$3"
2424                         ;;
2425                 news-os) osvers="$3"
2426                         case "$3" in
2427                         4*) osname=newsos4 ;;
2428                         *) osname=newsos ;;
2429                         esac
2430                         ;;
2431                 next*) osname=next ;;
2432                 nonstop-ux) osname=nonstopux ;;
2433                 POSIX-BC | posix-bc ) osname=posix-bc
2434                         osvers="$3"
2435                         ;;
2436                 powerux | power_ux | powermax_os | powermaxos | \
2437                 powerunix | power_unix) osname=powerux
2438                         osvers="$3"
2439                         ;;
2440                 qnx) osname=qnx
2441                         osvers="$4"
2442                         ;;
2443                 solaris) osname=solaris
2444                         case "$3" in
2445                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2446                         *)      osvers="$3" ;;
2447                         esac
2448                         ;;
2449                 sunos) osname=sunos
2450                         case "$3" in
2451                         5*) osname=solaris
2452                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2453                         *)      osvers="$3" ;;
2454                         esac
2455                         ;;
2456                 titanos) osname=titanos
2457                         case "$3" in
2458                         1*) osvers=1 ;;
2459                         2*) osvers=2 ;;
2460                         3*) osvers=3 ;;
2461                         4*) osvers=4 ;;
2462                         *)      osvers="$3" ;;
2463                         esac
2464                         ;;
2465                 ultrix) osname=ultrix
2466                         osvers="$3"
2467                         ;;
2468                 osf1|mls+)      case "$5" in
2469                                 alpha)
2470                                         osname=dec_osf
2471                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2472                                         case "$osvers" in
2473                                         [1-9].[0-9]*) ;;
2474                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2475                                         esac
2476                                         ;;
2477                         hp*)    osname=hp_osf1  ;;
2478                         mips)   osname=mips_osf1 ;;
2479                         esac
2480                         ;;
2481                 unixware) osname=svr5
2482                         osvers="$4"
2483                         ;;
2484                 uts) osname=uts
2485                         osvers="$3"
2486                         ;;
2487                 $2) case "$osname" in
2488                         *isc*) ;;
2489                         *freebsd*) ;;
2490                         svr*)
2491                                 : svr4.x or possibly later
2492                                 case "svr$3" in 
2493                                 ${osname}*)
2494                                         osname=svr$3
2495                                         osvers=$4
2496                                         ;;
2497                                 esac
2498                                 case "$osname" in
2499                                 svr4.0)
2500                                         : Check for ESIX
2501                                         if test -f /stand/boot ; then
2502                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2503                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2504                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2505                                                         if test -n "$isesix"; then
2506                                                                 osname=esix4
2507                                                         fi
2508                                                 fi
2509                                         fi
2510                                         ;;
2511                                 esac
2512                                 ;;
2513                         *)      if test -f /etc/systemid; then
2514                                         osname=sco
2515                                         set `echo $3 | $sed 's/\./ /g'` $4
2516                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2517                                                 osvers=$1.$2.$3
2518                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2519                                                 osvers=$1.$2
2520                                         elif $test -f $src/hints/sco_$1.sh; then
2521                                                 osvers=$1
2522                                         fi
2523                                 else
2524                                         case "$osname" in
2525                                         '') : Still unknown.  Probably a generic Sys V.
2526                                                 osname="sysv"
2527                                                 osvers="$3"
2528                                                 ;;
2529                                         esac
2530                                 fi
2531                                 ;;
2532                         esac
2533                         ;;
2534                 *)      case "$osname" in
2535                         '') : Still unknown.  Probably a generic BSD.
2536                                 osname="$1"
2537                                 osvers="$3"
2538                                 ;;
2539                         esac
2540                         ;;
2541                 esac
2542         else
2543                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2544                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2545                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2546                                 osname=news_os
2547                         fi
2548                         $rm -f UU/kernel.what
2549                 elif test -d c:/.; then
2550                         set X $myuname
2551                         osname=os2
2552                         osvers="$5"
2553                 fi
2554         fi
2555         
2556         : Now look for a hint file osname_osvers, unless one has been
2557         : specified already.
2558         case "$hintfile" in
2559         ''|' ')
2560                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2561                 : Also try without trailing minor version numbers.
2562                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2563                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2564                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2565                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2566                 case "$file" in
2567                 '') dflt=none ;;
2568                 *)  case "$osvers" in
2569                         '') dflt=$file
2570                                 ;;
2571                         *)  if $test -f $src/hints/$file.sh ; then
2572                                         dflt=$file
2573                                 elif $test -f $src/hints/$xfile.sh ; then
2574                                         dflt=$xfile
2575                                 elif $test -f $src/hints/$xxfile.sh ; then
2576                                         dflt=$xxfile
2577                                 elif $test -f $src/hints/$xxxfile.sh ; then
2578                                         dflt=$xxxfile
2579                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2580                                         dflt=$xxxxfile
2581                                 elif $test -f "$src/hints/${osname}.sh" ; then
2582                                         dflt="${osname}"
2583                                 else
2584                                         dflt=none
2585                                 fi
2586                                 ;;
2587                         esac
2588                         ;;
2589                 esac
2590                 if $test -f Policy.sh ; then
2591                         case "$dflt" in
2592                         *Policy*) ;;
2593                         none) dflt="Policy" ;;
2594                         *) dflt="Policy $dflt" ;;
2595                         esac
2596                 fi
2597                 ;;
2598         *)
2599                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2600                 ;;
2601         esac
2602
2603         if $test -f Policy.sh ; then
2604                 $cat <<EOM
2605
2606 There's also a Policy hint file available, which should make the
2607 site-specific (policy) questions easier to answer.
2608 EOM
2609
2610         fi
2611
2612         $cat <<EOM
2613
2614 You may give one or more space-separated answers, or "none" if appropriate.
2615 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2616 is a good thing.  DO NOT give a wrong version or a wrong OS.
2617
2618 EOM
2619
2620         rp="Which of these apply, if any?"
2621         . UU/myread
2622         tans=$ans
2623         for file in $tans; do
2624                 if $test X$file = XPolicy -a -f Policy.sh; then
2625                         . Policy.sh
2626                         $cat Policy.sh >> UU/config.sh
2627                 elif $test -f $src/hints/$file.sh; then
2628                         . $src/hints/$file.sh
2629                         $cat $src/hints/$file.sh >> UU/config.sh
2630                 elif $test X$tans = X -o X$tans = Xnone ; then
2631                         : nothing
2632                 else
2633                         : Give one chance to correct a possible typo.
2634                         echo "$file.sh does not exist"
2635                         dflt=$file
2636                         rp="hint to use instead?"
2637                         . UU/myread
2638                         for file in $ans; do
2639                                 if $test -f "$src/hints/$file.sh"; then
2640                                         . $src/hints/$file.sh
2641                                         $cat $src/hints/$file.sh >> UU/config.sh
2642                                 elif $test X$ans = X -o X$ans = Xnone ; then
2643                                         : nothing
2644                                 else
2645                                         echo "$file.sh does not exist -- ignored."
2646                                 fi
2647                         done
2648                 fi
2649         done
2650
2651         hint=recommended
2652         : Remember our hint file for later.
2653         if $test -f "$src/hints/$file.sh" ; then
2654                 hintfile="$file"
2655         else
2656                 hintfile=''
2657         fi
2658 fi
2659 cd UU
2660 ;;
2661 *)
2662         echo " "
2663         echo "Fetching default answers from $config_sh..." >&4
2664         tmp_n="$n"
2665         tmp_c="$c"
2666         cd ..
2667         cp $config_sh config.sh 2>/dev/null
2668         chmod +w config.sh
2669         . ./config.sh
2670         cd UU
2671         cp ../config.sh .
2672         n="$tmp_n"
2673         c="$tmp_c"
2674         hint=previous
2675         ;;
2676 esac
2677 test "$override" && . ./optdef.sh
2678 myuname="$newmyuname"
2679
2680 : Restore computed paths
2681 for file in $loclist $trylist; do
2682         eval $file="\$_$file"
2683 done
2684
2685 cat << EOM
2686
2687 Configure uses the operating system name and version to set some defaults.
2688 The default value is probably right if the name rings a bell. Otherwise,
2689 since spelling matters for me, either accept the default or answer "none"
2690 to leave it blank.
2691
2692 EOM
2693 case "$osname" in
2694         ''|' ')
2695                 case "$hintfile" in
2696                 ''|' '|none) dflt=none ;;
2697                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2698                 esac
2699                 ;;
2700         *) dflt="$osname" ;;
2701 esac
2702 rp="Operating system name?"
2703 . ./myread
2704 case "$ans" in
2705 none)  osname='' ;;
2706 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2707 esac
2708 echo " "
2709 case "$osvers" in
2710         ''|' ')
2711                 case "$hintfile" in
2712                 ''|' '|none) dflt=none ;;
2713                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2714                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2715                         case "$dflt" in
2716                         ''|' ') dflt=none ;;
2717                         esac
2718                         ;;
2719                 esac
2720                 ;;
2721         *) dflt="$osvers" ;;
2722 esac
2723 rp="Operating system version?"
2724 . ./myread
2725 case "$ans" in
2726 none)  osvers='' ;;
2727 *) osvers="$ans" ;;
2728 esac
2729
2730
2731 . ./posthint.sh
2732
2733 : who configured the system
2734 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2735 cf_by=`(logname) 2>/dev/null`
2736 case "$cf_by" in
2737 "")
2738         cf_by=`(whoami) 2>/dev/null`
2739         case "$cf_by" in
2740         "") cf_by=unknown ;;
2741         esac ;;
2742 esac
2743
2744 : set up the script used to warn in case of inconsistency
2745 cat <<EOS >whoa
2746 $startsh
2747 EOS
2748 cat <<'EOSC' >>whoa
2749 dflt=y
2750 echo " "
2751 echo "*** WHOA THERE!!! ***" >&4
2752 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2753 rp="    Keep the $hint value?"
2754 . ./myread
2755 case "$ans" in
2756 y) td=$was; tu=$was;;
2757 esac
2758 EOSC
2759
2760 : function used to set $1 to $val
2761 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2762 case "$val$was" in
2763 $define$undef) . ./whoa; eval "$var=\$td";;
2764 $undef$define) . ./whoa; eval "$var=\$tu";;
2765 *) eval "$var=$val";;
2766 esac'
2767
2768 case "$usethreads" in
2769 $define|true|[yY]*)     dflt='y';;
2770 *) dflt='n';;
2771 esac
2772 cat <<EOM
2773
2774 Perl can be built to take advantage of threads on some systems.
2775 To do so, Configure can be run with -Dusethreads.
2776
2777 Note that threading is a highly experimental feature, and
2778 some known race conditions still remain.  If you choose to try
2779 it, be very sure to not actually deploy it for production
2780 purposes.  README.threads has more details, and is required
2781 reading if you enable threads.
2782
2783 If this doesn't make any sense to you, just accept the default '$dflt'.
2784 EOM
2785 rp='Build a threading Perl?'
2786 . ./myread
2787 case "$ans" in
2788 y|Y)    val="$define" ;;
2789 *)      val="$undef" ;;
2790 esac
2791 set usethreads
2792 eval $setvar
2793
2794 case "$usethreads" in
2795 $define)
2796         $cat <<EOM
2797
2798 As of 5.5.640, Perl has two different internal threading implementations,
2799 the 5.005 version (5005threads) and an interpreter-based version
2800 (ithreads) that has one interpreter per thread.  Both are very 
2801 experimental.  This arrangement exists to help developers work out
2802 which one is better.
2803
2804 If you're a casual user, you probably don't want interpreter-threads
2805 at this time.  There doesn't yet exist a way to create threads from
2806 within Perl in this model, i.e., "use Thread;" will NOT work.
2807 EOM
2808         : Default to ithreads unless overridden on command line or with
2809         : old config.sh
2810         dflt='y'
2811         case "$use5005threads" in
2812                 $define|true|[yY]*) dflt='n';;
2813         esac
2814         case "$useithreads" in
2815                 $undef|false|[nN]*) dflt='n';;
2816         esac
2817         rp='Use interpreter-based ithreads?'
2818         . ./myread
2819         case "$ans" in
2820         y|Y)    val="$define" ;;
2821         *)      val="$undef" ;;
2822         esac
2823         set useithreads
2824         eval $setvar
2825         : Now set use5005threads to the opposite value.
2826         case "$useithreads" in
2827         $define) val="$undef" ;;
2828         *) val="$define" ;;
2829         esac
2830         set use5005threads
2831         eval $setvar
2832         ;;
2833 *)
2834         useithreads="$undef"
2835         use5005threads="$undef"
2836         ;;
2837 esac
2838
2839 case "$d_oldpthreads" in
2840 '')     : Configure tests would be welcome here.  For now, assume undef.
2841         val="$undef" ;;
2842 *)      val="$d_oldpthreads" ;;
2843 esac
2844 set d_oldpthreads
2845 eval $setvar
2846
2847
2848 case "$usethreads" in
2849 "$define"|true|[yY]*)
2850 : Look for a hint-file generated 'call-back-unit'.  If the
2851 : user has specified that a threading perl is to be built,
2852 : we may need to set or change some other defaults.
2853         if $test -f usethreads.cbu; then
2854                 echo "Your platform has some specific hints for threaded builds, using them..."
2855                 . ./usethreads.cbu
2856         else
2857                 $cat <<EOM
2858 (Your platform doesn't have any specific hints for threaded builds.
2859  Assuming POSIX threads, then.)
2860 EOM
2861         fi
2862         ;;
2863 esac
2864
2865 cat <<EOM
2866
2867 Perl can be built so that multiple Perl interpreters can coexist
2868 within the same Perl executable.
2869 EOM
2870
2871 case "$useithreads" in
2872 $define)
2873         cat <<EOM
2874 This multiple interpreter support is required for interpreter-based threads.
2875 EOM
2876         val="$define"
2877         ;;
2878 *)      case "$usemultiplicity" in
2879         $define|true|[yY]*)     dflt='y';;
2880         *) dflt='n';;
2881         esac
2882         echo " "
2883         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2884         rp='Build Perl for multiplicity?'
2885         . ./myread
2886         case "$ans" in
2887         y|Y)    val="$define" ;;
2888         *)      val="$undef" ;;
2889         esac
2890         ;;
2891 esac
2892 set usemultiplicity
2893 eval $setvar
2894
2895 : make some quick guesses about what we are up against
2896 echo " "
2897 $echo $n "Hmm...  $c"
2898 echo exit 1 >bsd
2899 echo exit 1 >usg
2900 echo exit 1 >v7
2901 echo exit 1 >osf1
2902 echo exit 1 >eunice
2903 echo exit 1 >xenix
2904 echo exit 1 >venix
2905 echo exit 1 >os2
2906 d_bsd="$undef"
2907 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2908 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2909 then
2910         echo "Looks kind of like an OSF/1 system, but we'll see..."
2911         echo exit 0 >osf1
2912 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2913         xxx=`./loc addbib blurfl $pth`
2914         if $test -f $xxx; then
2915         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2916                 echo exit 0 >bsd
2917                 echo exit 0 >usg
2918         else
2919                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2920                         echo "Looks kind of like an extended USG system, but we'll see..."
2921                 else
2922                         echo "Looks kind of like a USG system, but we'll see..."
2923                 fi
2924                 echo exit 0 >usg
2925         fi
2926 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2927         echo "Looks kind of like a BSD system, but we'll see..."
2928         d_bsd="$define"
2929         echo exit 0 >bsd
2930 else
2931         echo "Looks kind of like a Version 7 system, but we'll see..."
2932         echo exit 0 >v7
2933 fi
2934 case "$eunicefix" in
2935 *unixtovms*)
2936         $cat <<'EOI'
2937 There is, however, a strange, musty smell in the air that reminds me of
2938 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2939 EOI
2940         echo exit 0 >eunice
2941         d_eunice="$define"
2942 : it so happens the Eunice I know will not run shell scripts in Unix format
2943         ;;
2944 *)
2945         echo " "
2946         echo "Congratulations.  You aren't running Eunice."
2947         d_eunice="$undef"
2948         ;;
2949 esac
2950 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2951 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2952 : semicolon as a patch separator
2953 case "$p_" in
2954 :) ;;
2955 *)
2956         $cat <<'EOI'
2957 I have the feeling something is not exactly right, however...don't tell me...
2958 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2959 (Or you may be running DOS with DJGPP.)
2960 EOI
2961         echo exit 0 >os2
2962         ;;
2963 esac
2964 if test -f /xenix; then
2965         echo "Actually, this looks more like a XENIX system..."
2966         echo exit 0 >xenix
2967         d_xenix="$define"
2968 else
2969         echo " "
2970         echo "It's not Xenix..."
2971         d_xenix="$undef"
2972 fi
2973 chmod +x xenix
2974 $eunicefix xenix
2975 if test -f /venix; then
2976         echo "Actually, this looks more like a VENIX system..."
2977         echo exit 0 >venix
2978 else
2979         echo " "
2980         if ./xenix; then
2981                 : null
2982         else
2983                 echo "Nor is it Venix..."
2984         fi
2985 fi
2986 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2987 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2988 $rm -f foo
2989
2990 case "$cc" in
2991 '') dflt=cc;;
2992 *) dflt="$cc";;
2993 esac
2994 rp="Use which C compiler?"
2995 . ./myread
2996 cc="$ans"
2997 : Look for a hint-file generated 'call-back-unit'.  Now that the
2998 : user has specified the compiler, we may need to set or change some
2999 : other defaults.
3000 if $test -f cc.cbu; then
3001     . ./cc.cbu
3002 fi
3003 . ./checkcc
3004
3005 echo " "
3006 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3007 $cat >gccvers.c <<EOM
3008 #include <stdio.h>
3009 int main() {
3010 #ifdef __GNUC__
3011 #ifdef __VERSION__
3012         printf("%s\n", __VERSION__);
3013 #else
3014         printf("%s\n", "1");
3015 #endif
3016 #endif
3017         exit(0);
3018 }
3019 EOM
3020 if $cc -o gccvers $ldflags gccvers.c; then
3021         gccversion=`./gccvers`
3022         case "$gccversion" in
3023         '') echo "You are not using GNU cc." ;;
3024         *)  echo "You are using GNU cc $gccversion."
3025             ccname=gcc  
3026             ;;
3027         esac
3028 else
3029         echo " "
3030         echo "*** WHOA THERE!!! ***" >&4
3031         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3032         case "$knowitall" in
3033         '')
3034         echo "    You'd better start hunting for one and let me know about it." >&4
3035                 exit 1
3036                 ;;
3037         esac
3038 fi
3039 $rm -f gccvers*
3040 case "$gccversion" in
3041 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3042 esac
3043 case "$gccversion" in
3044 '') gccosandvers='' ;;
3045 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3046    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3047    gccshortvers=''
3048    case "$gccosandvers" in
3049    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3050    $osname$osvers) ;; # looking good
3051    $osname*) cat <<EOM >&4
3052
3053 *** WHOA THERE!!! ***
3054
3055     Your gcc has not been compiled for the exact release of
3056     your operating system ($gccosandvers versus $osname$osvers).
3057
3058     In general it is a good idea to keep gcc synchronized with
3059     the operating system because otherwise serious problems
3060     may ensue when trying to compile software, like Perl.
3061
3062     I'm trying to be optimistic here, though, and will continue.
3063     If later during the configuration and build icky compilation
3064     problems appear (headerfile conflicts being the most common
3065     manifestation), I suggest reinstalling the gcc to match
3066     your operating system release.
3067
3068 EOM
3069       ;;
3070    *) gccosandvers='' ;; # failed to parse, better be silent
3071    esac
3072    ;;
3073 esac
3074 case "$ccname" in
3075 '') ccname="$cc" ;;
3076 esac
3077
3078 : see how we invoke the C preprocessor
3079 echo " "
3080 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3081 cat <<'EOT' >testcpp.c
3082 #define ABC abc
3083 #define XYZ xyz
3084 ABC.XYZ
3085 EOT
3086 cd ..
3087 if test ! -f cppstdin; then
3088         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3089                 # AIX cc -E doesn't show the absolute headerfile
3090                 # locations but we'll cheat by using the -M flag.
3091                 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
3092         else
3093                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3094         fi
3095 else
3096         echo "Keeping your $hint cppstdin wrapper."
3097 fi
3098 chmod 755 cppstdin
3099 wrapper=`pwd`/cppstdin
3100 ok='false'
3101 cd UU
3102
3103 if $test "X$cppstdin" != "X" && \
3104         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3105         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3106 then
3107         echo "You used to use $cppstdin $cppminus so we'll use that again."
3108         case "$cpprun" in
3109         '') echo "But let's see if we can live without a wrapper..." ;;
3110         *)
3111                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3112                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3113                 then
3114                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3115                         ok='true'
3116                 else
3117                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3118                 fi
3119                 ;;
3120         esac
3121 else
3122         case "$cppstdin" in
3123         '') ;;
3124         *)
3125                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3126                 ;;
3127         esac
3128 fi
3129
3130 if $ok; then
3131         : nothing
3132 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3133         $cc -E <testcpp.c >testcpp.out 2>&1; \
3134         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3135         echo "Yup, it does."
3136         x_cpp="$cc -E"
3137         x_minus='';
3138 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3139         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3140         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3141         echo "Yup, it does."
3142         x_cpp="$cc -E"
3143         x_minus='-';
3144 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3145         $cc -P <testcpp.c >testcpp.out 2>&1; \
3146         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3147         echo "Yipee, that works!"
3148         x_cpp="$cc -P"
3149         x_minus='';
3150 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3151         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3152         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3153         echo "At long last!"
3154         x_cpp="$cc -P"
3155         x_minus='-';
3156 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3157         $cpp <testcpp.c >testcpp.out 2>&1; \
3158         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3159         echo "It works!"
3160         x_cpp="$cpp"
3161         x_minus='';
3162 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3163         $cpp - <testcpp.c >testcpp.out 2>&1; \
3164         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3165         echo "Hooray, it works!  I was beginning to wonder."
3166         x_cpp="$cpp"
3167         x_minus='-';
3168 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3169         $wrapper <testcpp.c >testcpp.out 2>&1; \
3170         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3171         x_cpp="$wrapper"
3172         x_minus=''
3173         echo "Eureka!"
3174 else
3175         dflt=''
3176         rp="No dice.  I can't find a C preprocessor.  Name one:"
3177         . ./myread
3178         x_cpp="$ans"
3179         x_minus=''
3180         $x_cpp <testcpp.c >testcpp.out 2>&1
3181         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3182                 echo "OK, that will do." >&4
3183         else
3184 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3185                 exit 1
3186         fi
3187 fi
3188
3189 case "$ok" in
3190 false)
3191         cppstdin="$x_cpp"
3192         cppminus="$x_minus"
3193         cpprun="$x_cpp"
3194         cpplast="$x_minus"
3195         set X $x_cpp
3196         shift
3197         case "$1" in
3198         "$cpp")
3199                 echo "Perhaps can we force $cc -E using a wrapper..."
3200                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3201                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3202                 then
3203                         echo "Yup, we can."
3204                         cppstdin="$wrapper"
3205                         cppminus='';
3206                 else
3207                         echo "Nope, we'll have to live without it..."
3208                 fi
3209                 ;;
3210         esac
3211         case "$cpprun" in
3212         "$wrapper")
3213                 cpprun=''
3214                 cpplast=''
3215                 ;;
3216         esac
3217         ;;
3218 esac
3219
3220 case "$cppstdin" in
3221 "$wrapper"|'cppstdin') ;;
3222 *) $rm -f $wrapper;;
3223 esac
3224 $rm -f testcpp.c testcpp.out
3225
3226 : decide how portable to be.  Allow command line overrides.
3227 case "$d_portable" in
3228 "$undef") ;;
3229 *)      d_portable="$define" ;;
3230 esac
3231
3232 : set up shell script to do ~ expansion
3233 cat >filexp <<EOSS
3234 $startsh
3235 : expand filename
3236 case "\$1" in
3237  ~/*|~)
3238         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3239         ;;
3240  ~*)
3241         if $test -f /bin/csh; then
3242                 /bin/csh -f -c "glob \$1"
3243                 failed=\$?
3244                 echo ""
3245                 exit \$failed
3246         else
3247                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3248                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3249                 if $test ! -d "\$dir"; then
3250                         me=\`basename \$0\`
3251                         echo "\$me: can't locate home directory for: \$name" >&2
3252                         exit 1
3253                 fi
3254                 case "\$1" in
3255                 */*)
3256                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3257                         ;;
3258                 *)
3259                         echo \$dir
3260                         ;;
3261                 esac
3262         fi
3263         ;;
3264 *)
3265         echo \$1
3266         ;;
3267 esac
3268 EOSS
3269 chmod +x filexp
3270 $eunicefix filexp
3271
3272 : now set up to get a file name
3273 cat <<EOS >getfile
3274 $startsh
3275 EOS
3276 cat <<'EOSC' >>getfile
3277 tilde=''
3278 fullpath=''
3279 already=''
3280 skip=''
3281 none_ok=''
3282 exp_file=''
3283 nopath_ok=''
3284 orig_rp="$rp"
3285 orig_dflt="$dflt"
3286 case "$gfpth" in
3287 '') gfpth='.' ;;
3288 esac
3289
3290 case "$fn" in
3291 *\(*)
3292         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3293         fn=`echo $fn | sed 's/(.*)//'`
3294         ;;
3295 esac
3296
3297 case "$fn" in
3298 *:*)
3299         loc_file=`expr $fn : '.*:\(.*\)'`
3300         fn=`expr $fn : '\(.*\):.*'`
3301         ;;
3302 esac
3303
3304 case "$fn" in
3305 *~*) tilde=true;;
3306 esac
3307 case "$fn" in
3308 */*) fullpath=true;;
3309 esac
3310 case "$fn" in
3311 *+*) skip=true;;
3312 esac
3313 case "$fn" in
3314 *n*) none_ok=true;;
3315 esac
3316 case "$fn" in
3317 *e*) exp_file=true;;
3318 esac
3319 case "$fn" in
3320 *p*) nopath_ok=true;;
3321 esac
3322
3323 case "$fn" in
3324 *f*) type='File';;
3325 *d*) type='Directory';;
3326 *l*) type='Locate';;
3327 esac
3328
3329 what="$type"
3330 case "$what" in
3331 Locate) what='File';;
3332 esac
3333
3334 case "$exp_file" in
3335 '')
3336         case "$d_portable" in
3337         "$define") ;;
3338         *) exp_file=true;;
3339         esac
3340         ;;
3341 esac
3342
3343 cd ..
3344 while test "$type"; do
3345         redo=''
3346         rp="$orig_rp"
3347         dflt="$orig_dflt"
3348         case "$tilde" in
3349         true) rp="$rp (~name ok)";;
3350         esac
3351         . UU/myread
3352         if test -f UU/getfile.ok && \
3353                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3354         then
3355                 value="$ans"
3356                 ansexp="$ans"
3357                 break
3358         fi
3359         case "$ans" in
3360         none)
3361                 value=''
3362                 ansexp=''
3363                 case "$none_ok" in
3364                 true) type='';;
3365                 esac
3366                 ;;
3367         *)
3368                 case "$tilde" in
3369                 '') value="$ans"
3370                         ansexp="$ans";;
3371                 *)
3372                         value=`UU/filexp $ans`
3373                         case $? in
3374                         0)
3375                                 if test "$ans" != "$value"; then
3376                                         echo "(That expands to $value on this system.)"
3377                                 fi
3378                                 ;;
3379                         *) value="$ans";;
3380                         esac
3381                         ansexp="$value"
3382                         case "$exp_file" in
3383                         '') value="$ans";;
3384                         esac
3385                         ;;
3386                 esac
3387                 case "$fullpath" in
3388                 true)
3389                         case "$ansexp" in
3390                         /*) value="$ansexp" ;;
3391                         [a-zA-Z]:/*) value="$ansexp" ;;
3392                         *)
3393                                 redo=true
3394                                 case "$already" in
3395                                 true)
3396                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3397                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3398                                         ;;
3399                                 *)
3400                                 echo "Please give a full path name, starting with slash." >&4
3401                                         case "$tilde" in
3402                                         true)
3403                                 echo "Note that using ~name is ok provided it expands well." >&4
3404                                                 already=true
3405                                                 ;;
3406                                         esac
3407                                 esac
3408                                 ;;
3409                         esac
3410                         ;;
3411                 esac
3412                 case "$redo" in
3413                 '')
3414                         case "$type" in
3415                         File)
3416                                 for fp in $gfpth; do
3417                                         if test "X$fp" = X.; then
3418                                             pf="$ansexp"
3419                                         else    
3420                                             pf="$fp/$ansexp"
3421                                         fi
3422                                         if test -f "$pf"; then
3423                                                 type=''
3424                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3425                                         then
3426                                                 echo "($value is not a plain file, but that's ok.)"
3427                                                 type=''
3428                                         fi
3429                                         if test X"$type" = X; then
3430                                             value="$pf"
3431                                             break
3432                                         fi
3433                                 done
3434                                 ;;
3435                         Directory)
3436                                 for fp in $gfpth; do
3437                                         if test "X$fp" = X.; then
3438                                             dir="$ans"
3439                                             direxp="$ansexp"
3440                                         else    
3441                                             dir="$fp/$ansexp"
3442                                             direxp="$fp/$ansexp"
3443                                         fi
3444                                         if test -d "$direxp"; then
3445                                                 type=''
3446                                                 value="$dir"
3447                                                 break
3448                                         fi
3449                                 done
3450                                 ;;
3451                         Locate)
3452                                 if test -d "$ansexp"; then
3453                                         echo "(Looking for $loc_file in directory $value.)"
3454                                         value="$value/$loc_file"
3455                                         ansexp="$ansexp/$loc_file"
3456                                 fi
3457                                 if test -f "$ansexp"; then
3458                                         type=''
3459                                 fi
3460                                 case "$nopath_ok" in
3461                                 true)   case "$value" in
3462                                         */*) ;;
3463                                         *)      echo "Assuming $value will be in people's path."
3464                                                 type=''
3465                                                 ;;
3466                                         esac
3467                                         ;;
3468                                 esac
3469                                 ;;
3470                         esac
3471
3472                         case "$skip" in
3473                         true) type='';
3474                         esac
3475
3476                         case "$type" in
3477                         '') ;;
3478                         *)
3479                                 if test "$fastread" = yes; then
3480                                         dflt=y
3481                                 else
3482                                         dflt=n
3483                                 fi
3484                                 rp="$what $value doesn't exist.  Use that name anyway?"
3485                                 . UU/myread
3486                                 dflt=''
3487                                 case "$ans" in
3488                                 y*) type='';;
3489                                 *) echo " ";;
3490                                 esac
3491                                 ;;
3492                         esac
3493                         ;;
3494                 esac
3495                 ;;
3496         esac
3497 done
3498 cd UU
3499 ans="$value"
3500 rp="$orig_rp"
3501 dflt="$orig_dflt"
3502 rm -f getfile.ok
3503 test "X$gfpthkeep" != Xy && gfpth=""
3504 EOSC
3505
3506 : What should the include directory be ?
3507 echo " "
3508 $echo $n "Hmm...  $c"
3509 dflt='/usr/include'
3510 incpath=''
3511 mips_type=''
3512 if $test -f /bin/mips && /bin/mips; then
3513         echo "Looks like a MIPS system..."
3514         $cat >usr.c <<'EOCP'
3515 #ifdef SYSTYPE_BSD43
3516 /bsd43
3517 #endif
3518 EOCP
3519         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3520                 dflt='/bsd43/usr/include'
3521                 incpath='/bsd43'
3522                 mips_type='BSD 4.3'
3523         else
3524                 mips_type='System V'
3525         fi
3526         $rm -f usr.c usr.out
3527         echo "and you're compiling with the $mips_type compiler and libraries."
3528         xxx_prompt=y
3529         echo "exit 0" >mips
3530 else
3531         echo "Doesn't look like a MIPS system."
3532         xxx_prompt=n
3533         echo "exit 1" >mips
3534 fi
3535 chmod +x mips
3536 $eunicefix mips
3537 case "$usrinc" in
3538 '') ;;
3539 *) dflt="$usrinc";;
3540 esac
3541 case "$xxx_prompt" in
3542 y)      fn=d/
3543         echo " "
3544         rp='Where are the include files you want to use?'
3545         . ./getfile
3546         usrinc="$ans"
3547         ;;
3548 *)      usrinc="$dflt"
3549         ;;
3550 esac
3551
3552 : Set private lib path
3553 case "$plibpth" in
3554 '') if ./mips; then
3555                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3556         fi;;
3557 esac
3558 case "$libpth" in
3559 ' ') dlist='';;
3560 '') dlist="$loclibpth $plibpth $glibpth";;
3561 *) dlist="$libpth";;
3562 esac
3563
3564 : Now check and see which directories actually exist, avoiding duplicates
3565 libpth=''
3566 for xxx in $dlist
3567 do
3568     if $test -d $xxx; then
3569                 case " $libpth " in
3570                 *" $xxx "*) ;;
3571                 *) libpth="$libpth $xxx";;
3572                 esac
3573     fi
3574 done
3575 $cat <<'EOM'
3576
3577 Some systems have incompatible or broken versions of libraries.  Among
3578 the directories listed in the question below, please remove any you
3579 know not to be holding relevant libraries, and add any that are needed.
3580 Say "none" for none.
3581
3582 EOM
3583 case "$libpth" in
3584 '') dflt='none';;
3585 *)
3586         set X $libpth
3587         shift
3588         dflt=${1+"$@"}
3589         ;;
3590 esac
3591 rp="Directories to use for library searches?"
3592 . ./myread
3593 case "$ans" in
3594 none) libpth=' ';;
3595 *) libpth="$ans";;
3596 esac
3597
3598 : compute shared library extension
3599 case "$so" in
3600 '')
3601         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3602                 dflt='sl'
3603         else
3604                 dflt='so'
3605         fi
3606         ;;
3607 *) dflt="$so";;
3608 esac
3609 $cat <<EOM
3610
3611 On some systems, shared libraries may be available.  Answer 'none' if
3612 you want to suppress searching of shared libraries for the remainder
3613 of this configuration.
3614
3615 EOM
3616 rp='What is the file extension used for shared libraries?'
3617 . ./myread
3618 so="$ans"
3619
3620 : Define several unixisms.
3621 : Hints files or command line option can be used to override them.
3622 : The convoluted testing is in case hints files set either the old
3623 : or the new name.
3624 case "$_exe" in
3625 '')     case "$exe_ext" in
3626     '') ;;
3627         *)      _exe="$exe_ext" ;;
3628         esac
3629         ;;
3630 esac
3631 case "$_a" in
3632 '')     case "$lib_ext" in
3633     '') _a='.a';;
3634         *)      _a="$lib_ext" ;;
3635         esac
3636         ;;
3637 esac
3638 case "$_o" in
3639 '') case "$obj_ext" in
3640         '')     _o='.o';;
3641         *)      _o="$obj_ext";;
3642         esac
3643         ;;
3644 esac
3645 case "$p_" in
3646 '') case "$path_sep" in
3647         '')     p_=':';;
3648         *)      p_="$path_sep";;
3649         esac
3650         ;;
3651 esac
3652 exe_ext=$_exe
3653 lib_ext=$_a
3654 obj_ext=$_o
3655 path_sep=$p_
3656
3657 : Which makefile gets called first.  This is used by make depend.
3658 case "$firstmakefile" in
3659 '') firstmakefile='makefile';;
3660 esac
3661
3662 case "$usesocks" in
3663 $define|true|[yY]*)     dflt='y';;
3664 *) dflt='n';;
3665 esac
3666 cat <<EOM
3667
3668 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3669 Configure must be run with -Dusesocks.
3670
3671 If this doesn't make any sense to you, just accept the default '$dflt'.
3672 EOM
3673 rp='Build Perl for SOCKS?'
3674 . ./myread
3675 case "$ans" in
3676 y|Y)    val="$define" ;;     
3677 *)      val="$undef" ;;
3678 esac
3679 set usesocks
3680 eval $setvar
3681
3682 : Looking for optional libraries
3683 echo " "
3684 echo "Checking for optional libraries..." >&4
3685 case "$libs" in
3686 ' '|'') dflt='';;
3687 *) dflt="$libs";;
3688 esac
3689 case "$libswanted" in
3690 '') libswanted='c_s';;
3691 esac
3692 case "$usesocks" in
3693 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3694 esac
3695 libsfound=''
3696 libsfiles=''
3697 libsdirs=''
3698 libspath=''
3699 for thisdir in $libpth $xlibpth; do
3700   test -d $thisdir && libspath="$libspath $thisdir"
3701 done
3702 for thislib in $libswanted; do
3703         for thisdir in $libspath; do
3704             xxx=''
3705             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3706                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3707                 $test -f "$xxx" && eval $libscheck
3708                 $test -f "$xxx" && libstyle=shared
3709             fi
3710             if test ! -f "$xxx"; then
3711                 xxx=$thisdir/lib$thislib.$so
3712                 $test -f "$xxx" && eval $libscheck
3713                 $test -f "$xxx" && libstyle=shared
3714             fi  
3715             if test ! -f "$xxx"; then
3716                 xxx=$thisdir/lib$thislib$_a
3717                 $test -f "$xxx" && eval $libscheck
3718                 $test -f "$xxx" && libstyle=static
3719             fi
3720             if test ! -f "$xxx"; then
3721                 xxx=$thisdir/$thislib$_a
3722                 $test -f "$xxx" && eval $libscheck
3723                 $test -f "$xxx" && libstyle=static
3724             fi
3725             if test ! -f "$xxx"; then
3726                 xxx=$thisdir/lib${thislib}_s$_a
3727                 $test -f "$xxx" && eval $libscheck
3728                 $test -f "$xxx" && libstyle=static
3729                 $test -f "$xxx" && thislib=${thislib}_s
3730             fi
3731             if test ! -f "$xxx"; then
3732                 xxx=$thisdir/Slib$thislib$_a
3733                 $test -f "$xxx" && eval $libscheck
3734                 $test -f "$xxx" && libstyle=static
3735             fi
3736             if $test -f "$xxx"; then
3737                 case "$libstyle" in
3738                 shared) echo "Found -l$thislib (shared)." ;;
3739                 static) echo "Found -l$thislib." ;;
3740                 *)      echo "Found -l$thislib ($libstyle)." ;;
3741                 esac
3742                 case " $dflt " in
3743                 *"-l$thislib "*);;
3744                 *) dflt="$dflt -l$thislib"
3745                    libsfound="$libsfound $xxx"
3746                    yyy=`basename $xxx`
3747                    libsfiles="$libsfiles $yyy"
3748                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3749                    case " $libsdirs " in
3750                    *" $yyy "*) ;;
3751                    *) libsdirs="$libsdirs $yyy" ;;
3752                    esac
3753                    ;;
3754                 esac
3755                 break
3756             fi  
3757         done
3758         if $test ! -f "$xxx"; then
3759             echo "No -l$thislib."
3760         fi
3761 done
3762 set X $dflt
3763 shift
3764 dflt="$*"
3765 case "$libs" in
3766 '') dflt="$dflt";;
3767 *) dflt="$libs";;
3768 esac
3769 case "$dflt" in
3770 ' '|'') dflt='none';;
3771 esac
3772
3773 $cat <<EOM
3774
3775 In order to compile $package on your machine, a number of libraries
3776 are usually needed.  Include any other special libraries here as well.
3777 Say "none" for none.  The default list is almost always right.
3778 EOM
3779
3780 echo " "
3781 rp="What libraries to use?"
3782 . ./myread
3783 case "$ans" in
3784 none) libs=' ';;
3785 *) libs="$ans";;
3786 esac
3787
3788 : determine optimization, if desired, or use for debug flag also
3789 case "$optimize" in
3790 ' '|$undef) dflt='none';;
3791 '') dflt='-O';;
3792 *) dflt="$optimize";;
3793 esac
3794 $cat <<EOH
3795
3796 By default, $package compiles with the -O flag to use the optimizer.
3797 Alternately, you might want to use the symbolic debugger, which uses
3798 the -g flag (on traditional Unix systems).  Either flag can be
3799 specified here.  To use neither flag, specify the word "none".
3800
3801 EOH
3802 rp="What optimizer/debugger flag should be used?"
3803 . ./myread
3804 optimize="$ans"
3805 case "$optimize" in
3806 'none') optimize=" ";;
3807 esac
3808
3809 dflt=''
3810 : We will not override a previous value, but we might want to
3811 : augment a hint file
3812 case "$hint" in
3813 default|recommended)
3814         case "$gccversion" in
3815         1*) dflt='-fpcc-struct-return' ;;
3816         esac
3817         case "$optimize" in
3818         *-g*) dflt="$dflt -DDEBUGGING";;
3819         esac
3820         case "$gccversion" in
3821         2*) if test -d /etc/conf/kconfig.d &&
3822                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3823                 then
3824                         dflt="$dflt -posix"
3825                 fi
3826                 ;;
3827         esac
3828         case "$gccversion" in
3829         1*) ;;
3830         2.[0-8]*) ;;
3831         ?*)     echo " "
3832                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3833                 echo 'int main(void) { return 0; }' > gcctest.c
3834                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3835                         echo "Yes, it does." 2>&1
3836                         case "$ccflags" in
3837                         *strict-aliasing*) 
3838                                 echo "Leaving current flags $ccflags alone." 2>&1
3839                                 ;;
3840                         *) dflt="$dflt -fno-strict-aliasing" ;;
3841                         esac
3842                 else
3843                         echo "Nope, it doesn't, but that's ok." 2>&1
3844                 fi
3845                 ;;
3846         esac
3847         ;;
3848 esac
3849
3850 case "$mips_type" in
3851 *BSD*|'') inclwanted="$locincpth $usrinc";;
3852 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3853 esac
3854 for thisincl in $inclwanted; do
3855         if $test -d $thisincl; then
3856                 if $test x$thisincl != x$usrinc; then
3857                         case "$dflt" in
3858                         *" -I$thisincl "*);;
3859                         *) dflt="$dflt -I$thisincl ";;
3860                         esac
3861                 fi
3862         fi
3863 done
3864
3865 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3866         xxx=true;
3867 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3868         xxx=true;
3869 else
3870         xxx=false;
3871 fi;
3872 if $xxx; then
3873         case "$dflt" in
3874         *$2*);;
3875         *) dflt="$dflt -D$2";;
3876         esac;
3877 fi'
3878
3879 set signal.h LANGUAGE_C; eval $inctest
3880
3881 case "$usesocks" in
3882 $define)
3883         ccflags="$ccflags -DSOCKS"
3884         ;;
3885 esac
3886
3887 case "$hint" in
3888 default|recommended) dflt="$ccflags $dflt" ;;
3889 *) dflt="$ccflags";;
3890 esac
3891
3892 case "$dflt" in
3893 ''|' ') dflt=none;;
3894 esac
3895
3896 $cat <<EOH
3897
3898 Your C compiler may want other flags.  For this question you should include
3899 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3900 but you should NOT include libraries or ld flags like -lwhatever.  If you
3901 want $package to honor its debug switch, you should include -DDEBUGGING here.
3902 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3903
3904 To use no flags, specify the word "none".
3905
3906 EOH
3907 set X $dflt
3908 shift
3909 dflt=${1+"$@"}
3910 rp="Any additional cc flags?"
3911 . ./myread
3912 case "$ans" in
3913 none) ccflags='';;
3914 *) ccflags="$ans";;
3915 esac
3916
3917 : the following weeds options from ccflags that are of no interest to cpp
3918 cppflags="$ccflags"
3919 case "$gccversion" in
3920 1*) cppflags="$cppflags -D__GNUC__"
3921 esac
3922 case "$mips_type" in
3923 '');;
3924 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3925 esac
3926 case "$cppflags" in
3927 '');;
3928 *)
3929         echo " "
3930         echo "Let me guess what the preprocessor flags are..." >&4
3931         set X $cppflags
3932         shift
3933         cppflags=''
3934         $cat >cpp.c <<'EOM'
3935 #define BLURFL foo
3936
3937 BLURFL xx LFRULB
3938 EOM
3939         previous=''
3940         for flag in $*
3941         do
3942                 case "$flag" in
3943                 -*) ftry="$flag";;
3944                 *) ftry="$previous $flag";;
3945                 esac
3946                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3947                         >cpp1.out 2>/dev/null && \
3948                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3949                         >cpp2.out 2>/dev/null && \
3950                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3951                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3952                 then
3953                         cppflags="$cppflags $ftry"
3954                         previous=''
3955                 else
3956                         previous="$flag"
3957                 fi
3958         done
3959         set X $cppflags
3960         shift
3961         cppflags=${1+"$@"}
3962         case "$cppflags" in
3963         *-*)  echo "They appear to be: $cppflags";;
3964         esac
3965         $rm -f cpp.c cpp?.out
3966         ;;
3967 esac
3968
3969 : flags used in final linking phase
3970 case "$ldflags" in
3971 '') if ./venix; then
3972                 dflt='-i -z'
3973         else
3974                 dflt=''
3975         fi
3976         case "$ccflags" in
3977         *-posix*) dflt="$dflt -posix" ;;
3978         esac
3979         ;;
3980 *) dflt="$ldflags";;
3981 esac
3982
3983 : Try to guess additional flags to pick up local libraries.
3984 for thislibdir in $libpth; do
3985         case " $loclibpth " in
3986         *" $thislibdir "*)
3987                 case "$dflt " in 
3988                 *"-L$thislibdir "*) ;;
3989                 *)  dflt="$dflt -L$thislibdir" ;;
3990                 esac
3991                 ;;
3992         esac
3993 done
3994
3995 case "$dflt" in
3996 '') dflt='none' ;;
3997 esac
3998
3999 $cat <<EOH
4000
4001 Your C linker may need flags.  For this question you should
4002 include -L/whatever and any other flags used by the C linker, but you
4003 should NOT include libraries like -lwhatever.
4004
4005 Make sure you include the appropriate -L/path flags if your C linker
4006 does not normally search all of the directories you specified above,
4007 namely
4008         $libpth
4009 To use no flags, specify the word "none".
4010
4011 EOH
4012
4013 rp="Any additional ld flags (NOT including libraries)?"
4014 . ./myread
4015 case "$ans" in
4016 none) ldflags='';;
4017 *) ldflags="$ans";;
4018 esac
4019 rmlist="$rmlist pdp11"
4020
4021 : coherency check
4022 echo " "
4023 echo "Checking your choice of C compiler and flags for coherency..." >&4
4024 $cat > try.c <<'EOF'
4025 #include <stdio.h>
4026 int main() { printf("Ok\n"); exit(0); }
4027 EOF
4028 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4029 shift
4030 $cat >try.msg <<'EOM'
4031 I've tried to compile and run the following simple program:
4032
4033 EOM
4034 $cat try.c >> try.msg
4035
4036 $cat >> try.msg <<EOM
4037
4038 I used the command:
4039
4040         $*
4041         ./try
4042
4043 and I got the following output:
4044
4045 EOM
4046 dflt=y
4047 if sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4048         if sh -c './try' >>try.msg 2>&1; then
4049                 xxx=`./try`
4050                 case "$xxx" in
4051                 "Ok") dflt=n ;;
4052                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4053                         case " $libs " in
4054                         *" -lsfio "*)
4055                                 cat >> try.msg <<'EOQS'
4056 If $libs contains -lsfio, and sfio is mis-configured, then it
4057 sometimes (apparently) runs and exits with a 0 status, but with no
4058 output!  It may have to do with sfio's use of _exit vs. exit.
4059
4060 EOQS
4061                                 rp="You have a big problem.  Shall I abort Configure"
4062                                 dflt=y
4063                                 ;;
4064                         esac
4065                         ;;
4066                 esac
4067         else
4068                 echo "The program compiled OK, but exited with status $?." >>try.msg
4069                 rp="You have a problem.  Shall I abort Configure"
4070                 dflt=y
4071         fi
4072 else
4073         echo "I can't compile the test program." >>try.msg
4074         rp="You have a BIG problem.  Shall I abort Configure"
4075         dflt=y
4076 fi
4077 case "$dflt" in
4078 y)
4079         $cat try.msg >&4
4080         case "$knowitall" in
4081         '')
4082                 echo "(The supplied flags or libraries might be incorrect.)"
4083                 ;;
4084         *) dflt=n;;
4085         esac
4086         echo " "
4087         . ./myread
4088         case "$ans" in
4089         n*|N*) ;;
4090         *)      echo "Ok.  Stopping Configure." >&4
4091                 exit 1
4092                 ;;
4093         esac
4094         ;;
4095 n) echo "OK, that should do.";;
4096 esac
4097 $rm -f try try.* core
4098
4099 : define an is-a-typedef? function
4100 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4101 case "$inclist" in
4102 "") inclist="sys/types.h";;
4103 esac;
4104 eval "varval=\$$var";
4105 case "$varval" in
4106 "")
4107         $rm -f temp.c;
4108         for inc in $inclist; do
4109                 echo "#include <$inc>" >>temp.c;
4110         done;
4111         echo "#ifdef $type" >> temp.c;
4112         echo "printf(\"We have $type\");" >> temp.c;
4113         echo "#endif" >> temp.c;
4114         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4115         if $contains $type temp.E >/dev/null 2>&1; then
4116                 eval "$var=\$type";
4117         else
4118                 eval "$var=\$def";
4119         fi;
4120         $rm -f temp.?;;
4121 *) eval "$var=\$varval";;
4122 esac'
4123
4124 : define an is-a-typedef? function that prompts if the type is not available.
4125 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4126 case "$inclist" in
4127 "") inclist="sys/types.h";;
4128 esac;
4129 eval "varval=\$$var";
4130 case "$varval" in
4131 "")
4132         $rm -f temp.c;
4133         for inc in $inclist; do
4134                 echo "#include <$inc>" >>temp.c;
4135         done;
4136         echo "#ifdef $type" >> temp.c;
4137         echo "printf(\"We have $type\");" >> temp.c;
4138         echo "#endif" >> temp.c;
4139         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4140         echo " " ;
4141         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4142         if $contains $type temp.E >/dev/null 2>&1; then
4143                 echo "$type found." >&4;
4144                 eval "$var=\$type";
4145         else
4146                 echo "$type NOT found." >&4;
4147                 dflt="$def";
4148                 . ./myread ;
4149                 eval "$var=\$ans";
4150         fi;
4151         $rm -f temp.?;;
4152 *) eval "$var=\$varval";;
4153 esac'
4154
4155 : define a shorthand compile call
4156 compile='
4157 mc_file=$1;
4158 shift;
4159 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4160 : define a shorthand compile call for compilations that should be ok.
4161 compile_ok='
4162 mc_file=$1;
4163 shift;
4164 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4165
4166 : check for lengths of integral types
4167 echo " "
4168 case "$intsize" in
4169 '')
4170         echo "Checking to see how big your integers are..." >&4
4171         $cat >intsize.c <<'EOCP'
4172 #include <stdio.h>
4173 int main()
4174 {
4175         printf("intsize=%d;\n", (int)sizeof(int));
4176         printf("longsize=%d;\n", (int)sizeof(long));
4177         printf("shortsize=%d;\n", (int)sizeof(short));
4178         exit(0);
4179 }
4180 EOCP
4181         set intsize
4182         if eval $compile_ok && ./intsize > /dev/null; then
4183                 eval `./intsize`
4184                 echo "Your integers are $intsize bytes long."
4185                 echo "Your long integers are $longsize bytes long."
4186                 echo "Your short integers are $shortsize bytes long."
4187         else
4188                 $cat >&4 <<EOM
4189 !
4190 Help! I can't compile and run the intsize test program: please enlighten me!
4191 (This is probably a misconfiguration in your system or libraries, and
4192 you really ought to fix it.  Still, I'll try anyway.)
4193 !
4194 EOM
4195                 dflt=4
4196                 rp="What is the size of an integer (in bytes)?"
4197                 . ./myread
4198                 intsize="$ans"
4199                 dflt=$intsize
4200                 rp="What is the size of a long integer (in bytes)?"
4201                 . ./myread
4202                 longsize="$ans"
4203                 dflt=2
4204                 rp="What is the size of a short integer (in bytes)?"
4205                 . ./myread
4206                 shortsize="$ans"
4207         fi
4208         ;;
4209 esac
4210 $rm -f intsize intsize.*
4211
4212 : see what type lseek is declared as in the kernel
4213 rp="What is the type used for lseek's offset on this system?"
4214 set off_t lseektype long stdio.h sys/types.h
4215 eval $typedef_ask
4216
4217 echo " "
4218 echo "Checking to see how big your file offsets are..." >&4
4219 $cat >try.c <<EOCP
4220 #include <sys/types.h>
4221 #include <stdio.h>
4222 int main()
4223 {
4224     printf("%d\n", (int)sizeof($lseektype));
4225     return(0); 
4226 }
4227 EOCP
4228 set try
4229 if eval $compile_ok; then
4230         lseeksize=`./try`
4231         echo "Your file offsets are $lseeksize bytes long."
4232 else
4233         dflt=$longsize
4234         echo " "
4235         echo "(I can't seem to compile the test program.  Guessing...)"
4236         rp="What is the size of your file offsets (in bytes)?"
4237         . ./myread
4238         lseeksize="$ans"
4239 fi
4240 $rm -f try.c try
4241
4242 : see what type file positions are declared as in the library
4243 rp="What is the type for file position used by fsetpos()?"
4244 set fpos_t fpostype long stdio.h sys/types.h
4245 eval $typedef_ask
4246
4247 echo " "
4248 case "$fpostype" in
4249 *_t) zzz="$fpostype"    ;;
4250 *)   zzz="fpos_t"       ;;
4251 esac
4252 echo "Checking the size of $zzz..." >&4 
4253 cat > try.c <<EOCP
4254 #include <sys/types.h>
4255 #include <stdio.h>
4256 int main() {
4257     printf("%d\n", (int)sizeof($fpostype));
4258     exit(0);
4259 }
4260 EOCP
4261 set try
4262 if eval $compile_ok; then
4263         yyy=`./try`
4264         case "$yyy" in
4265         '')     fpossize=4
4266                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4267                 ;;
4268         *)      fpossize=$yyy
4269                 echo "Your $zzz is $fpossize bytes long."
4270                 ;;
4271         esac
4272 else
4273         dflt="$longsize"
4274         echo " " >&4
4275         echo "(I can't compile the test program.  Guessing...)" >&4
4276         rp="What is the size of your file positions (in bytes)?"
4277         . ./myread
4278         fpossize="$ans"
4279 fi
4280
4281
4282
4283 # Backward compatibility (uselfs is deprecated).
4284 case "$uselfs" in
4285 "$define"|true|[yY]*)
4286         cat <<EOM >&4
4287
4288 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4289 EOM
4290         uselargefiles="$define"
4291         ;;
4292 esac                          
4293
4294 case "$lseeksize:$fpossize" in
4295 8:8) cat <<EOM
4296
4297 You can have files larger than 2 gigabytes.
4298 EOM
4299    val="$define" ;;
4300 *)    case "$uselargefiles" in
4301    "$undef"|false|[nN]*) dflt='n' ;;
4302    *)   dflt='y' ;;
4303    esac
4304    cat <<EOM
4305
4306 Perl can be built to understand large files (files larger than 2 gigabytes)
4307 on some systems.  To do so, Configure can be run with -Duselargefiles.
4308
4309 If this doesn't make any sense to you, just accept the default '$dflt'.
4310 EOM
4311    rp='Try to understand large files, if available?'
4312    . ./myread
4313    case "$ans" in
4314    y|Y)         val="$define" ;;
4315    *)           val="$undef"  ;;
4316    esac
4317    ;;
4318 esac
4319 set uselargefiles
4320 eval $setvar
4321 case "$uselargefiles" in
4322 "$define")
4323 : Look for a hint-file generated 'call-back-unit'.  If the
4324 : user has specified that a large files perl is to be built,
4325 : we may need to set or change some other defaults.
4326         if $test -f uselargefiles.cbu; then
4327                 echo "Your platform has some specific hints for large file builds, using them..."
4328                 . ./uselargefiles.cbu
4329                 echo " "
4330                 echo "Rechecking to see how big your file offsets are..." >&4
4331                 $cat >try.c <<EOCP
4332 #include <sys/types.h>
4333 #include <stdio.h>
4334 int main()
4335 {
4336     printf("%d\n", (int)sizeof($lseektype));
4337     return(0); 
4338 }
4339 EOCP
4340                 set try
4341                 if eval $compile_ok; then
4342                         lseeksize=`./try`
4343                         $echo "Your file offsets are now $lseeksize bytes long."
4344                 else
4345                         dflt="$lseeksize"
4346                         echo " "
4347                         echo "(I can't seem to compile the test program.  Guessing...)"
4348                         rp="What is the size of your file offsets (in bytes)?"
4349                         . ./myread
4350                         lseeksize="$ans"
4351                 fi
4352                 case "$fpostype" in
4353                 *_t) zzz="$fpostype"    ;;
4354                 *)   zzz="fpos_t"       ;;
4355                 esac
4356                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4357                 $cat > try.c <<EOCP
4358 #include <sys/types.h>
4359 #include <stdio.h>
4360 int main() {
4361     printf("%d\n", (int)sizeof($fpostype));
4362     exit(0);
4363 }
4364 EOCP
4365                 set try
4366                 if eval $compile_ok; then
4367                         yyy=`./try`
4368                         dflt="$lseeksize"
4369                         case "$yyy" in
4370                         '')     echo " "
4371                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4372                                 ;;
4373                         *)      fpossize=$yyy
4374                                 echo " $fpossize bytes." >&4
4375                                 ;;
4376                         esac
4377                 else
4378                         dflt="$fpossize"
4379                         echo " "
4380                         echo "(I can't compile the test program.  Guessing...)" >&4
4381                         rp="What is the size of your file positions (in bytes)?"
4382                         . ./myread
4383                         fpossize="$ans"
4384                 fi
4385                 $rm -f try.c try
4386         fi
4387         ;;
4388 esac
4389
4390
4391 case "$usemorebits" in
4392 "$define"|true|[yY]*)
4393         use64bitint="$define"
4394         uselongdouble="$define"
4395         usemorebits="$define"
4396         ;;
4397 *)      usemorebits="$undef"
4398         ;;
4399 esac
4400
4401
4402 case "$uselonglong" in
4403 "$define"|true|[yY]*)
4404         cat <<EOM >&4
4405
4406 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4407 EOM
4408         use64bitint="$define"
4409         ;;
4410 esac                          
4411 case "$use64bits" in
4412 "$define"|true|[yY]*)
4413         cat <<EOM >&4
4414
4415 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4416 EOM
4417         use64bitint="$define"
4418         ;;
4419 esac                          
4420 case "$use64bitints" in
4421 "$define"|true|[yY]*)
4422         cat <<EOM >&4
4423
4424 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4425 EOM
4426         use64bitint="$define"
4427         ;;
4428 esac                          
4429 case "$use64bitsint" in
4430 "$define"|true|[yY]*)
4431         cat <<EOM >&4
4432
4433 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4434 EOM
4435         use64bitint="$define"
4436         ;;
4437 esac                          
4438 case "$uselonglongs" in
4439 "$define"|true|[yY]*)
4440         cat <<EOM >&4
4441
4442 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4443 EOM
4444         use64bitint="$define"
4445         ;;
4446 esac                          
4447 case "$use64bitsall" in
4448 "$define"|true|[yY]*)
4449         cat <<EOM >&4
4450
4451 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4452 EOM
4453         use64bitall="$define"
4454         ;;
4455 esac                          
4456
4457 case "$ccflags" in
4458 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4459 esac
4460 case "$use64bitall" in
4461 "$define"|true|[yY]*) use64bitint="$define" ;;
4462 esac
4463
4464 case "$longsize" in
4465 8) cat <<EOM
4466
4467 You have natively 64-bit long integers.
4468 EOM
4469    val="$define"
4470    ;;
4471 *) case "$use64bitint" in
4472    "$define"|true|[yY]*) dflt='y';;
4473    *) dflt='n';;
4474    esac
4475    cat <<EOM
4476
4477 Perl can be built to take advantage of 64-bit integer types
4478 on some systems.  To do so, Configure can be run with -Duse64bitint.
4479 Choosing this option will most probably introduce binary incompatibilities.
4480
4481 If this doesn't make any sense to you, just accept the default '$dflt'.
4482 EOM
4483    rp='Try to use 64-bit integers, if available?'
4484    . ./myread
4485    case "$ans" in
4486    [yY]*) val="$define" ;;
4487    *)     val="$undef"  ;;
4488    esac
4489    ;;
4490 esac
4491 set use64bitint
4492 eval $setvar
4493
4494 case "$use64bitall" in
4495 "$define"|true|[yY]*) dflt='y' ;;
4496 *) case "$longsize" in
4497    8) dflt='y' ;;
4498    *) dflt='n' ;;
4499    esac
4500    ;;
4501 esac    
4502 cat <<EOM
4503
4504 You may also choose to try maximal 64-bitness.  It means using as much
4505 64-bitness as possible on the platform.  This in turn means even more
4506 binary incompatibilities.  On the other hand, your platform may not
4507 have any more 64-bitness available than what you already have chosen.
4508
4509 If this doesn't make any sense to you, just accept the default '$dflt'.
4510 EOM
4511 rp='Try to use maximal 64-bit support, if available?'
4512 . ./myread
4513 case "$ans" in
4514 [yY]*) val="$define" ;;
4515 *)     val="$undef"  ;;
4516 esac
4517 set use64bitall
4518 eval $setvar
4519 case "$use64bitall" in
4520 "$define")
4521         case "$use64bitint" in
4522         "$undef")
4523                 cat <<EOM
4524
4525 Since you have chosen a maximally 64-bit build, I'm also turning on
4526 the use of 64-bit integers.
4527 EOM
4528                 use64bitint="$define" ;;
4529         esac
4530         ;;
4531 esac
4532
4533 case "$use64bitint" in
4534 "$define"|true|[yY]*)
4535 : Look for a hint-file generated 'call-back-unit'.  If the
4536 : user has specified that a 64-bit perl is to be built,
4537 : we may need to set or change some other defaults.
4538         if $test -f use64bitint.cbu; then
4539                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4540                 . ./use64bitint.cbu
4541         fi
4542         case "$longsize" in
4543         4) case "$archname64" in
4544            '') archname64=64int ;;
4545            esac
4546            ;;
4547         esac
4548         ;;
4549 esac
4550
4551 case "$use64bitall" in
4552 "$define"|true|[yY]*)
4553 : Look for a hint-file generated 'call-back-unit'.  If the
4554 : user has specified that a maximally 64-bit perl is to be built,
4555 : we may need to set or change some other defaults.
4556         if $test -f use64bitall.cbu; then
4557                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4558                 . ./use64bitall.cbu
4559         fi
4560         case "$longsize" in
4561         4) case "$archname64" in
4562            ''|64int) archname64=64all ;;
4563            esac
4564            ;;
4565         esac
4566         ;;
4567 esac
4568
4569 echo " "
4570 echo "Checking for GNU C Library..." >&4
4571 cat >gnulibc.c <<EOM
4572 #include <stdio.h>
4573 int main()
4574 {
4575 #ifdef __GLIBC__
4576     exit(0);
4577 #else
4578     exit(1);
4579 #endif
4580 }
4581 EOM
4582 set gnulibc
4583 if eval $compile_ok && ./gnulibc; then
4584         val="$define"
4585         echo "You are using the GNU C Library"
4586 else
4587         val="$undef"
4588         echo "You are not using the GNU C Library"
4589 fi
4590 $rm -f gnulibc*
4591 set d_gnulibc
4592 eval $setvar
4593
4594 : see if nm is to be used to determine whether a symbol is defined or not
4595 case "$usenm" in
4596 '')
4597         dflt=''
4598         case "$d_gnulibc" in
4599         "$define")
4600                 echo " "
4601                 echo "nm probably won't work on the GNU C Library." >&4
4602                 dflt=n
4603                 ;;
4604         esac
4605         case "$dflt" in
4606         '') 
4607                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4608                         echo " "
4609                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4610                         echo "'nm' won't be sufficient on this sytem." >&4
4611                         dflt=n
4612                 fi
4613                 ;;
4614         esac
4615         case "$dflt" in
4616         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4617                 if $test $dflt -gt 20; then
4618                         dflt=y
4619                 else
4620                         dflt=n
4621                 fi
4622                 ;;
4623         esac
4624         ;;
4625 *)
4626         case "$usenm" in
4627         true|$define) dflt=y;;
4628         *) dflt=n;;
4629         esac
4630         ;;
4631 esac
4632 $cat <<EOM
4633
4634 I can use $nm to extract the symbols from your C libraries. This
4635 is a time consuming task which may generate huge output on the disk (up
4636 to 3 megabytes) but that should make the symbols extraction faster. The
4637 alternative is to skip the 'nm' extraction part and to compile a small
4638 test program instead to determine whether each symbol is present. If
4639 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4640 this may be the best solution.
4641
4642 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4643
4644 EOM
4645 rp="Shall I use $nm to extract C symbols from the libraries?"
4646 . ./myread
4647 case "$ans" in
4648 [Nn]*) usenm=false;;
4649 *) usenm=true;;
4650 esac
4651
4652 runnm=$usenm
4653 case "$reuseval" in
4654 true) runnm=false;;
4655 esac
4656
4657 : nm options which may be necessary
4658 case "$nm_opt" in
4659 '') if $test -f /mach_boot; then
4660                 nm_opt=''       # Mach
4661         elif $test -d /usr/ccs/lib; then
4662                 nm_opt='-p'     # Solaris (and SunOS?)
4663         elif $test -f /dgux; then
4664                 nm_opt='-p'     # DG-UX
4665         elif $test -f /lib64/rld; then
4666                 nm_opt='-p'     # 64-bit Irix
4667         else
4668                 nm_opt=''
4669         fi;;
4670 esac
4671
4672 : nm options which may be necessary for shared libraries but illegal
4673 : for archive libraries.  Thank you, Linux.
4674 case "$nm_so_opt" in
4675 '')     case "$myuname" in
4676         *linux*)
4677                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4678                         nm_so_opt='--dynamic'
4679                 fi
4680                 ;;
4681         esac
4682         ;;
4683 esac
4684
4685 case "$runnm" in
4686 true)
4687 : get list of predefined functions in a handy place
4688 echo " "
4689 case "$libc" in
4690 '') libc=unknown
4691         case "$libs" in
4692         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4693         esac
4694         ;;
4695 esac
4696 libnames='';
4697 case "$libs" in
4698 '') ;;
4699 *)  for thislib in $libs; do
4700         case "$thislib" in
4701         -lc|-lc_s)
4702                 : Handle C library specially below.
4703                 ;;
4704         -l*)
4705                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4706                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4707                         :
4708                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4709                         :
4710                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4711                         :
4712                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4713                         :
4714                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4715                         :
4716                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4717                         :
4718                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4719                         :
4720                 else
4721                         try=''
4722                 fi
4723                 libnames="$libnames $try"
4724                 ;;
4725         *) libnames="$libnames $thislib" ;;
4726         esac
4727         done
4728         ;;
4729 esac
4730 xxx=normal
4731 case "$libc" in
4732 unknown)
4733         set /lib/libc.$so
4734         for xxx in $libpth; do
4735                 $test -r $1 || set $xxx/libc.$so
4736                 : The messy sed command sorts on library version numbers.
4737                 $test -r $1 || \
4738                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4739                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4740                                 h
4741                                 s/[0-9][0-9]*/0000&/g
4742                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4743                                 G
4744                                 s/\n/ /' | \
4745                          $sort | $sed -e 's/^.* //'`
4746                 eval set \$$#
4747         done
4748         $test -r $1 || set /usr/ccs/lib/libc.$so
4749         $test -r $1 || set /lib/libsys_s$_a
4750         ;;
4751 *)
4752         set blurfl
4753         ;;
4754 esac
4755 if $test -r "$1"; then
4756         echo "Your (shared) C library seems to be in $1."
4757         libc="$1"
4758 elif $test -r /lib/libc && $test -r /lib/clib; then
4759         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4760         xxx=apollo
4761         libc='/lib/clib /lib/libc'
4762         if $test -r /lib/syslib; then
4763                 echo "(Your math library is in /lib/syslib.)"
4764                 libc="$libc /lib/syslib"
4765         fi
4766 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4767         echo "Your C library seems to be in $libc, as you said before."
4768 elif $test -r $incpath/usr/lib/libc$_a; then
4769         libc=$incpath/usr/lib/libc$_a;
4770         echo "Your C library seems to be in $libc.  That's fine."
4771 elif $test -r /lib/libc$_a; then
4772         libc=/lib/libc$_a;
4773         echo "Your C library seems to be in $libc.  You're normal."
4774 else
4775         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4776                 :
4777         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4778                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4779         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4780                 :
4781         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4782                 :
4783         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4784                 :
4785         else
4786                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4787         fi
4788         if $test -r "$tans"; then
4789                 echo "Your C library seems to be in $tans, of all places."
4790                 libc=$tans
4791         else
4792                 libc='blurfl'
4793         fi
4794 fi
4795 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4796         dflt="$libc"
4797         cat <<EOM
4798
4799 If the guess above is wrong (which it might be if you're using a strange
4800 compiler, or your machine supports multiple models), you can override it here.
4801
4802 EOM
4803 else
4804         dflt=''
4805         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4806         cat >&4 <<EOM
4807 I can't seem to find your C library.  I've looked in the following places:
4808
4809 EOM
4810         $sed 's/^/      /' libpath
4811         cat <<EOM
4812
4813 None of these seems to contain your C library. I need to get its name...
4814
4815 EOM
4816 fi
4817 fn=f
4818 rp='Where is your C library?'
4819 . ./getfile
4820 libc="$ans"
4821
4822 echo " "
4823 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4824 set X `cat libnames`
4825 shift
4826 xxx=files
4827 case $# in 1) xxx=file; esac
4828 echo "Extracting names from the following $xxx for later perusal:" >&4
4829 echo " "
4830 $sed 's/^/      /' libnames >&4
4831 echo " "
4832 $echo $n "This may take a while...$c" >&4
4833
4834 for file in $*; do
4835         case $file in
4836         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4837         *) $nm $nm_opt $file 2>/dev/null;;
4838         esac
4839 done >libc.tmp
4840
4841 $echo $n ".$c"
4842 $grep fprintf libc.tmp > libc.ptf
4843 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4844 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4845 xxx='[ADTSIW]'
4846 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4847         eval $xscan;\
4848         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4849                 eval $xrun
4850 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4851         eval $xscan;\
4852         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4853                 eval $xrun
4854 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4855         eval $xscan;\
4856         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4857                 eval $xrun
4858 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4859         eval $xscan;\
4860         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4861                 eval $xrun
4862 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4863         eval $xscan;\
4864         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4865                 eval $xrun
4866 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4867         eval $xscan;\
4868         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4869                 eval $xrun
4870 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4871                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4872         eval $xscan;\
4873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4874                 eval $xrun
4875 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4876         eval $xscan;\
4877         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4878                 eval $xrun
4879 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4880         eval $xscan;\
4881         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4882                 eval $xrun
4883 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4884         eval $xscan;\
4885         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4886                 eval $xrun
4887 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4888         eval $xscan;\
4889         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4890                 eval $xrun
4891 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4892         eval $xscan;\
4893         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4894                 eval $xrun
4895 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4896         eval $xscan;\
4897         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4898                 eval $xrun
4899 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4900         eval $xscan;\
4901         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4902                 eval $xrun
4903 else
4904         $nm -p $* 2>/dev/null >libc.tmp
4905         $grep fprintf libc.tmp > libc.ptf
4906         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4907                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4908         then
4909                 nm_opt='-p'
4910                 eval $xrun
4911         else
4912                 echo " "
4913                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4914                 com=''
4915                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4916                         for thisname in $libnames $libc; do
4917                                 $ar t $thisname >>libc.tmp
4918                         done
4919                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4920                         echo "Ok." >&4
4921                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4922                         # Repeat libc to extract forwarders to DLL entries too
4923                         for thisname in $libnames $libc; do
4924                                 $ar tv $thisname >>libc.tmp
4925                                 # Revision 50 of EMX has bug in $ar.
4926                                 # it will not extract forwarders to DLL entries
4927                                 # Use emximp which will extract exactly them.
4928                                 emximp -o tmp.imp $thisname \
4929                                     2>/dev/null && \
4930                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4931                                     < tmp.imp >>libc.tmp
4932                                 $rm tmp.imp
4933                         done
4934                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4935                         echo "Ok." >&4
4936                 else
4937                         echo "$ar didn't seem to work right." >&4
4938                         echo "Maybe this is a Cray...trying bld instead..." >&4
4939                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4940                         then
4941                                 for thisname in $libnames; do
4942                                         bld t $libnames | \
4943                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4944                                         $ar t $thisname >>libc.tmp
4945                                 done
4946                                 echo "Ok." >&4
4947                         else
4948                                 echo "That didn't work either.  Giving up." >&4
4949                                 exit 1
4950                         fi
4951                 fi
4952         fi
4953 fi
4954 nm_extract="$com"
4955 if $test -f /lib/syscalls.exp; then
4956         echo " "
4957         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4958         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4959 fi
4960 ;;
4961 esac
4962 $rm -f libnames libpath
4963
4964 : is a C symbol defined?
4965 csym='tlook=$1;
4966 case "$3" in
4967 -v) tf=libc.tmp; tc=""; tdc="";;
4968 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4969 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4970 esac;
4971 tx=yes;
4972 case "$reuseval-$4" in
4973 true-) ;;
4974 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4975 esac;
4976 case "$tx" in
4977 yes)
4978         case "$runnm" in
4979         true)
4980                 if $contains $tlook $tf >/dev/null 2>&1;
4981                 then tval=true;
4982                 else tval=false;
4983                 fi;;
4984         *)
4985                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4986                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
4987                 then tval=true;
4988                 else tval=false;
4989                 fi;
4990                 $rm -f t t.c;;
4991         esac;;
4992 *)
4993         case "$tval" in
4994         $define) tval=true;;
4995         *) tval=false;;
4996         esac;;
4997 esac;
4998 eval "$2=$tval"'
4999
5000 : define an is-in-libc? function
5001 inlibc='echo " "; td=$define; tu=$undef;
5002 sym=$1; var=$2; eval "was=\$$2";
5003 tx=yes;
5004 case "$reuseval$was" in
5005 true) ;;
5006 true*) tx=no;;
5007 esac;
5008 case "$tx" in
5009 yes)
5010         set $sym tres -f;
5011         eval $csym;
5012         case "$tres" in
5013         true)
5014                 echo "$sym() found." >&4;
5015                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5016         *)
5017                 echo "$sym() NOT found." >&4;
5018                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5019         esac;;
5020 *)
5021         case "$was" in
5022         $define) echo "$sym() found." >&4;;
5023         *) echo "$sym() NOT found." >&4;;
5024         esac;;
5025 esac'
5026
5027 : see if sqrtl exists
5028 set sqrtl d_sqrtl
5029 eval $inlibc
5030
5031 case "$ccflags" in
5032 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5033 esac
5034
5035 case "$uselongdouble" in
5036 $define|true|[yY]*)     dflt='y';;
5037 *) dflt='n';;
5038 esac
5039 cat <<EOM
5040
5041 Perl can be built to take advantage of long doubles which
5042 (if available) may give more accuracy and range for floating point numbers.
5043
5044 If this doesn't make any sense to you, just accept the default '$dflt'.
5045 EOM
5046 rp='Try to use long doubles if available?'
5047 . ./myread
5048 case "$ans" in
5049 y|Y)    val="$define"   ;;
5050 *)      val="$undef"    ;;
5051 esac
5052 set uselongdouble
5053 eval $setvar
5054
5055 case "$uselongdouble" in
5056 true|[yY]*) uselongdouble="$define" ;;
5057 esac
5058
5059 case "$uselongdouble" in
5060 $define)
5061 : Look for a hint-file generated 'call-back-unit'.  If the
5062 : user has specified that long doubles should be used,
5063 : we may need to set or change some other defaults.
5064         if $test -f uselongdouble.cbu; then
5065                 echo "Your platform has some specific hints for long doubles, using them..."
5066                 . ./uselongdouble.cbu
5067         else
5068                 $cat <<EOM
5069 (Your platform doesn't have any specific hints for long doubles.)
5070 EOM
5071         fi
5072         ;;
5073 esac
5074
5075 case "$uselongdouble:$d_sqrtl" in
5076 $define:$undef)
5077                 $cat <<EOM >&4
5078
5079 *** You requested the use of long doubles but you do not seem to have
5080 *** the mathematic functions for long doubles.  I'm disabling the use
5081 *** of long doubles.
5082
5083 EOM
5084         uselongdouble=$undef
5085         ;;
5086 esac
5087
5088 : check for length of double
5089 echo " "
5090 case "$doublesize" in
5091 '')
5092         echo "Checking to see how big your double precision numbers are..." >&4
5093         $cat >try.c <<'EOCP'
5094 #include <stdio.h>
5095 int main()
5096 {
5097     printf("%d\n", (int)sizeof(double));
5098     exit(0);
5099 }
5100 EOCP
5101         set try
5102         if eval $compile_ok; then
5103                 doublesize=`./try`
5104                 echo "Your double is $doublesize bytes long."
5105         else
5106                 dflt='8'
5107                 echo "(I can't seem to compile the test program.  Guessing...)"
5108                 rp="What is the size of a double precision number (in bytes)?"
5109                 . ./myread
5110                 doublesize="$ans"
5111         fi
5112         ;;
5113 esac
5114 $rm -f try.c try
5115
5116 : check for long doubles
5117 echo " "
5118 echo "Checking to see if you have long double..." >&4
5119 echo 'int main() { long double x = 7.0; }' > try.c
5120 set try
5121 if eval $compile; then
5122         val="$define"
5123         echo "You have long double."
5124 else
5125         val="$undef"
5126         echo "You do not have long double."
5127 fi
5128 $rm try.*
5129 set d_longdbl
5130 eval $setvar
5131
5132 : check for length of long double
5133 case "${d_longdbl}${longdblsize}" in
5134 $define)
5135         echo " "
5136         echo "Checking to see how big your long doubles are..." >&4
5137         $cat >try.c <<'EOCP'
5138 #include <stdio.h>
5139 int main()
5140 {
5141         printf("%d\n", sizeof(long double));
5142 }
5143 EOCP
5144         set try
5145         set try
5146         if eval $compile; then
5147                 longdblsize=`./try$exe_ext`
5148                 echo "Your long doubles are $longdblsize bytes long."
5149         else
5150                 dflt='8'
5151                 echo " "
5152                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5153                 rp="What is the size of a long double (in bytes)?"
5154                 . ./myread
5155                 longdblsize="$ans"
5156         fi
5157         if $test "X$doublesize" = "X$longdblsize"; then
5158                 echo "(That isn't any different from an ordinary double.)"
5159         fi      
5160         ;;
5161 esac
5162 $rm -f try.* try
5163
5164 : determine the architecture name
5165 echo " "
5166 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5167         tarch=`arch`"-$osname"
5168 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5169         if uname -m > tmparch 2>&1 ; then
5170                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5171                         -e 's/$/'"-$osname/" tmparch`
5172         else
5173                 tarch="$osname"
5174         fi
5175         $rm -f tmparch
5176 else
5177         tarch="$osname"
5178 fi
5179 case "$myarchname" in
5180 ''|"$tarch") ;;
5181 *)
5182         echo "(Your architecture name used to be $myarchname.)"
5183         archname=''
5184         ;;
5185 esac
5186 myarchname="$tarch"
5187 case "$archname" in
5188 '') dflt="$tarch";;
5189 *) dflt="$archname";;
5190 esac
5191 rp='What is your architecture name'
5192 . ./myread
5193 archname="$ans"
5194 case "$usethreads" in
5195 $define)
5196         echo "Threads selected." >&4
5197         case "$archname" in
5198         *-thread*) echo "...and architecture name already has -thread." >&4
5199                 ;;
5200         *)      archname="$archname-thread"
5201                 echo "...setting architecture name to $archname." >&4
5202                 ;;
5203         esac
5204         ;;
5205 esac
5206 case "$usemultiplicity" in
5207 $define)
5208         echo "Multiplicity selected." >&4
5209         case "$archname" in
5210         *-multi*) echo "...and architecture name already has -multi." >&4
5211                 ;;
5212         *)      archname="$archname-multi"
5213                 echo "...setting architecture name to $archname." >&4
5214                 ;;
5215         esac
5216         ;;
5217 esac
5218 case "$use64bitint$use64bitall" in
5219 *"$define"*)
5220         case "$archname64" in
5221         '')
5222                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5223                 ;;
5224         *)
5225                 case "$use64bitint" in
5226                 "$define") echo "64 bit integers selected." >&4 ;;
5227                 esac
5228                 case "$use64bitall" in
5229                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5230                 esac
5231                 case "$archname" in
5232                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5233                         ;;
5234                 *)      archname="$archname-$archname64"
5235                         echo "...setting architecture name to $archname." >&4
5236                         ;;
5237                 esac
5238                 ;;
5239         esac
5240 esac
5241 case "$uselongdouble" in
5242 $define)
5243         echo "Long doubles selected." >&4
5244         case "$longdblsize" in
5245         $doublesize)
5246                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5247                 ;;
5248         *)
5249                 case "$archname" in
5250                 *-ld*) echo "...and architecture name already has -ld." >&4
5251                         ;;
5252                 *)      archname="$archname-ld"
5253                         echo "...setting architecture name to $archname." >&4
5254                         ;;
5255                 esac
5256                 ;;
5257         esac
5258         ;;
5259 esac
5260
5261 : determine root of directory hierarchy where package will be installed.
5262 case "$prefix" in
5263 '')
5264         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5265         ;;
5266 *)
5267         dflt="$prefix"
5268         ;;
5269 esac
5270 $cat <<EOM
5271
5272 By default, $package will be installed in $dflt/bin, manual pages
5273 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5274 installation directories. Typically this is something like /usr/local.
5275 If you wish to have binaries under /usr/bin but other parts of the
5276 installation under /usr/local, that's ok: you will be prompted
5277 separately for each of the installation directories, the prefix being
5278 only used to set the defaults.
5279
5280 EOM
5281 fn=d~
5282 rp='Installation prefix to use?'
5283 . ./getfile
5284 oldprefix=''
5285 case "$prefix" in
5286 '') ;;
5287 *)
5288         case "$ans" in
5289         "$prefix") ;;
5290         *) oldprefix="$prefix";;
5291         esac
5292         ;;
5293 esac
5294 prefix="$ans"
5295 prefixexp="$ansexp"
5296
5297 : is AFS running?
5298 echo " "
5299 case "$afs" in
5300 $define|true)   afs=true ;;
5301 $undef|false)   afs=false ;;
5302 *)      if test -d /afs; then
5303                 afs=true
5304         else
5305                 afs=false
5306         fi
5307         ;;
5308 esac
5309 if $afs; then
5310         echo "AFS may be running... I'll be extra cautious then..." >&4
5311 else
5312         echo "AFS does not seem to be running..." >&4
5313 fi
5314
5315 : determine installation prefix for where package is to be installed.
5316 if $afs; then 
5317 $cat <<EOM
5318
5319 Since you are running AFS, I need to distinguish the directory in which
5320 files will reside from the directory in which they are installed (and from
5321 which they are presumably copied to the former directory by occult means).
5322
5323 EOM
5324         case "$installprefix" in
5325         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5326         *) dflt="$installprefix";;
5327         esac
5328 else
5329 $cat <<EOM
5330
5331 In some special cases, particularly when building $package for distribution,
5332 it is convenient to distinguish between the directory in which files should 
5333 be installed from the directory ($prefix) in which they 
5334 will eventually reside.  For most users, these two directories are the same.
5335
5336 EOM
5337         case "$installprefix" in
5338         '') dflt=$prefix ;;
5339         *) dflt=$installprefix;;
5340         esac
5341 fi
5342 fn=d~
5343 rp='What installation prefix should I use for installing files?'
5344 . ./getfile
5345 installprefix="$ans"
5346 installprefixexp="$ansexp"
5347
5348 : set the prefixit variable, to compute a suitable default value
5349 prefixit='case "$3" in
5350 ""|none)
5351         case "$oldprefix" in
5352         "") eval "$1=\"\$$2\"";;
5353         *)
5354                 case "$3" in
5355                 "") eval "$1=";;
5356                 none)
5357                         eval "tp=\"\$$2\"";
5358                         case "$tp" in
5359                         ""|" ") eval "$1=\"\$$2\"";;
5360                         *) eval "$1=";;
5361                         esac;;
5362                 esac;;
5363         esac;;
5364 *)
5365         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5366         case "$tp" in
5367         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5368         /*-$oldprefix/*|\~*-$oldprefix/*)
5369                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5370         *) eval "$1=\"\$$2\"";;
5371         esac;;
5372 esac'
5373
5374
5375 : get the patchlevel
5376 echo " "
5377 echo "Getting the current patchlevel..." >&4
5378 if $test -r $rsrc/patchlevel.h;then
5379         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5380         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5381         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5382         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5383         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5384         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5385 else
5386         revision=0
5387         patchlevel=0
5388         subversion=0
5389         api_revision=0
5390         api_version=0
5391         api_subversion=0
5392 fi
5393 $echo "(You have $package version $patchlevel subversion $subversion.)"
5394 case "$osname" in
5395 dos|vms)
5396         : XXX Should be a Configure test for double-dots in filenames.
5397         version=`echo $revision $patchlevel $subversion | \
5398                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5399         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5400                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5401         ;;
5402 *)
5403         version=`echo $revision $patchlevel $subversion | \
5404                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5405         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5406                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5407         ;;
5408 esac
5409 : Special case the 5.005_xx maintenance series, which used 5.005
5410 : without any subversion label as a subdirectory in $sitelib
5411 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5412         api_versionstring='5.005'
5413 fi
5414
5415 : determine installation style
5416 : For now, try to deduce it from prefix unless it is already set.
5417 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5418 case "$installstyle" in
5419 '')     case "$prefix" in
5420                 *perl*) dflt='lib';;
5421                 *) dflt='lib/perl5' ;;
5422         esac
5423         ;;
5424 *)      dflt="$installstyle" ;;
5425 esac
5426 : Probably not worth prompting for this since we prompt for all
5427 : the directories individually, and the prompt would be too long and
5428 : confusing anyway.
5429 installstyle=$dflt
5430
5431 : determine where private library files go
5432 : Usual default is /usr/local/lib/perl5/$version.
5433 : Also allow things like /opt/perl/lib/$version, since 
5434 : /opt/perl/lib/perl5... would be redundant.
5435 : The default "style" setting is made in installstyle.U
5436 case "$installstyle" in
5437 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5438 *)       set dflt privlib lib/$version ;;
5439 esac
5440 eval $prefixit
5441 $cat <<EOM
5442
5443 There are some auxiliary files for $package that need to be put into a
5444 private library directory that is accessible by everyone.
5445
5446 EOM
5447 fn=d~+
5448 rp='Pathname where the private library files will reside?'
5449 . ./getfile
5450 privlib="$ans"
5451 privlibexp="$ansexp"
5452 : Change installation prefix, if necessary.
5453 if $test X"$prefix" != X"$installprefix"; then
5454         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5455 else
5456         installprivlib="$privlibexp"
5457 fi
5458
5459 : set the prefixup variable, to restore leading tilda escape
5460 prefixup='case "$prefixexp" in
5461 "$prefix") ;;
5462 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5463 esac'
5464
5465 : determine where public architecture dependent libraries go
5466 set archlib archlib
5467 eval $prefixit
5468 : privlib default is /usr/local/lib/$package/$version
5469 : archlib default is /usr/local/lib/$package/$version/$archname
5470 : privlib may have an optional trailing /share.
5471 tdflt=`echo $privlib | $sed 's,/share$,,'`
5472 tdflt=$tdflt/$archname
5473 case "$archlib" in
5474 '')     dflt=$tdflt
5475         ;;
5476 *)      dflt="$archlib"
5477     ;;
5478 esac
5479 $cat <<EOM
5480
5481 $spackage contains architecture-dependent library files.  If you are
5482 sharing libraries in a heterogeneous environment, you might store
5483 these files in a separate location.  Otherwise, you can just include
5484 them with the rest of the public library files.
5485
5486 EOM
5487 fn=d+~
5488 rp='Where do you want to put the public architecture-dependent libraries?'
5489 . ./getfile
5490 archlib="$ans"
5491 archlibexp="$ansexp"
5492 if $test X"$archlib" = X"$privlib"; then
5493         d_archlib="$undef"
5494 else
5495         d_archlib="$define"
5496 fi
5497 : Change installation prefix, if necessary.
5498 if $test X"$prefix" != X"$installprefix"; then
5499         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5500 else
5501         installarchlib="$archlibexp"
5502 fi
5503
5504
5505 : Binary compatibility with 5.005 is not possible for builds
5506 : with advanced features
5507 case "$usethreads$usemultiplicity" in
5508 *define*)
5509         bincompat5005="$undef"
5510         d_bincompat5005="$undef"
5511         ;;
5512 *)      $cat <<EOM
5513
5514 This version of Perl can be compiled for binary compatibility with 5.005.
5515 If you decide to do so, you will be able to continue using most of the
5516 extensions that were compiled for Perl 5.005.
5517
5518 EOM
5519         case "$bincompat5005$d_bincompat5005" in
5520         *"$undef"*) dflt=n ;;
5521         *) dflt=y ;;
5522         esac
5523         rp='Binary compatibility with Perl 5.005?'
5524         . ./myread
5525         case "$ans" in
5526         y*) val="$define" ;;
5527         *)  val="$undef" ;;
5528         esac
5529         set d_bincompat5005
5530         eval $setvar
5531         case "$d_bincompat5005" in
5532         "$define")
5533                 bincompat5005="$define"
5534                 ;;
5535         *)      bincompat5005="$undef"
5536                 d_bincompat5005="$undef"
5537                 ;;
5538         esac
5539         ;;
5540 esac
5541
5542
5543 : see if setuid scripts can be secure
5544 $cat <<EOM
5545
5546 Some kernels have a bug that prevents setuid #! scripts from being
5547 secure.  Some sites have disabled setuid #! scripts because of this.
5548
5549 First let's decide if your kernel supports secure setuid #! scripts.
5550 (If setuid #! scripts would be secure but have been disabled anyway,
5551 don't say that they are secure if asked.)
5552
5553 EOM
5554
5555 val="$undef"
5556 if $test -d /dev/fd; then
5557         echo "#!$ls" >reflect
5558         chmod +x,u+s reflect
5559         ./reflect >flect 2>&1
5560         if $contains "/dev/fd" flect >/dev/null; then
5561                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5562                 val="$define"
5563         else
5564                 $cat <<EOM
5565 If you are not sure if they are secure, I can check but I'll need a
5566 username and password different from the one you are using right now.
5567 If you don't have such a username or don't want me to test, simply
5568 enter 'none'.
5569
5570 EOM
5571                 rp='Other username to test security of setuid scripts with?'
5572                 dflt='none'
5573                 . ./myread
5574                 case "$ans" in
5575                 n|none)
5576                         case "$d_suidsafe" in
5577                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5578                                 dflt=n;;
5579                         "$undef")
5580                                 echo "Well, the $hint value is *not* secure." >&4
5581                                 dflt=n;;
5582                         *)      echo "Well, the $hint value *is* secure." >&4
5583                                 dflt=y;;
5584                         esac
5585                         ;;
5586                 *)
5587                         $rm -f reflect flect
5588                         echo "#!$ls" >reflect
5589                         chmod +x,u+s reflect
5590                         echo >flect
5591                         chmod a+w flect
5592                         echo '"su" will (probably) prompt you for '"$ans's password."
5593                         su $ans -c './reflect >flect'
5594                         if $contains "/dev/fd" flect >/dev/null; then
5595                                 echo "Okay, it looks like setuid scripts are secure." >&4
5596                                 dflt=y
5597                         else
5598                                 echo "I don't think setuid scripts are secure." >&4
5599                                 dflt=n
5600                         fi
5601                         ;;
5602                 esac
5603                 rp='Does your kernel have *secure* setuid scripts?'
5604                 . ./myread
5605                 case "$ans" in
5606                 [yY]*)  val="$define";;
5607                 *)      val="$undef";;
5608                 esac
5609         fi
5610 else
5611         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5612         echo "(That's for file descriptors, not floppy disks.)"
5613         val="$undef"
5614 fi
5615 set d_suidsafe
5616 eval $setvar
5617
5618 $rm -f reflect flect
5619
5620 : now see if they want to do setuid emulation
5621 echo " "
5622 val="$undef"
5623 case "$d_suidsafe" in
5624 "$define")
5625         val="$undef"
5626         echo "No need to emulate SUID scripts since they are secure here." >& 4
5627         ;;
5628 *)
5629         $cat <<EOM
5630 Some systems have disabled setuid scripts, especially systems where
5631 setuid scripts cannot be secure.  On systems where setuid scripts have
5632 been disabled, the setuid/setgid bits on scripts are currently
5633 useless.  It is possible for $package to detect those bits and emulate
5634 setuid/setgid in a secure fashion.  This emulation will only work if
5635 setuid scripts have been disabled in your kernel.
5636
5637 EOM
5638         case "$d_dosuid" in
5639         "$define") dflt=y ;;
5640         *) dflt=n ;;
5641         esac
5642         rp="Do you want to do setuid/setgid emulation?"
5643         . ./myread
5644         case "$ans" in
5645         [yY]*)  val="$define";;
5646         *)      val="$undef";;
5647         esac
5648         ;;
5649 esac
5650 set d_dosuid
5651 eval $setvar
5652
5653 : determine filename position in cpp output
5654 echo " "
5655 echo "Computing filename position in cpp output for #include directives..." >&4
5656 echo '#include <stdio.h>' > foo.c
5657 $cat >fieldn <<EOF
5658 $startsh
5659 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5660 $grep '^[       ]*#.*stdio\.h' | \
5661 while read cline; do
5662         pos=1
5663         set \$cline
5664         while $test \$# -gt 0; do
5665                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5666                         echo "\$pos"
5667                         exit 0
5668                 fi
5669                 shift
5670                 pos=\`expr \$pos + 1\`
5671         done
5672 done
5673 EOF
5674 chmod +x fieldn
5675 fieldn=`./fieldn`
5676 $rm -f foo.c fieldn
5677 case $fieldn in
5678 '') pos='???';;
5679 1) pos=first;;
5680 2) pos=second;;
5681 3) pos=third;;
5682 *) pos="${fieldn}th";;
5683 esac
5684 echo "Your cpp writes the filename in the $pos field of the line."
5685
5686 : locate header file
5687 $cat >findhdr <<EOF
5688 $startsh
5689 wanted=\$1
5690 name=''
5691 for usrincdir in $usrinc
5692 do
5693         if test -f \$usrincdir/\$wanted; then
5694                 echo "\$usrincdir/\$wanted"
5695                 exit 0
5696         fi
5697 done
5698 awkprg='{ print \$$fieldn }'
5699 echo "#include <\$wanted>" > foo\$\$.c
5700 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5701 $grep "^[       ]*#.*\$wanted" | \
5702 while read cline; do
5703         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5704         case "\$name" in
5705         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5706         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5707         *) exit 2;;
5708         esac;
5709 done;
5710 #
5711 # status = 0: grep returned 0 lines, case statement not executed
5712 # status = 1: headerfile found
5713 # status = 2: while loop executed, no headerfile found
5714 #
5715 status=\$?
5716 $rm -f foo\$\$.c;
5717 if test \$status -eq 1; then
5718         exit 0;
5719 fi
5720 exit 1
5721 EOF
5722 chmod +x findhdr
5723
5724 : define an alternate in-header-list? function
5725 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5726 cont=true; xxf="echo \"<\$1> found.\" >&4";
5727 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5728 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5729 esac;
5730 case $# in 4) instead=instead;; *) instead="at last";; esac;
5731 while $test "$cont"; do
5732         xxx=`./findhdr $1`
5733         var=$2; eval "was=\$$2";
5734         if $test "$xxx" && $test -r "$xxx";
5735         then eval $xxf;
5736         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5737                 cont="";
5738         else eval $xxnf;
5739         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5740         set $yyy; shift; shift; yyy=$@;
5741         case $# in 0) cont="";;
5742         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5743                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5744         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5745                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5746         esac;
5747 done;
5748 while $test "$yyy";
5749 do set $yyy; var=$2; eval "was=\$$2";
5750         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5751         set $yyy; shift; shift; yyy=$@;
5752 done'
5753
5754 : see if this is a malloc.h system
5755 set malloc.h i_malloc
5756 eval $inhdr
5757
5758 : see if stdlib is available
5759 set stdlib.h i_stdlib
5760 eval $inhdr
5761
5762 : determine which malloc to compile in
5763 echo " "
5764 case "$usemymalloc" in
5765 ''|[yY]*|true|$define)  dflt='y' ;;
5766 *)      dflt='n' ;;
5767 esac
5768 rp="Do you wish to attempt to use the malloc that comes with $package?"
5769 . ./myread
5770 usemymalloc="$ans"
5771 case "$ans" in
5772 y*|true)
5773         usemymalloc='y'
5774         mallocsrc='malloc.c'
5775         mallocobj="malloc$_o"
5776         d_mymalloc="$define"
5777         case "$libs" in
5778         *-lmalloc*)
5779                 : Remove malloc from list of libraries to use
5780                 echo "Removing unneeded -lmalloc from library list" >&4
5781                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5782                 shift
5783                 libs="$*"
5784                 echo "libs = $libs" >&4
5785                 ;;
5786         esac
5787         ;;
5788 *)
5789         usemymalloc='n'
5790         mallocsrc=''
5791         mallocobj=''
5792         d_mymalloc="$undef"
5793         ;;
5794 esac
5795
5796 : compute the return types of malloc and free
5797 echo " "
5798 $cat >malloc.c <<END
5799 #$i_malloc I_MALLOC
5800 #$i_stdlib I_STDLIB
5801 #include <stdio.h>
5802 #include <sys/types.h>
5803 #ifdef I_MALLOC
5804 #include <malloc.h>
5805 #endif
5806 #ifdef I_STDLIB
5807 #include <stdlib.h>
5808 #endif
5809 #ifdef TRY_MALLOC
5810 void *malloc();
5811 #endif
5812 #ifdef TRY_FREE
5813 void free();
5814 #endif
5815 END
5816 case "$malloctype" in
5817 '')
5818         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5819                 malloctype='void *'
5820         else
5821                 malloctype='char *'
5822         fi
5823         ;;
5824 esac
5825 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5826
5827 case "$freetype" in
5828 '')
5829         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5830                 freetype='void'
5831         else
5832                 freetype='int'
5833         fi
5834         ;;
5835 esac
5836 echo "Your system uses $freetype free(), it would seem." >&4
5837 $rm -f malloc.[co]
5838 $cat <<EOM
5839
5840 After $package is installed, you may wish to install various
5841 add-on modules and utilities.  Typically, these add-ons will
5842 be installed under $prefix with the rest
5843 of this package.  However, you may wish to install such add-ons
5844 elsewhere under a different prefix.
5845
5846 If you do not wish to put everything under a single prefix, that's
5847 ok.  You will be prompted for the individual locations; this siteprefix
5848 is only used to suggest the defaults.
5849
5850 The default should be fine for most people.
5851
5852 EOM
5853 fn=d~+
5854 rp='Installation prefix to use for add-on modules and utilities?'
5855 : XXX Here might be another good place for an installstyle setting.
5856 case "$siteprefix" in
5857 '') dflt=$prefix ;;
5858 *)  dflt=$siteprefix ;;
5859 esac
5860 . ./getfile
5861 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5862 oldsiteprefix=''
5863 case "$siteprefix" in
5864 '') ;;
5865 *)      case "$ans" in
5866         "$prefix") ;;
5867         *) oldsiteprefix="$prefix";;
5868         esac
5869         ;;
5870 esac
5871 siteprefix="$ans"
5872 siteprefixexp="$ansexp"
5873
5874 : determine where site specific libraries go.
5875 : Usual default is /usr/local/lib/perl5/site_perl/$version
5876 : The default "style" setting is made in installstyle.U
5877 : XXX No longer works with Prefixit stuff.
5878 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5879 case "$sitelib" in
5880 '') case "$installstyle" in
5881         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5882         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5883         esac
5884         ;;
5885 *)      dflt="$sitelib"
5886         ;;
5887 esac
5888 $cat <<EOM
5889
5890 The installation process will create a directory for
5891 site-specific extensions and modules.  Most users find it convenient
5892 to place all site-specific files in this directory rather than in the
5893 main distribution directory.
5894
5895 EOM
5896 fn=d~+
5897 rp='Pathname for the site-specific library files?'
5898 . ./getfile
5899 sitelib="$ans"
5900 sitelibexp="$ansexp"
5901 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
5902 : Change installation prefix, if necessary.
5903 if $test X"$prefix" != X"$installprefix"; then
5904         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
5905 else
5906         installsitelib="$sitelibexp"
5907 fi
5908
5909 : determine where site specific architecture-dependent libraries go.
5910 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
5911 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
5912 : sitelib may have an optional trailing /share.
5913 case "$sitearch" in
5914 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
5915         dflt="$dflt/$archname"
5916         ;;
5917 *)      dflt="$sitearch"
5918         ;;
5919 esac
5920 set sitearch sitearch none
5921 eval $prefixit
5922 $cat <<EOM
5923
5924 The installation process will also create a directory for
5925 architecture-dependent site-specific extensions and modules.
5926
5927 EOM
5928 fn=d~+
5929 rp='Pathname for the site-specific architecture-dependent library files?'
5930 . ./getfile
5931 sitearch="$ans"
5932 sitearchexp="$ansexp"
5933 : Change installation prefix, if necessary.
5934 if $test X"$prefix" != X"$installprefix"; then
5935         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
5936 else
5937         installsitearch="$sitearchexp"
5938 fi
5939
5940 $cat <<EOM
5941
5942 The installation process will also create a directory for
5943 vendor-supplied add-ons.  Vendors who supply perl with their system
5944 may find it convenient to place all vendor-supplied files in this
5945 directory rather than in the main distribution directory.  This will
5946 ease upgrades between binary-compatible maintenance versions of perl.
5947
5948 Of course you may also use these directories in whatever way you see
5949 fit.  For example, you might use them to access modules shared over a
5950 company-wide network.
5951
5952 The default answer should be fine for most people.
5953 This causes further questions about vendor add-ons to be skipped
5954 and no vendor-specific directories will be configured for perl.
5955
5956 EOM
5957 rp='Do you want to configure vendor-specific add-on directories?'
5958 case "$usevendorprefix" in
5959 define|true|[yY]*) dflt=y ;;
5960 *)      : User may have set vendorprefix directly on Configure command line.
5961         case "$vendorprefix" in
5962         ''|' ') dflt=n ;;
5963         *)      dflt=y ;;
5964         esac
5965         ;;
5966 esac
5967 . ./myread
5968 case "$ans" in
5969 [yY]*)  fn=d~+
5970         rp='Installation prefix to use for vendor-supplied add-ons?'
5971         case "$vendorprefix" in
5972         '') dflt='' ;;
5973         *)  dflt=$vendorprefix ;;
5974         esac
5975         . ./getfile
5976         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5977         oldvendorprefix=''
5978         case "$vendorprefix" in
5979         '') ;;
5980         *)      case "$ans" in
5981                 "$prefix") ;;
5982                 *) oldvendorprefix="$prefix";;
5983                 esac
5984                 ;;
5985         esac
5986         usevendorprefix="$define"
5987         vendorprefix="$ans"
5988         vendorprefixexp="$ansexp"
5989         ;;
5990 *)      usevendorprefix="$undef"
5991         vendorprefix=''
5992         vendorprefixexp=''
5993         ;;
5994 esac
5995
5996 case "$vendorprefix" in
5997 '')     d_vendorlib="$undef"
5998         vendorlib=''
5999         vendorlibexp=''
6000         ;;
6001 *)      d_vendorlib="$define"
6002         : determine where vendor-supplied modules go.
6003         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6004         case "$vendorlib" in
6005         '')
6006                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6007                 case "$installstyle" in
6008                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6009                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6010                 esac
6011                 ;;
6012         *)      dflt="$vendorlib"
6013                 ;;
6014         esac
6015         fn=d~+
6016         rp='Pathname for the vendor-supplied library files?'
6017         . ./getfile
6018         vendorlib="$ans"
6019         vendorlibexp="$ansexp"
6020         ;;
6021 esac
6022 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6023 : Change installation prefix, if necessary.
6024 if $test X"$prefix" != X"$installprefix"; then
6025         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6026 else
6027         installvendorlib="$vendorlibexp"
6028 fi
6029
6030 case "$vendorprefix" in
6031 '')     d_vendorarch="$undef"
6032         vendorarch=''
6033         vendorarchexp=''
6034         ;;
6035 *)      d_vendorarch="$define"
6036         : determine where vendor-supplied architecture-dependent libraries go.
6037         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6038         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6039         : vendorlib may have an optional trailing /share.
6040         case "$vendorarch" in
6041         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6042                 dflt="$dflt/$archname"
6043                 ;;
6044         *)      dflt="$vendorarch" ;;
6045         esac
6046         fn=d~+
6047         rp='Pathname for vendor-supplied architecture-dependent files?'
6048         . ./getfile
6049         vendorarch="$ans"
6050         vendorarchexp="$ansexp"
6051         ;;
6052 esac
6053 : Change installation prefix, if necessary.
6054 if $test X"$prefix" != X"$installprefix"; then
6055         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6056 else
6057         installvendorarch="$vendorarchexp"
6058 fi
6059
6060 : Final catch-all directories to search
6061 $cat <<EOM
6062
6063 Lastly, you can have perl look in other directories for extensions and
6064 modules in addition to those already specified.
6065 These directories will be searched after 
6066         $sitearch 
6067         $sitelib 
6068 EOM
6069 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6070 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6071 echo ' '
6072 case "$otherlibdirs" in
6073 ''|' ') dflt='none' ;;
6074 *)      dflt="$otherlibdirs" ;;
6075 esac
6076 $cat <<EOM
6077 Enter a colon-separated set of extra paths to include in perl's @INC
6078 search path, or enter 'none' for no extra paths.
6079
6080 EOM
6081
6082 rp='Colon-separated list of additional directories for perl to search?'
6083 . ./myread
6084 case "$ans" in
6085 ' '|''|none)    otherlibdirs=' ' ;;     
6086 *)      otherlibdirs="$ans" ;;
6087 esac
6088 case "$otherlibdirs" in
6089 ' ') val=$undef ;;
6090 *)      val=$define ;;
6091 esac
6092 set d_perl_otherlibdirs
6093 eval $setvar
6094
6095 : Cruising for prototypes
6096 echo " "
6097 echo "Checking out function prototypes..." >&4
6098 $cat >prototype.c <<'EOCP'
6099 int main(int argc, char *argv[]) {
6100         exit(0);}
6101 EOCP
6102 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6103         echo "Your C compiler appears to support function prototypes."
6104         val="$define"
6105 else
6106         echo "Your C compiler doesn't seem to understand function prototypes."
6107         val="$undef"
6108 fi
6109 set prototype
6110 eval $setvar
6111 $rm -f prototype*
6112
6113 case "$prototype" in
6114 "$define") ;;
6115 *)      ansi2knr='ansi2knr'
6116         echo " "
6117         cat <<EOM >&4
6118
6119 $me:  FATAL ERROR:
6120 This version of $package can only be compiled by a compiler that 
6121 understands function prototypes.  Unfortunately, your C compiler 
6122         $cc $ccflags
6123 doesn't seem to understand them.  Sorry about that.
6124
6125 If GNU cc is available for your system, perhaps you could try that instead.  
6126
6127 Eventually, we hope to support building Perl with pre-ANSI compilers.
6128 If you would like to help in that effort, please contact <perlbug@perl.org>.
6129
6130 Aborting Configure now.
6131 EOM
6132         exit 2
6133         ;;
6134 esac
6135
6136 : determine where public executables go
6137 echo " "
6138 set dflt bin bin
6139 eval $prefixit
6140 fn=d~
6141 rp='Pathname where the public executables will reside?'
6142 . ./getfile
6143 if $test "X$ansexp" != "X$binexp"; then
6144         installbin=''
6145 fi
6146 bin="$ans"
6147 binexp="$ansexp"
6148 : Change installation prefix, if necessary.
6149 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6150 if $test X"$prefix" != X"$installprefix"; then
6151         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6152 else
6153         installbin="$binexp"
6154 fi
6155
6156 : Find perl5.005 or later.
6157 echo "Looking for a previously installed perl5.005 or later... "
6158 case "$perl5" in
6159 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6160                 : Check if this perl is recent and can load a simple module
6161                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6162                         perl5=$tdir/perl
6163                         break;
6164                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6165                         perl5=$tdir/perl
6166                         break;
6167                 fi
6168         done
6169         ;;
6170 *)      perl5="$perl5"
6171         ;;
6172 esac
6173 case "$perl5" in
6174 '')     echo "None found.  That's ok.";;
6175 *)      echo "Using $perl5." ;;
6176 esac
6177
6178 : Determine list of previous versions to include in @INC
6179 $cat > getverlist <<EOPL
6180 #!$perl5 -w
6181 use File::Basename;
6182 \$api_versionstring = "$api_versionstring";
6183 \$version = "$version";
6184 \$stem = "$sitelib_stem";
6185 \$archname = "$archname";
6186 EOPL
6187         $cat >> getverlist <<'EOPL'
6188 # Can't have leading @ because metaconfig interprets it as a command!
6189 ;@inc_version_list=();
6190 # XXX Redo to do opendir/readdir? 
6191 if (-d $stem) {
6192     chdir($stem);
6193     ;@candidates = glob("5.*");
6194 }
6195 else {
6196     ;@candidates = ();
6197 }
6198
6199 # XXX ToDo:  These comparisons must be reworked when two-digit
6200 # subversions come along, so that 5.7.10 compares as greater than
6201 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6202 # widespread that we can use the built-in version vectors rather
6203 # than reinventing them here.  For 5.6.0, however, we must
6204 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6205 foreach $d (@candidates) {
6206     if ($d lt $version) {
6207         if ($d ge $api_versionstring) {
6208             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6209         }
6210         elsif ($d ge "5.005") {
6211             unshift(@inc_version_list, grep { -d } $d);
6212         }
6213     }
6214     else {
6215         # Skip newer version.  I.e. don't look in
6216         # 5.7.0 if we're installing 5.6.1.
6217     }
6218 }
6219
6220 if (@inc_version_list) {
6221     print join(' ', @inc_version_list);
6222 }
6223 else {
6224     # Blank space to preserve value for next Configure run.
6225     print " ";
6226 }
6227 EOPL
6228 chmod +x getverlist
6229 case "$inc_version_list" in
6230 '')     if test -x "$perl5"; then
6231                 dflt=`$perl5 getverlist`
6232         else
6233                 dflt='none'
6234         fi
6235         ;;
6236 $undef) dflt='none' ;;
6237 *)  dflt="$inc_version_list" ;;
6238 esac
6239 case "$dflt" in
6240 ''|' ') dflt=none ;;
6241 esac
6242 case "$dflt" in
6243 5.005) case "$bincompat5005" in
6244        $define|true|[yY]*) ;;
6245        *) dflt=none ;;
6246        esac
6247        ;;
6248 esac
6249 $cat <<'EOM'
6250
6251 In order to ease the process of upgrading, this version of perl 
6252 can be configured to use modules built and installed with earlier 
6253 versions of perl that were installed under $prefix.  Specify here
6254 the list of earlier versions that this version of perl should check.
6255 If Configure detected no earlier versions of perl installed under
6256 $prefix, then the list will be empty.  Answer 'none' to tell perl
6257 to not search earlier versions.
6258
6259 The default should almost always be sensible, so if you're not sure,
6260 just accept the default.
6261 EOM
6262
6263 rp='List of earlier versions to include in @INC?'
6264 . ./myread
6265 case "$ans" in
6266 [Nn]one|''|' ') inc_version_list=' ' ;;
6267 *) inc_version_list="$ans" ;;
6268 esac
6269 case "$inc_version_list" in
6270 ''|' ') 
6271         inc_version_list_init='0';;
6272 *)      inc_version_list_init=`echo $inc_version_list |
6273                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6274         ;;
6275 esac
6276 $rm -f getverlist
6277
6278 : determine whether to install perl also as /usr/bin/perl
6279
6280 echo " "
6281 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6282         $cat <<EOM
6283 Many scripts expect perl to be installed as /usr/bin/perl.
6284 I can install the perl you are about to compile also as /usr/bin/perl
6285 (in addition to $installbin/perl).
6286 EOM
6287         case "$installusrbinperl" in
6288         "$undef"|[nN]*) dflt='n';;
6289         *)              dflt='y';;
6290         esac
6291         rp="Do you want to install perl as /usr/bin/perl?"
6292         . ./myread
6293         case "$ans" in
6294         [yY]*)  val="$define";;
6295         *)      val="$undef" ;;
6296         esac
6297 else
6298         val="$undef"
6299 fi
6300 set installusrbinperl
6301 eval $setvar
6302
6303 : see if dld is available
6304 set dld.h i_dld
6305 eval $inhdr
6306
6307 : see if dlopen exists
6308 xxx_runnm="$runnm"
6309 runnm=false
6310 set dlopen d_dlopen
6311 eval $inlibc
6312 runnm="$xxx_runnm"
6313
6314 : determine which dynamic loading, if any, to compile in
6315 echo " "
6316 dldir="ext/DynaLoader"
6317 case "$usedl" in
6318 $define|y|true)
6319         dflt='y'
6320         usedl="$define"
6321         ;;
6322 $undef|n|false)
6323         dflt='n'
6324         usedl="$undef"
6325         ;;
6326 *) 
6327         dflt='n'
6328         case "$d_dlopen" in
6329             $define) dflt='y' ;;
6330         esac
6331         case "$i_dld" in
6332             $define) dflt='y' ;;
6333         esac
6334         : Does a dl_xxx.xs file exist for this operating system
6335         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6336         ;;
6337 esac
6338 rp="Do you wish to use dynamic loading?"
6339 . ./myread
6340 usedl="$ans"
6341 case "$ans" in
6342 y*) usedl="$define"
6343         case "$dlsrc" in
6344         '')
6345                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6346                         dflt="$dldir/dl_${osname}.xs"
6347                 elif $test "$d_dlopen" = "$define" ; then
6348                         dflt="$dldir/dl_dlopen.xs"
6349                 elif $test "$i_dld" = "$define" ; then
6350                         dflt="$dldir/dl_dld.xs"
6351                 else
6352                         dflt=''
6353                 fi
6354                 ;;
6355         *)      dflt="$dldir/$dlsrc"
6356                 ;;
6357         esac
6358     echo "The following dynamic loading files are available:"
6359         : Can not go over to $dldir because getfile has path hard-coded in.
6360         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6361         rp="Source file to use for dynamic loading"
6362         fn="fne"
6363         gfpth="$src"
6364         . ./getfile
6365         usedl="$define"
6366         : emulate basename
6367         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6368
6369         $cat << EOM
6370
6371 Some systems may require passing special flags to $cc -c to
6372 compile modules that will be used to create a shared library.
6373 To use no flags, say "none".
6374
6375 EOM
6376     case "$cccdlflags" in
6377     '') case "$gccversion" in
6378                 '') case "$osname" in
6379                         hpux)   dflt='+z' ;;
6380                         next)   dflt='none' ;;
6381                         irix*)  dflt='-KPIC' ;;
6382                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6383                         sunos)  dflt='-pic' ;;
6384                         *)      dflt='none' ;;
6385                     esac
6386                         ;;
6387                 *)  case "$osname" in
6388                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6389                         *)      dflt='-fpic' ;;
6390                     esac ;;
6391             esac ;;
6392         ' ') dflt='none' ;;
6393     *)  dflt="$cccdlflags" ;;
6394     esac
6395     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6396     . ./myread
6397     case "$ans" in
6398     none) cccdlflags=' ' ;;
6399     *) cccdlflags="$ans" ;;
6400     esac
6401
6402     cat << EOM
6403
6404 Some systems use ld to create libraries that can be dynamically loaded,
6405 while other systems (such as those using ELF) use $cc.
6406
6407 EOM
6408         case "$ld" in
6409         '')     $cat >try.c <<'EOM'
6410 /* Test for whether ELF binaries are produced */
6411 #include <fcntl.h>
6412 #include <stdlib.h>
6413 int main() {
6414         char b[4];
6415         int i = open("a.out",O_RDONLY);
6416         if(i == -1) 
6417                 exit(1); /* fail */
6418         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6419                 exit(0); /* succeed (yes, it's ELF) */
6420         else
6421                 exit(1); /* fail */
6422 }
6423 EOM
6424                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6425                         cat <<EOM
6426 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6427 EOM
6428                         dflt="$cc"
6429                 else
6430                         echo "I'll use ld to build dynamic libraries."
6431                         dflt='ld'
6432                 fi
6433                 rm -f try.c a.out
6434                 ;;
6435         *)      dflt="$ld"
6436                 ;;
6437         esac
6438
6439     rp="What command should be used to create dynamic libraries?"
6440     . ./myread
6441         ld="$ans"
6442
6443     cat << EOM
6444
6445 Some systems may require passing special flags to $ld to create a
6446 library that can be dynamically loaded.  If your ld flags include
6447 -L/other/path options to locate libraries outside your loader's normal
6448 search path, you may need to specify those -L options here as well.  To
6449 use no flags, say "none".
6450
6451 EOM
6452     case "$lddlflags" in
6453     '') case "$osname" in
6454                         beos) dflt='-nostart' ;;
6455                         hpux) dflt='-b';
6456                               case "$gccversion" in
6457                               '') dflt="$dflt +vnocompatwarnings" ;;
6458                               esac
6459                               ;;        
6460                         linux|irix*)    dflt='-shared' ;;
6461                         next)  dflt='none' ;;
6462                         solaris) dflt='-G' ;;
6463                         sunos) dflt='-assert nodefinitions' ;;
6464                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6465                 *)     dflt='none' ;;
6466                         esac
6467                         ;;
6468     *) dflt="$lddlflags" ;;
6469     esac
6470
6471         : Try to guess additional flags to pick up local libraries.
6472         : Be careful not to append to a plain 'none'
6473         case "$dflt" in
6474         none) dflt='' ;;
6475         esac
6476         for thisflag in $ldflags; do
6477                 case "$thisflag" in
6478                 -L*|-R*)
6479                         case " $dflt " in
6480                         *" $thisflag "*) ;;
6481                         *) dflt="$dflt $thisflag" ;;
6482                         esac
6483                         ;;
6484                 esac
6485         done
6486
6487         case "$dflt" in
6488         ''|' ') dflt='none' ;;
6489         esac
6490
6491     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6492     . ./myread
6493     case "$ans" in
6494     none) lddlflags=' ' ;;
6495     *) lddlflags="$ans" ;;
6496     esac
6497
6498         cat <<EOM
6499
6500 Some systems may require passing special flags to $cc to indicate that
6501 the resulting executable will use dynamic linking.  To use no flags,
6502 say "none".
6503
6504 EOM
6505     case "$ccdlflags" in
6506     '') case "$osname" in
6507                 hpux)   dflt='-Wl,-E' ;;
6508                 linux)  dflt='-rdynamic' ;;
6509                 next)   dflt='none' ;;
6510                 sunos)  dflt='none' ;;
6511                 *)      dflt='none' ;;
6512             esac ;;
6513     ' ')  dflt='none' ;;
6514     *)  dflt="$ccdlflags" ;;
6515     esac
6516     rp="Any special flags to pass to $cc to use dynamic linking?"
6517     . ./myread
6518     case "$ans" in
6519     none) ccdlflags=' ' ;;
6520     *) ccdlflags="$ans" ;;
6521     esac
6522     ;;
6523 *)  usedl="$undef"
6524         ld='ld'
6525     dlsrc='dl_none.xs'
6526     lddlflags=''
6527     ccdlflags=''
6528     ;;
6529 esac
6530
6531 also=''
6532 case "$usedl" in
6533 $undef)
6534         # No dynamic loading being used, so don't bother even to prompt.
6535         useshrplib='false'
6536         ;;
6537 *)      case "$useshrplib" in
6538         '')     case "$osname" in
6539                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6540                         dflt=y
6541                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6542                         ;;
6543                 next*)
6544                         case "$osvers" in
6545                         4*)     dflt=y
6546                                 also='Building a shared libperl is needed for MAB support.'
6547                                 ;;
6548                         *)      dflt=n
6549                                 ;;
6550                         esac
6551                         ;;
6552                 *)      dflt=n
6553                         ;;
6554                 esac
6555                 ;;
6556         $define|true|[Yy]*)
6557                 dflt=y
6558                 ;;
6559         *)      dflt=n
6560                 ;;
6561         esac
6562         $cat << EOM
6563
6564 The perl executable is normally obtained by linking perlmain.c with
6565 libperl${_a}, any static extensions (usually just DynaLoader), and
6566 any other libraries needed on this system (such as -lm, etc.).  Since
6567 your system supports dynamic loading, it is probably possible to build
6568 a shared libperl.$so.  If you will have more than one executable linked
6569 to libperl.$so, this will significantly reduce the size of each
6570 executable, but it may have a noticeable affect on performance.  The
6571 default is probably sensible for your system.
6572 $also
6573
6574 EOM
6575         rp="Build a shared libperl.$so (y/n)"
6576         . ./myread
6577         case "$ans" in
6578         true|$define|[Yy]*)
6579                 useshrplib='true'  ;;
6580         *)      useshrplib='false' ;;
6581         esac
6582         ;;
6583 esac
6584
6585 case "$useshrplib" in
6586 true)
6587         case "$libperl" in
6588         '')
6589                 # Figure out a good name for libperl.so.  Since it gets stored in
6590                 # a version-specific architecture-dependent library, the version
6591                 # number isn't really that important, except for making cc/ld happy.
6592                 #
6593                 # A name such as libperl.so.3.1
6594                 majmin="libperl.$so.$patchlevel.$subversion"
6595                 # A name such as libperl.so.301
6596                 majonly=`echo $patchlevel $subversion |
6597                         $awk '{printf "%d%02d", $1, $2}'`
6598                 majonly=libperl.$so.$majonly
6599                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6600                 # rely on figuring it out from the naming of libc.
6601                 case "${osname}${osvers}" in
6602                 next4*)
6603                         dflt=libperl.5.$so
6604                         # XXX How handle the --version stuff for MAB?
6605                         ;;
6606                 linux*)  # ld won't link with a bare -lperl otherwise.
6607                         dflt=libperl.$so
6608                         ;;
6609                 cygwin*) # include version
6610                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6611                         ;;
6612                 *)      # Try to guess based on whether libc has major.minor.
6613                         case "$libc" in
6614                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6615                         *libc.$so.[0-9]*) dflt=$majonly ;;
6616                         *)      dflt=libperl.$so ;;
6617                         esac
6618                         ;;
6619                 esac
6620                 ;;
6621         *)      dflt=$libperl
6622                 ;;
6623         esac
6624         cat << EOM
6625
6626 I need to select a good name for the shared libperl.  If your system uses
6627 library names with major and minor numbers, then you might want something
6628 like $majmin.  Alternatively, if your system uses a single version
6629 number for shared libraries, then you might want to use $majonly.
6630 Or, your system might be quite happy with a simple libperl.$so.
6631
6632 Since the shared libperl will get installed into a version-specific
6633 architecture-dependent directory, the version number of the shared perl
6634 library probably isn't important, so the default should be o.k.
6635
6636 EOM
6637         rp='What name do you want to give to the shared libperl?'
6638         . ./myread
6639         libperl=$ans
6640         echo "Ok, I'll use $libperl"
6641         ;;
6642 *)
6643         libperl="libperl${_a}"
6644         ;;
6645 esac
6646
6647 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6648 case "$shrpdir" in
6649 '') ;;
6650 *)      $cat >&4 <<EOM
6651 WARNING:  Use of the shrpdir variable for the installation location of
6652 the shared $libperl is not supported.  It was never documented and
6653 will not work in this version.  Let me (perlbug@perl.org)
6654 know of any problems this may cause.
6655
6656 EOM
6657         case "$shrpdir" in
6658         "$archlibexp/CORE")
6659                 $cat >&4 <<EOM
6660 But your current setting of $shrpdir is
6661 the default anyway, so it's harmless.
6662 EOM
6663                 ;;
6664         *)
6665                 $cat >&4 <<EOM
6666 Further, your current attempted setting of $shrpdir
6667 conflicts with the value of $archlibexp/CORE
6668 that installperl will use.
6669 EOM
6670                 ;;
6671         esac
6672         ;;
6673 esac
6674
6675 # How will the perl executable find the installed shared $libperl?
6676 # Add $xxx to ccdlflags.
6677 # If we can't figure out a command-line option, use $shrpenv to
6678 # set env LD_RUN_PATH.  The main perl makefile uses this.
6679 shrpdir=$archlibexp/CORE
6680 xxx=''
6681 tmp_shrpenv=''
6682 if "$useshrplib"; then
6683     case "$osname" in 
6684         aix)
6685                 # We'll set it in Makefile.SH...
6686                 ;;
6687         solaris|netbsd)
6688                 xxx="-R $shrpdir"
6689                 ;;
6690         freebsd)
6691                 xxx="-Wl,-R$shrpdir"
6692                 ;;
6693         linux|irix*|dec_osf)
6694                 xxx="-Wl,-rpath,$shrpdir"
6695                 ;;
6696         next)
6697                 # next doesn't like the default...
6698                 ;;
6699         beos)
6700                 # beos doesn't like the default, either.
6701                 ;;
6702         hpux*)
6703                 # hpux doesn't like the default, either.
6704                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6705                 ;;
6706         *)
6707                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6708                 ;;
6709         esac
6710         case "$xxx" in
6711         '') ;;
6712         *)      
6713                 # Only add $xxx if it isn't already in ccdlflags.
6714                 case " $ccdlflags " in
6715                 *" $xxx "*)     ;;
6716                 *)      ccdlflags="$ccdlflags $xxx"
6717                         cat <<EOM >&4
6718
6719 Adding $xxx to the flags
6720 passed to $ld so that the perl executable will find the 
6721 installed shared $libperl.
6722
6723 EOM
6724                         ;;
6725                 esac
6726                 ;;
6727         esac
6728 fi
6729 # Fix ccdlflags in AIX for building external extensions.
6730 # (For building Perl itself bare -bE:perl.exp is needed,
6731 #  Makefile.SH takes care of this.)
6732 case "$osname" in
6733 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6734 esac
6735 # Respect a hint or command-line value.
6736 case "$shrpenv" in
6737 '') shrpenv="$tmp_shrpenv" ;;
6738 esac
6739 case "$ldlibpthname" in
6740 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6741 none)   ldlibpthname='' ;;
6742 esac
6743
6744 : determine where manual pages are on this system
6745 echo " "
6746 case "$sysman" in
6747 '') 
6748         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6749         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6750         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6751         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6752         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6753         sysman=`./loc . /usr/man/man1 $syspath`
6754         ;;
6755 esac
6756 if $test -d "$sysman"; then
6757         echo "System manual is in $sysman." >&4
6758 else
6759         echo "Could not find manual pages in source form." >&4
6760 fi
6761
6762 : determine where manual pages go
6763 set man1dir man1dir none
6764 eval $prefixit
6765 $cat <<EOM
6766
6767 $spackage has manual pages available in source form.
6768 EOM
6769 case "$nroff" in
6770 nroff)
6771         echo "However, you don't have nroff, so they're probably useless to you."
6772         case "$man1dir" in
6773         '') man1dir="none";;
6774         esac;;
6775 esac
6776 echo "If you don't want the manual sources installed, answer 'none'."
6777 case "$man1dir" in
6778 ' ') dflt=none
6779         ;;
6780 '')
6781         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6782         lookpath="$lookpath $prefixexp/man/p_man/man1"
6783         lookpath="$lookpath $prefixexp/man/u_man/man1"
6784         lookpath="$lookpath $prefixexp/man/man.1"
6785         case "$sysman" in
6786         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6787         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6788         esac
6789         set dflt
6790         eval $prefixup
6791         ;;
6792 *)  dflt="$man1dir"
6793         ;;
6794 esac
6795 echo " "
6796 fn=dn+~
6797 rp="Where do the main $spackage manual pages (source) go?"
6798 . ./getfile
6799 if $test "X$man1direxp" != "X$ansexp"; then
6800         installman1dir=''
6801 fi
6802 man1dir="$ans"
6803 man1direxp="$ansexp"
6804 case "$man1dir" in
6805 '')     man1dir=' '
6806         installman1dir='';;
6807 esac
6808
6809 : Change installation prefix, if necessary.
6810 if $test X"$prefix" != X"$installprefix"; then
6811         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6812 else
6813         installman1dir="$man1direxp"
6814 fi
6815
6816 : What suffix to use on installed man pages
6817
6818 case "$man1dir" in
6819 ' ')
6820         man1ext='0'
6821         ;;
6822 *)
6823         rp="What suffix should be used for the main $spackage man pages?"
6824         case "$man1ext" in
6825         '')     case "$man1dir" in
6826                 *1)  dflt=1 ;;
6827                 *1p) dflt=1p ;;
6828                 *1pm) dflt=1pm ;;
6829                 *l) dflt=l;;
6830                 *n) dflt=n;;
6831                 *o) dflt=o;;
6832                 *p) dflt=p;;
6833                 *C) dflt=C;;
6834                 *L) dflt=L;;
6835                 *L1) dflt=L1;;
6836                 *) dflt=1;;
6837                 esac
6838                 ;;
6839         *)      dflt="$man1ext";;
6840         esac
6841         . ./myread
6842         man1ext="$ans"
6843         ;;
6844 esac
6845
6846 : see if we can have long filenames
6847 echo " "
6848 first=123456789abcdef
6849 $rm -f $first
6850 if (echo hi >$first) 2>/dev/null; then
6851         if $test -f 123456789abcde; then
6852                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6853                 val="$undef"
6854         else
6855                 echo 'You can have filenames longer than 14 characters.'>&4
6856                 val="$define"
6857         fi
6858 else
6859         $cat <<'EOM'
6860 You can't have filenames longer than 14 chars.
6861 You can't even think about them!
6862 EOM
6863         val="$undef"
6864 fi 
6865 set d_flexfnam
6866 eval $setvar
6867 $rm -rf 123456789abcde*
6868
6869 : determine where library module manual pages go
6870 set man3dir man3dir none
6871 eval $prefixit
6872 $cat <<EOM
6873
6874 $spackage has manual pages for many of the library modules.
6875 EOM
6876
6877 case "$nroff" in
6878 nroff)
6879         $cat <<'EOM'
6880 However, you don't have nroff, so they're probably useless to you.
6881 EOM
6882         case "$man3dir" in
6883         '') man3dir="none";;
6884         esac;;
6885 esac
6886
6887 case "$d_flexfnam" in
6888 undef)
6889         $cat <<'EOM'
6890 However, your system can't handle the long file names like File::Basename.3. 
6891 EOM
6892         case "$man3dir" in
6893         '') man3dir="none";;
6894         esac;;
6895 esac
6896
6897 echo "If you don't want the manual sources installed, answer 'none'."
6898 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6899 case "$man3dir" in
6900 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6901         if $test -d "$privlib/man/man3"; then
6902                 cat <<EOM >&4
6903
6904 WARNING:  Previous versions of perl installed man3 pages into
6905 $privlib/man/man3.  This version will suggest a 
6906 new default of $dflt.  
6907 EOM
6908                 tdflt=$dflt
6909                 dflt='n'
6910                 rp='Do you wish to preserve the old behavior?(y/n)'
6911                 . ./myread
6912                 case "$ans" in
6913                 y*) dflt="$privlib/man/man3" ;;
6914                 *)  dflt=$tdflt ;;
6915                 esac
6916     fi
6917         ;;
6918 *)      dflt="$man3dir" ;;
6919 esac
6920 case "$dflt" in
6921 ' ') dflt=none ;;
6922 esac
6923 echo " "
6924 fn=dn+~
6925 rp="Where do the $package library man pages (source) go?"
6926 . ./getfile
6927 man3dir="$ans"
6928 man3direxp="$ansexp"
6929 case "$man3dir" in
6930 '')     man3dir=' '
6931         installman3dir='';;
6932 esac
6933
6934 : Change installation prefix, if necessary.
6935 if $test X"$prefix" != X"$installprefix"; then
6936         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6937 else
6938         installman3dir="$man3direxp"
6939 fi
6940
6941 : What suffix to use on installed man pages
6942 case "$man3dir" in
6943 ' ')
6944         man3ext='0'
6945         ;;
6946 *)
6947         rp="What suffix should be used for the $package library man pages?"
6948         case "$man3ext" in
6949         '')     case "$man3dir" in
6950                 *3)  dflt=3 ;;
6951                 *3p) dflt=3p ;;
6952                 *3pm) dflt=3pm ;;
6953                 *l) dflt=l;;
6954                 *n) dflt=n;;
6955                 *o) dflt=o;;
6956                 *p) dflt=p;;
6957                 *C) dflt=C;;
6958                 *L) dflt=L;;
6959                 *L3) dflt=L3;;
6960                 *) dflt=3;;
6961                 esac
6962                 ;;
6963         *)      dflt="$man3ext";;
6964         esac
6965         . ./myread
6966         man3ext="$ans"
6967         ;;
6968 esac
6969
6970 : see if we have to deal with yellow pages, now NIS.
6971 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6972         if $test -f /usr/etc/nibindd; then
6973                 echo " "
6974                 echo "I'm fairly confident you're on a NeXT."
6975                 echo " "
6976                 rp='Do you get the hosts file via NetInfo?'
6977                 dflt=y
6978                 case "$hostcat" in
6979                 nidump*) ;;
6980                 '') ;;
6981                 *) dflt=n;;
6982                 esac
6983                 . ./myread
6984                 case "$ans" in
6985                 y*) hostcat='nidump hosts .';;
6986                 *)      case "$hostcat" in
6987                         nidump*) hostcat='';;
6988                         esac
6989                         ;;
6990                 esac
6991         fi
6992         case "$hostcat" in
6993         nidump*) ;;
6994         *)
6995                 case "$hostcat" in
6996                 *ypcat*) dflt=y;;
6997                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6998                                 dflt=y
6999                         else
7000                                 dflt=n
7001                         fi;;
7002                 *) dflt=n;;
7003                 esac
7004                 echo " "
7005                 rp='Are you getting the hosts file via yellow pages?'
7006                 . ./myread
7007                 case "$ans" in
7008                 y*) hostcat='ypcat hosts';;
7009                 *) hostcat='cat /etc/hosts';;
7010                 esac
7011                 ;;
7012         esac
7013 fi
7014 case "$hostcat" in
7015 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7016 esac
7017 case "$groupcat" in
7018 '') test -f /etc/group && groupcat='cat /etc/group';;
7019 esac
7020 case "$passcat" in
7021 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7022 esac
7023
7024 : now get the host name
7025 echo " "
7026 echo "Figuring out host name..." >&4
7027 case "$myhostname" in
7028 '') cont=true
7029         echo 'Maybe "hostname" will work...'
7030         if tans=`sh -c hostname 2>&1` ; then
7031                 myhostname=$tans
7032                 phostname=hostname
7033                 cont=''
7034         fi
7035         ;;
7036 *) cont='';;
7037 esac
7038 if $test "$cont"; then
7039         if ./xenix; then
7040                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7041                 if tans=`cat /etc/systemid 2>&1` ; then
7042                         myhostname=$tans
7043                         phostname='cat /etc/systemid'
7044                         echo "Whadyaknow.  Xenix always was a bit strange..."
7045                         cont=''
7046                 fi
7047         elif $test -r /etc/systemid; then
7048                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7049         fi
7050 fi
7051 if $test "$cont"; then
7052         echo 'No, maybe "uuname -l" will work...'
7053         if tans=`sh -c 'uuname -l' 2>&1` ; then
7054                 myhostname=$tans
7055                 phostname='uuname -l'
7056         else
7057                 echo 'Strange.  Maybe "uname -n" will work...'
7058                 if tans=`sh -c 'uname -n' 2>&1` ; then
7059                         myhostname=$tans
7060                         phostname='uname -n'
7061                 else
7062                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7063                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7064                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7065                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7066                         else
7067                                 case "$myhostname" in
7068                                 '') echo "Does this machine have an identity crisis or something?"
7069                                         phostname='';;
7070                                 *)
7071                                         echo "Well, you said $myhostname before..."
7072                                         phostname='echo $myhostname';;
7073                                 esac
7074                         fi
7075                 fi
7076         fi
7077 fi
7078 : you do not want to know about this
7079 set $myhostname
7080 myhostname=$1
7081
7082 : verify guess
7083 if $test "$myhostname" ; then
7084         dflt=y
7085         rp='Your host name appears to be "'$myhostname'".'" Right?"
7086         . ./myread
7087         case "$ans" in
7088         y*) ;;
7089         *) myhostname='';;
7090         esac
7091 fi
7092
7093 : bad guess or no guess
7094 while $test "X$myhostname" = X ; do
7095         dflt=''
7096         rp="Please type the (one word) name of your host:"
7097         . ./myread
7098         myhostname="$ans"
7099 done
7100
7101 : translate upper to lower if necessary
7102 case "$myhostname" in
7103 *[A-Z]*)
7104         echo "(Normalizing case in your host name)"
7105         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7106         ;;
7107 esac
7108
7109 case "$myhostname" in
7110 *.*)
7111         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7112         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7113         echo "(Trimming domain name from host name--host name is now $myhostname)"
7114         ;;
7115 *) case "$mydomain" in
7116         '')
7117                 {
7118                         test "X$hostcat" = "Xypcat hosts" &&
7119                         ypmatch "$myhostname" hosts 2>/dev/null |\
7120                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7121                         $test -s hosts
7122                 } || {
7123                         test "X$hostcat" != "X" &&
7124                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7125                                         /[       ]$myhostname[  . ]/p" > hosts
7126                 }
7127                 tmp_re="[       . ]"
7128                 if $test -f hosts; then
7129                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7130                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7131                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7132                                 hosts | $sort | $uniq | \
7133                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7134                         case `$echo X$dflt` in
7135                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7136                                 dflt=.
7137                                 ;;
7138                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7139                                 ;;
7140                         esac
7141                 else
7142                         echo "(I cannot locate a hosts database anywhere)"
7143                         dflt=.
7144                 fi
7145                 case "$dflt" in
7146                 .)
7147                         tans=`./loc resolv.conf X /etc /usr/etc`
7148                         if $test -f "$tans"; then
7149                                 echo "(Attempting domain name extraction from $tans)"
7150                                 dflt=.`$sed -n -e 's/   / /g' \
7151                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7152                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7153                                 case "$dflt" in
7154                                 .) dflt=.`$sed -n -e 's/        / /g' \
7155                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7156                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7157                                         ;;
7158                                 esac
7159                         fi
7160                         ;;
7161                 esac
7162                 case "$dflt" in
7163                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7164                         dflt=.`sh -c domainname 2>/dev/null`
7165                         case "$dflt" in
7166                         '') dflt='.';;
7167                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7168                         esac
7169                         ;;
7170                 esac
7171                 case "$dflt" in
7172                 .) echo "(Lost all hope -- silly guess then)"
7173                         dflt='.uucp'
7174                         ;;
7175                 esac
7176                 $rm -f hosts
7177                 ;;
7178         *) dflt="$mydomain";;
7179         esac;;
7180 esac
7181 echo " "
7182 rp="What is your domain name?"
7183 . ./myread
7184 tans="$ans"
7185 case "$ans" in
7186 '') ;;
7187 .*) ;;
7188 *) tans=".$tans";;
7189 esac
7190 mydomain="$tans"
7191
7192 : translate upper to lower if necessary
7193 case "$mydomain" in
7194 *[A-Z]*)
7195         echo "(Normalizing case in your domain name)"
7196         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7197         ;;
7198 esac
7199
7200 : a little sanity check here
7201 case "$phostname" in
7202 '') ;;
7203 *)
7204         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7205         $myhostname$mydomain|$myhostname) ;;
7206         *)
7207                 case "$phostname" in
7208                 sed*)
7209                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7210                         ;;
7211                 *)
7212                         echo "(That doesn't agree with your $phostname command, by the way.)"
7213                         ;;
7214                 esac
7215         ;;
7216         esac
7217         ;;
7218 esac
7219
7220 $cat <<EOM
7221
7222 I need to get your e-mail address in Internet format if possible, i.e.
7223 something like user@host.domain. Please answer accurately since I have
7224 no easy means to double check it. The default value provided below
7225 is most probably close to reality but may not be valid from outside
7226 your organization...
7227
7228 EOM
7229 cont=x
7230 while test "$cont"; do
7231         case "$cf_email" in
7232         '') dflt="$cf_by@$myhostname$mydomain";;
7233         *) dflt="$cf_email";;
7234         esac
7235         rp='What is your e-mail address?'
7236         . ./myread
7237         cf_email="$ans"
7238         case "$cf_email" in
7239         *@*.*) cont='' ;;
7240         *)
7241                 rp='Address does not look like an Internet one.  Use it anyway?'
7242                 case "$fastread" in
7243                 yes) dflt=y ;;
7244                 *) dflt=n ;;
7245                 esac
7246                 . ./myread
7247                 case "$ans" in
7248                 y*) cont='' ;;
7249                 *) echo " " ;;
7250                 esac
7251                 ;;
7252         esac
7253 done
7254
7255 $cat <<EOM
7256
7257 If you or somebody else will be maintaining perl at your site, please
7258 fill in the correct e-mail address here so that they may be contacted
7259 if necessary. Currently, the "perlbug" program included with perl
7260 will send mail to this address in addition to perlbug@perl.org. You may
7261 enter "none" for no administrator.
7262
7263 EOM
7264 case "$perladmin" in
7265 '') dflt="$cf_email";;
7266 *) dflt="$perladmin";;
7267 esac
7268 rp='Perl administrator e-mail address'
7269 . ./myread
7270 perladmin="$ans"
7271
7272 : determine whether to only install version-specific parts.
7273 echo " "
7274 $cat <<EOM
7275 Do you want to install only the version-specific parts of the perl
7276 distribution?  Usually you do *not* want to do this.
7277 EOM
7278 case "$versiononly" in
7279 "$define"|[Yy]*|true) dflt='y' ;;
7280 *) dflt='n';
7281 esac
7282 rp="Do you want to install only the version-specific parts of perl?"
7283 . ./myread
7284 case "$ans" in
7285 [yY]*)  val="$define";;
7286 *)      val="$undef" ;;
7287 esac
7288 set versiononly
7289 eval $setvar
7290
7291 : figure out how to guarantee perl startup
7292 case "$startperl" in
7293 '')
7294         case "$sharpbang" in
7295         *!)
7296                 $cat <<EOH
7297
7298 I can use the #! construct to start perl on your system. This will
7299 make startup of perl scripts faster, but may cause problems if you
7300 want to share those scripts and perl is not in a standard place
7301 ($binexp/perl) on all your platforms. The alternative is to force
7302 a shell by starting the script with a single ':' character.
7303
7304 EOH
7305                 case "$versiononly" in
7306                 "$define")      dflt="$binexp/perl$version";;  
7307                 *)              dflt="$binexp/perl";;
7308                 esac
7309                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7310                 . ./myread
7311                 case "$ans" in
7312                 none)   startperl=": # use perl";;
7313                 *)      startperl="#!$ans"
7314                         if $test 30 -lt `echo "$ans" | wc -c`; then
7315                                 $cat >&4 <<EOM
7316
7317 WARNING:  Some systems limit the #! command to 32 characters.
7318 If you experience difficulty running Perl scripts with #!, try
7319 installing Perl in a directory with a shorter pathname.
7320
7321 EOM
7322                         fi ;;
7323                 esac
7324                 ;;
7325         *) startperl=": # use perl"
7326                 ;;
7327         esac
7328         ;;
7329 esac
7330 echo "I'll use $startperl to start perl scripts."
7331
7332 : figure best path for perl in scripts
7333 case "$perlpath" in
7334 '')
7335         perlpath="$binexp/perl"
7336         case "$startperl" in
7337         *!*) ;;
7338         *)
7339                 $cat <<EOH
7340
7341 I will use the "eval 'exec'" idiom to start Perl on your system.
7342 I can use the full path of your Perl binary for this purpose, but
7343 doing so may cause problems if you want to share those scripts and
7344 Perl is not always in a standard place ($binexp/perl).
7345
7346 EOH
7347                 dflt="$binexp/perl"
7348                 rp="What path shall I use in \"eval 'exec'\"?"
7349                 . ./myread
7350                 perlpath="$ans"
7351                 ;;
7352         esac
7353         ;;
7354 esac
7355 case "$startperl" in
7356 *!*)    ;;
7357 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7358 esac
7359
7360 : determine where public executable scripts go
7361 set scriptdir scriptdir
7362 eval $prefixit
7363 case "$scriptdir" in
7364 '')
7365         dflt="$bin"
7366         : guess some guesses
7367         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7368         $test -d /usr/share/bin     && dflt=/usr/share/bin
7369         $test -d /usr/local/script  && dflt=/usr/local/script
7370         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7371         $test -d $prefixexp/script  && dflt=$prefixexp/script
7372         set dflt
7373         eval $prefixup
7374         ;;
7375 *)  dflt="$scriptdir"
7376         ;;
7377 esac
7378 $cat <<EOM
7379  
7380 Some installations have a separate directory just for executable scripts so
7381 that they can mount it across multiple architectures but keep the scripts in
7382 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7383 Or you might just lump your scripts in with all your other executables.
7384  
7385 EOM
7386 fn=d~
7387 rp='Where do you keep publicly executable scripts?'
7388 . ./getfile
7389 if $test "X$ansexp" != "X$scriptdirexp"; then
7390         installscript=''
7391 fi
7392 scriptdir="$ans"
7393 scriptdirexp="$ansexp"
7394 : Change installation prefix, if necessary.
7395 if $test X"$prefix" != X"$installprefix"; then
7396         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7397 else
7398         installscript="$scriptdirexp"
7399 fi
7400
7401 : determine where add-on public executables go
7402 case "$sitebin" in
7403 '')     dflt=$siteprefix/bin ;;
7404 *)      dflt=$sitebin ;;
7405 esac
7406 fn=d~
7407 rp='Pathname where the add-on public executables should be installed?'
7408 . ./getfile
7409 sitebin="$ans"
7410 sitebinexp="$ansexp"
7411 : Change installation prefix, if necessary.
7412 if $test X"$prefix" != X"$installprefix"; then
7413         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7414 else
7415         installsitebin="$sitebinexp"
7416 fi
7417
7418 case "$useperlio" in
7419 $define|true|[yY]*)     dflt='y';;
7420 *) dflt='n';;
7421 esac
7422 cat <<EOM
7423
7424 Previous version of $package used the standard IO mechanisms as defined
7425 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7426 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7427 the default.  This abstraction layer can use AT&T's sfio (if you already
7428 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7429 problems with some extension modules.  Using PerlIO with stdio is safe,
7430 but it is slower than plain stdio and therefore is not the default.
7431
7432 If this doesn't make any sense to you, just accept the default '$dflt'.
7433 EOM
7434 rp='Use the experimental PerlIO abstraction layer?'
7435 . ./myread
7436 case "$ans" in
7437 y|Y) 
7438         val="$define"
7439         ;;     
7440 *)      
7441         echo "Ok, doing things the stdio way"
7442         val="$undef"
7443         ;;
7444 esac
7445 set useperlio
7446 eval $setvar 
7447
7448 case "$vendorprefix" in
7449 '')     d_vendorbin="$undef"
7450         vendorbin=''
7451         vendorbinexp=''
7452         ;;
7453 *)      d_vendorbin="$define"
7454         : determine where vendor-supplied executables go.
7455         case "$vendorbin" in
7456         '') dflt=$vendorprefix/bin ;;
7457         *)      dflt="$vendorbin" ;;
7458         esac
7459         fn=d~+
7460         rp='Pathname for the vendor-supplied executables directory?'
7461         . ./getfile
7462         vendorbin="$ans"
7463         vendorbinexp="$ansexp"
7464         ;;
7465 esac
7466 : Change installation prefix, if necessary.
7467 if $test X"$prefix" != X"$installprefix"; then
7468         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7469 else
7470         installvendorbin="$vendorbinexp"
7471 fi
7472
7473 : see if qgcvt exists
7474 set qgcvt d_qgcvt
7475 eval $inlibc
7476
7477 echo " "
7478
7479 if $test X"$d_longdbl" = X"$define"; then
7480
7481 echo "Checking how to print long doubles..." >&4
7482
7483 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7484         $cat >try.c <<'EOCP'
7485 #include <sys/types.h>
7486 #include <stdio.h>
7487 int main() {
7488   double d = 123.456;
7489   printf("%.3f\n", d);
7490 }
7491 EOCP
7492         set try
7493         if eval $compile; then
7494                 yyy=`./try$exe_ext`
7495                 case "$yyy" in
7496                 123.456)
7497                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7498                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7499                         echo "We will use %f."
7500                         ;;
7501                 esac
7502         fi
7503 fi
7504
7505 if $test X"$sPRIfldbl" = X; then
7506         $cat >try.c <<'EOCP'
7507 #include <sys/types.h>
7508 #include <stdio.h>
7509 int main() {
7510   long double d = 123.456;
7511   printf("%.3llf\n", d);
7512 }
7513 EOCP
7514         set try
7515         if eval $compile; then
7516                 yyy=`./try$exe_ext`
7517                 case "$yyy" in
7518                 123.456)
7519                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7520                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7521                         echo "We will use %llf."
7522                         ;;
7523                 esac
7524         fi
7525 fi
7526
7527 if $test X"$sPRIfldbl" = X; then
7528         $cat >try.c <<'EOCP'
7529 #include <sys/types.h>
7530 #include <stdio.h>
7531 int main() {
7532   long double d = 123.456;
7533   printf("%.3Lf\n", d);
7534 }
7535 EOCP
7536         set try
7537         if eval $compile; then
7538                 yyy=`./try$exe_ext`
7539                 case "$yyy" in
7540                 123.456)
7541                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7542                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7543                         echo "We will use %Lf."
7544                         ;;
7545                 esac
7546         fi
7547 fi
7548
7549 if $test X"$sPRIfldbl" = X; then
7550         $cat >try.c <<'EOCP'
7551 #include <sys/types.h>
7552 #include <stdio.h>
7553 int main() {
7554   long double d = 123.456;
7555   printf("%.3lf\n", d);
7556 }
7557 EOCP
7558         set try
7559         if eval $compile; then
7560                 yyy=`./try$exe_ext`
7561                 case "$yyy" in
7562                 123.456)
7563                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7564                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7565                         echo "We will use %lf."
7566                         ;;
7567                 esac
7568         fi
7569 fi
7570
7571 if $test X"$sPRIfldbl" = X; then
7572         echo "Cannot figure out how to print long doubles." >&4
7573 else
7574         sSCNfldbl=$sPRIfldbl    # expect consistency
7575 fi
7576
7577 $rm -f try try.*
7578
7579 fi # d_longdbl
7580
7581 case "$sPRIfldbl" in
7582 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7583         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7584         d_SCNfldbl="$undef";
7585         ;;
7586 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7587         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7588         d_SCNfldbl="$define";
7589         ;;
7590 esac
7591
7592 : Check how to convert floats to strings.
7593 echo " "
7594 echo "Checking for an efficient way to convert floats to strings."
7595 echo " " > try.c
7596 case "$uselongdouble" in
7597 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7598 esac
7599 case "$d_longdbl" in
7600 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7601 esac
7602 case "$d_PRIgldbl" in
7603 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7604 esac
7605 $cat >>try.c <<EOP
7606 #ifdef TRY_gconvert
7607 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7608 char *myname = "gconvert";
7609 #endif
7610 #ifdef TRY_gcvt
7611 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7612 char *myname = "gcvt";
7613 #endif
7614 #ifdef TRY_qgcvt
7615 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7616 char *myname = "qgcvt";
7617 #define DOUBLETYPE long double
7618 #endif
7619 #ifdef TRY_sprintf
7620 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7621 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7622 #else
7623 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7624 #endif
7625 char *myname = "sprintf";
7626 #endif
7627
7628 #ifndef DOUBLETYPE
7629 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7630 #define DOUBLETYPE long double
7631 #else
7632 #define DOUBLETYPE double
7633 #endif
7634 #endif
7635
7636 #include <stdio.h>
7637
7638 #define I_STDLIB $i_stdlib
7639 #ifdef I_STDLIB
7640 #include <stdlib.h>
7641 #endif
7642
7643 int
7644 checkit(expect, got)
7645 char *expect;
7646 char *got;
7647 {
7648     if (strcmp(expect, got)) {
7649                 printf("%s oddity:  Expected %s, got %s\n",
7650                         myname, expect, got);
7651                 exit(1);
7652         }
7653 }
7654
7655 int main()
7656
7657         char buf[64]; 
7658         buf[63] = '\0';
7659
7660         /* This must be 1st test on (which?) platform */
7661         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7662         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7663         checkit("0.1", buf);
7664
7665         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7666         checkit("1", buf);
7667
7668         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7669         checkit("1.1", buf);
7670
7671         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7672         checkit("1.01", buf);
7673
7674         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7675         checkit("1.001", buf);
7676
7677         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7678         checkit("1.0001", buf);
7679
7680         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7681         checkit("1.00001", buf);
7682
7683         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7684         checkit("1.000001", buf);
7685
7686         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7687         checkit("0", buf);
7688
7689         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7690         checkit("-1", buf);
7691
7692         /* Some Linux gcvt's give 1.e+5 here. */
7693         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7694         checkit("100000", buf);
7695         
7696         /* Some Linux gcvt's give -1.e+5 here. */
7697         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7698         checkit("-100000", buf);
7699
7700         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7701         checkit("123.456", buf);
7702
7703         exit(0);
7704 }
7705 EOP
7706 case "$d_Gconvert" in
7707 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7708 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7709 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7710 *) xxx_list='gconvert gcvt sprintf' ;;
7711 esac
7712
7713 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7714 "$define$define$define")
7715     # for long doubles prefer first qgcvt, then sprintf
7716     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7717     xxx_list="sprintf $xxx_list"
7718     case "$d_qgcvt" in
7719     "$define") xxx_list="qgcvt $xxx_list" ;;
7720     esac
7721     ;;
7722 esac
7723
7724 for xxx_convert in $xxx_list; do
7725         echo "Trying $xxx_convert..."
7726         $rm -f try try$_o
7727         set try -DTRY_$xxx_convert
7728         if eval $compile; then
7729                 echo "$xxx_convert() found." >&4
7730                 if ./try; then
7731                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7732                         break;
7733                 else
7734                         echo "...But $xxx_convert didn't work as I expected."
7735                 fi
7736         else
7737                 echo "$xxx_convert NOT found." >&4
7738         fi
7739 done
7740         
7741 case "$xxx_convert" in
7742 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7743 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7744 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7745 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7746    "$define$define$define")
7747       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7748    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7749    esac
7750    ;;  
7751 esac
7752
7753 : Initialize h_fcntl
7754 h_fcntl=false
7755
7756 : Initialize h_sysfile
7757 h_sysfile=false
7758
7759 : access call always available on UNIX
7760 set access d_access
7761 eval $inlibc
7762
7763 : locate the flags for 'access()'
7764 case "$d_access" in
7765 "$define")
7766         echo " "
7767         $cat >access.c <<'EOCP'
7768 #include <sys/types.h>
7769 #ifdef I_FCNTL
7770 #include <fcntl.h>
7771 #endif
7772 #ifdef I_SYS_FILE
7773 #include <sys/file.h>
7774 #endif
7775 #ifdef I_UNISTD
7776 #include <unistd.h>
7777 #endif
7778 int main() {
7779         exit(R_OK);
7780 }
7781 EOCP
7782         : check sys/file.h first, no particular reason here
7783         if $test `./findhdr sys/file.h` && \
7784                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7785                 h_sysfile=true;
7786                 echo "<sys/file.h> defines the *_OK access constants." >&4
7787         elif $test `./findhdr fcntl.h` && \
7788                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7789                 h_fcntl=true;
7790                 echo "<fcntl.h> defines the *_OK access constants." >&4
7791         elif $test `./findhdr unistd.h` && \
7792                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7793                 echo "<unistd.h> defines the *_OK access constants." >&4
7794         else
7795                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7796         fi
7797         ;;
7798 esac
7799 $rm -f access*
7800
7801 : see if accessx exists
7802 set accessx d_accessx
7803 eval $inlibc
7804
7805 : see if alarm exists
7806 set alarm d_alarm
7807 eval $inlibc
7808
7809 : see if atolf exists
7810 set atolf d_atolf
7811 eval $inlibc
7812
7813 : see if atoll exists
7814 set atoll d_atoll
7815 eval $inlibc
7816
7817 : Look for GNU-cc style attribute checking
7818 echo " "
7819 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7820 $cat >attrib.c <<'EOCP'
7821 #include <stdio.h>
7822 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7823 EOCP
7824 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7825         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7826                 echo "Your C compiler doesn't fully support __attribute__."
7827                 val="$undef"
7828         else
7829                 echo "Your C compiler supports __attribute__."
7830                 val="$define"
7831         fi
7832 else
7833         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7834         val="$undef"
7835 fi
7836 set d_attribut
7837 eval $setvar
7838 $rm -f attrib*
7839
7840 : see if bcmp exists
7841 set bcmp d_bcmp
7842 eval $inlibc
7843
7844 : see if bcopy exists
7845 set bcopy d_bcopy
7846 eval $inlibc
7847
7848 : see if this is a unistd.h system
7849 set unistd.h i_unistd
7850 eval $inhdr
7851
7852 : see if getpgrp exists
7853 set getpgrp d_getpgrp
7854 eval $inlibc
7855
7856 case "$d_getpgrp" in
7857 "$define")
7858         echo " "
7859         echo "Checking to see which flavor of getpgrp is in use..."
7860         $cat >set.c <<EOP
7861 #$i_unistd I_UNISTD
7862 #include <sys/types.h>
7863 #ifdef I_UNISTD
7864 #  include <unistd.h>
7865 #endif
7866 int main()
7867 {
7868         if (getuid() == 0) {
7869                 printf("(I see you are running Configure as super-user...)\n");
7870                 setuid(1);
7871         }
7872 #ifdef TRY_BSD_PGRP
7873         if (getpgrp(1) == 0)
7874                 exit(0);
7875 #else
7876         if (getpgrp() > 0)
7877                 exit(0);
7878 #endif
7879         exit(1);
7880 }
7881 EOP
7882         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7883                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7884                 val="$define"
7885         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7886                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7887                 val="$undef"
7888         else
7889                 echo "I can't seem to compile and run the test program."
7890                 if ./usg; then
7891                         xxx="a USG one, i.e. you use getpgrp()."
7892                 else
7893                         # SVR4 systems can appear rather BSD-ish.
7894                         case "$i_unistd" in
7895                         $undef)
7896                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7897                                 val="$define"
7898                                 ;;
7899                         $define)
7900                                 xxx="probably a USG one, i.e. you use getpgrp()."
7901                                 val="$undef"
7902                                 ;;
7903                         esac
7904                 fi
7905                 echo "Assuming your getpgrp is $xxx" >&4
7906         fi
7907         ;;
7908 *) val="$undef";;
7909 esac
7910 set d_bsdgetpgrp
7911 eval $setvar
7912 $rm -f set set.c
7913
7914 : see if setpgrp exists
7915 set setpgrp d_setpgrp
7916 eval $inlibc
7917
7918 case "$d_setpgrp" in
7919 "$define")
7920         echo " "
7921         echo "Checking to see which flavor of setpgrp is in use..."
7922         $cat >set.c <<EOP
7923 #$i_unistd I_UNISTD
7924 #include <sys/types.h>
7925 #ifdef I_UNISTD
7926 #  include <unistd.h>
7927 #endif
7928 int main()
7929 {
7930         if (getuid() == 0) {
7931                 printf("(I see you are running Configure as super-user...)\n");
7932                 setuid(1);
7933         }
7934 #ifdef TRY_BSD_PGRP
7935         if (-1 == setpgrp(1, 1))
7936                 exit(0);
7937 #else
7938         if (setpgrp() != -1)
7939                 exit(0);
7940 #endif
7941         exit(1);
7942 }
7943 EOP
7944         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7945                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7946                 val="$define"
7947         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
7948                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7949                 val="$undef"
7950         else
7951                 echo "(I can't seem to compile and run the test program.)"
7952                 if ./usg; then
7953                         xxx="a USG one, i.e. you use setpgrp()."
7954                 else
7955                         # SVR4 systems can appear rather BSD-ish.
7956                         case "$i_unistd" in
7957                         $undef)
7958                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7959                                 val="$define"
7960                                 ;;
7961                         $define)
7962                                 xxx="probably a USG one, i.e. you use setpgrp()."
7963                                 val="$undef"
7964                                 ;;
7965                         esac
7966                 fi
7967                 echo "Assuming your setpgrp is $xxx" >&4
7968         fi
7969         ;;
7970 *) val="$undef";;
7971 esac
7972 set d_bsdsetpgrp
7973 eval $setvar
7974 $rm -f set set.c
7975 : see if bzero exists
7976 set bzero d_bzero
7977 eval $inlibc
7978
7979 : see if signal is declared as pointer to function returning int or void
7980 echo " "
7981 xxx=`./findhdr signal.h`
7982 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7983 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7984         echo "You have int (*signal())() instead of void." >&4
7985         val="$undef"
7986 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7987         echo "You have void (*signal())()." >&4
7988         val="$define"
7989 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7990         echo "You have int (*signal())() instead of void." >&4
7991         val="$undef"
7992 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7993         echo "You have void (*signal())()." >&4
7994         val="$define"
7995 else
7996         case "$d_voidsig" in
7997         '')
7998         echo "I can't determine whether signal handler returns void or int..." >&4
7999                 dflt=void
8000                 rp="What type does your signal handler return?"
8001                 . ./myread
8002                 case "$ans" in
8003                 v*) val="$define";;
8004                 *) val="$undef";;
8005                 esac;;
8006         "$define")
8007                 echo "As you already told me, signal handler returns void." >&4
8008                 val="$define"
8009                 ;;
8010         *)      echo "As you already told me, signal handler returns int." >&4
8011                 val="$undef"
8012                 ;;
8013         esac
8014 fi
8015 set d_voidsig
8016 eval $setvar
8017 case "$d_voidsig" in
8018 "$define") signal_t="void";;
8019 *) signal_t="int";;
8020 esac
8021 $rm -f $$.tmp
8022
8023 : check for ability to cast large floats to 32-bit ints.
8024 echo " "
8025 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8026 if $test "$intsize" -ge 4; then
8027         xxx=int
8028 else
8029         xxx=long
8030 fi
8031 $cat >try.c <<EOCP
8032 #include <stdio.h>
8033 #include <sys/types.h>
8034 #include <signal.h>
8035 $signal_t blech(s) int s; { exit(3); }
8036 int main()
8037 {
8038         $xxx i32;
8039         double f, g;
8040         int result = 0;
8041         char str[16];
8042         signal(SIGFPE, blech);
8043
8044         /* Don't let compiler optimize the test away.  Store the number 
8045            in a writable string for gcc to pass to sscanf under HP/UX.
8046         */
8047         sprintf(str, "2147483647");
8048         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8049         g = 10 * f;
8050         i32  = ($xxx) g;
8051
8052         /* x86 processors will probably give 0x8000 0000, which is a
8053        sign change.  We don't want that.  We want to mimic SPARC
8054            behavior here, which is to preserve the sign and give
8055            back 0x7fff ffff.
8056         */
8057         if (i32 != ($xxx) f)
8058                 result |= 1;
8059         exit(result);
8060 }
8061 EOCP
8062 set try
8063 if eval $compile_ok; then
8064         ./try
8065         yyy=$?
8066 else
8067         echo "(I can't seem to compile the test program--assuming it can't)"
8068         yyy=1
8069 fi
8070 case "$yyy" in
8071 0)      val="$define"
8072         echo "Yup, it can."
8073         ;;
8074 *)      val="$undef"
8075         echo "Nope, it can't."
8076         ;;
8077 esac
8078 set d_casti32
8079 eval $setvar
8080 $rm -f try try.*
8081
8082 : check for ability to cast negative floats to unsigned
8083 echo " "
8084 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8085 $cat >try.c <<EOCP
8086 #include <stdio.h>
8087 #include <sys/types.h>
8088 #include <signal.h>
8089 $signal_t blech(s) int s; { exit(7); }
8090 $signal_t blech_in_list(s) int s; { exit(4); }
8091 unsigned long dummy_long(p) unsigned long p; { return p; }
8092 unsigned int dummy_int(p) unsigned int p; { return p; }
8093 unsigned short dummy_short(p) unsigned short p; { return p; }
8094 int main()
8095 {
8096         double f;
8097         unsigned long along;
8098         unsigned int aint;
8099         unsigned short ashort;
8100         int result = 0;
8101         char str[16];
8102         
8103         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8104            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8105            optimized the whole file away
8106         */
8107         /* Store the number in a writable string for gcc to pass to 
8108            sscanf under HP/UX.
8109         */
8110         sprintf(str, "-123");
8111         sscanf(str, "%lf", &f);  /* f = -123.; */
8112
8113         signal(SIGFPE, blech);
8114         along = (unsigned long)f;
8115         aint = (unsigned int)f;
8116         ashort = (unsigned short)f;
8117         if (along != (unsigned long)-123)
8118                 result |= 1;
8119         if (aint != (unsigned int)-123)
8120                 result |= 1;
8121         if (ashort != (unsigned short)-123)
8122                 result |= 1;
8123         sprintf(str, "1073741824.");
8124         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8125         f = f + f;
8126         along = 0;
8127         along = (unsigned long)f;
8128         if (along != 0x80000000)
8129                 result |= 2;
8130         f -= 1.;
8131         along = 0;
8132         along = (unsigned long)f;
8133         if (along != 0x7fffffff)
8134                 result |= 1;
8135         f += 2.;
8136         along = 0;
8137         along = (unsigned long)f;
8138         if (along != 0x80000001)
8139                 result |= 2;
8140         if (result)
8141                 exit(result);
8142         signal(SIGFPE, blech_in_list);
8143         sprintf(str, "123.");
8144         sscanf(str, "%lf", &f);  /* f = 123.; */
8145         along = dummy_long((unsigned long)f);
8146         aint = dummy_int((unsigned int)f);
8147         ashort = dummy_short((unsigned short)f);
8148         if (along != (unsigned long)123)
8149                 result |= 4;
8150         if (aint != (unsigned int)123)
8151                 result |= 4;
8152         if (ashort != (unsigned short)123)
8153                 result |= 4;
8154         exit(result);
8155
8156 }
8157 EOCP
8158 set try
8159 if eval $compile_ok; then
8160         ./try
8161         castflags=$?
8162 else
8163         echo "(I can't seem to compile the test program--assuming it can't)"
8164         castflags=7
8165 fi
8166 case "$castflags" in
8167 0)      val="$define"
8168         echo "Yup, it can."
8169         ;;
8170 *)      val="$undef"
8171         echo "Nope, it can't."
8172         ;;
8173 esac
8174 set d_castneg
8175 eval $setvar
8176 $rm -f try.*
8177
8178 : see if vprintf exists
8179 echo " "
8180 if set vprintf val -f d_vprintf; eval $csym; $val; then
8181         echo 'vprintf() found.' >&4
8182         val="$define"
8183         $cat >vprintf.c <<'EOF'
8184 #include <varargs.h>
8185
8186 int main() { xxx("foo"); }
8187
8188 xxx(va_alist)
8189 va_dcl
8190 {
8191         va_list args;
8192         char buf[10];
8193
8194         va_start(args);
8195         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8196 }
8197 EOF
8198         set vprintf
8199         if eval $compile && ./vprintf; then
8200                 echo "Your vsprintf() returns (int)." >&4
8201                 val2="$undef"
8202         else
8203                 echo "Your vsprintf() returns (char*)." >&4
8204                 val2="$define"
8205         fi
8206 else
8207         echo 'vprintf() NOT found.' >&4
8208                 val="$undef"
8209                 val2="$undef"
8210 fi
8211 set d_vprintf
8212 eval $setvar
8213 val=$val2
8214 set d_charvspr
8215 eval $setvar
8216
8217 : see if chown exists
8218 set chown d_chown
8219 eval $inlibc
8220
8221 : see if chroot exists
8222 set chroot d_chroot
8223 eval $inlibc
8224
8225 : see if chsize exists
8226 set chsize d_chsize
8227 eval $inlibc
8228
8229 : check for const keyword
8230 echo " "
8231 echo 'Checking to see if your C compiler knows about "const"...' >&4
8232 $cat >const.c <<'EOCP'
8233 typedef struct spug { int drokk; } spug;
8234 int main()
8235 {
8236         const char *foo;
8237         const spug y;
8238 }
8239 EOCP
8240 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8241         val="$define"
8242         echo "Yup, it does."
8243 else
8244         val="$undef"
8245         echo "Nope, it doesn't."
8246 fi
8247 set d_const
8248 eval $setvar
8249
8250 : see if crypt exists
8251 echo " "
8252 if set crypt val -f d_crypt; eval $csym; $val; then
8253         echo 'crypt() found.' >&4
8254         val="$define"
8255         cryptlib=''
8256 else
8257         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8258         if $test -z "$cryptlib"; then
8259                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8260         else
8261                 cryptlib=-lcrypt
8262         fi
8263         if $test -z "$cryptlib"; then
8264                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8265         else
8266                 cryptlib=-lcrypt
8267         fi
8268         if $test -z "$cryptlib"; then
8269                 cryptlib=`./loc libcrypt$_a "" $libpth`
8270         else
8271                 cryptlib=-lcrypt
8272         fi
8273         if $test -z "$cryptlib"; then
8274                 echo 'crypt() NOT found.' >&4
8275                 val="$undef"
8276         else
8277                 val="$define"
8278         fi
8279 fi
8280 set d_crypt
8281 eval $setvar
8282
8283 : get csh whereabouts
8284 case "$csh" in
8285 'csh') val="$undef" ;;
8286 *) val="$define" ;;
8287 esac
8288 set d_csh
8289 eval $setvar
8290 : Respect a hint or command line value for full_csh.
8291 case "$full_csh" in
8292 '') full_csh=$csh ;;
8293 esac
8294
8295 : see if cuserid exists
8296 set cuserid d_cuserid
8297 eval $inlibc
8298
8299 : see if this is a limits.h system
8300 set limits.h i_limits
8301 eval $inhdr
8302
8303 : see if this is a float.h system
8304 set float.h i_float
8305 eval $inhdr
8306
8307 : See if number of significant digits in a double precision number is known
8308 echo " "
8309 $cat >dbl_dig.c <<EOM
8310 #$i_limits I_LIMITS
8311 #$i_float I_FLOAT
8312 #ifdef I_LIMITS
8313 #include <limits.h>
8314 #endif
8315 #ifdef I_FLOAT
8316 #include <float.h>
8317 #endif
8318 #ifdef DBL_DIG
8319 printf("Contains DBL_DIG");
8320 #endif
8321 EOM
8322 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8323 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8324         echo "DBL_DIG found." >&4
8325         val="$define"
8326 else
8327         echo "DBL_DIG NOT found." >&4
8328         val="$undef"
8329 fi
8330 $rm -f dbl_dig.?
8331 set d_dbl_dig
8332 eval $setvar
8333
8334 : see if difftime exists
8335 set difftime d_difftime
8336 eval $inlibc
8337
8338 : see if this is a dirent system
8339 echo " "
8340 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8341         val="$define"
8342         echo "<dirent.h> found." >&4
8343 else
8344         val="$undef"
8345         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8346                 echo "<sys/dir.h> found." >&4
8347                 echo " "
8348         else
8349                 xinc=`./findhdr sys/ndir.h`
8350         fi
8351         echo "<dirent.h> NOT found." >&4
8352 fi
8353 set i_dirent
8354 eval $setvar
8355
8356 : Look for type of directory structure.
8357 echo " "
8358 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8359
8360 case "$direntrytype" in
8361 ''|' ')
8362         case "$i_dirent" in
8363         $define) guess1='struct dirent' ;;
8364         *) guess1='struct direct'  ;;
8365         esac
8366         ;;
8367 *)      guess1="$direntrytype"
8368         ;;
8369 esac
8370
8371 case "$guess1" in
8372 'struct dirent') guess2='struct direct' ;;
8373 *) guess2='struct dirent' ;;
8374 esac
8375                 
8376 if $contains "$guess1" try.c >/dev/null 2>&1; then
8377         direntrytype="$guess1"
8378         echo "Your directory entries are $direntrytype." >&4
8379 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8380         direntrytype="$guess2"
8381         echo "Your directory entries seem to be $direntrytype." >&4
8382 else
8383         echo "I don't recognize your system's directory entries." >&4
8384         rp="What type is used for directory entries on this system?"
8385         dflt="$guess1"
8386         . ./myread
8387         direntrytype="$ans"
8388 fi
8389 $rm -f try.c
8390
8391
8392 : see if the directory entry stores field length
8393 echo " "
8394 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8395 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8396         echo "Good, your directory entry keeps length information in d_namlen." >&4
8397         val="$define"
8398 else
8399         echo "Your directory entry does not know about the d_namlen field." >&4
8400         val="$undef"
8401 fi
8402 set d_dirnamlen
8403 eval $setvar
8404 $rm -f try.c
8405
8406 : see if dlerror exists
8407 xxx_runnm="$runnm"
8408 runnm=false
8409 set dlerror d_dlerror
8410 eval $inlibc
8411 runnm="$xxx_runnm"
8412
8413 : see if dlfcn is available
8414 set dlfcn.h i_dlfcn
8415 eval $inhdr
8416
8417 case "$usedl" in
8418 $define|y|true)
8419         $cat << EOM
8420
8421 On a few systems, the dynamically loaded modules that perl generates and uses
8422 will need a different extension than shared libs. The default will probably
8423 be appropriate.
8424
8425 EOM
8426         case "$dlext" in
8427         '')     dflt="$so" ;;
8428         *)      dflt="$dlext" ;;
8429         esac
8430         rp='What is the extension of dynamically loaded modules'
8431         . ./myread
8432         dlext="$ans"
8433         ;;
8434 *)
8435         dlext="none"
8436         ;;
8437 esac
8438
8439 : Check if dlsym need a leading underscore
8440 echo " "
8441 val="$undef"
8442
8443 case "$dlsrc" in
8444 dl_dlopen.xs)
8445         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8446         $cat >dyna.c <<'EOM'
8447 fred () { }
8448 EOM
8449
8450 $cat >fred.c<<EOM
8451
8452 #include <stdio.h>
8453 #$i_dlfcn I_DLFCN
8454 #ifdef I_DLFCN
8455 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8456 #else
8457 #include <sys/types.h>
8458 #include <nlist.h>
8459 #include <link.h>
8460 #endif
8461
8462 extern int fred() ;
8463
8464 int main()
8465 {
8466     void * handle ;
8467     void * symbol ;
8468 #ifndef RTLD_LAZY
8469     int mode = 1 ;
8470 #else
8471     int mode = RTLD_LAZY ;
8472 #endif
8473     handle = dlopen("./dyna.$dlext", mode) ;
8474     if (handle == NULL) {
8475         printf ("1\n") ;
8476         fflush (stdout) ;
8477         exit(0);
8478     }
8479     symbol = dlsym(handle, "fred") ;
8480     if (symbol == NULL) {
8481         /* try putting a leading underscore */
8482         symbol = dlsym(handle, "_fred") ;
8483         if (symbol == NULL) {
8484             printf ("2\n") ;
8485             fflush (stdout) ;
8486             exit(0);
8487         }
8488         printf ("3\n") ;
8489     }
8490     else
8491         printf ("4\n") ;
8492     fflush (stdout) ;
8493     exit(0);
8494 }
8495 EOM
8496         : Call the object file tmp-dyna.o in case dlext=o.
8497         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8498                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8499                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8500                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8501                 xxx=`./fred`
8502                 case $xxx in
8503                 1)      echo "Test program failed using dlopen." >&4
8504                         echo "Perhaps you should not use dynamic loading." >&4;;
8505                 2)      echo "Test program failed using dlsym." >&4
8506                         echo "Perhaps you should not use dynamic loading." >&4;;
8507                 3)      echo "dlsym needs a leading underscore" >&4
8508                         val="$define" ;;
8509                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8510                 esac
8511         else
8512                 echo "I can't compile and run the test program." >&4
8513                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8514         fi
8515         ;;
8516 esac
8517                 
8518 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8519
8520 set d_dlsymun
8521 eval $setvar
8522
8523 hasproto='varname=$1; func=$2; shift; shift;
8524 while $test $# -ge 2; do
8525         case "$1" in
8526         $define) echo "#include <$2>";;
8527         esac ;
8528     shift 2;
8529 done > try.c;
8530 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8531 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8532         echo "$func() prototype found.";
8533         val="$define";
8534 else
8535         echo "$func() prototype NOT found.";
8536         val="$undef";
8537 fi;
8538 set $varname;
8539 eval $setvar;
8540 $rm -f try.c tryout.c'
8541
8542 : see if prototype for drand48 is available
8543 echo " "
8544 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8545 eval $hasproto
8546
8547 : see if dup2 exists
8548 set dup2 d_dup2
8549 eval $inlibc
8550
8551 : see if eaccess exists
8552 set eaccess d_eaccess
8553 eval $inlibc
8554
8555 : see if endgrent exists
8556 set endgrent d_endgrent
8557 eval $inlibc
8558
8559 : see if endhostent exists
8560 set endhostent d_endhent
8561 eval $inlibc
8562
8563 : see if endnetent exists
8564 set endnetent d_endnent
8565 eval $inlibc
8566
8567 : see if endprotoent exists
8568 set endprotoent d_endpent
8569 eval $inlibc
8570
8571 : see if endpwent exists
8572 set endpwent d_endpwent
8573 eval $inlibc
8574
8575 : see if endservent exists
8576 set endservent d_endsent
8577 eval $inlibc
8578
8579 : Locate the flags for 'open()'
8580 echo " "
8581 $cat >open3.c <<'EOCP'
8582 #include <sys/types.h>
8583 #ifdef I_FCNTL
8584 #include <fcntl.h>
8585 #endif
8586 #ifdef I_SYS_FILE
8587 #include <sys/file.h>
8588 #endif
8589 int main() {
8590         if(O_RDONLY);
8591 #ifdef O_TRUNC
8592         exit(0);
8593 #else
8594         exit(1);
8595 #endif
8596 }
8597 EOCP
8598 : check sys/file.h first to get FREAD on Sun
8599 if $test `./findhdr sys/file.h` && \
8600                 set open3 -DI_SYS_FILE && eval $compile; then
8601         h_sysfile=true;
8602         echo "<sys/file.h> defines the O_* constants..." >&4
8603         if ./open3; then
8604                 echo "and you have the 3 argument form of open()." >&4
8605                 val="$define"
8606         else
8607                 echo "but not the 3 argument form of open().  Oh, well." >&4
8608                 val="$undef"
8609         fi
8610 elif $test `./findhdr fcntl.h` && \
8611                 set open3 -DI_FCNTL && eval $compile; then
8612         h_fcntl=true;
8613         echo "<fcntl.h> defines the O_* constants..." >&4
8614         if ./open3; then
8615                 echo "and you have the 3 argument form of open()." >&4
8616                 val="$define"
8617         else
8618                 echo "but not the 3 argument form of open().  Oh, well." >&4
8619                 val="$undef"
8620         fi
8621 else
8622         val="$undef"
8623         echo "I can't find the O_* constant definitions!  You got problems." >&4
8624 fi
8625 set d_open3
8626 eval $setvar
8627 $rm -f open3*
8628
8629 : see which of string.h or strings.h is needed
8630 echo " "
8631 strings=`./findhdr string.h`
8632 if $test "$strings" && $test -r "$strings"; then
8633         echo "Using <string.h> instead of <strings.h>." >&4
8634         val="$define"
8635 else
8636         val="$undef"
8637         strings=`./findhdr strings.h`
8638         if $test "$strings" && $test -r "$strings"; then
8639                 echo "Using <strings.h> instead of <string.h>." >&4
8640         else
8641                 echo "No string header found -- You'll surely have problems." >&4
8642         fi
8643 fi
8644 set i_string
8645 eval $setvar
8646 case "$i_string" in
8647 "$undef") strings=`./findhdr strings.h`;;
8648 *)        strings=`./findhdr string.h`;;
8649 esac
8650
8651 : check for non-blocking I/O stuff
8652 case "$h_sysfile" in
8653 true) echo "#include <sys/file.h>" > head.c;;
8654 *)
8655         case "$h_fcntl" in
8656         true) echo "#include <fcntl.h>" > head.c;;
8657         *) echo "#include <sys/fcntl.h>" > head.c;;
8658         esac
8659         ;;
8660 esac
8661 echo " "
8662 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8663 case "$o_nonblock" in
8664 '')
8665         $cat head.c > try.c
8666         $cat >>try.c <<'EOCP'
8667 #include <stdio.h>
8668 int main() {
8669 #ifdef O_NONBLOCK
8670         printf("O_NONBLOCK\n");
8671         exit(0);
8672 #endif
8673 #ifdef O_NDELAY
8674         printf("O_NDELAY\n");
8675         exit(0);
8676 #endif
8677 #ifdef FNDELAY
8678         printf("FNDELAY\n");
8679         exit(0);
8680 #endif
8681         exit(0);
8682 }
8683 EOCP
8684         set try
8685         if eval $compile_ok; then
8686                 o_nonblock=`./try`
8687                 case "$o_nonblock" in
8688                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8689                 *) echo "Seems like we can use $o_nonblock.";;
8690                 esac
8691         else
8692                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8693         fi
8694         ;;
8695 *) echo "Using $hint value $o_nonblock.";;
8696 esac
8697 $rm -f try try.* .out core
8698
8699 echo " "
8700 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8701 case "$eagain" in
8702 '')
8703         $cat head.c > try.c
8704         $cat >>try.c <<EOCP
8705 #include <errno.h>
8706 #include <sys/types.h>
8707 #include <signal.h>
8708 #include <stdio.h> 
8709 #define MY_O_NONBLOCK $o_nonblock
8710 #ifndef errno  /* XXX need better Configure test */
8711 extern int errno;
8712 #endif
8713 #$i_unistd I_UNISTD
8714 #ifdef I_UNISTD
8715 #include <unistd.h>
8716 #endif
8717 #$i_string I_STRING
8718 #ifdef I_STRING
8719 #include <string.h>
8720 #else
8721 #include <strings.h>
8722 #endif
8723 $signal_t blech(x) int x; { exit(3); }
8724 EOCP
8725         $cat >> try.c <<'EOCP'
8726 int main()
8727 {
8728         int pd[2];
8729         int pu[2];
8730         char buf[1];
8731         char string[100];
8732
8733         pipe(pd);       /* Down: child -> parent */
8734         pipe(pu);       /* Up: parent -> child */
8735         if (0 != fork()) {
8736                 int ret;
8737                 close(pd[1]);   /* Parent reads from pd[0] */
8738                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8739                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8740                         exit(1);
8741                 signal(SIGALRM, blech);
8742                 alarm(5);
8743                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8744                         exit(2);
8745                 sprintf(string, "%d\n", ret);
8746                 write(2, string, strlen(string));
8747                 alarm(0);
8748 #ifdef EAGAIN
8749                 if (errno == EAGAIN) {
8750                         printf("EAGAIN\n");
8751                         goto ok;
8752                 }
8753 #endif
8754 #ifdef EWOULDBLOCK
8755                 if (errno == EWOULDBLOCK)
8756                         printf("EWOULDBLOCK\n");
8757 #endif
8758         ok:
8759                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8760                 sleep(2);                               /* Give it time to close our pipe */
8761                 alarm(5);
8762                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8763                 alarm(0);
8764                 sprintf(string, "%d\n", ret);
8765                 write(3, string, strlen(string));
8766                 exit(0);
8767         }
8768
8769         close(pd[0]);                   /* We write to pd[1] */
8770         close(pu[1]);                   /* We read from pu[0] */
8771         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8772         close(pd[1]);                   /* Pipe pd is now fully closed! */
8773         exit(0);                                /* Bye bye, thank you for playing! */
8774 }
8775 EOCP
8776         set try
8777         if eval $compile_ok; then
8778                 echo "$startsh" >mtry
8779                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8780                 chmod +x mtry
8781                 ./mtry >/dev/null 2>&1
8782                 case $? in
8783                 0) eagain=`$cat try.out`;;
8784                 1) echo "Could not perform non-blocking setting!";;
8785                 2) echo "I did a successful read() for something that was not there!";;
8786                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8787                 *) echo "Something terribly wrong happened during testing.";;
8788                 esac
8789                 rd_nodata=`$cat try.ret`
8790                 echo "A read() system call with no data present returns $rd_nodata."
8791                 case "$rd_nodata" in
8792                 0|-1) ;;
8793                 *)
8794                         echo "(That's peculiar, fixing that to be -1.)"
8795                         rd_nodata=-1
8796                         ;;
8797                 esac
8798                 case "$eagain" in
8799                 '')
8800                         echo "Forcing errno EAGAIN on read() with no data available."
8801                         eagain=EAGAIN
8802                         ;;
8803                 *)
8804                         echo "Your read() sets errno to $eagain when no data is available."
8805                         ;;
8806                 esac
8807                 status=`$cat try.err`
8808                 case "$status" in
8809                 0) echo "And it correctly returns 0 to signal EOF.";;
8810                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8811                 *) echo "However, your read() returns '$status' on EOF??";;
8812                 esac
8813                 val="$define"
8814                 if test "$status" = "$rd_nodata"; then
8815                         echo "WARNING: you can't distinguish between EOF and no data!"
8816                         val="$undef"
8817                 fi
8818         else
8819                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8820                 eagain=EAGAIN
8821         fi
8822         set d_eofnblk
8823         eval $setvar
8824         ;;
8825 *)
8826         echo "Using $hint value $eagain."
8827         echo "Your read() returns $rd_nodata when no data is present."
8828         case "$d_eofnblk" in
8829         "$define") echo "And you can see EOF because read() returns 0.";;
8830         "$undef") echo "But you can't see EOF status from read() returned value.";;
8831         *)
8832                 echo "(Assuming you can't see EOF status from read anyway.)"
8833                 d_eofnblk=$undef
8834                 ;;
8835         esac
8836         ;;
8837 esac
8838 $rm -f try try.* .out core head.c mtry
8839
8840 : see if fchmod exists
8841 set fchmod d_fchmod
8842 eval $inlibc
8843
8844 : see if fchown exists
8845 set fchown d_fchown
8846 eval $inlibc
8847
8848 : see if this is an fcntl system
8849 set fcntl d_fcntl
8850 eval $inlibc
8851
8852 echo " "
8853 : See if fcntl-based locking works.
8854 $cat >try.c <<'EOCP'
8855 #include <stdlib.h>
8856 #include <unistd.h>
8857 #include <fcntl.h>
8858 int main() {
8859 #if defined(F_SETLK) && defined(F_SETLKW)
8860      struct flock flock;
8861      int retval, fd;
8862      fd = open("try.c", O_RDONLY);
8863      flock.l_type = F_RDLCK;
8864      flock.l_whence = SEEK_SET;
8865      flock.l_start = flock.l_len = 0;
8866      retval = fcntl(fd, F_SETLK, &flock);
8867      close(fd);
8868      (retval < 0 ? exit(2) : exit(0));
8869 #else
8870      exit(2);
8871 #endif
8872 }
8873 EOCP
8874 echo "Checking if fcntl-based file locking works... "
8875 case "$d_fcntl" in
8876 "$define")
8877         set try
8878         if eval $compile_ok; then
8879                 if ./try; then
8880                         echo "Yes, it seems to work."
8881                         val="$define"
8882                 else
8883                         echo "Nope, it didn't work."
8884                         val="$undef"
8885                 fi
8886         else
8887                 echo "I'm unable to compile the test program, so I'll assume not."
8888                 val="$undef"
8889         fi
8890         ;;
8891 *) val="$undef";
8892         echo "Nope, since you don't even have fcntl()."
8893         ;;
8894 esac
8895 set d_fcntl_can_lock
8896 eval $setvar
8897 $rm -f try*
8898
8899
8900 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8901 while $test $# -ge 2; do
8902         case "$1" in
8903         $define) echo "#include <$2>";;
8904         esac ;
8905     shift 2;
8906 done > try.c;
8907 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8908 set try;
8909 if eval $compile; then
8910         val="$define";
8911 else
8912         val="$undef";
8913 fi;
8914 set $varname;
8915 eval $setvar;
8916 $rm -f try.c try.o'
8917
8918 socketlib=''
8919 sockethdr=''
8920 : see whether socket exists
8921 echo " "
8922 $echo $n "Hmm... $c" >&4
8923 if set socket val -f d_socket; eval $csym; $val; then
8924         echo "Looks like you have Berkeley networking support." >&4
8925         d_socket="$define"
8926         if set setsockopt val -f; eval $csym; $val; then
8927                 d_oldsock="$undef"
8928         else
8929                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8930                 d_oldsock="$define"
8931         fi
8932 else
8933         if $contains socklib libc.list >/dev/null 2>&1; then
8934                 echo "Looks like you have Berkeley networking support." >&4
8935                 d_socket="$define"
8936                 : we will have to assume that it supports the 4.2 BSD interface
8937                 d_oldsock="$undef"
8938         else
8939                 echo "You don't have Berkeley networking in libc$_a..." >&4
8940                 if test "X$d_socket" = "X$define"; then
8941                    echo "...but you seem to believe that you have sockets." >&4
8942                 else
8943                         for net in net socket
8944                         do
8945                                 if test -f /usr/lib/lib$net$_a; then
8946                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8947                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8948                                         if $contains socket libc.list >/dev/null 2>&1; then
8949                                                 d_socket="$define"
8950                                                 socketlib="-l$net"
8951                                                 case "$net" in
8952                                                 net)
8953                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8954                                                         sockethdr="-I/usr/netinclude"
8955                                                         ;;
8956                                                 esac
8957                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8958                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8959                                                         d_oldsock="$undef"
8960                                                 else
8961                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8962                                                         d_oldsock="$define"
8963                                                 fi
8964                                                 break
8965                                         fi
8966                                 fi
8967                         done
8968                         if test "X$d_socket" != "X$define"; then
8969                            echo "or anywhere else I see." >&4
8970                            d_socket="$undef"
8971                            d_oldsock="$undef"
8972                         fi
8973                 fi
8974         fi
8975 fi
8976
8977 : see if socketpair exists
8978 set socketpair d_sockpair
8979 eval $inlibc
8980
8981
8982 echo " "
8983 echo "Checking the availability of certain socket constants..." >& 4
8984 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8985         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8986         $cat >try.c <<EOF
8987 #include <sys/types.h>
8988 #include <sys/socket.h>
8989 int main() {
8990     int i = $ENUM;
8991 }
8992 EOF
8993         val="$undef"
8994         set try; if eval $compile; then
8995                 val="$define"
8996         fi
8997         set d_${enum}; eval $setvar
8998         $rm -f try.c try
8999 done
9000
9001 : see if sys/select.h has to be included
9002 set sys/select.h i_sysselct
9003 eval $inhdr
9004
9005 : see if we should include time.h, sys/time.h, or both
9006 echo " "
9007 if test "X$timeincl" = X; then
9008         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9009         $echo $n "I'm now running the test program...$c"
9010         $cat >try.c <<'EOCP'
9011 #include <sys/types.h>
9012 #ifdef I_TIME
9013 #include <time.h>
9014 #endif
9015 #ifdef I_SYSTIME
9016 #ifdef SYSTIMEKERNEL
9017 #define KERNEL
9018 #endif
9019 #include <sys/time.h>
9020 #endif
9021 #ifdef I_SYSSELECT
9022 #include <sys/select.h>
9023 #endif
9024 int main()
9025 {
9026         struct tm foo;
9027 #ifdef S_TIMEVAL
9028         struct timeval bar;
9029 #endif
9030 #ifdef S_TIMEZONE
9031         struct timezone tzp;
9032 #endif
9033         if (foo.tm_sec == foo.tm_sec)
9034                 exit(0);
9035 #ifdef S_TIMEVAL
9036         if (bar.tv_sec == bar.tv_sec)
9037                 exit(0);
9038 #endif
9039         exit(1);
9040 }
9041 EOCP
9042         flags=''
9043         for s_timezone in '-DS_TIMEZONE' ''; do
9044         sysselect=''
9045         for s_timeval in '-DS_TIMEVAL' ''; do
9046         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9047         for i_time in '' '-DI_TIME'; do
9048         for i_systime in '-DI_SYSTIME' ''; do
9049                 case "$flags" in
9050                 '') $echo $n ".$c"
9051                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9052                         if eval $compile; then
9053                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9054                                 shift
9055                                 flags="$*"
9056                                 echo " "
9057                                 $echo $n "Succeeded with $flags$c"
9058                         fi
9059                         ;;
9060                 esac
9061         done
9062         done
9063         done
9064         done
9065         done
9066         timeincl=''
9067         echo " "
9068         case "$flags" in
9069         *SYSTIMEKERNEL*) i_systimek="$define"
9070                 timeincl=`./findhdr sys/time.h`
9071                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9072         *) i_systimek="$undef";;
9073         esac
9074         case "$flags" in
9075         *I_TIME*) i_time="$define"
9076                 timeincl=`./findhdr time.h`" $timeincl"
9077                 echo "We'll include <time.h>." >&4;;
9078         *) i_time="$undef";;
9079         esac
9080         case "$flags" in
9081         *I_SYSTIME*) i_systime="$define"
9082                 timeincl=`./findhdr sys/time.h`" $timeincl"
9083                 echo "We'll include <sys/time.h>." >&4;;
9084         *) i_systime="$undef";;
9085         esac
9086         $rm -f try.c try
9087 fi
9088
9089 : check for fd_set items
9090 $cat <<EOM
9091
9092 Checking to see how well your C compiler handles fd_set and friends ...
9093 EOM
9094 $cat >fd_set.c <<EOCP
9095 #$i_systime I_SYS_TIME
9096 #$i_sysselct I_SYS_SELECT
9097 #$d_socket HAS_SOCKET
9098 #include <sys/types.h>
9099 #ifdef HAS_SOCKET
9100 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9101 #endif
9102 #ifdef I_SYS_TIME
9103 #include <sys/time.h>
9104 #endif
9105 #ifdef I_SYS_SELECT
9106 #include <sys/select.h>
9107 #endif
9108 int main() {
9109         fd_set fds;
9110
9111 #ifdef TRYBITS
9112         if(fds.fds_bits);
9113 #endif
9114
9115 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9116         exit(0);
9117 #else
9118         exit(1);
9119 #endif
9120 }
9121 EOCP
9122 set fd_set -DTRYBITS
9123 if eval $compile; then
9124         d_fds_bits="$define"
9125         d_fd_set="$define"
9126         echo "Well, your system knows about the normal fd_set typedef..." >&4
9127         if ./fd_set; then
9128                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9129                 d_fd_macros="$define"
9130         else
9131                 $cat >&4 <<'EOM'
9132 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9133 EOM
9134                 d_fd_macros="$undef"
9135         fi
9136 else
9137         $cat <<'EOM'
9138 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9139 EOM
9140         set fd_set
9141         if eval $compile; then
9142                 d_fds_bits="$undef"
9143                 d_fd_set="$define"
9144                 echo "Well, your system has some sort of fd_set available..." >&4
9145                 if ./fd_set; then
9146                         echo "and you have the normal fd_set macros." >&4
9147                         d_fd_macros="$define"
9148                 else
9149                         $cat <<'EOM'
9150 but not the normal fd_set macros!  Gross!  More work for me...
9151 EOM
9152                         d_fd_macros="$undef"
9153                 fi
9154         else
9155         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9156                 d_fd_set="$undef"
9157                 d_fds_bits="$undef"
9158                 d_fd_macros="$undef"
9159         fi
9160 fi
9161 $rm -f fd_set*
9162
9163 : see if fgetpos exists
9164 set fgetpos d_fgetpos
9165 eval $inlibc
9166
9167 : see if flock exists
9168 set flock d_flock
9169 eval $inlibc
9170
9171 : see if fork exists
9172 set fork d_fork
9173 eval $inlibc
9174
9175 : see if pathconf exists
9176 set pathconf d_pathconf
9177 eval $inlibc
9178
9179 : see if fpathconf exists
9180 set fpathconf d_fpathconf
9181 eval $inlibc
9182
9183
9184 : check for fpos64_t
9185 echo " "
9186 echo "Checking to see if you have fpos64_t..." >&4
9187 $cat >try.c <<EOCP
9188 #include <stdio.h>
9189 int main() { fpos64_t x = 7; }
9190 EOCP
9191 set try
9192 if eval $compile; then
9193         val="$define"
9194         echo "You have fpos64_t."
9195 else
9196         val="$undef"
9197         echo "You do not have fpos64_t."
9198         case "$fpossize" in
9199         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9200         esac
9201 fi
9202 $rm -f try.* try
9203 set d_fpos64_t
9204 eval $setvar
9205
9206 : see if frexpl exists
9207 set frexpl d_frexpl
9208 eval $inlibc
9209
9210 hasstruct='varname=$1; struct=$2; shift; shift;
9211 while $test $# -ge 2; do
9212         case "$1" in
9213         $define) echo "#include <$2>";;
9214         esac ;
9215     shift 2;
9216 done > try.c;
9217 echo "int main () { struct $struct foo; }" >> try.c;
9218 set try;
9219 if eval $compile; then
9220         val="$define";
9221 else
9222         val="$undef";
9223 fi;
9224 set $varname;
9225 eval $setvar;
9226 $rm -f try.c try.o'
9227
9228 : see if this is a sys/param system
9229 set sys/param.h i_sysparam
9230 eval $inhdr
9231
9232 : see if this is a sys/mount.h system
9233 set sys/mount.h i_sysmount
9234 eval $inhdr
9235
9236 : see if sys/types.h has to be included
9237 set sys/types.h i_systypes
9238 eval $inhdr
9239
9240
9241 echo " "
9242 echo "Checking to see if your system supports struct fs_data..." >&4
9243 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9244 eval $hasstruct
9245 case "$d_fs_data_s" in
9246 "$define")      echo "Yes, it does."   ;;
9247 *)              echo "No, it doesn't." ;;
9248 esac
9249
9250 : see if fseeko exists
9251 set fseeko d_fseeko
9252 eval $inlibc
9253 case "$longsize" in
9254 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9255 esac
9256
9257 : see if fsetpos exists
9258 set fsetpos d_fsetpos
9259 eval $inlibc
9260
9261
9262 : see if fstatfs exists
9263 set fstatfs d_fstatfs
9264 eval $inlibc
9265
9266
9267 : see if statvfs exists
9268 set statvfs d_statvfs
9269 eval $inlibc
9270
9271 : see if fstatvfs exists
9272 set fstatvfs d_fstatvfs
9273 eval $inlibc
9274
9275
9276 : see if ftello exists
9277 set ftello d_ftello
9278 eval $inlibc
9279 case "$longsize" in
9280 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9281 esac
9282
9283 : see if getcwd exists
9284 set getcwd d_getcwd
9285 eval $inlibc
9286
9287 : see if getespwnam exists
9288 set getespwnam d_getespwnam
9289 eval $inlibc
9290
9291
9292 : see if getfsstat exists
9293 set getfsstat d_getfsstat
9294 eval $inlibc
9295
9296 : see if getgrent exists
9297 set getgrent d_getgrent
9298 eval $inlibc
9299
9300 : see if gethostbyaddr exists
9301 set gethostbyaddr d_gethbyaddr
9302 eval $inlibc
9303
9304 : see if gethostbyname exists
9305 set gethostbyname d_gethbyname
9306 eval $inlibc
9307
9308 : see if gethostent exists
9309 set gethostent d_gethent
9310 eval $inlibc
9311
9312 : see how we will look up host name
9313 echo " "
9314 call=''
9315 if set gethostname val -f d_gethname; eval $csym; $val; then
9316         echo 'gethostname() found.' >&4
9317         d_gethname="$define"
9318         call=gethostname
9319 fi
9320 if set uname val -f d_uname; eval $csym; $val; then
9321         if ./xenix; then
9322                 $cat <<'EOM'
9323 uname() was found, but you're running xenix, and older versions of xenix
9324 have a broken uname(). If you don't really know whether your xenix is old
9325 enough to have a broken system call, use the default answer.
9326
9327 EOM
9328                 dflt=y
9329                 case "$d_uname" in
9330                 "$define") dflt=n;;
9331                 esac
9332                 rp='Is your uname() broken?'
9333                 . ./myread
9334                 case "$ans" in
9335                 n*) d_uname="$define"; call=uname;;
9336                 esac
9337         else
9338                 echo 'uname() found.' >&4
9339                 d_uname="$define"
9340                 case "$call" in
9341                 '') call=uname ;;
9342                 esac
9343         fi
9344 fi
9345 case "$d_gethname" in
9346 '') d_gethname="$undef";;
9347 esac
9348 case "$d_uname" in
9349 '') d_uname="$undef";;
9350 esac
9351 case "$d_uname$d_gethname" in
9352 *define*)
9353         dflt=n
9354         cat <<EOM
9355  
9356 Every now and then someone has a $call() that lies about the hostname
9357 but can't be fixed for political or economic reasons.  If you wish, I can
9358 pretend $call() isn't there and maybe compute hostname at run-time
9359 thanks to the '$phostname' command.
9360
9361 EOM
9362         rp="Shall I ignore $call() from now on?"
9363         . ./myread
9364         case "$ans" in
9365         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9366         esac;;
9367 esac
9368 case "$phostname" in
9369 '') aphostname='';;
9370 *) case "$aphostname" in
9371         /*) ;;
9372         *) set X $phostname
9373                 shift
9374                 file=$1
9375                 shift
9376                 file=`./loc $file $file $pth`
9377                 aphostname=`echo $file $*`
9378                 ;;
9379         esac
9380         ;;
9381 esac
9382 case "$d_uname$d_gethname" in
9383 *define*) ;;
9384 *)
9385         case "$phostname" in
9386         '')
9387                 echo "There will be no way for $package to get your hostname." >&4;;
9388         *)
9389         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9390                 ;;
9391         esac;;
9392 esac
9393 case "$d_phostname" in
9394 '') d_phostname="$undef";;
9395 esac
9396
9397 : see if this is a netdb.h system
9398 set netdb.h i_netdb
9399 eval $inhdr
9400
9401 : see if prototypes for various gethostxxx netdb.h functions are available
9402 echo " "
9403 set d_gethostprotos gethostent $i_netdb netdb.h
9404 eval $hasproto
9405
9406 : see if getlogin exists
9407 set getlogin d_getlogin
9408 eval $inlibc
9409
9410 : see if getmnt exists
9411 set getmnt d_getmnt
9412 eval $inlibc
9413
9414 : see if getmntent exists
9415 set getmntent d_getmntent
9416 eval $inlibc
9417
9418 : see if getnetbyaddr exists
9419 set getnetbyaddr d_getnbyaddr
9420 eval $inlibc
9421
9422 : see if getnetbyname exists
9423 set getnetbyname d_getnbyname
9424 eval $inlibc
9425
9426 : see if getnetent exists
9427 set getnetent d_getnent
9428 eval $inlibc
9429
9430 : see if prototypes for various getnetxxx netdb.h functions are available
9431 echo " "
9432 set d_getnetprotos getnetent $i_netdb netdb.h
9433 eval $hasproto
9434
9435
9436 : see if getprotobyname exists
9437 set getprotobyname d_getpbyname
9438 eval $inlibc
9439
9440 : see if getprotobynumber exists
9441 set getprotobynumber d_getpbynumber
9442 eval $inlibc
9443
9444 : see if getprotoent exists
9445 set getprotoent d_getpent
9446 eval $inlibc
9447
9448 : see if getpgid exists
9449 set getpgid d_getpgid
9450 eval $inlibc
9451
9452 : see if getpgrp2 exists
9453 set getpgrp2 d_getpgrp2
9454 eval $inlibc
9455
9456 : see if getppid exists
9457 set getppid d_getppid
9458 eval $inlibc
9459
9460 : see if getpriority exists
9461 set getpriority d_getprior
9462 eval $inlibc
9463
9464 : see if prototypes for various getprotoxxx netdb.h functions are available
9465 echo " "
9466 set d_getprotoprotos getprotoent $i_netdb netdb.h
9467 eval $hasproto
9468
9469 : see if getprpwnam exists
9470 set getprpwnam d_getprpwnam
9471 eval $inlibc
9472
9473 : see if getpwent exists
9474 set getpwent d_getpwent
9475 eval $inlibc
9476
9477
9478 : see if getservbyname exists
9479 set getservbyname d_getsbyname
9480 eval $inlibc
9481
9482 : see if getservbyport exists
9483 set getservbyport d_getsbyport
9484 eval $inlibc
9485
9486 : see if getservent exists
9487 set getservent d_getsent
9488 eval $inlibc
9489
9490 : see if prototypes for various getservxxx netdb.h functions are available
9491 echo " "
9492 set d_getservprotos getservent $i_netdb netdb.h
9493 eval $hasproto
9494
9495 : see if getspnam exists
9496 set getspnam d_getspnam
9497 eval $inlibc
9498
9499 : see if gettimeofday or ftime exists
9500 set gettimeofday d_gettimeod
9501 eval $inlibc
9502 case "$d_gettimeod" in
9503 "$undef")
9504         set ftime d_ftime 
9505         eval $inlibc
9506         ;;
9507 *)
9508         val="$undef"; set d_ftime; eval $setvar
9509         ;;
9510 esac
9511 case "$d_gettimeod$d_ftime" in
9512 "$undef$undef")
9513         echo " "
9514         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9515         ;;
9516 esac
9517
9518 : see if this is an grp system
9519 set grp.h i_grp
9520 eval $inhdr
9521
9522 case "$i_grp" in
9523 $define)
9524         xxx=`./findhdr grp.h`
9525         $cppstdin $cppflags $cppminus < $xxx >$$.h
9526
9527         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9528                 val="$define"
9529         else
9530                 val="$undef"
9531         fi
9532         set d_grpasswd
9533         eval $setvar
9534
9535         $rm -f $$.h
9536         ;;
9537 *)
9538         val="$undef";
9539         set d_grpasswd; eval $setvar
9540         ;;
9541 esac
9542
9543 : see if hasmntopt exists
9544 set hasmntopt d_hasmntopt
9545 eval $inlibc
9546
9547 : see if this is a netinet/in.h or sys/in.h system
9548 set netinet/in.h i_niin sys/in.h i_sysin
9549 eval $inhdr
9550
9551 : see if arpa/inet.h has to be included
9552 set arpa/inet.h i_arpainet
9553 eval $inhdr
9554
9555 : see if htonl --and friends-- exists
9556 val=''
9557 set htonl val
9558 eval $inlibc
9559
9560 : Maybe they are macros.
9561 case "$val" in
9562 $undef)
9563         $cat >htonl.c <<EOM
9564 #include <stdio.h>
9565 #include <sys/types.h>
9566 #$i_niin I_NETINET_IN
9567 #$i_sysin I_SYS_IN
9568 #$i_arpainet I_ARPA_INET
9569 #ifdef I_NETINET_IN
9570 #include <netinet/in.h>
9571 #endif
9572 #ifdef I_SYS_IN
9573 #include <sys/in.h>
9574 #endif
9575 #ifdef I_ARPA_INET
9576 #include <arpa/inet.h>
9577 #endif
9578 #ifdef htonl
9579 printf("Defined as a macro.");
9580 #endif
9581 EOM
9582         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9583         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9584                 val="$define"
9585                 echo "But it seems to be defined as a macro." >&4
9586         fi
9587         $rm -f htonl.?
9588         ;;
9589 esac
9590 set d_htonl
9591 eval $setvar
9592
9593 : see if iconv exists
9594 set iconv d_iconv
9595 eval $inlibc
9596
9597 : index or strchr
9598 echo " "
9599 if set index val -f; eval $csym; $val; then
9600         if set strchr val -f d_strchr; eval $csym; $val; then
9601                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9602                         val="$define"
9603                         vali="$undef"
9604                         echo "strchr() found." >&4
9605                 else
9606                         val="$undef"
9607                         vali="$define"
9608                         echo "index() found." >&4
9609                 fi
9610         else
9611                 val="$undef"
9612                 vali="$define"
9613                 echo "index() found." >&4
9614         fi
9615 else
9616         if set strchr val -f d_strchr; eval $csym; $val; then
9617                 val="$define"
9618                 vali="$undef"
9619                 echo "strchr() found." >&4
9620         else
9621                 echo "No index() or strchr() found!" >&4
9622                 val="$undef"
9623                 vali="$undef"
9624         fi
9625 fi
9626 set d_strchr; eval $setvar
9627 val="$vali"
9628 set d_index; eval $setvar
9629
9630 : check whether inet_aton exists
9631 set inet_aton d_inetaton
9632 eval $inlibc
9633
9634 : see if inttypes.h is available
9635 : we want a real compile instead of Inhdr because some systems
9636 : have an inttypes.h which includes non-existent headers
9637 echo " "
9638 $cat >try.c <<EOCP
9639 #include <inttypes.h>
9640 int main() {
9641         static int32_t foo32 = 0x12345678;
9642 }
9643 EOCP
9644 set try
9645 if eval $compile; then
9646         echo "<inttypes.h> found." >&4
9647         val="$define"
9648 else
9649         echo "<inttypes.h> NOT found." >&4
9650         val="$undef"
9651 fi
9652 $rm -f try.c try
9653 set i_inttypes
9654 eval $setvar
9655
9656 : check for int64_t
9657 echo " "
9658 echo "Checking to see if you have int64_t..." >&4
9659 $cat >try.c <<EOCP
9660 #include <sys/types.h>
9661 #$i_inttypes I_INTTYPES
9662 #ifdef I_INTTYPES
9663 #include <inttypes.h>
9664 #endif
9665 int main() { int64_t x = 7; }
9666 EOCP
9667 set try
9668 if eval $compile; then
9669         val="$define"
9670         echo "You have int64_t."
9671 else
9672         val="$undef"
9673         echo "You do not have int64_t."
9674 fi
9675 $rm -f try try.*
9676 set d_int64_t
9677 eval $setvar
9678
9679 : Look for isascii
9680 echo " "
9681 $cat >isascii.c <<'EOCP'
9682 #include <stdio.h>
9683 #include <ctype.h>
9684 int main() {
9685         int c = 'A';
9686         if (isascii(c))
9687                 exit(0);
9688         else
9689                 exit(1);
9690 }
9691 EOCP
9692 set isascii
9693 if eval $compile; then
9694         echo "isascii() found." >&4
9695         val="$define"
9696 else
9697         echo "isascii() NOT found." >&4
9698         val="$undef"
9699 fi
9700 set d_isascii
9701 eval $setvar
9702 $rm -f isascii*
9703
9704 : see if isnan exists
9705 set isnan d_isnan
9706 eval $inlibc
9707
9708 : see if isnanl exists
9709 set isnanl d_isnanl
9710 eval $inlibc
9711
9712 : see if killpg exists
9713 set killpg d_killpg
9714 eval $inlibc
9715
9716 : see if lchown exists
9717 echo " "
9718 $cat > try.c <<'EOCP'
9719 /* System header to define __stub macros and hopefully few prototypes,
9720     which can conflict with char lchown(); below.  */
9721 #include <assert.h>
9722 /* Override any gcc2 internal prototype to avoid an error.  */
9723 /* We use char because int might match the return type of a gcc2
9724    builtin and then its argument prototype would still apply.  */
9725 char lchown();
9726 int main() {
9727     /*  The GNU C library defines this for functions which it implements
9728         to always fail with ENOSYS.  Some functions are actually named
9729         something starting with __ and the normal name is an alias.  */
9730 #if defined (__stub_lchown) || defined (__stub___lchown)
9731 choke me
9732 #else
9733 lchown();
9734 #endif
9735 ; return 0; }
9736 EOCP
9737 set try
9738 if eval $compile; then
9739     $echo "lchown() found." >&4
9740     val="$define"
9741 else
9742     $echo "lchown() NOT found." >&4
9743     val="$undef"
9744 fi
9745 set d_lchown
9746 eval $setvar
9747
9748 : See if number of significant digits in a double precision number is known
9749 echo " "
9750 $cat >ldbl_dig.c <<EOM
9751 #$i_limits I_LIMITS
9752 #$i_float I_FLOAT
9753 #ifdef I_LIMITS
9754 #include <limits.h>
9755 #endif
9756 #ifdef I_FLOAT
9757 #include <float.h>
9758 #endif
9759 #ifdef LDBL_DIG
9760 printf("Contains LDBL_DIG");
9761 #endif
9762 EOM
9763 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9764 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9765         echo "LDBL_DIG found." >&4
9766         val="$define"
9767 else
9768         echo "LDBL_DIG NOT found." >&4
9769         val="$undef"
9770 fi
9771 $rm -f ldbl_dig.?
9772 set d_ldbl_dig
9773 eval $setvar
9774
9775 : see if link exists
9776 set link d_link
9777 eval $inlibc
9778
9779 : see if localeconv exists
9780 set localeconv d_locconv
9781 eval $inlibc
9782
9783 : see if lockf exists
9784 set lockf d_lockf
9785 eval $inlibc
9786
9787 : check for long long
9788 echo " "
9789 echo "Checking to see if you have long long..." >&4
9790 echo 'int main() { long long x = 7; return 0; }' > try.c
9791 set try
9792 if eval $compile; then
9793         val="$define"
9794         echo "You have long long."
9795 else
9796         val="$undef"
9797         echo "You do not have long long."
9798 fi
9799 $rm try.*
9800 set d_longlong
9801 eval $setvar
9802
9803 : check for length of long long
9804 case "${d_longlong}${longlongsize}" in
9805 $define)
9806         echo " "
9807         echo "Checking to see how big your long longs are..." >&4
9808         $cat >try.c <<'EOCP'
9809 #include <stdio.h>
9810 int main()
9811 {
9812     printf("%d\n", (int)sizeof(long long));
9813     return(0);
9814 }
9815 EOCP
9816         set try
9817         if eval $compile_ok; then
9818                 longlongsize=`./try$exe_ext`
9819                 echo "Your long longs are $longlongsize bytes long."
9820         else
9821                 dflt='8'
9822                 echo " "
9823                 echo "(I can't seem to compile the test program.  Guessing...)"
9824                 rp="What is the size of a long long (in bytes)?"
9825                 . ./myread
9826                 longlongsize="$ans"
9827         fi
9828         if $test "X$longsize" = "X$longlongsize"; then
9829                 echo "(That isn't any different from an ordinary long.)"
9830         fi      
9831         ;;
9832 esac
9833 $rm -f try.* try
9834
9835 : see if prototype for lseek is available
9836 echo " "
9837 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9838 eval $hasproto
9839
9840 : see if lstat exists
9841 set lstat d_lstat
9842 eval $inlibc
9843
9844 : see if madvise exists
9845 set madvise d_madvise
9846 eval $inlibc
9847
9848 : see if mblen exists
9849 set mblen d_mblen
9850 eval $inlibc
9851
9852 : see if mbstowcs exists
9853 set mbstowcs d_mbstowcs
9854 eval $inlibc
9855
9856 : see if mbtowc exists
9857 set mbtowc d_mbtowc
9858 eval $inlibc
9859
9860 : see if memchr exists
9861 set memchr d_memchr
9862 eval $inlibc
9863
9864 : see if memcmp exists
9865 set memcmp d_memcmp
9866 eval $inlibc
9867
9868 : see if memcpy exists
9869 set memcpy d_memcpy
9870 eval $inlibc
9871
9872 : see if memmove exists
9873 set memmove d_memmove
9874 eval $inlibc
9875
9876 : see if memset exists
9877 set memset d_memset
9878 eval $inlibc
9879
9880 : see if mkdir exists
9881 set mkdir d_mkdir
9882 eval $inlibc
9883
9884 : see if mkdtemp exists
9885 set mkdtemp d_mkdtemp
9886 eval $inlibc
9887
9888 : see if mkfifo exists
9889 set mkfifo d_mkfifo
9890 eval $inlibc
9891
9892 : see if mkstemp exists
9893 set mkstemp d_mkstemp
9894 eval $inlibc
9895
9896 : see if mkstemps exists
9897 set mkstemps d_mkstemps
9898 eval $inlibc
9899
9900 : see if mktime exists
9901 set mktime d_mktime
9902 eval $inlibc
9903
9904 : see if this is a sys/mman.h system
9905 set sys/mman.h i_sysmman
9906 eval $inhdr
9907
9908 : see if mmap exists
9909 set mmap d_mmap
9910 eval $inlibc
9911 : see what shmat returns
9912 : default to something harmless
9913 mmaptype='void *'
9914 case "$i_sysmman$d_mmap" in
9915 "$define$define")
9916         $cat >mmap.c <<'END'
9917 #include <sys/mman.h>
9918 void *mmap();
9919 END
9920         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9921                 mmaptype='void *'
9922         else
9923                 mmaptype='caddr_t'
9924         fi
9925         echo "and it returns ($mmaptype)." >&4
9926         ;;
9927 esac
9928
9929
9930
9931 : see if modfl exists
9932 set modfl d_modfl
9933 eval $inlibc
9934
9935 : see if mprotect exists
9936 set mprotect d_mprotect
9937 eval $inlibc
9938
9939 : see if msgctl exists
9940 set msgctl d_msgctl
9941 eval $inlibc
9942
9943 : see if msgget exists
9944 set msgget d_msgget
9945 eval $inlibc
9946
9947 : see if msgsnd exists
9948 set msgsnd d_msgsnd
9949 eval $inlibc
9950
9951 : see if msgrcv exists
9952 set msgrcv d_msgrcv
9953 eval $inlibc
9954
9955 : see how much of the 'msg*(2)' library is present.
9956 h_msg=true
9957 echo " "
9958 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9959 *"$undef"*) h_msg=false;;
9960 esac
9961 case "$osname" in
9962 freebsd)
9963     case "`ipcs 2>&1`" in
9964     "SVID messages"*"not configured"*)
9965         echo "Your $osname does not have the msg*(2) configured." >&4
9966         h_msg=false
9967         val="$undef"
9968         set msgctl d_msgctl
9969         eval $setvar
9970         set msgget d_msgget
9971         eval $setvar
9972         set msgsnd d_msgsnd
9973         eval $setvar
9974         set msgrcv d_msgrcv
9975         eval $setvar
9976         ;;
9977     esac
9978     ;;
9979 esac
9980 : we could also check for sys/ipc.h ...
9981 if $h_msg && $test `./findhdr sys/msg.h`; then
9982         echo "You have the full msg*(2) library." >&4
9983         val="$define"
9984 else
9985         echo "You don't have the full msg*(2) library." >&4
9986         val="$undef"
9987 fi
9988 set d_msg
9989 eval $setvar
9990
9991 : see if msync exists
9992 set msync d_msync
9993 eval $inlibc
9994
9995 : see if munmap exists
9996 set munmap d_munmap
9997 eval $inlibc
9998
9999 : see if nice exists
10000 set nice d_nice
10001 eval $inlibc
10002
10003
10004 echo " "
10005 echo "Checking which 64-bit integer type we could use..." >&4
10006
10007 case "$intsize" in
10008 8) val=int
10009    set quadtype
10010    eval $setvar
10011    val='"unsigned int"'
10012    set uquadtype
10013    eval $setvar
10014    quadkind=1
10015    ;;
10016 *) case "$longsize" in
10017    8) val=long
10018       set quadtype
10019       eval $setvar
10020       val='"unsigned long"'
10021       set uquadtype
10022       eval $setvar
10023       quadkind=2
10024       ;;
10025    *) case "$d_longlong:$longlongsize" in
10026       define:8)
10027         val='"long long"'
10028         set quadtype
10029         eval $setvar
10030         val='"unsigned long long"'
10031         set uquadtype
10032         eval $setvar
10033         quadkind=3
10034         ;;
10035       *) case "$d_int64_t" in
10036          define)
10037            val=int64_t
10038            set quadtype
10039            eval $setvar
10040            val=uint64_t
10041            set uquadtype
10042            eval $setvar
10043            quadkind=4
10044            ;;
10045          esac
10046          ;;
10047       esac
10048       ;;
10049    esac
10050    ;;
10051 esac
10052
10053 case "$quadtype" in
10054 '')     echo "Alas, no 64-bit integer types in sight." >&4
10055         d_quad="$undef"
10056         ;;
10057 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10058             verb="will"
10059         else
10060             verb="could"
10061         fi
10062         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10063         d_quad="$define"
10064         ;;
10065 esac
10066
10067 : check for length of character
10068 echo " "
10069 case "$charsize" in
10070 '')
10071         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10072         $cat >try.c <<'EOCP'
10073 #include <stdio.h>
10074 int main()
10075 {
10076     printf("%d\n", (int)sizeof(char));
10077     exit(0);
10078 }
10079 EOCP
10080         set try
10081         if eval $compile_ok; then
10082                 dflt=`./try`
10083         else
10084                 dflt='1'
10085                 echo "(I can't seem to compile the test program.  Guessing...)"
10086         fi
10087         ;;
10088 *)
10089         dflt="$charsize"
10090         ;;
10091 esac
10092 rp="What is the size of a character (in bytes)?"
10093 . ./myread
10094 charsize="$ans"
10095 $rm -f try.c try
10096
10097
10098 echo " "
10099 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10100
10101 case "$use64bitint:$d_quad:$quadtype" in
10102 define:define:?*)
10103         ivtype="$quadtype"
10104         uvtype="$uquadtype"
10105         ivsize=8
10106         uvsize=8
10107         ;;
10108 *)      ivtype="long"
10109         uvtype="unsigned long"
10110         ivsize=$longsize
10111         uvsize=$longsize
10112         ;;
10113 esac
10114
10115 case "$uselongdouble:$d_longdbl" in
10116 define:define)
10117         nvtype="long double"
10118         nvsize=$longdblsize
10119         ;;
10120 *)      nvtype=double
10121         nvsize=$doublesize
10122         ;;
10123 esac
10124
10125 $echo "(IV will be "$ivtype", $ivsize bytes)"
10126 $echo "(UV will be "$uvtype", $uvsize bytes)"
10127 $echo "(NV will be "$nvtype", $nvsize bytes)"
10128
10129 $cat >try.c <<EOCP
10130 #$i_inttypes I_INTTYPES
10131 #ifdef I_INTTYPES
10132 #include <inttypes.h>
10133 #endif
10134 #include <stdio.h>
10135 int main() {
10136 #ifdef INT8
10137    int8_t i =  INT8_MAX;
10138   uint8_t u = UINT8_MAX;
10139   printf("int8_t\n");
10140 #endif
10141 #ifdef INT16
10142    int16_t i =  INT16_MAX;
10143   uint16_t i = UINT16_MAX;
10144   printf("int16_t\n");
10145 #endif
10146 #ifdef INT32
10147    int32_t i =  INT32_MAX;
10148   uint32_t u = UINT32_MAX;
10149   printf("int32_t\n");
10150 #endif
10151 }
10152 EOCP
10153
10154 case "$i8type" in
10155 '')     case "$charsize" in
10156         1)      i8type=char
10157                 u8type="unsigned char"
10158                 i8size=$charsize
10159                 u8size=$charsize
10160                 ;;
10161         esac
10162         ;;
10163 esac
10164 case "$i8type" in
10165 '')     set try -DINT8
10166         if eval $compile; then
10167                 case "`./try$exe_ext`" in
10168                 int8_t) i8type=int8_t
10169                         u8type=uint8_t
10170                         i8size=1
10171                         u8size=1
10172                         ;;
10173                 esac
10174         fi
10175         ;;
10176 esac
10177 case "$i8type" in
10178 '')     if $test $charsize -ge 1; then
10179                 i8type=char
10180                 u8type="unsigned char"
10181                 i8size=$charsize
10182                 u8size=$charsize
10183         fi
10184         ;;
10185 esac
10186
10187 case "$i16type" in
10188 '')     case "$shortsize" in
10189         2)      i16type=short
10190                 u16type="unsigned short"
10191                 i16size=$shortsize
10192                 u16size=$shortsize
10193                 ;;
10194         esac
10195         ;;
10196 esac
10197 case "$i16type" in
10198 '')     set try -DINT16
10199         if eval $compile; then
10200                 case "`./try$exe_ext`" in
10201                 int16_t)
10202                         i16type=int16_t
10203                         u16type=uint16_t
10204                         i16size=2
10205                         u16size=2
10206                         ;;
10207                 esac
10208         fi
10209         ;;
10210 esac
10211 case "$i16type" in
10212 '')     if $test $shortsize -ge 2; then
10213                 i16type=short
10214                 u16type="unsigned short"
10215                 i16size=$shortsize
10216                 u16size=$shortsize
10217         fi
10218         ;;
10219 esac
10220
10221 case "$i32type" in
10222 '')     case "$longsize" in
10223         4)      i32type=long
10224                 u32type="unsigned long"
10225                 i32size=$longsize
10226                 u32size=$longsize
10227                 ;;
10228         *)      case "$intsize" in
10229                 4)      i32type=int
10230                         u32type="unsigned int"
10231                         i32size=$intsize
10232                         u32size=$intsize
10233                         ;;
10234                 esac
10235                 ;;
10236         esac
10237         ;;
10238 esac
10239 case "$i32type" in
10240 '')     set try -DINT32
10241         if eval $compile; then
10242                 case "`./try$exe_ext`" in
10243                 int32_t)
10244                         i32type=int32_t
10245                         u32type=uint32_t
10246                         i32size=4
10247                         u32size=4
10248                         ;;
10249                 esac
10250         fi
10251         ;;
10252 esac
10253 case "$i32type" in
10254 '')     if $test $intsize -ge 4; then
10255                 i32type=int
10256                 u32type="unsigned int"
10257                 i32size=$intsize
10258                 u32size=$intsize
10259         fi
10260         ;;
10261 esac
10262
10263 case "$i64type" in
10264 '')     case "$d_quad:$quadtype" in
10265         define:?*)
10266                 i64type="$quadtype"
10267                 u64type="$uquadtype"
10268                 i64size=8
10269                 u64size=8
10270                 ;;
10271         esac
10272         ;;
10273 esac
10274
10275 $echo "Checking whether your NVs can preserve your UVs..." >&4
10276 $cat <<EOP >try.c
10277 #include <stdio.h>
10278 int main() {
10279     $uvtype k = ($uvtype)~0, l;
10280     $nvtype d;
10281     l = k;
10282     d = ($nvtype)l;
10283     l = ($uvtype)d;
10284     if (l == k)
10285        printf("preserve\n");
10286     exit(0);
10287 }
10288 EOP
10289 set try
10290 if eval $compile; then
10291         case "`./try$exe_ext`" in
10292         preserve) d_nv_preserves_uv="$define" ;;
10293         esac
10294 fi      
10295 case "$d_nv_preserves_uv" in
10296 $define) $echo "Yes, they can."  2>&1 ;;
10297 *)       $echo "No, they can't." 2>&1
10298          d_nv_preserves_uv="$undef"
10299          ;;
10300 esac
10301
10302 $rm -f try.* try
10303
10304 case "$d_nv_preserves_uv" in
10305 "$define") d_nv_preserves_uv_bits=`expr $uvsize \* 8` ;;
10306 *)      $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10307         $cat <<EOP >try.c
10308 #include <stdio.h>
10309 int main() {
10310     $uvtype u = 0;
10311     int     n = 8 * $uvsize;
10312     int     i;
10313     for (i = 0; i < n; i++) {
10314       u = u << 1 | ($uvtype)1;
10315       if (($uvtype)($nvtype)u != u)
10316         break;
10317     }
10318     printf("%d\n", i);
10319     exit(0);
10320 }
10321 EOP
10322         set try
10323         if eval $compile; then
10324                 d_nv_preserves_uv_bits="`./try$exe_ext`"
10325         fi
10326         case "$d_nv_preserves_uv_bits" in
10327         [1-9]*) $echo "Your NVs can preserve $d_nv_preserves_uv_bits bits of your UVs."  2>&1 ;;
10328         *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10329                 d_nv_preserves_uv_bits="$undef"
10330                 ;;
10331         esac
10332         $rm -f try.* try
10333         ;;
10334 esac
10335
10336
10337 : check for off64_t
10338 echo " "
10339 echo "Checking to see if you have off64_t..." >&4
10340 $cat >try.c <<EOCP
10341 #include <sys/types.h>
10342 #include <unistd.h>
10343 int main() { off64_t x = 7; }
10344 EOCP
10345 set try
10346 if eval $compile; then
10347         val="$define"
10348         echo "You have off64_t."
10349 else
10350         val="$undef"
10351         echo "You do not have off64_t."
10352         case "$lseeksize" in
10353         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10354         esac
10355 fi
10356 $rm -f try.* try
10357 set d_off64_t
10358 eval $setvar
10359
10360 : see if POSIX threads are available
10361 set pthread.h i_pthread
10362 eval $inhdr
10363
10364
10365
10366
10367 : how to create joinable pthreads
10368 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10369         echo " "
10370         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10371         $cat >try.c <<'EOCP'
10372 #include <pthread.h>
10373 int main() {
10374     int detachstate = JOINABLE;
10375 }
10376 EOCP
10377         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10378         if eval $compile; then
10379                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10380                 val="$undef" # Yes, undef.
10381                 set d_old_pthread_create_joinable
10382                 eval $setvar
10383                 val=""
10384                 set old_pthread_create_joinable
10385                 eval $setvar
10386         else
10387                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10388                 if eval $compile; then
10389                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10390                         val="$define"
10391                         set d_old_pthread_create_joinable
10392                         eval $setvar
10393                         val=PTHREAD_CREATE_UNDETACHED
10394                         set old_pthread_create_joinable
10395                         eval $setvar
10396                 else            
10397                         set try -DJOINABLE=__UNDETACHED
10398                         if eval $compile; then
10399                                 echo "You seem to use __UNDETACHED." >&4
10400                                 val="$define"
10401                                 set d_old_pthread_create_joinable
10402                                 eval $setvar
10403                                 val=__UNDETACHED
10404                                 set old_pthread_create_joinable
10405                                 eval $setvar
10406                         else
10407                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10408                                 val="$define"
10409                                 set d_old_pthread_create_joinable
10410                                 eval $setvar
10411                                 val=0
10412                                 set old_pthread_create_joinable
10413                                 eval $setvar
10414                         fi
10415                 fi
10416         fi
10417         $rm -f try try.*
10418 else
10419     d_old_pthread_create_joinable="$undef"
10420     old_pthread_create_joinable=""
10421 fi
10422
10423 : see if pause exists
10424 set pause d_pause
10425 eval $inlibc
10426
10427 : see if pipe exists
10428 set pipe d_pipe
10429 eval $inlibc
10430
10431 : see if poll exists
10432 set poll d_poll
10433 eval $inlibc
10434
10435
10436 : see whether the various POSIXish _yields exist
10437 $cat >try.c <<EOP
10438 #include <pthread.h>
10439 #include <stdio.h>
10440 int main() {
10441 #ifdef SCHED_YIELD
10442         sched_yield();
10443 #else
10444 #ifdef PTHREAD_YIELD
10445         pthread_yield();
10446 #else
10447 #ifdef PTHREAD_YIELD_NULL
10448         pthread_yield(NULL);
10449 #endif
10450 #endif
10451 #endif
10452 }
10453 EOP
10454 : see if sched_yield exists
10455 set try -DSCHED_YIELD
10456 if eval $compile; then
10457     val="$define"
10458     sched_yield='sched_yield()'
10459 else
10460     val="$undef"
10461 fi
10462 case "$usethreads" in
10463 $define)
10464         case "$val" in
10465         $define) echo 'sched_yield() found.' >&4        ;;
10466         *)       echo 'sched_yield() NOT found.' >&4    ;;
10467         esac
10468 esac
10469 set d_sched_yield
10470 eval $setvar
10471
10472 : see if pthread_yield exists
10473 set try -DPTHREAD_YIELD
10474 if eval $compile; then
10475     val="$define"
10476     case "$sched_yield" in
10477     '') sched_yield='pthread_yield()' ;;
10478     esac
10479 else
10480     set try -DPTHREAD_YIELD_NULL
10481     if eval $compile; then
10482         val="$define"
10483         case "$sched_yield" in
10484         '') sched_yield='pthread_yield(NULL)' ;;
10485         esac
10486     else
10487         val="$undef"
10488     fi
10489 fi
10490 case "$usethreads" in
10491 $define)
10492         case "$val" in
10493         $define) echo 'pthread_yield() found.' >&4      ;;
10494         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10495         esac
10496         ;;
10497 esac
10498 set d_pthread_yield
10499 eval $setvar
10500
10501 case "$sched_yield" in
10502 '') sched_yield=undef ;;
10503 esac
10504
10505 $rm -f try try.*
10506
10507 : see if this is a pwd.h system
10508 set pwd.h i_pwd
10509 eval $inhdr
10510
10511 case "$i_pwd" in
10512 $define)
10513         xxx=`./findhdr pwd.h`
10514         $cppstdin $cppflags $cppminus < $xxx >$$.h
10515
10516         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10517                 val="$define"
10518         else
10519                 val="$undef"
10520         fi
10521         set d_pwquota
10522         eval $setvar
10523
10524         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10525                 val="$define"
10526         else
10527                 val="$undef"
10528         fi
10529         set d_pwage
10530         eval $setvar
10531
10532         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10533                 val="$define"
10534         else
10535                 val="$undef"
10536         fi
10537         set d_pwchange
10538         eval $setvar
10539
10540         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10541                 val="$define"
10542         else
10543                 val="$undef"
10544         fi
10545         set d_pwclass
10546         eval $setvar
10547
10548         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10549                 val="$define"
10550         else
10551                 val="$undef"
10552         fi
10553         set d_pwexpire
10554         eval $setvar
10555
10556         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10557                 val="$define"
10558         else
10559                 val="$undef"
10560         fi
10561         set d_pwcomment
10562         eval $setvar
10563
10564         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10565                 val="$define"
10566         else
10567                 val="$undef"
10568         fi
10569         set d_pwgecos
10570         eval $setvar
10571
10572         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10573                 val="$define"
10574         else
10575                 val="$undef"
10576         fi
10577         set d_pwpasswd
10578         eval $setvar
10579
10580         $rm -f $$.h
10581         ;;
10582 *)
10583         val="$undef"; 
10584         set d_pwquota; eval $setvar
10585         set d_pwage; eval $setvar
10586         set d_pwchange; eval $setvar
10587         set d_pwclass; eval $setvar
10588         set d_pwexpire; eval $setvar
10589         set d_pwcomment; eval $setvar
10590         set d_pwgecos; eval $setvar
10591         set d_pwpasswd; eval $setvar
10592         ;;
10593 esac
10594
10595 : see if readdir and friends exist
10596 set readdir d_readdir
10597 eval $inlibc
10598 set seekdir d_seekdir
10599 eval $inlibc
10600 set telldir d_telldir
10601 eval $inlibc
10602 set rewinddir d_rewinddir
10603 eval $inlibc
10604
10605 : see if readlink exists
10606 set readlink d_readlink
10607 eval $inlibc
10608
10609 : see if rename exists
10610 set rename d_rename
10611 eval $inlibc
10612
10613 : see if rmdir exists
10614 set rmdir d_rmdir
10615 eval $inlibc
10616
10617 : see if memory.h is available.
10618 val=''
10619 set memory.h val
10620 eval $inhdr
10621
10622 : See if it conflicts with string.h
10623 case "$val" in
10624 $define)
10625         case "$strings" in
10626         '') ;;
10627         *)
10628                 $cppstdin $cppflags $cppminus < $strings > mem.h
10629                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10630                         echo " "
10631                         echo "We won't be including <memory.h>."
10632                         val="$undef"
10633                 fi
10634                 $rm -f mem.h
10635                 ;;
10636         esac
10637 esac
10638 set i_memory
10639 eval $setvar
10640
10641 : can bcopy handle overlapping blocks?
10642 val="$undef"
10643 case "$d_bcopy" in
10644 "$define")
10645         echo " "
10646         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10647         $cat >try.c <<EOCP
10648 #$i_memory I_MEMORY
10649 #$i_stdlib I_STDLIB
10650 #$i_string I_STRING
10651 #$i_unistd I_UNISTD
10652 EOCP
10653         $cat >>try.c <<'EOCP'
10654 #include <stdio.h>
10655 #ifdef I_MEMORY
10656 #  include <memory.h>
10657 #endif
10658 #ifdef I_STDLIB
10659 #  include <stdlib.h>
10660 #endif
10661 #ifdef I_STRING
10662 #  include <string.h>
10663 #else
10664 #  include <strings.h>
10665 #endif
10666 #ifdef I_UNISTD
10667 #  include <unistd.h>  /* Needed for NetBSD */
10668 #endif
10669 int main()
10670 {
10671 char buf[128], abc[128];
10672 char *b;
10673 int len;
10674 int off;
10675 int align;
10676
10677 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10678
10679 for (align = 7; align >= 0; align--) {
10680         for (len = 36; len; len--) {
10681                 b = buf+align;
10682                 bcopy(abc, b, len);
10683                 for (off = 1; off <= len; off++) {
10684                         bcopy(b, b+off, len);
10685                         bcopy(b+off, b, len);
10686                         if (bcmp(b, abc, len))
10687                                 exit(1);
10688                 }
10689         }
10690 }
10691 exit(0);
10692 }
10693 EOCP
10694         set try
10695         if eval $compile_ok; then
10696                 if ./try 2>/dev/null; then
10697                         echo "Yes, it can."
10698                         val="$define"
10699                 else
10700                         echo "It can't, sorry."
10701                         case "$d_memmove" in
10702                         "$define") echo "But that's Ok since you have memmove()." ;;
10703                         esac
10704                 fi
10705         else
10706                 echo "(I can't compile the test program, so we'll assume not...)"
10707                 case "$d_memmove" in
10708                 "$define") echo "But that's Ok since you have memmove()." ;;
10709                 esac
10710         fi
10711         ;;
10712 esac
10713 $rm -f try.* try core
10714 set d_safebcpy
10715 eval $setvar
10716
10717 : can memcpy handle overlapping blocks?
10718 val="$undef"
10719 case "$d_memcpy" in
10720 "$define")
10721         echo " "
10722         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10723         $cat >try.c <<EOCP
10724 #$i_memory I_MEMORY
10725 #$i_stdlib I_STDLIB
10726 #$i_string I_STRING
10727 #$i_unistd I_UNISTD
10728 EOCP
10729         $cat >>try.c <<'EOCP'
10730 #include <stdio.h>
10731 #ifdef I_MEMORY
10732 #  include <memory.h>
10733 #endif
10734 #ifdef I_STDLIB
10735 #  include <stdlib.h>
10736 #endif
10737 #ifdef I_STRING
10738 #  include <string.h>
10739 #else
10740 #  include <strings.h>
10741 #endif
10742 #ifdef I_UNISTD
10743 #  include <unistd.h>  /* Needed for NetBSD */
10744 #endif
10745 int main()
10746 {
10747 char buf[128], abc[128];
10748 char *b;
10749 int len;
10750 int off;
10751 int align;
10752
10753 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10754    try to store the string in read-only memory. */
10755 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10756
10757 for (align = 7; align >= 0; align--) {
10758         for (len = 36; len; len--) {
10759                 b = buf+align;
10760                 memcpy(b, abc, len);
10761                 for (off = 1; off <= len; off++) {
10762                         memcpy(b+off, b, len);
10763                         memcpy(b, b+off, len);
10764                         if (memcmp(b, abc, len))
10765                                 exit(1);
10766                 }
10767         }
10768 }
10769 exit(0);
10770 }
10771 EOCP
10772         set try
10773         if eval $compile_ok; then
10774                 if ./try 2>/dev/null; then
10775                         echo "Yes, it can."
10776                         val="$define"
10777                 else
10778                         echo "It can't, sorry."
10779                         case "$d_memmove" in
10780                         "$define") echo "But that's Ok since you have memmove()." ;;
10781                         esac
10782                 fi
10783         else
10784                 echo "(I can't compile the test program, so we'll assume not...)"
10785                 case "$d_memmove" in
10786                 "$define") echo "But that's Ok since you have memmove()." ;;
10787                 esac
10788         fi
10789         ;;
10790 esac
10791 $rm -f try.* try core
10792 set d_safemcpy
10793 eval $setvar
10794
10795 : can memcmp be trusted to compare relative magnitude?
10796 val="$undef"
10797 case "$d_memcmp" in
10798 "$define")
10799         echo " "
10800         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10801         $cat >try.c <<EOCP
10802 #$i_memory I_MEMORY
10803 #$i_stdlib I_STDLIB
10804 #$i_string I_STRING
10805 #$i_unistd I_UNISTD
10806 EOCP
10807         $cat >>try.c <<'EOCP'
10808 #include <stdio.h>
10809 #ifdef I_MEMORY
10810 #  include <memory.h>
10811 #endif
10812 #ifdef I_STDLIB
10813 #  include <stdlib.h>
10814 #endif
10815 #ifdef I_STRING
10816 #  include <string.h>
10817 #else
10818 #  include <strings.h>
10819 #endif
10820 #ifdef I_UNISTD
10821 #  include <unistd.h>  /* Needed for NetBSD */
10822 #endif
10823 int main()
10824 {
10825 char a = -1;
10826 char b = 0;
10827 if ((a < b) && memcmp(&a, &b, 1) < 0)
10828         exit(1);
10829 exit(0);
10830 }
10831 EOCP
10832         set try
10833         if eval $compile_ok; then
10834                 if ./try 2>/dev/null; then
10835                         echo "Yes, it can."
10836                         val="$define"
10837                 else
10838                         echo "No, it can't (it uses signed chars)."
10839                 fi
10840         else
10841                 echo "(I can't compile the test program, so we'll assume not...)"
10842         fi
10843         ;;
10844 esac
10845 $rm -f try.* try core
10846 set d_sanemcmp
10847 eval $setvar
10848
10849 : see if select exists
10850 set select d_select
10851 eval $inlibc
10852
10853 : see if semctl exists
10854 set semctl d_semctl
10855 eval $inlibc
10856
10857 : see if semget exists
10858 set semget d_semget
10859 eval $inlibc
10860
10861 : see if semop exists
10862 set semop d_semop
10863 eval $inlibc
10864
10865 : see how much of the 'sem*(2)' library is present.
10866 h_sem=true
10867 echo " "
10868 case "$d_semctl$d_semget$d_semop" in
10869 *"$undef"*) h_sem=false;;
10870 esac
10871 case "$osname" in
10872 freebsd)
10873     case "`ipcs 2>&1`" in
10874     "SVID messages"*"not configured"*)
10875         echo "Your $osname does not have the sem*(2) configured." >&4
10876         h_sem=false
10877         val="$undef"
10878         set semctl d_semctl
10879         eval $setvar
10880         set semget d_semget
10881         eval $setvar
10882         set semop d_semop
10883         eval $setvar
10884         ;;
10885     esac
10886     ;;
10887 esac
10888 : we could also check for sys/ipc.h ...
10889 if $h_sem && $test `./findhdr sys/sem.h`; then
10890         echo "You have the full sem*(2) library." >&4
10891         val="$define"
10892 else
10893         echo "You don't have the full sem*(2) library." >&4
10894         val="$undef"
10895 fi
10896 set d_sem
10897 eval $setvar
10898
10899 : see whether sys/sem.h defines union semun
10900 echo " "
10901 $cat > try.c <<'END'
10902 #include <sys/types.h>
10903 #include <sys/ipc.h>
10904 #include <sys/sem.h>
10905 int main () { union semun semun; semun.buf = 0; }
10906 END
10907 set try
10908 if eval $compile; then
10909     echo "You have union semun in <sys/sem.h>." >&4
10910     val="$define"
10911 else
10912     echo "You do not have union semun in <sys/sem.h>." >&4
10913     val="$undef"
10914 fi
10915 $rm -f try try.c try.h
10916 set d_union_semun
10917 eval $setvar
10918
10919 : see how to do semctl IPC_STAT
10920 case "$d_sem" in
10921 $define)
10922     : see whether semctl IPC_STAT can use union semun
10923     echo " "
10924     $cat > try.h <<END
10925 #ifndef S_IRUSR
10926 #   ifdef S_IREAD
10927 #       define S_IRUSR S_IREAD
10928 #       define S_IWUSR S_IWRITE
10929 #       define S_IXUSR S_IEXEC
10930 #   else
10931 #       define S_IRUSR 0400
10932 #       define S_IWUSR 0200
10933 #       define S_IXUSR 0100
10934 #   endif
10935 #   define S_IRGRP (S_IRUSR>>3)
10936 #   define S_IWGRP (S_IWUSR>>3)
10937 #   define S_IXGRP (S_IXUSR>>3)
10938 #   define S_IROTH (S_IRUSR>>6)
10939 #   define S_IWOTH (S_IWUSR>>6)
10940 #   define S_IXOTH (S_IXUSR>>6)
10941 #endif
10942 #ifndef S_IRWXU
10943 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10944 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10945 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10946 #endif
10947 END
10948
10949     $cat > try.c <<END
10950 #include <sys/types.h>
10951 #include <sys/ipc.h>
10952 #include <sys/sem.h>
10953 #include <sys/stat.h>
10954 #include <stdio.h>
10955 #include <errno.h>
10956 #include "try.h"
10957 #ifndef errno
10958 extern int errno;
10959 #endif
10960 #$d_union_semun HAS_UNION_SEMUN
10961 int main() {
10962     union semun
10963 #ifndef HAS_UNION_SEMUN
10964     {
10965         int val;
10966         struct semid_ds *buf;
10967         unsigned short *array;
10968     }
10969 #endif
10970     arg;
10971     int sem, st;
10972
10973 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10974     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10975     if (sem > -1) {
10976         struct semid_ds argbuf;
10977         arg.buf = &argbuf;
10978 #       ifdef IPC_STAT
10979         st = semctl(sem, 0, IPC_STAT, arg);
10980         if (st == 0)
10981             printf("semun\n");
10982         else
10983 #       endif /* IPC_STAT */
10984             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10985 #       ifdef IPC_RMID
10986         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10987 #       endif /* IPC_RMID */
10988             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10989     } else
10990 #endif /* IPC_PRIVATE && ... */
10991         printf("semget failed: errno = %d\n", errno);
10992   return 0;
10993 }
10994 END
10995     val="$undef"
10996     set try
10997     if eval $compile; then
10998         xxx=`./try`
10999         case "$xxx" in
11000         semun) val="$define" ;;
11001         esac
11002     fi
11003     $rm -f try try.c
11004     set d_semctl_semun
11005     eval $setvar
11006     case "$d_semctl_semun" in
11007     $define)
11008         echo "You can use union semun for semctl IPC_STAT." >&4
11009         also='also'
11010         ;;
11011     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11012         also=''
11013         ;;
11014     esac
11015
11016     : see whether semctl IPC_STAT can use struct semid_ds pointer
11017     $cat > try.c <<'END'
11018 #include <sys/types.h>
11019 #include <sys/ipc.h>
11020 #include <sys/sem.h>
11021 #include <sys/stat.h>
11022 #include "try.h"
11023 #include <stdio.h>
11024 #include <errno.h>
11025 #ifndef errno
11026 extern int errno;
11027 #endif
11028 int main() {
11029     struct semid_ds arg;
11030     int sem, st;
11031
11032 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11033     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11034     if (sem > -1) {
11035 #       ifdef IPC_STAT
11036         st = semctl(sem, 0, IPC_STAT, &arg);
11037         if (st == 0)
11038             printf("semid_ds\n");
11039         else
11040 #       endif /* IPC_STAT */
11041             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11042 #       ifdef IPC_RMID
11043         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11044 #       endif /* IPC_RMID */
11045             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11046     } else
11047 #endif /* IPC_PRIVATE && ... */
11048         printf("semget failed: errno = %d\n", errno);
11049
11050     return 0;
11051 }
11052 END
11053     val="$undef"
11054     set try
11055     if eval $compile; then
11056         xxx=`./try`
11057         case "$xxx" in
11058         semid_ds) val="$define" ;;
11059         esac
11060     fi
11061     $rm -f try try.c
11062     set d_semctl_semid_ds
11063     eval $setvar
11064     case "$d_semctl_semid_ds" in
11065     $define)
11066         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11067         ;;
11068     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11069         ;;
11070     esac
11071     $rm -f try.h
11072     ;;
11073 *)  val="$undef"
11074
11075     # We do not have the full sem*(2) library, so assume we can not
11076     # use either.
11077
11078     set d_semctl_semun
11079     eval $setvar
11080
11081     set d_semctl_semid_ds
11082     eval $setvar
11083     ;;
11084 esac
11085
11086 : see if setegid exists
11087 set setegid d_setegid
11088 eval $inlibc
11089
11090 : see if seteuid exists
11091 set seteuid d_seteuid
11092 eval $inlibc
11093
11094 : see if setgrent exists
11095 set setgrent d_setgrent
11096 eval $inlibc
11097
11098 : see if sethostent exists
11099 set sethostent d_sethent
11100 eval $inlibc
11101
11102 : see if setlinebuf exists
11103 set setlinebuf d_setlinebuf
11104 eval $inlibc
11105
11106 : see if setlocale exists
11107 set setlocale d_setlocale
11108 eval $inlibc
11109
11110 : see if setnetent exists
11111 set setnetent d_setnent
11112 eval $inlibc
11113
11114 : see if setprotoent exists
11115 set setprotoent d_setpent
11116 eval $inlibc
11117
11118 : see if setpgid exists
11119 set setpgid d_setpgid
11120 eval $inlibc
11121
11122 : see if setpgrp2 exists
11123 set setpgrp2 d_setpgrp2
11124 eval $inlibc
11125
11126 : see if setpriority exists
11127 set setpriority d_setprior
11128 eval $inlibc
11129
11130 : see if setproctitle exists
11131 set setproctitle d_setproctitle
11132 eval $inlibc
11133
11134 : see if setpwent exists
11135 set setpwent d_setpwent
11136 eval $inlibc
11137
11138 : see if setregid exists
11139 set setregid d_setregid
11140 eval $inlibc
11141 set setresgid d_setresgid
11142 eval $inlibc
11143
11144 : see if setreuid exists
11145 set setreuid d_setreuid
11146 eval $inlibc
11147 set setresuid d_setresuid
11148 eval $inlibc
11149
11150 : see if setrgid exists
11151 set setrgid d_setrgid
11152 eval $inlibc
11153
11154 : see if setruid exists
11155 set setruid d_setruid
11156 eval $inlibc
11157
11158 : see if setservent exists
11159 set setservent d_setsent
11160 eval $inlibc
11161
11162 : see if setsid exists
11163 set setsid d_setsid
11164 eval $inlibc
11165
11166 : see if setvbuf exists
11167 set setvbuf d_setvbuf
11168 eval $inlibc
11169
11170 : see if sfio.h is available
11171 set sfio.h i_sfio
11172 eval $inhdr
11173
11174
11175 : see if sfio library is available
11176 case "$i_sfio" in
11177 $define)
11178         val=''
11179         set sfreserve val
11180         eval $inlibc
11181         ;;
11182 *)
11183         val="$undef"
11184         ;;
11185 esac
11186 : Ok, but do we want to use it.
11187 case "$val" in
11188 $define)
11189         case "$usesfio" in
11190         true|$define|[yY]*) dflt='y';;
11191         *) dflt='n';;
11192         esac
11193         echo "$package can use the sfio library, but it is experimental."
11194         case "$useperlio" in
11195         "$undef")
11196             echo "For sfio also the PerlIO abstraction layer is needed."
11197             echo "Earlier you said you wouldn't want that."
11198             ;;
11199         esac
11200         rp="You seem to have sfio available, do you want to try using it?"
11201         . ./myread
11202         case "$ans" in
11203         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11204                 useperlio="$define"
11205                 val="$define"
11206                 ;;
11207         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11208                 val="$undef"
11209                 : Remove sfio from list of libraries to use
11210                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11211                 shift
11212                 libs="$*"
11213                 echo "libs = $libs" >&4
11214                 ;;
11215         esac
11216         ;;
11217 *)      case "$usesfio" in
11218         true|$define|[yY]*)
11219                 echo "Sorry, cannot find sfio on this machine." >&4
11220                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11221                 val="$undef"
11222                 ;;
11223         esac
11224         ;;
11225 esac
11226 set d_sfio
11227 eval $setvar
11228 case "$d_sfio" in
11229 $define) usesfio='true';;
11230 *) usesfio='false';;
11231 esac
11232
11233 : see if shmctl exists
11234 set shmctl d_shmctl
11235 eval $inlibc
11236
11237 : see if shmget exists
11238 set shmget d_shmget
11239 eval $inlibc
11240
11241 : see if shmat exists
11242 set shmat d_shmat
11243 eval $inlibc
11244 : see what shmat returns
11245 case "$d_shmat" in
11246 "$define")
11247         $cat >shmat.c <<'END'
11248 #include <sys/shm.h>
11249 void *shmat();
11250 END
11251         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11252                 shmattype='void *'
11253         else
11254                 shmattype='char *'
11255         fi
11256         echo "and it returns ($shmattype)." >&4
11257         : see if a prototype for shmat is available
11258         xxx=`./findhdr sys/shm.h`
11259         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11260         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11261                 val="$define"
11262         else
11263                 val="$undef"
11264         fi
11265         $rm -f shmat.[co]
11266         ;;
11267 *)
11268         val="$undef"
11269         ;;
11270 esac
11271 set d_shmatprototype
11272 eval $setvar
11273
11274 : see if shmdt exists
11275 set shmdt d_shmdt
11276 eval $inlibc
11277
11278 : see how much of the 'shm*(2)' library is present.
11279 h_shm=true
11280 echo " "
11281 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11282 *"$undef"*) h_shm=false;;
11283 esac
11284 case "$osname" in
11285 freebsd)
11286     case "`ipcs 2>&1`" in
11287     "SVID shared memory"*"not configured"*)
11288         echo "Your $osname does not have the shm*(2) configured." >&4
11289         h_shm=false
11290         val="$undef"
11291         set shmctl d_shmctl
11292         evat $setvar
11293         set shmget d_shmget
11294         evat $setvar
11295         set shmat d_shmat
11296         evat $setvar
11297         set shmdt d_shmdt
11298         evat $setvar
11299         ;;
11300     esac
11301     ;;
11302 esac
11303 : we could also check for sys/ipc.h ...
11304 if $h_shm && $test `./findhdr sys/shm.h`; then
11305         echo "You have the full shm*(2) library." >&4
11306         val="$define"
11307 else
11308         echo "You don't have the full shm*(2) library." >&4
11309         val="$undef"
11310 fi
11311 set d_shm
11312 eval $setvar
11313
11314 echo " "
11315 : see if we have sigaction
11316 if set sigaction val -f d_sigaction; eval $csym; $val; then
11317         echo 'sigaction() found.' >&4
11318         $cat > try.c <<'EOP'
11319 #include <stdio.h>
11320 #include <sys/types.h>
11321 #include <signal.h>
11322 int main()
11323 {
11324     struct sigaction act, oact;
11325     act.sa_flags = 0;
11326     oact.sa_handler = 0;
11327     /* so that act and oact are used */
11328     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11329 }
11330 EOP
11331         set try
11332         if eval $compile_ok; then
11333                 val="$define"
11334         else
11335                 echo "But you don't seem to have a useable struct sigaction." >&4
11336                 val="$undef"
11337         fi
11338 else
11339         echo 'sigaction NOT found.' >&4
11340         val="$undef"
11341 fi
11342 set d_sigaction; eval $setvar
11343 $rm -f try try$_o try.c
11344
11345 : see if sigsetjmp exists
11346 echo " "
11347 case "$d_sigsetjmp" in
11348 '')
11349         $cat >try.c <<'EOP'
11350 #include <setjmp.h>
11351 sigjmp_buf env;
11352 int set = 1;
11353 int main()
11354 {
11355         if (sigsetjmp(env,1))
11356                 exit(set);
11357         set = 0;
11358         siglongjmp(env, 1);
11359         exit(1);
11360 }
11361 EOP
11362         set try
11363         if eval $compile; then
11364                 if ./try >/dev/null 2>&1; then
11365                         echo "POSIX sigsetjmp found." >&4
11366                         val="$define"
11367                 else
11368                         $cat >&4 <<EOM
11369 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11370 I'll ignore them.
11371 EOM
11372                         val="$undef"
11373                 fi
11374         else
11375                 echo "sigsetjmp not found." >&4
11376                 val="$undef"
11377         fi
11378         ;;
11379 *) val="$d_sigsetjmp"
11380         case "$d_sigsetjmp" in
11381         $define) echo "POSIX sigsetjmp found." >&4;;
11382         $undef) echo "sigsetjmp not found." >&4;;
11383         esac
11384         ;;
11385 esac
11386 set d_sigsetjmp
11387 eval $setvar
11388 $rm -f try.c try
11389
11390 : see if socks5_init exists
11391 set socks5_init d_socks5_init
11392 eval $inlibc
11393
11394 : see if sys/stat.h is available
11395 set sys/stat.h i_sysstat
11396 eval $inhdr
11397
11398
11399 : see if stat knows about block sizes
11400 echo " "
11401 echo "Checking to see if your struct stat has st_blocks field..." >&4
11402 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11403 eval $hasfield
11404
11405
11406 : see if this is a sys/vfs.h system
11407 set sys/vfs.h i_sysvfs
11408 eval $inhdr
11409
11410
11411 : see if this is a sys/statfs.h system
11412 set sys/statfs.h i_sysstatfs
11413 eval $inhdr
11414
11415
11416 echo " "
11417 echo "Checking to see if your system supports struct statfs..." >&4
11418 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
11419 eval $hasstruct
11420 case "$d_statfs_s" in
11421 "$define")      echo "Yes, it does."   ;;
11422 *)              echo "No, it doesn't." ;;
11423 esac
11424
11425
11426
11427 : see if struct statfs knows about f_flags
11428 case "$d_statfs_s" in
11429 define) 
11430         echo " "
11431         echo "Checking to see if your struct statfs has f_flags field..." >&4
11432         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
11433         eval $hasfield
11434         ;;
11435 *)      val="$undef"
11436         set d_statfs_f_flags
11437         eval $setvar
11438         ;;
11439 esac
11440 case "$d_statfs_f_flags" in
11441 "$define")      echo "Yes, it does."   ;;
11442 *)              echo "No, it doesn't." ;;
11443 esac
11444
11445 : see if _ptr and _cnt from stdio act std
11446 echo " "
11447 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11448         echo "(Looks like you have stdio.h from Linux.)"
11449         case "$stdio_ptr" in
11450         '') stdio_ptr='((fp)->_IO_read_ptr)'
11451                 ptr_lval=$define
11452                 ;;
11453         *)      ptr_lval=$d_stdio_ptr_lval;;
11454         esac
11455         case "$stdio_cnt" in
11456         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11457                 cnt_lval=$undef
11458                 ;;
11459         *)      cnt_lval=$d_stdio_cnt_lval;;
11460         esac
11461         case "$stdio_base" in
11462         '') stdio_base='((fp)->_IO_read_base)';;
11463         esac
11464         case "$stdio_bufsiz" in
11465         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11466         esac
11467 else
11468         case "$stdio_ptr" in
11469         '') stdio_ptr='((fp)->_ptr)'
11470                 ptr_lval=$define
11471                 ;;
11472         *)      ptr_lval=$d_stdio_ptr_lval;;
11473         esac
11474         case "$stdio_cnt" in
11475         '') stdio_cnt='((fp)->_cnt)'
11476                 cnt_lval=$define
11477                 ;;
11478         *)      cnt_lval=$d_stdio_cnt_lval;;
11479         esac
11480         case "$stdio_base" in
11481         '') stdio_base='((fp)->_base)';;
11482         esac
11483         case "$stdio_bufsiz" in
11484         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11485         esac
11486 fi
11487 : test whether _ptr and _cnt really work
11488 echo "Checking how std your stdio is..." >&4
11489 $cat >try.c <<EOP
11490 #include <stdio.h>
11491 #define FILE_ptr(fp)    $stdio_ptr
11492 #define FILE_cnt(fp)    $stdio_cnt
11493 int main() {
11494         FILE *fp = fopen("try.c", "r");
11495         char c = getc(fp);
11496         if (
11497                 18 <= FILE_cnt(fp) &&
11498                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11499         )
11500                 exit(0);
11501         exit(1);
11502 }
11503 EOP
11504 val="$undef"
11505 set try
11506 if eval $compile; then
11507         if ./try; then
11508                 echo "Your stdio acts pretty std."
11509                 val="$define"
11510         else
11511                 echo "Your stdio isn't very std."
11512         fi
11513 else
11514         echo "Your stdio doesn't appear very std."
11515 fi
11516 $rm -f try.c try
11517 set d_stdstdio
11518 eval $setvar
11519
11520 : Can _ptr be used as an lvalue?
11521 case "$d_stdstdio$ptr_lval" in
11522 $define$define) val=$define ;;
11523 *) val=$undef ;;
11524 esac
11525 set d_stdio_ptr_lval
11526 eval $setvar
11527
11528 : Can _cnt be used as an lvalue?
11529 case "$d_stdstdio$cnt_lval" in
11530 $define$define) val=$define ;;
11531 *) val=$undef ;;
11532 esac
11533 set d_stdio_cnt_lval
11534 eval $setvar
11535
11536
11537 : test whether setting _ptr sets _cnt as a side effect
11538 d_stdio_ptr_lval_sets_cnt="$undef"
11539 d_stdio_ptr_lval_nochange_cnt="$undef"
11540 case "$d_stdio_ptr_lval$d_stdstdio" in
11541 $define$define)
11542         echo "Checking to see what happens if we set the stdio ptr..." >&4
11543 $cat >try.c <<EOP
11544 #include <stdio.h>
11545 /* Can we scream? */
11546 /* Eat dust sed :-) */
11547 #define FILE_ptr(fp)    $stdio_ptr
11548 #define FILE_cnt(fp)    $stdio_cnt
11549 int main() {
11550         FILE *fp = fopen("try.c", "r");
11551         char c = getc(fp);
11552         char *ptr;
11553         size_t cnt;
11554         if (!(
11555                 18 <= FILE_cnt(fp) &&
11556                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11557         )) {
11558                 puts("Fail even to read");
11559                 exit (1);
11560         }
11561         ptr = FILE_ptr(fp);
11562         cnt = FILE_cnt(fp);
11563
11564         FILE_ptr(fp)+= 42;
11565
11566         if (FILE_ptr(fp) != (ptr + 42)) {
11567                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11568                 exit (1);
11569         }
11570         if (FILE_cnt(fp) <= 20) {
11571                 printf ("Fail (<20 chars to test)");
11572                 exit (1);
11573         }
11574         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11575                 puts("Fail compare");
11576                 exit (1);
11577         }
11578         if (cnt == FILE_cnt(fp)) {
11579                 puts("Pass_unchanged");
11580                 exit (0);
11581         }       
11582         if (FILE_cnt(fp) == (cnt - 42)) {
11583                 puts("Pass_changed");
11584                 exit (0);
11585         }
11586         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11587         return 1;
11588
11589 }
11590 EOP
11591         set try
11592         if eval $compile; then
11593                 case `./try$exe_ext` in
11594                 Pass_changed)
11595                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11596                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11597                 Pass_unchanged)
11598                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11599                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11600                 Fail*)
11601                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11602                 *)
11603                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11604         esac
11605         else
11606                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11607         fi
11608         $rm -f try.c try
11609         ;;
11610 esac
11611
11612 : see if _base is also standard
11613 val="$undef"
11614 case "$d_stdstdio" in
11615 $define)
11616         $cat >try.c <<EOP
11617 #include <stdio.h>
11618 #define FILE_base(fp)   $stdio_base
11619 #define FILE_bufsiz(fp) $stdio_bufsiz
11620 int main() {
11621         FILE *fp = fopen("try.c", "r");
11622         char c = getc(fp);
11623         if (
11624                 19 <= FILE_bufsiz(fp) &&
11625                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11626         )
11627                 exit(0);
11628         exit(1);
11629 }
11630 EOP
11631         set try
11632         if eval $compile; then
11633                 if ./try; then
11634                         echo "And its _base field acts std."
11635                         val="$define"
11636                 else
11637                         echo "But its _base field isn't std."
11638                 fi
11639         else
11640                 echo "However, it seems to be lacking the _base field."
11641         fi
11642         $rm -f try.c try
11643         ;;
11644 esac
11645 set d_stdiobase
11646 eval $setvar
11647
11648 $cat >&4 <<EOM
11649 Checking how to access stdio streams by file descriptor number...
11650 EOM
11651 case "$stdio_stream_array" in
11652 '')     $cat >try.c <<EOCP
11653 #include <stdio.h>
11654 int main() {
11655   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11656     printf("yes\n");
11657 }
11658 EOCP
11659         for s in _iob __iob __sF
11660         do
11661                 set try -DSTDIO_STREAM_ARRAY=$s
11662                 if eval $compile; then
11663                         case "`./try$exe_ext`" in
11664                         yes)    stdio_stream_array=$s; break ;;
11665                         esac
11666                 fi
11667         done
11668         $rm -f try.* try$exe_ext
11669 esac
11670 case "$stdio_stream_array" in
11671 '')     $cat >&4 <<EOM
11672 I can't figure out how to access stdio streams by file descriptor number.
11673 EOM
11674         d_stdio_stream_array="$undef"
11675         ;;
11676 *)      $cat >&4 <<EOM
11677 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11678 EOM
11679         d_stdio_stream_array="$define"
11680         ;;
11681 esac
11682
11683 : see if strcoll exists
11684 set strcoll d_strcoll
11685 eval $inlibc
11686
11687 : check for structure copying
11688 echo " "
11689 echo "Checking to see if your C compiler can copy structs..." >&4
11690 $cat >try.c <<'EOCP'
11691 int main()
11692 {
11693         struct blurfl {
11694                 int dyick;
11695         } foo, bar;
11696
11697         foo = bar;
11698 }
11699 EOCP
11700 if $cc -c try.c >/dev/null 2>&1 ; then
11701         val="$define"
11702         echo "Yup, it can."
11703 else
11704         val="$undef"
11705         echo "Nope, it can't."
11706 fi
11707 set d_strctcpy
11708 eval $setvar
11709 $rm -f try.*
11710
11711 : see if strerror and/or sys_errlist[] exist
11712 echo " "
11713 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11714     if set strerror val -f d_strerror; eval $csym; $val; then
11715                 echo 'strerror() found.' >&4
11716                 d_strerror="$define"
11717                 d_strerrm='strerror(e)'
11718                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11719                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11720                         d_syserrlst="$define"
11721                 else
11722                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11723                         d_syserrlst="$undef"
11724                 fi
11725     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11726                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11727                 echo 'strerror() found in string header.' >&4
11728                 d_strerror="$define"
11729                 d_strerrm='strerror(e)'
11730                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11731                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11732                                 d_syserrlst="$define"
11733                 else
11734                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11735                         d_syserrlst="$undef"
11736                 fi
11737     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11738                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11739                 d_strerror="$undef"
11740                 d_syserrlst="$define"
11741                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11742     else
11743                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11744                 d_strerror="$undef"
11745                 d_syserrlst="$undef"
11746                 d_strerrm='"unknown"'
11747     fi
11748 fi
11749
11750 : see if strtod exists
11751 set strtod d_strtod
11752 eval $inlibc
11753
11754 : see if strtol exists
11755 set strtol d_strtol
11756 eval $inlibc
11757
11758 : see if strtold exists
11759 set strtold d_strtold
11760 eval $inlibc
11761
11762 : see if strtoll exists
11763 set strtoll d_strtoll
11764 eval $inlibc
11765
11766 case "$d_longlong-$d_strtoll" in
11767 "$define-$define")
11768         $cat <<EOM
11769 Checking whether your strtoll() works okay...
11770 EOM
11771         $cat >try.c <<'EOCP'
11772 #include <errno.h>
11773 #ifdef __hpux
11774 #define strtoll __strtoll
11775 #endif
11776 #ifdef __EMX__
11777 #define strtoll _strtoll
11778 #endif
11779 #include <stdio.h>
11780 extern long long int strtoll(char *s, char **, int); 
11781 static int bad = 0;
11782 int check(char *s, long long ell, int een) {
11783         long long gll;
11784         errno = 0;
11785         gll = strtoll(s, 0, 10);
11786         if (!((gll == ell) && (errno == een)))
11787                 bad++;
11788 }
11789 int main() {
11790         check(" 1",                                      1LL, 0);
11791         check(" 0",                                      0LL, 0);
11792         check("-1",                                     -1LL, 0);
11793         check("-9223372036854775808", -9223372036854775808LL, 0);
11794         check("-9223372036854775808", -9223372036854775808LL, 0);
11795         check(" 9223372036854775807",  9223372036854775807LL, 0);
11796         check("-9223372036854775808", -9223372036854775808LL, 0);
11797         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
11798         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
11799         if (!bad)
11800                 printf("ok\n");
11801 }
11802 EOCP
11803         set try
11804         if eval $compile; then
11805                 yyy=`./try`
11806                 case "$yyy" in
11807                 ok) echo "Your strtoll() seems to be working okay." ;;
11808                 *) cat <<EOM >&4
11809 Your strtoll() doesn't seem to be working okay.
11810 EOM
11811                    d_strtoll="$undef"
11812                    ;;
11813                 esac
11814         else
11815                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11816                 d_strtoll="$undef"
11817         fi
11818         ;;
11819 esac
11820
11821 : see if strtoul exists
11822 set strtoul d_strtoul
11823 eval $inlibc
11824
11825 : see if strtoull exists
11826 set strtoull d_strtoull
11827 eval $inlibc
11828
11829 case "$d_longlong-$d_strtoull" in
11830 "$define-$define")
11831         $cat <<EOM
11832 Checking whether your strtoull() works okay...
11833 EOM
11834         $cat >try.c <<'EOCP'
11835 #include <errno.h>
11836 #ifdef __hpux
11837 #define strtoull __strtoull
11838 #endif
11839 #include <stdio.h>
11840 extern unsigned long long int strtoull(char *s, char **, int); 
11841 static int bad = 0;
11842 int check(char *s, long long eull, int een) {
11843         long long gull;
11844         errno = 0;
11845         gull = strtoull(s, 0, 10);
11846         if (!((gull == eull) && (errno == een)))
11847                 bad++;
11848 }
11849 int main() {
11850         check(" 1",                                       1LL, 0);
11851         check(" 0",                                       0LL, 0);
11852         check("18446744073709551615", 18446744073709551615ULL, 0);
11853         check("18446744073709551616", 18446744073709551615ULL, ERANGE);
11854         if (!bad)
11855                 printf("ok\n");
11856 }
11857 EOCP
11858         set try
11859         if eval $compile; then
11860                 case "`./try`" in
11861                 ok) echo "Your strtoull() seems to be working okay." ;;
11862                 *) cat <<EOM >&4
11863 Your strtoull() doesn't seem to be working okay.
11864 EOM
11865                    d_strtoull="$undef"
11866                    ;;
11867                 esac
11868         fi
11869         ;;
11870 esac
11871
11872 : see if strtouq exists
11873 set strtouq d_strtouq
11874 eval $inlibc
11875
11876 : see if strxfrm exists
11877 set strxfrm d_strxfrm
11878 eval $inlibc
11879
11880 : see if symlink exists
11881 set symlink d_symlink
11882 eval $inlibc
11883
11884 : see if syscall exists
11885 set syscall d_syscall
11886 eval $inlibc
11887
11888 : see if sysconf exists
11889 set sysconf d_sysconf
11890 eval $inlibc
11891
11892 : see if system exists
11893 set system d_system
11894 eval $inlibc
11895
11896 : see if tcgetpgrp exists
11897 set tcgetpgrp d_tcgetpgrp
11898 eval $inlibc
11899
11900 : see if tcsetpgrp exists
11901 set tcsetpgrp d_tcsetpgrp
11902 eval $inlibc
11903
11904 : see if prototype for telldir is available
11905 echo " "
11906 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11907 eval $hasproto
11908
11909 : see if this is a sys/times.h system
11910 set sys/times.h i_systimes
11911 eval $inhdr
11912
11913 : see if times exists
11914 echo " "
11915 if set times val -f d_times; eval $csym; $val; then
11916         echo 'times() found.' >&4
11917         d_times="$define"
11918         inc=''
11919         case "$i_systimes" in
11920         "$define") inc='sys/times.h';;
11921         esac
11922         rp="What is the type returned by times() on this system?"
11923         set clock_t clocktype long stdio.h sys/types.h $inc
11924         eval $typedef_ask
11925 else
11926         echo 'times() NOT found, hope that will do.' >&4
11927         d_times="$undef"
11928         clocktype='int'
11929 fi
11930
11931 : see if truncate exists
11932 set truncate d_truncate
11933 eval $inlibc
11934
11935 : see if tzname[] exists
11936 echo " "
11937 if set tzname val -a d_tzname; eval $csym; $val; then
11938         val="$define"
11939         echo 'tzname[] found.' >&4
11940 else
11941         val="$undef"
11942         echo 'tzname[] NOT found.' >&4
11943 fi
11944 set d_tzname
11945 eval $setvar
11946
11947 : see if umask exists
11948 set umask d_umask
11949 eval $inlibc
11950
11951 : see if ustat exists
11952 set ustat d_ustat
11953 eval $inlibc
11954
11955 : backward compatibility for d_hvfork
11956 if test X$d_hvfork != X; then
11957         d_vfork="$d_hvfork"
11958         d_hvfork=''
11959 fi
11960 : see if there is a vfork
11961 val=''
11962 set vfork val
11963 eval $inlibc
11964
11965 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11966 : perl on Solaris 2.x, and probably elsewhere.
11967 case "$val" in
11968 $define)
11969         echo " "
11970         case "$usevfork" in
11971         false) dflt='n';;
11972         *) dflt='y';;
11973         esac
11974         cat <<'EOM'
11975  
11976 Perl can only use a vfork() that doesn't suffer from strict
11977 restrictions on calling functions or modifying global data in
11978 the child.  For example, glibc-2.1 contains such a vfork()
11979 that is unsuitable.  If your system provides a proper fork()
11980 call, chances are that you do NOT want perl to use vfork().
11981
11982 EOM
11983         rp="Do you still want to use vfork()?"
11984         . ./myread
11985         case "$ans" in
11986         y|Y) ;;
11987         *)
11988                 echo "Ok, we won't use vfork()."
11989                 val="$undef"
11990                 ;;
11991         esac
11992         ;;
11993 esac
11994 set d_vfork
11995 eval $setvar
11996 case "$d_vfork" in
11997 $define) usevfork='true';;
11998 *) usevfork='false';;
11999 esac
12000
12001 : see if this is an sysdir system
12002 set sys/dir.h i_sysdir
12003 eval $inhdr
12004
12005 : see if this is an sysndir system
12006 set sys/ndir.h i_sysndir
12007 eval $inhdr
12008
12009 : see if closedir exists
12010 set closedir d_closedir
12011 eval $inlibc
12012
12013 case "$d_closedir" in
12014 "$define")
12015         echo " "
12016         echo "Checking whether closedir() returns a status..." >&4
12017         cat > closedir.c <<EOM
12018 #$i_dirent I_DIRENT             /**/
12019 #$i_sysdir I_SYS_DIR            /**/
12020 #$i_sysndir I_SYS_NDIR          /**/
12021 #$i_systypes I_SYS_TYPES        /**/
12022
12023 #if defined(I_SYS_TYPES)
12024 #include <sys/types.h>
12025 #endif
12026 #if defined(I_DIRENT)
12027 #include <dirent.h>
12028 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12029 #include <sys/dir.h>
12030 #endif
12031 #else
12032 #ifdef I_SYS_NDIR
12033 #include <sys/ndir.h>
12034 #else
12035 #ifdef I_SYS_DIR
12036 #ifdef hp9000s500
12037 #include <ndir.h>       /* may be wrong in the future */
12038 #else
12039 #include <sys/dir.h>
12040 #endif
12041 #endif
12042 #endif
12043 #endif 
12044 int main() { return closedir(opendir(".")); }
12045 EOM
12046         set closedir
12047         if eval $compile_ok; then
12048                 if ./closedir > /dev/null 2>&1 ; then
12049                         echo "Yes, it does."
12050                         val="$undef"
12051                 else
12052                         echo "No, it doesn't."
12053                         val="$define"
12054                 fi
12055         else
12056                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12057                 val="$define"
12058         fi
12059         ;;
12060 *)
12061         val="$undef";
12062         ;;
12063 esac
12064 set d_void_closedir
12065 eval $setvar
12066 $rm -f closedir*
12067 : check for volatile keyword
12068 echo " "
12069 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
12070 $cat >try.c <<'EOCP'
12071 int main()
12072 {
12073         typedef struct _goo_struct goo_struct;
12074         goo_struct * volatile goo = ((goo_struct *)0);
12075         struct _goo_struct {
12076                 long long_int;
12077                 int reg_int;
12078                 char char_var;
12079         };
12080         typedef unsigned short foo_t;
12081         char *volatile foo;
12082         volatile int bar;
12083         volatile foo_t blech;
12084         foo = foo;
12085 }
12086 EOCP
12087 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
12088         val="$define"
12089         echo "Yup, it does."
12090 else
12091         val="$undef"
12092         echo "Nope, it doesn't."
12093 fi
12094 set d_volatile
12095 eval $setvar
12096 $rm -f try.*
12097
12098 : see if there is a wait4
12099 set wait4 d_wait4
12100 eval $inlibc
12101
12102 : see if waitpid exists
12103 set waitpid d_waitpid
12104 eval $inlibc
12105
12106 : see if wcstombs exists
12107 set wcstombs d_wcstombs
12108 eval $inlibc
12109
12110 : see if wctomb exists
12111 set wctomb d_wctomb
12112 eval $inlibc
12113
12114 : preserve RCS keywords in files with variable substitution, grrr
12115 Date='$Date'
12116 Id='$Id'
12117 Log='$Log'
12118 RCSfile='$RCSfile'
12119 Revision='$Revision'
12120
12121 case "$crosscompile" in
12122 ''|[nN]*) crosscompile="$undef" ;;
12123 esac
12124
12125 case "$osname" in
12126 next|rhapsody|darwin) multiarch="$define" ;;
12127 esac
12128 case "$multiarch" in
12129 ''|[nN]*) multiarch="$undef" ;;
12130 esac
12131
12132 : check for alignment requirements
12133 echo " "
12134 case "$crosscompile$multiarch" in
12135 *$define*)
12136         $cat <<EOM
12137 You seem to be either cross-compiling or doing a multiarchitecture build,
12138 skipping the memory alignment check.
12139
12140 EOM
12141         case "$alignbytes" in
12142         '') alignbytes=8 ;;
12143         esac
12144         ;;
12145 *)
12146         case "$alignbytes" in
12147         '') echo "Checking alignment constraints..." >&4
12148                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12149                         $cat >try.c <<'EOCP'
12150 typedef long double NV;
12151 EOCP
12152                 else
12153                         $cat >try.c <<'EOCP'
12154 typedef double NV;
12155 EOCP
12156                 fi
12157                 $cat >>try.c <<'EOCP'
12158 #include <stdio.h>
12159 struct foobar {
12160         char foo;
12161         NV bar;
12162 } try_algn;
12163 int main()
12164 {
12165     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12166     return(0);
12167 }
12168 EOCP
12169                 set try
12170                 if eval $compile_ok; then
12171                         dflt=`./try`
12172                 else
12173                         dflt='8'
12174                         echo "(I can't seem to compile the test program...)"
12175                 fi
12176                 ;;
12177         *) dflt="$alignbytes"
12178                 ;;
12179         esac
12180         rp="Doubles must be aligned on a how-many-byte boundary?"
12181         . ./myread
12182         alignbytes="$ans"
12183         $rm -f try.c try
12184         ;;
12185 esac
12186
12187
12188 : set the base revision
12189 baserev=5.0
12190
12191 : check for ordering of bytes in a long
12192 echo " "
12193 case "$crosscompile$multiarch" in
12194 *$define*)
12195         $cat <<EOM
12196 You seem to be either cross-compiling or doing a multiarchitecture build,
12197 skipping the byteorder check.
12198
12199 EOM
12200         byteorder='0xffff'
12201         ;;
12202 *)
12203         case "$byteorder" in
12204         '')
12205                 $cat <<'EOM'
12206 In the following, larger digits indicate more significance.  A big-endian
12207 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12208 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12209 machines may have weird orders like 3412.  A Cray will report 87654321,
12210 an Alpha will report 12345678. If the test program works the default is
12211 probably right.
12212 I'm now running the test program...
12213 EOM
12214                 $cat >try.c <<'EOCP'
12215 #include <stdio.h>
12216 int main()
12217 {
12218         int i;
12219         union {
12220                 unsigned long l;
12221                 char c[sizeof(long)];
12222         } u;
12223
12224         if (sizeof(long) > 4)
12225                 u.l = (0x08070605L << 32) | 0x04030201L;
12226         else
12227                 u.l = 0x04030201L;
12228         for (i = 0; i < sizeof(long); i++)
12229                 printf("%c", u.c[i]+'0');
12230         printf("\n");
12231         exit(0);
12232 }
12233 EOCP
12234                 xxx_prompt=y
12235                 set try
12236                 if eval $compile && ./try > /dev/null; then
12237                         dflt=`./try`
12238                         case "$dflt" in
12239                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12240                                 echo "(The test program ran ok.)"
12241                                 echo "byteorder=$dflt"
12242                                 xxx_prompt=n
12243                         ;;
12244                         ????|????????) echo "(The test program ran ok.)" ;;
12245                         *) echo "(The test program didn't run right for some reason.)" ;;
12246                         esac
12247                 else
12248                         dflt='4321'
12249                         cat <<'EOM'
12250 (I can't seem to compile the test program.  Guessing big-endian...)
12251 EOM
12252                 fi
12253                 case "$xxx_prompt" in
12254                 y)
12255                         rp="What is the order of bytes in a long?"
12256                         . ./myread
12257                         byteorder="$ans"
12258                         ;;
12259                 *)      byteorder=$dflt
12260                         ;;
12261                 esac
12262                 ;;
12263         esac
12264         $rm -f try.c try
12265         ;;
12266 esac
12267
12268
12269 : how do we catenate cpp tokens here?
12270 echo " "
12271 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12272 $cat >cpp_stuff.c <<'EOCP'
12273 #define RCAT(a,b)a/**/b
12274 #define ACAT(a,b)a ## b
12275 RCAT(Rei,ser)
12276 ACAT(Cir,cus)
12277 EOCP
12278 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12279 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12280         echo "Oh!  Smells like ANSI's been here." >&4
12281         echo "We can catify or stringify, separately or together!"
12282         cpp_stuff=42
12283 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12284         echo "Ah, yes!  The good old days!" >&4
12285         echo "However, in the good old days we don't know how to stringify and"
12286         echo "catify at the same time."
12287         cpp_stuff=1
12288 else
12289         $cat >&4 <<EOM
12290 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12291 to have to edit the values of CAT[2-5] in config.h...
12292 EOM
12293         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12294 fi
12295 $rm -f cpp_stuff.*
12296
12297 : see if this is a db.h system
12298 set db.h i_db
12299 eval $inhdr
12300
12301 case "$i_db" in
12302 $define)
12303         : Check db version.
12304         echo " "
12305         echo "Checking Berkeley DB version ..." >&4
12306         $cat >try.c <<EOCP
12307 #$d_const HASCONST
12308 #ifndef HASCONST
12309 #define const
12310 #endif
12311 #include <sys/types.h>
12312 #include <stdio.h>
12313 #include <db.h>
12314 int main()
12315 {
12316 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12317     int Major, Minor, Patch ;
12318     unsigned long Version ;
12319     (void)db_version(&Major, &Minor, &Patch) ;
12320     printf("You have Berkeley DB Version 2 or greater\n");
12321
12322     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12323                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12324     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12325                 Major, Minor, Patch) ;
12326
12327     /* check that db.h & libdb are compatible */
12328     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12329         printf("db.h and libdb are incompatible\n") ;
12330         exit(3);        
12331     }
12332
12333     printf("db.h and libdb are compatible\n") ;
12334
12335     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12336                 + DB_VERSION_PATCH ;
12337
12338     /* needs to be >= 2.3.4 */
12339     if (Version < 2003004) {
12340     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12341         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12342         exit(2);        
12343     }
12344
12345     exit(0);
12346 #else
12347 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12348     printf("You have Berkeley DB Version 1\n");
12349     exit(0);    /* DB version < 2: the coast is clear. */
12350 #else
12351     exit(1);    /* <db.h> not Berkeley DB? */
12352 #endif
12353 #endif
12354 }
12355 EOCP
12356         set try
12357         if eval $compile_ok && ./try; then
12358                 echo 'Looks OK.' >&4
12359         else
12360                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12361                 i_db=$undef
12362                 case " $libs " in
12363                 *"-ldb "*)
12364                         : Remove db from list of libraries to use
12365                         echo "Removing unusable -ldb from library list" >&4
12366                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12367                         shift
12368                         libs="$*"
12369                         echo "libs = $libs" >&4
12370                         ;;
12371                 esac
12372         fi
12373         $rm -f try.*
12374         ;;
12375 esac
12376
12377 case "$i_db" in
12378 define)
12379         : Check the return type needed for hash 
12380         echo " "
12381         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12382         $cat >try.c <<EOCP
12383 #$d_const HASCONST
12384 #ifndef HASCONST
12385 #define const
12386 #endif
12387 #include <sys/types.h>
12388 #include <db.h>
12389
12390 #ifndef DB_VERSION_MAJOR
12391 u_int32_t hash_cb (ptr, size)
12392 const void *ptr;
12393 size_t size;
12394 {
12395 }
12396 HASHINFO info;
12397 int main()
12398 {
12399         info.hash = hash_cb;
12400 }
12401 #endif
12402 EOCP
12403         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12404                 if $contains warning try.out >>/dev/null 2>&1 ; then
12405                         db_hashtype='int'
12406                 else
12407                         db_hashtype='u_int32_t'
12408                 fi
12409         else
12410                 : XXX Maybe we should just give up here.
12411                 db_hashtype=u_int32_t
12412                 $cat try.out >&4
12413                 echo "Help:  I can't seem to compile the db test program." >&4
12414                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12415         fi
12416         $rm -f try.*
12417         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12418         ;;
12419 *)      db_hashtype=u_int32_t
12420         ;;
12421 esac
12422 case "$i_db" in
12423 define)
12424         : Check the return type needed for prefix 
12425         echo " "
12426         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12427         cat >try.c <<EOCP
12428 #$d_const HASCONST
12429 #ifndef HASCONST
12430 #define const
12431 #endif
12432 #include <sys/types.h>
12433 #include <db.h>
12434
12435 #ifndef DB_VERSION_MAJOR
12436 size_t prefix_cb (key1, key2)
12437 const DBT *key1;
12438 const DBT *key2;
12439 {
12440 }
12441 BTREEINFO info;
12442 int main()
12443 {
12444         info.prefix = prefix_cb;
12445 }
12446 #endif
12447 EOCP
12448         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12449                 if $contains warning try.out >>/dev/null 2>&1 ; then
12450                         db_prefixtype='int'
12451                 else
12452                         db_prefixtype='size_t'
12453                 fi
12454         else
12455                 db_prefixtype='size_t'
12456                 : XXX Maybe we should just give up here.
12457                 $cat try.out >&4
12458                 echo "Help:  I can't seem to compile the db test program." >&4
12459                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12460         fi
12461         $rm -f try.*
12462         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12463         ;;
12464 *)      db_prefixtype='size_t'
12465         ;;
12466 esac
12467
12468 : check for void type
12469 echo " "
12470 echo "Checking to see how well your C compiler groks the void type..." >&4
12471 case "$voidflags" in
12472 '')
12473         $cat >try.c <<'EOCP'
12474 #if TRY & 1
12475 void sub() {
12476 #else
12477 sub() {
12478 #endif
12479         extern void moo();      /* function returning void */
12480         void (*goo)();          /* ptr to func returning void */
12481 #if TRY & 8
12482         void *hue;              /* generic ptr */
12483 #endif
12484 #if TRY & 2
12485         void (*foo[10])();
12486 #endif
12487
12488 #if TRY & 4
12489         if(goo == moo) {
12490                 exit(0);
12491         }
12492 #endif
12493         exit(0);
12494 }
12495 int main() { sub(); }
12496 EOCP
12497         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12498                 voidflags=$defvoidused
12499         echo "Good.  It appears to support void to the level $package wants.">&4
12500                 if $contains warning .out >/dev/null 2>&1; then
12501                         echo "However, you might get some warnings that look like this:"
12502                         $cat .out
12503                 fi
12504         else
12505 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12506                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12507                         echo "It supports 1..."
12508                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12509                                 echo "It also supports 2..."
12510                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12511                                         voidflags=7
12512                                         echo "And it supports 4 but not 8 definitely."
12513                                 else
12514                                         echo "It doesn't support 4..."
12515                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12516                                                 voidflags=11
12517                                                 echo "But it supports 8."
12518                                         else
12519                                                 voidflags=3
12520                                                 echo "Neither does it support 8."
12521                                         fi
12522                                 fi
12523                         else
12524                                 echo "It does not support 2..."
12525                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12526                                         voidflags=13
12527                                         echo "But it supports 4 and 8."
12528                                 else
12529                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12530                                                 voidflags=5
12531                                                 echo "And it supports 4 but has not heard about 8."
12532                                         else
12533                                                 echo "However it supports 8 but not 4."
12534                                         fi
12535                                 fi
12536                         fi
12537                 else
12538                         echo "There is no support at all for void."
12539                         voidflags=0
12540                 fi
12541         fi
12542 esac
12543 case "$voidflags" in
12544 "$defvoidused") ;;
12545 *)      $cat >&4 <<'EOM'
12546   Support flag bits are:
12547     1: basic void declarations.
12548     2: arrays of pointers to functions returning void.
12549     4: operations between pointers to and addresses of void functions.
12550     8: generic void pointers.
12551 EOM
12552         dflt="$voidflags";
12553         rp="Your void support flags add up to what?"
12554         . ./myread
12555         voidflags="$ans"
12556         ;;
12557 esac
12558 $rm -f try.* .out
12559
12560
12561 : How can we generate normalized random numbers ?
12562 echo " "
12563 echo "Looking for a random number function..." >&4
12564 case "$randfunc" in
12565 '')
12566         if set drand48 val -f; eval $csym; $val; then
12567                 dflt="drand48"
12568                 echo "Good, found drand48()." >&4
12569         elif set random val -f; eval $csym; $val; then
12570                 dflt="random"
12571                 echo "OK, found random()." >&4
12572         else
12573                 dflt="rand"
12574                 echo "Yick, looks like I have to use rand()." >&4
12575         fi
12576         echo " "
12577         ;;
12578 *)
12579         dflt="$randfunc"
12580         ;;
12581 esac
12582 cont=true
12583
12584 case "$ccflags" in
12585 *-Dmy_rand=*|*-Dmy_srand=*)
12586         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12587         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12588         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12589         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12590         ;;
12591 esac
12592
12593 while $test "$cont"; do
12594         rp="Use which function to generate random numbers?"
12595         . ./myread
12596         if $test "$ans" = "$dflt"; then
12597                 : null
12598         else
12599                 randbits=''
12600         fi
12601         randfunc="$ans"
12602         if set $ans val -f; eval $csym; $val; then
12603                 cont=''
12604         else
12605                 dflt=y
12606                 rp="I cannot find function $ans. Use that name anyway?"
12607                 . ./myread
12608                 dflt=rand
12609                 case "$ans" in
12610                         [yY]*) cont='';;
12611                 esac
12612         fi
12613         case "$cont" in
12614         '')
12615                 case "$randfunc" in
12616                 drand48)
12617                         drand01="drand48()"
12618                         seedfunc="srand48"
12619                         randbits=48
12620                         randseedtype=long
12621                         ;;
12622                 rand|random)
12623                         case "$randbits" in
12624                         '')
12625 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12626                                 $cat >try.c <<EOCP
12627 #$i_unistd I_UNISTD
12628 #$i_stdlib I_STDLIB
12629 #include <stdio.h>
12630 #ifdef I_UNISTD
12631 #  include <unistd.h>
12632 #endif
12633 #ifdef I_STDLIB
12634 #  include <stdlib.h>
12635 #endif
12636 int main()
12637 {
12638         register int i;
12639         register unsigned long tmp;
12640         register unsigned long max = 0L;
12641
12642         for (i = 1000; i; i--) {
12643                 tmp = (unsigned long) $randfunc();
12644                 if (tmp > max) max = tmp;
12645         }
12646         for (i = 0; max; i++)
12647                 max /= 2;
12648         printf("%d\n",i);
12649 }
12650 EOCP
12651                                 set try
12652                                 if eval $compile_ok; then
12653                                         dflt=`try`
12654                                 else
12655                                         dflt='?'
12656                                         echo "(I can't seem to compile the test program...)"
12657                                 fi
12658                                 ;;
12659                         *)
12660                                 dflt="$randbits"
12661                                 ;;
12662                         esac
12663                         rp="How many bits does your $randfunc() function produce?"
12664                         . ./myread
12665                         randbits="$ans"
12666                         $rm -f try.c try
12667                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12668                         seedfunc="s$randfunc"
12669                         randseedtype=unsigned
12670                         ;;
12671                 *)
12672                         dflt="31"
12673                         rp="How many bits does your $randfunc() function produce?"
12674                         . ./myread
12675                         randbits="$ans"
12676                         seedfunc="s$randfunc"
12677                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12678                         if set $seedfunc val -f; eval $csym; $val; then
12679                                 echo "(Using $seedfunc() to seed random generator)"
12680                         else
12681                                 echo "(Warning: no $seedfunc() to seed random generator)"
12682                                 seedfunc=rand
12683                         fi
12684                         randseedtype=unsigned
12685                         ;;
12686                 esac
12687                 ;;
12688         esac
12689 done
12690
12691 echo " "
12692 echo "Determining whether or not we are on an EBCDIC system..." >&4
12693 $cat >tebcdic.c <<'EOM'
12694 int main()
12695 {
12696   if ('M'==0xd4) return 0;
12697   return 1;
12698 }
12699 EOM
12700
12701 val=$undef
12702 set tebcdic
12703 if eval $compile_ok; then
12704         if ./tebcdic; then
12705                 echo "You seem to speak EBCDIC." >&4
12706                 val="$define"
12707         else
12708                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
12709         fi
12710 else
12711         echo "I'm unable to compile the test program." >&4
12712         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
12713 fi
12714 $rm -f tebcdic.c tebcdic
12715 set ebcdic
12716 eval $setvar
12717
12718 echo " "
12719 $cat >&4 <<EOM
12720 Checking how to flush all pending stdio output...
12721 EOM
12722 # I only know how to find the first 32 possibly open files on SunOS.
12723 # See also hints/sunos_4_1.sh and util.c  --AD
12724 case "$osname" in
12725 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12726 esac
12727 $cat >>try.c <<EOCP
12728 #include <stdio.h>
12729 #$i_unistd I_UNISTD
12730 #ifdef I_UNISTD
12731 # include <unistd.h>
12732 #endif
12733 #$d_sysconf HAS_SYSCONF
12734 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12735 #ifdef HAS_STDIO_STREAM_ARRAY
12736 # define STDIO_STREAM_ARRAY $stdio_stream_array
12737 #endif
12738 int main() {
12739   FILE* p = fopen("try.out", "w");
12740 #ifdef TRY_FPUTC
12741   fputc('x', p);
12742 #else
12743 # ifdef TRY_FPRINTF
12744   fprintf(p, "x");
12745 # endif
12746 #endif
12747 #ifdef TRY_FFLUSH_NULL
12748   fflush(NULL);
12749 #endif
12750 #ifdef TRY_FFLUSH_ALL
12751   {
12752     long open_max = -1;
12753 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12754     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12755 # else
12756 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12757     open_max = sysconf(_SC_OPEN_MAX);
12758 #  else
12759 #   ifdef FOPEN_MAX
12760     open_max = FOPEN_MAX;
12761 #   else
12762 #    ifdef OPEN_MAX
12763     open_max = OPEN_MAX;
12764 #    else
12765 #     ifdef _NFILE
12766     open_max = _NFILE;
12767 #     endif
12768 #    endif
12769 #   endif
12770 #  endif
12771 # endif 
12772 # ifdef HAS_STDIO_STREAM_ARRAY
12773     if (open_max > 0) {
12774       long i;
12775       for (i = 0; i < open_max; i++)
12776             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12777                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12778                 STDIO_STREAM_ARRAY[i]._flag)
12779                 fflush(&STDIO_STREAM_ARRAY[i]);
12780     }   
12781   }
12782 # endif
12783 #endif
12784   _exit(42);
12785 }
12786 EOCP
12787 : first we have to find out how _not_ to flush
12788 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12789     output=''
12790     set try -DTRY_FPUTC
12791     if eval $compile; then
12792             $rm -f try.out
12793             ./try$exe_ext 2>/dev/null
12794             if $test ! -s try.out -a "X$?" = X42; then
12795                 output=-DTRY_FPUTC
12796             fi
12797     fi
12798     case "$output" in
12799     '')
12800             set try -DTRY_FPRINTF
12801             $rm -f try.out
12802             if eval $compile; then
12803                     $rm -f try.out
12804                     ./try$exe_ext 2>/dev/null
12805                     if $test ! -s try.out -a "X$?" = X42; then
12806                         output=-DTRY_FPRINTF
12807                     fi
12808             fi
12809         ;;
12810     esac
12811 fi
12812 : check for fflush NULL behaviour
12813 case "$fflushNULL" in
12814 '')     set try -DTRY_FFLUSH_NULL $output
12815         if eval $compile; then
12816                 $rm -f try.out
12817                 ./try$exe_ext 2>/dev/null
12818                 code="$?"
12819                 if $test -s try.out -a "X$code" = X42; then
12820                         fflushNULL="`$cat try.out`"
12821                 else
12822                         if $test "X$code" != X42; then
12823                                 $cat >&4 <<EOM
12824 (If this test failed, don't worry, we'll try another method shortly.)
12825 EOM
12826                         fi
12827                 fi
12828         fi
12829         $rm -f core try.core core.try.*
12830         case "$fflushNULL" in
12831         x)      $cat >&4 <<EOM
12832 Your fflush(NULL) works okay for output streams.
12833 Let's see if it clobbers input pipes...
12834 EOM
12835 # As of mid-March 2000 all versions of Solaris appear to have a stdio
12836 # bug that improperly flushes the input end of pipes.  So we avoid the
12837 # autoflush on fork/system/exec support for now. :-(
12838 $cat >tryp.c <<EOCP
12839 #include <stdio.h>
12840 int
12841 main(int argc, char **argv)
12842 {
12843     char buf[1024];
12844     int i;
12845     char *bp = buf;
12846     while (1) {
12847         while ((i = getc(stdin)) != -1
12848                && (*bp++ = i) != '\n'
12849                && bp < &buf[1024])
12850         /* DO NOTHING */ ;
12851         *bp = '\0';
12852         fprintf(stdout, "%s", buf);
12853         fflush(NULL);
12854         if (i == -1)
12855             return 0;
12856         bp = buf;
12857     }
12858 }
12859 EOCP
12860                 fflushNULL="$define"
12861                 set tryp
12862                 if eval $compile; then
12863                     $rm -f tryp.out
12864                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12865                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
12866                        $cat >&4 <<EOM
12867 fflush(NULL) seems to behave okay with input streams.
12868 EOM
12869                         fflushNULL="$define"
12870                     else
12871                         $cat >&4 <<EOM
12872 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
12873 EOM
12874                         fflushNULL="$undef"
12875                     fi
12876                 fi
12877                 $rm -f core tryp.c tryp.core core.tryp.*
12878                 ;;
12879         '')     $cat >&4 <<EOM
12880 Your fflush(NULL) isn't working (contrary to ANSI C).
12881 EOM
12882                 fflushNULL="$undef"
12883                 ;;
12884         *)      $cat >&4 <<EOM
12885 Cannot figure out whether your fflush(NULL) works or not.
12886 I'm assuming it doesn't (contrary to ANSI C).
12887 EOM
12888                 fflushNULL="$undef"
12889                 ;;
12890         esac
12891         ;;
12892 $define|true|[yY]*)
12893         fflushNULL="$define"
12894         ;;
12895 *)
12896         fflushNULL="$undef"
12897         ;;
12898 esac
12899 : check explicit looping only if NULL did not work, and if the pipe
12900 : bug does not show up on an explicit flush too
12901 case "$fflushNULL" in
12902 "$undef")
12903         $cat >tryp.c <<EOCP
12904 #include <stdio.h>
12905 int
12906 main(int argc, char **argv)
12907 {
12908     char buf[1024];
12909     int i;
12910     char *bp = buf;
12911     while (1) {
12912         while ((i = getc(stdin)) != -1
12913                && (*bp++ = i) != '\n'
12914                && bp < &buf[1024])
12915         /* DO NOTHING */ ;
12916         *bp = '\0';
12917         fprintf(stdout, "%s", buf);
12918         fflush(stdin);
12919         if (i == -1)
12920             return 0;
12921         bp = buf;
12922     }
12923 }
12924 EOCP
12925         set tryp
12926         if eval $compile; then
12927             $rm -f tryp.out
12928             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
12929             if cmp tryp.c tryp.out >/dev/null 2>&1; then
12930                $cat >&4 <<EOM
12931 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
12932 EOM
12933                 : now check for fflushall behaviour
12934                 case "$fflushall" in
12935                 '')     set try -DTRY_FFLUSH_ALL $output
12936                         if eval $compile; then
12937                                 $cat >&4 <<EOM
12938 (Now testing the other method--but note that this also may fail.)
12939 EOM
12940                                 $rm -f try.out
12941                                 ./try$exe_ext 2>/dev/null
12942                                 if $test -s try.out -a "X$?" = X42; then
12943                                         fflushall="`$cat try.out`"
12944                                 fi
12945                         fi
12946                         $rm -f core try.core core.try.*
12947                         case "$fflushall" in
12948                         x)      $cat >&4 <<EOM
12949 Whew. Flushing explicitly all the stdio streams works.
12950 EOM
12951                                 fflushall="$define"
12952                                 ;;
12953                         '')     $cat >&4 <<EOM
12954 Sigh. Flushing explicitly all the stdio streams doesn't work.
12955 EOM
12956                                 fflushall="$undef"
12957                                 ;;
12958                         *)      $cat >&4 <<EOM
12959 Cannot figure out whether flushing stdio streams explicitly works or not.
12960 I'm assuming it doesn't.
12961 EOM
12962                                 fflushall="$undef"
12963                                 ;;
12964                         esac
12965                         ;;
12966                 "$define"|true|[yY]*)
12967                         fflushall="$define"
12968                         ;;
12969                 *)
12970                         fflushall="$undef"
12971                         ;;
12972                 esac
12973             else
12974                 $cat >&4 <<EOM
12975 All is futile.  Even fflush(stdin) clobbers input pipes!
12976 EOM
12977                 fflushall="$undef"
12978             fi
12979         else
12980             fflushall="$undef"
12981         fi
12982         $rm -f core tryp.c tryp.core core.tryp.*
12983         ;;
12984 *)      fflushall="$undef"
12985         ;;
12986 esac
12987
12988 case "$fflushNULL$fflushall" in
12989 undefundef)
12990         $cat <<EOM
12991 OK, I give up.  I cannot figure out how to flush pending stdio output.
12992 We won't be flushing handles at all before fork/exec/popen.
12993 EOM
12994         ;;
12995 esac
12996 $rm -f try.* try$exe_ext
12997
12998 : Store the full pathname to the ar program for use in the C program
12999 : Respect a hint or command line value for full_ar.
13000 case "$full_ar" in
13001 '') full_ar=$ar ;;
13002 esac
13003
13004 : Store the full pathname to the sed program for use in the C program
13005 full_sed=$sed
13006
13007 : see what type gids are declared as in the kernel
13008 echo " "
13009 echo "Looking for the type for group ids returned by getgid()."
13010 set gid_t gidtype xxx stdio.h sys/types.h
13011 eval $typedef
13012 case "$gidtype" in
13013 xxx)
13014         xxx=`./findhdr sys/user.h`
13015         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13016         case $1 in
13017         unsigned) dflt="$1 $2" ;;
13018         *) dflt="$1" ;;
13019         esac
13020         ;;
13021 *) dflt="$gidtype";;
13022 esac
13023 case "$gidtype" in
13024 gid_t) echo "gid_t found." ;;
13025 *)      rp="What is the type for group ids returned by getgid()?"
13026         . ./myread
13027         gidtype="$ans"
13028         ;;
13029 esac
13030
13031 echo " "
13032 case "$gidtype" in
13033 *_t) zzz="$gidtype"     ;;
13034 *)   zzz="gid"          ;;
13035 esac
13036 echo "Checking the size of $zzz..." >&4 
13037 cat > try.c <<EOCP
13038 #include <sys/types.h>
13039 #include <stdio.h>
13040 int main() {
13041     printf("%d\n", (int)sizeof($gidtype));
13042     exit(0);
13043 }
13044 EOCP
13045 set try
13046 if eval $compile_ok; then
13047         yyy=`./try`
13048         case "$yyy" in
13049         '')     gidsize=4
13050                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13051                 ;;
13052         *)      gidsize=$yyy
13053                 echo "Your $zzz is $gidsize bytes long."
13054                 ;;
13055         esac
13056 else
13057         gidsize=4
13058         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13059 fi
13060
13061
13062 echo " "
13063 case "$gidtype" in
13064 *_t) zzz="$gidtype"     ;;
13065 *)   zzz="gid"          ;;
13066 esac
13067 echo "Checking the sign of $zzz..." >&4 
13068 cat > try.c <<EOCP
13069 #include <sys/types.h>
13070 #include <stdio.h>
13071 int main() {
13072         $gidtype foo = -1;
13073         if (foo < 0)
13074                 printf("-1\n");
13075         else
13076                 printf("1\n");
13077 }
13078 EOCP
13079 set try
13080 if eval $compile; then
13081         yyy=`./try`
13082         case "$yyy" in
13083         '')     gidsign=1
13084                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13085                 ;;
13086         *)      gidsign=$yyy
13087                 case "$gidsign" in
13088                  1) echo "Your $zzz is unsigned." ;;
13089                 -1) echo "Your $zzz is signed."   ;;
13090                 esac
13091                 ;;
13092         esac
13093 else
13094         gidsign=1
13095         echo "(I can't compile the test program--guessing unsigned.)" >&4
13096 fi
13097
13098
13099 echo " "
13100
13101 if $test X"$quadtype" != X; then
13102
13103 echo "Checking how to print 64-bit integers..." >&4
13104
13105 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13106         $cat >try.c <<'EOCP'
13107 #include <sys/types.h>
13108 #include <stdio.h>
13109 int main() {
13110   int q = 12345678901;
13111   printf("%ld\n", q);
13112 }
13113 EOCP
13114         set try
13115         if eval $compile; then
13116                 yyy=`./try$exe_ext`
13117                 case "$yyy" in
13118                 12345678901)
13119                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13120                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13121                         echo "We will use %d."
13122                         ;;
13123                 esac
13124         fi
13125 fi
13126
13127 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13128         $cat >try.c <<'EOCP'
13129 #include <sys/types.h>
13130 #include <stdio.h>
13131 int main() {
13132   long q = 12345678901;
13133   printf("%ld\n", q);
13134 }
13135 EOCP
13136         set try
13137         if eval $compile; then
13138                 yyy=`./try$exe_ext`
13139                 case "$yyy" in
13140                 12345678901)
13141                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13142                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13143                         echo "We will use %ld."
13144                         ;;
13145                 esac
13146         fi
13147 fi
13148
13149 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13150         $cat >try.c <<'EOCP'
13151 #include <sys/types.h>
13152 #include <inttypes.h>
13153 #include <stdio.h>
13154 int main() {
13155   int64_t q = 12345678901;
13156   printf("%" PRId64 "\n", q);
13157 }
13158 EOCP
13159         set try
13160         if eval $compile; then
13161                 yyy=`./try$exe_ext`
13162                 case "$yyy" in
13163                 12345678901)
13164                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13165                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13166                         echo "We will use the C9X style."
13167                         ;;
13168                 esac
13169         fi
13170 fi
13171
13172 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13173         $cat >try.c <<'EOCP'
13174 #include <sys/types.h>
13175 #include <stdio.h>
13176 int main() {
13177   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13178   printf("%lld\n", q);
13179 }
13180 EOCP
13181         set try
13182         if eval $compile; then
13183                 yyy=`./try$exe_ext`
13184                 case "$yyy" in
13185                 12345678901)
13186                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13187                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13188                         echo "We will use the %lld style."
13189                         ;;
13190                 esac
13191         fi
13192 fi
13193
13194 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13195         $cat >try.c <<EOCP
13196 #include <sys/types.h>
13197 #include <stdio.h>
13198 int main() {
13199   $quadtype q = 12345678901;
13200   printf("%Ld\n", q);
13201 }
13202 EOCP
13203         set try
13204         if eval $compile; then
13205                 yyy=`./try$exe_ext`
13206                 case "$yyy" in
13207                 12345678901)
13208                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13209                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13210                         echo "We will use %Ld."
13211                         ;;
13212                 esac
13213         fi
13214 fi
13215
13216 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13217         $cat >try.c <<EOCP
13218 #include <sys/types.h>
13219 #include <stdio.h>
13220 int main() {
13221   $quadtype q = 12345678901;
13222   printf("%qd\n", q);
13223 }
13224 EOCP
13225         set try
13226         if eval $compile; then
13227                 yyy=`./try$exe_ext`
13228                 case "$yyy" in
13229                 12345678901)
13230                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13231                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13232                         echo "We will use %qd."
13233                         ;;
13234                 esac
13235         fi
13236 fi
13237
13238 if $test X"$sPRId64" = X; then
13239         echo "Cannot figure out how to print 64-bit integers." >&4
13240 fi
13241
13242 $rm -f try try.*
13243
13244 fi
13245
13246 case "$sPRId64" in
13247 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13248         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13249         ;;
13250 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13251         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13252         ;;
13253 esac
13254
13255
13256 echo " "
13257 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13258
13259 if $test X"$ivsize" = X8; then
13260         ivdformat="$sPRId64"
13261         uvuformat="$sPRIu64"
13262         uvoformat="$sPRIo64"
13263         uvxformat="$sPRIx64"
13264         uvXUformat="$sPRIXU64"
13265 else
13266         if $test X"$ivsize" = X"$longsize"; then
13267                 ivdformat='"ld"'
13268                 uvuformat='"lu"'
13269                 uvoformat='"lo"'
13270                 uvxformat='"lx"'
13271                 uvXUformat='"lX"'
13272         else
13273                 if $test X"$ivsize" = X"$intsize"; then
13274                         ivdformat='"d"'
13275                         uvuformat='"u"'
13276                         uvoformat='"o"'
13277                         uvxformat='"x"'
13278                         uvXUformat='"X"'
13279                 else
13280                         : far out
13281                         if $test X"$ivsize" = X"$shortsize"; then
13282                                 ivdformat='"hd"'
13283                                 uvuformat='"hu"'
13284                                 uvoformat='"ho"'
13285                                 uvxformat='"hx"'
13286                                 uvXUformat='"hX"'
13287                         fi
13288                 fi
13289         fi
13290 fi
13291
13292 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13293         nveformat="$sPRIeldbl"
13294         nvfformat="$sPRIfldbl"
13295         nvgformat="$sPRIgldbl"
13296         nvEUformat="$sPRIEUldbl"
13297         nvFUformat="$sPRIFUldbl"
13298         nvGUformat="$sPRIGUldbl"
13299 else
13300         nveformat='"e"'
13301         nvfformat='"f"'
13302         nvgformat='"g"'
13303         nvEUformat='"E"'
13304         nvFUformat='"F"'
13305         nvGUformat='"G"'
13306 fi
13307
13308 case "$ivdformat" in
13309 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13310     exit 1
13311     ;;
13312 esac
13313
13314
13315 echo " "
13316 $echo "Checking the format string to be used for gids..." >&4
13317
13318 case "$gidsign" in
13319 -1)     if $test X"$gidsize" = X"$ivsize"; then
13320                 gidformat="$ivdformat"
13321         else
13322                 if $test X"$gidsize" = X"$longsize"; then
13323                         gidformat='"ld"'
13324                 else
13325                         if $test X"$gidsize" = X"$intsize"; then
13326                                 gidformat='"d"'
13327                         else
13328                                 if $test X"$gidsize" = X"$shortsize"; then
13329                                         gidformat='"hd"'
13330                                 fi
13331                         fi
13332                 fi
13333         fi
13334         ;;
13335 *)      if $test X"$gidsize" = X"$uvsize"; then
13336                 gidformat="$uvuformat"
13337         else
13338                 if $test X"$gidsize" = X"$longsize"; then
13339                         gidformat='"lu"'
13340                 else
13341                         if $test X"$gidsize" = X"$intsize"; then
13342                                 gidformat='"u"'
13343                         else
13344                                 if $test X"$gidsize" = X"$shortsize"; then
13345                                         gidformat='"hu"'
13346                                 fi
13347                         fi
13348                 fi
13349         fi
13350         ;;
13351 esac
13352
13353 : see if getgroups exists
13354 set getgroups d_getgrps
13355 eval $inlibc
13356
13357 : see if setgroups exists
13358 set setgroups d_setgrps
13359 eval $inlibc
13360
13361
13362 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13363 echo " "
13364 case "$d_getgrps$d_setgrps" in
13365 *define*)
13366         case "$groupstype" in
13367         '') dflt="$gidtype" ;;
13368         *)  dflt="$groupstype" ;;
13369         esac
13370         $cat <<EOM
13371 What type of pointer is the second argument to getgroups() and setgroups()?
13372 Usually this is the same as group ids, $gidtype, but not always.
13373
13374 EOM
13375         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13376         . ./myread
13377         groupstype="$ans"
13378         ;;
13379 *)  groupstype="$gidtype";;
13380 esac
13381
13382 echo " "
13383 echo "Checking if your $make program sets \$(MAKE)..." >&4
13384 case "$make_set_make" in
13385 '')
13386         $sed 's/^X //' > testmake.mak << 'EOF'
13387 Xall:
13388 X       @echo 'maketemp="$(MAKE)"'
13389 EOF
13390         case "`$make -f testmake.mak 2>/dev/null`" in
13391         *maketemp=*) make_set_make='#' ;;
13392         *)      make_set_make="MAKE=$make" ;;
13393         esac
13394         $rm -f testmake.mak
13395         ;;
13396 esac
13397 case "$make_set_make" in
13398 '#') echo "Yup, it does.";;
13399 *) echo "Nope, it doesn't.";;
13400 esac
13401
13402 : see what type is used for mode_t
13403 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13404 set mode_t modetype int stdio.h sys/types.h
13405 eval $typedef_ask
13406
13407 : define a fucntion to check prototypes
13408 $cat > protochk <<EOSH
13409 $startsh
13410 cc="$cc"
13411 optimize="$optimize"
13412 ccflags="$ccflags"
13413 prototype="$prototype"
13414 define="$define"
13415 rm=$rm
13416 EOSH
13417
13418 $cat >> protochk <<'EOSH'
13419
13420 $rm -f try.c
13421 foo="$1"
13422 shift
13423 while test $# -ge 2; do
13424         case "$1" in
13425                 $define) echo "#include <$2>" >> try.c ;;
13426                 literal) echo "$2" >> try.c ;;
13427         esac
13428     shift 2
13429 done
13430 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13431 cat >> try.c <<'EOCP'
13432 #ifdef CAN_PROTOTYPE
13433 #define _(args) args
13434 #else
13435 #define _(args) ()
13436 #endif
13437 EOCP
13438 echo "$foo" >> try.c
13439 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13440 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13441 status=$?
13442 $rm -f try.[co]
13443 exit $status
13444 EOSH
13445 chmod +x protochk
13446 $eunicefix protochk
13447
13448 : see what type is used for size_t
13449 rp="What is the type used for the length parameter for string functions?"
13450 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13451 eval $typedef_ask
13452
13453 : check for type of arguments to gethostbyaddr. 
13454 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13455         case "$d_gethbyaddr" in
13456         $define)
13457                 $cat <<EOM
13458
13459 Checking to see what type of arguments are accepted by gethostbyaddr().
13460 EOM
13461                 hdrs="$define sys/types.h
13462                         $d_socket sys/socket.h 
13463                         $i_niin netinet/in.h 
13464                         $i_netdb netdb.h
13465                         $i_unistd unistd.h"
13466                 : The first arg can 'char *' or 'void *'
13467                 : The second arg is some of integral type
13468                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13469                         for yyy in size_t long int; do
13470                                 case "$netdb_host_type" in
13471                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13472                                         if ./protochk "$try" $hdrs; then
13473                                                 echo "Your system accepts $xxx for the first arg."
13474                                                 echo "...and $yyy for the second arg."
13475                                                 netdb_host_type="$xxx"
13476                                                 netdb_hlen_type="$yyy"
13477                                         fi
13478                                         ;;
13479                                 esac
13480                         done
13481                 done
13482                 : In case none of those worked, prompt the user.
13483                 case "$netdb_host_type" in
13484                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13485                         dflt='char *'
13486                         . ./myread
13487                         netdb_host_type=$ans
13488                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13489                         dflt="$sizetype"
13490                         . ./myread
13491                         netdb_hlen_type=$ans
13492                         ;;
13493                 esac
13494                 ;;
13495         *)      : no gethostbyaddr, so pick harmless defaults
13496                 netdb_host_type='char *'
13497                 netdb_hlen_type="$sizetype"
13498                 ;;
13499         esac
13500         # Remove the "const" if needed. -- but then we'll have a 
13501         # prototype clash!
13502         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13503 fi
13504
13505 : check for type of argument to gethostbyname. 
13506 if test "X$netdb_name_type" = X ; then
13507         case "$d_gethbyname" in
13508         $define)
13509                 $cat <<EOM
13510
13511 Checking to see what type of argument is accepted by gethostbyname().
13512 EOM
13513                 hdrs="$define sys/types.h
13514                         $d_socket sys/socket.h 
13515                         $i_niin netinet/in.h 
13516                         $i_netdb netdb.h
13517                         $i_unistd unistd.h"
13518                 for xxx in "const char *" "char *"; do
13519                         case "$netdb_name_type" in
13520                         '')     try="extern struct hostent *gethostbyname($xxx);"
13521                                 if ./protochk "$try" $hdrs; then
13522                                         echo "Your system accepts $xxx."
13523                                         netdb_name_type="$xxx"
13524                                 fi
13525                                 ;;
13526                         esac
13527                 done
13528                 : In case none of those worked, prompt the user.
13529                 case "$netdb_name_type" in
13530                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13531                         dflt='char *'
13532                         . ./myread
13533                         netdb_name_type=$ans
13534                         ;;
13535                 esac
13536                 ;;
13537         *)      : no gethostbyname, so pick harmless default
13538                 netdb_name_type='char *'
13539                 ;;
13540         esac
13541 fi
13542
13543 : check for type of 1st argument to getnetbyaddr. 
13544 if test "X$netdb_net_type" = X ; then
13545         case "$d_getnbyaddr" in
13546         $define)
13547                 $cat <<EOM
13548
13549 Checking to see what type of 1st argument is accepted by getnetbyaddr().
13550 EOM
13551                 hdrs="$define sys/types.h
13552                         $d_socket sys/socket.h 
13553                         $i_niin netinet/in.h 
13554                         $i_netdb netdb.h
13555                         $i_unistd unistd.h"
13556                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
13557                         case "$netdb_net_type" in
13558                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
13559                                 if ./protochk "$try" $hdrs; then
13560                                         echo "Your system accepts $xxx."
13561                                         netdb_net_type="$xxx"
13562                                 fi
13563                                 ;;
13564                         esac
13565                 done
13566                 : In case none of those worked, prompt the user.
13567                 case "$netdb_net_type" in
13568                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
13569                         dflt='long'
13570                         . ./myread
13571                         netdb_net_type=$ans
13572                         ;;
13573                 esac
13574                 ;;
13575         *)      : no getnetbyaddr, so pick harmless default
13576                 netdb_net_type='long'
13577                 ;;
13578         esac
13579 fi
13580 : locate the preferred pager for this system
13581 case "$pager" in
13582 '')
13583         dflt=''
13584         case "$pg" in
13585         /*) dflt=$pg;;
13586         [a-zA-Z]:/*) dflt=$pg;;
13587         esac
13588         case "$more" in
13589         /*) dflt=$more;;
13590         [a-zA-Z]:/*) dflt=$more;;
13591         esac
13592         case "$less" in
13593         /*) dflt=$less;;
13594         [a-zA-Z]:/*) dflt=$less;;
13595         esac
13596         case "$dflt" in
13597         '') dflt=/usr/ucb/more;;
13598         esac
13599         ;;
13600 *) dflt="$pager";;
13601 esac
13602 echo " "
13603 fn=f/
13604 rp='What pager is used on your system?'
13605 . ./getfile
13606 pager="$ans"
13607
13608 : see what type pids are declared as in the kernel
13609 rp="What is the type of process ids on this system?"
13610 set pid_t pidtype int stdio.h sys/types.h
13611 eval $typedef_ask
13612
13613 : Find earliest binary compatible site_perl subdirectory perl can use.
13614 case "$bincompat5005" in
13615 "$define") xs_apiversion='5.005' ;;
13616 *) xs_apiversion=$version ;;   # The current site_perl version.
13617 esac
13618 : Find earliest pure perl site_perl subdirectory perl can use.
13619 : The versioned directories started at 5.005.
13620 pm_apiversion='5.005'
13621
13622 : check for length of pointer
13623 echo " "
13624 case "$ptrsize" in
13625 '')
13626         echo "Checking to see how big your pointers are..." >&4
13627         if test "$voidflags" -gt 7; then
13628                 echo '#define VOID_PTR char *' > try.c
13629         else
13630                 echo '#define VOID_PTR void *' > try.c
13631         fi
13632         $cat >>try.c <<'EOCP'
13633 #include <stdio.h>
13634 int main()
13635 {
13636     printf("%d\n", (int)sizeof(VOID_PTR));
13637     exit(0);
13638 }
13639 EOCP
13640         set try
13641         if eval $compile_ok; then
13642                 ptrsize=`./try`
13643                 echo "Your pointers are $ptrsize bytes long."
13644         else
13645                 dflt='4'
13646                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
13647                 rp="What is the size of a pointer (in bytes)?"
13648                 . ./myread
13649                 ptrsize="$ans"
13650         fi
13651         ;;
13652 esac
13653 $rm -f try.c try
13654
13655 : see if ar generates random libraries by itself
13656 echo " "
13657 echo "Checking how to generate random libraries on your machine..." >&4
13658 echo 'int bar1() { return bar2(); }' > bar1.c
13659 echo 'int bar2() { return 2; }' > bar2.c
13660 $cat > foo.c <<'EOP'
13661 int main() { printf("%d\n", bar1()); exit(0); }
13662 EOP
13663 $cc $ccflags -c bar1.c >/dev/null 2>&1
13664 $cc $ccflags -c bar2.c >/dev/null 2>&1
13665 $cc $ccflags -c foo.c >/dev/null 2>&1
13666 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
13667 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13668         ./foobar >/dev/null 2>&1; then
13669         echo "$ar appears to generate random libraries itself."
13670         orderlib=false
13671         ranlib=":"
13672 elif $ar ts bar$_a >/dev/null 2>&1 &&
13673         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
13674         ./foobar >/dev/null 2>&1; then
13675                 echo "a table of contents needs to be added with '$ar ts'."
13676                 orderlib=false
13677                 ranlib="$ar ts"
13678 else
13679         case "$ranlib" in
13680         :) ranlib='';;
13681         '')
13682                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
13683                 $test -f $ranlib || ranlib=''
13684                 ;;
13685         esac
13686         if $test -n "$ranlib"; then
13687                 echo "your system has '$ranlib'; we'll use that."
13688                 orderlib=false
13689         else
13690                 echo "your system doesn't seem to support random libraries"
13691                 echo "so we'll use lorder and tsort to order the libraries."
13692                 orderlib=true
13693                 ranlib=":"
13694         fi
13695 fi
13696 $rm -f foo* bar* 
13697
13698 : check for type of arguments to select. 
13699 case "$selecttype" in
13700 '') case "$d_select" in
13701         $define)
13702                 echo " "
13703                 $cat <<EOM
13704 Checking to see what type of arguments are accepted by select().
13705 EOM
13706                 hdrs="$define sys/types.h
13707                         $i_systime sys/time.h 
13708                         $i_sysselct sys/select.h
13709                         $d_socket sys/socket.h"
13710                 : The first arg can be int, unsigned, or size_t
13711                 : The last arg may or may not be 'const'
13712                 val=''
13713                 : void pointer has been seen but using that
13714                 : breaks the selectminbits test
13715                 for xxx in 'fd_set *' 'int *'; do
13716                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
13717                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
13718                                         case "$val" in
13719                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
13720                                                 if ./protochk "$try" $hdrs; then
13721                                                         echo "Your system accepts $xxx."
13722                                                         val="$xxx"
13723                                                 fi
13724                                                 ;;
13725                                         esac
13726                                 done
13727                         done
13728                 done
13729                 case "$val" in
13730                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
13731                         case "$d_fd_set" in
13732                                 $define) dflt="fd_set *" ;;
13733                                 *)              dflt="int *" ;;
13734                         esac
13735                         . ./myread
13736                         val=$ans
13737                         ;;
13738                 esac
13739                 selecttype="$val"
13740                 ;;
13741         *)      : no select, so pick a harmless default
13742                 selecttype='int *'
13743                 ;;
13744         esac
13745         ;;
13746 esac
13747
13748 : check for the select 'width'
13749 case "$selectminbits" in
13750 '') case "$d_select" in
13751         $define)
13752                 $cat <<EOM
13753
13754 Checking to see on how many bits at a time your select() operates...
13755 EOM
13756                 $cat >try.c <<EOCP
13757 #include <sys/types.h>
13758 #$i_time I_TIME
13759 #$i_systime I_SYS_TIME
13760 #$i_systimek I_SYS_TIME_KERNEL
13761 #ifdef I_TIME
13762 #   include <time.h>
13763 #endif
13764 #ifdef I_SYS_TIME
13765 #   ifdef I_SYS_TIME_KERNEL
13766 #       define KERNEL
13767 #   endif
13768 #   include <sys/time.h>
13769 #   ifdef I_SYS_TIME_KERNEL
13770 #       undef KERNEL
13771 #   endif
13772 #endif
13773 #$i_sysselct I_SYS_SELECT
13774 #ifdef I_SYS_SELECT
13775 #include <sys/select.h>
13776 #endif
13777 #$d_socket HAS_SOCKET
13778 #ifdef HAS_SOCKET
13779 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13780 #endif
13781 #include <stdio.h>
13782 $selecttype b;
13783 #define S sizeof(*(b))
13784 #define MINBITS 64
13785 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
13786 #define NBITS  (NBYTES * 8)
13787 int main() {
13788     char s[NBYTES];
13789     struct timeval t;
13790     int i;
13791     FILE* fp;
13792     int fd;
13793
13794     fclose(stdin);
13795     fp = fopen("try.c", "r");
13796     if (fp == 0)
13797       exit(1);
13798     fd = fileno(fp);
13799     if (fd < 0)
13800       exit(2);
13801     b = ($selecttype)s;
13802     for (i = 0; i < NBITS; i++)
13803         FD_SET(i, b);
13804     t.tv_sec  = 0;
13805     t.tv_usec = 0;
13806     select(fd + 1, b, 0, 0, &t);
13807     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13808     printf("%d\n", i + 1);
13809     return 0;
13810 }
13811 EOCP
13812                 set try
13813                 if eval $compile_ok; then
13814                         selectminbits=`./try`
13815                         case "$selectminbits" in
13816                         '')     cat >&4 <<EOM
13817 Cannot figure out on how many bits at a time your select() operates.
13818 I'll play safe and guess it is 32 bits.
13819 EOM
13820                                 selectminbits=32
13821                                 bits="32 bits"
13822                                 ;;
13823                         1)      bits="1 bit" ;;
13824                         *)      bits="$selectminbits bits" ;;
13825                         esac
13826                         echo "Your select() operates on $bits at a time." >&4
13827                 else
13828                         rp='What is the minimum number of bits your select() operates on?'
13829                         case "$byteorder" in
13830                         1234|12345678)  dflt=32 ;;
13831                         *)              dflt=1  ;;
13832                         esac
13833                         . ./myread
13834                         val=$ans
13835                         selectminbits="$val"
13836                 fi
13837                 $rm -f try.* try
13838                 ;;
13839         *)      : no select, so pick a harmless default
13840                 selectminbits='32'
13841                 ;;
13842         esac
13843         ;;
13844 esac
13845
13846 : Trace out the files included by signal.h, then look for SIGxxx names.
13847 : Remove SIGARRAYSIZE used by HPUX.
13848 : Remove SIGSTKSIZE used by Linux.
13849 : Remove SIGSTKSZ used by Posix.
13850 : Remove SIGTYP void lines used by OS2.
13851 : Some cpps, like os390, dont give the file name anywhere
13852 if [ "X$fieldn" = X ]; then
13853         : Just make some guesses.  We check them later.
13854         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13855 else
13856         xxx=`echo '#include <signal.h>' |
13857         $cppstdin $cppminus $cppflags 2>/dev/null |
13858         $grep '^[       ]*#.*include' | 
13859         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13860 fi
13861 : Check this list of files to be sure we have parsed the cpp output ok.
13862 : This will also avoid potentially non-existent files, such 
13863 : as ../foo/bar.h
13864 xxxfiles=''
13865 for xx in $xxx /dev/null ; do
13866         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13867 done
13868 : If we have found no files, at least try signal.h
13869 case "$xxxfiles" in
13870 '')     xxxfiles=`./findhdr signal.h` ;;
13871 esac
13872 xxx=`awk '
13873 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13874         print substr($2, 4, 20)
13875 }
13876 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13877         print substr($3, 4, 20)
13878 }' $xxxfiles`
13879 : Append some common names just in case the awk scan failed.
13880 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13881 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13882 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13883 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13884 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13885
13886 : generate a few handy files for later
13887 $cat > signal.c <<'EOCP'
13888 #include <sys/types.h>
13889 #include <signal.h>
13890 #include <stdio.h>
13891 int main() {
13892
13893 /* Strange style to avoid deeply-nested #if/#else/#endif */
13894 #ifndef NSIG
13895 #  ifdef _NSIG
13896 #    define NSIG (_NSIG)
13897 #  endif
13898 #endif
13899
13900 #ifndef NSIG
13901 #  ifdef SIGMAX
13902 #    define NSIG (SIGMAX+1)
13903 #  endif
13904 #endif
13905
13906 #ifndef NSIG
13907 #  ifdef SIG_MAX
13908 #    define NSIG (SIG_MAX+1)
13909 #  endif
13910 #endif
13911
13912 #ifndef NSIG
13913 #  ifdef MAXSIG
13914 #    define NSIG (MAXSIG+1)
13915 #  endif
13916 #endif
13917
13918 #ifndef NSIG
13919 #  ifdef MAX_SIG
13920 #    define NSIG (MAX_SIG+1)
13921 #  endif
13922 #endif
13923
13924 #ifndef NSIG
13925 #  ifdef SIGARRAYSIZE
13926 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13927 #  endif
13928 #endif
13929
13930 #ifndef NSIG
13931 #  ifdef _sys_nsig
13932 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13933 #  endif
13934 #endif
13935
13936 /* Default to some arbitrary number that's big enough to get most
13937    of the common signals.
13938 */
13939 #ifndef NSIG
13940 #    define NSIG 50
13941 #endif
13942
13943 printf("NSIG %d\n", NSIG);
13944
13945 #ifndef JUST_NSIG
13946
13947 EOCP
13948
13949 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13950 {
13951         printf "#ifdef SIG"; printf $1; printf "\n"
13952         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13953         printf $1; printf ");\n"
13954         printf "#endif\n"
13955 }
13956 END {
13957         printf "#endif /* JUST_NSIG */\n";
13958         printf "exit(0);\n}\n";
13959 }
13960 ' >>signal.c
13961 $cat >signal.awk <<'EOP'
13962 BEGIN { ndups = 0 }
13963 $1 ~ /^NSIG$/ { nsig = $2 }
13964 ($1 !~ /^NSIG$/) && (NF == 2) {
13965     if ($2 > maxsig) { maxsig = $2 }
13966     if (sig_name[$2]) {
13967         dup_name[ndups] = $1
13968         dup_num[ndups] = $2
13969         ndups++ 
13970     }
13971     else {
13972         sig_name[$2] = $1
13973         sig_num[$2] = $2
13974     }
13975 }
13976 END { 
13977     if (nsig == 0) {
13978         nsig = maxsig + 1
13979     }
13980     printf("NSIG %d\n", nsig);
13981     for (n = 1; n < nsig; n++) {
13982         if (sig_name[n]) {
13983             printf("%s %d\n", sig_name[n], sig_num[n])
13984         }
13985         else {
13986             printf("NUM%d %d\n", n, n) 
13987         }
13988     }
13989     for (n = 0; n < ndups; n++) {
13990         printf("%s %d\n", dup_name[n], dup_num[n])
13991     }
13992 }
13993 EOP
13994 $cat >signal_cmd <<EOS
13995 $startsh
13996 if $test -s signal.lst; then
13997     echo "Using your existing signal.lst file"
13998         exit 0
13999 fi
14000 xxx="$xxx"
14001 EOS
14002 $cat >>signal_cmd <<'EOS'
14003
14004 set signal
14005 if eval $compile_ok; then
14006         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14007 else
14008         echo "(I can't seem be able to compile the whole test program)" >&4
14009         echo "(I'll try it in little pieces.)" >&4
14010         set signal -DJUST_NSIG
14011         if eval $compile_ok; then
14012                 ./signal$_exe > signal.nsg
14013                 $cat signal.nsg
14014         else
14015                 echo "I can't seem to figure out how many signals you have." >&4
14016                 echo "Guessing 50." >&4
14017                 echo 'NSIG 50' > signal.nsg
14018         fi
14019         : Now look at all the signal names, one at a time.
14020         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14021                 $cat > signal.c <<EOCP
14022 #include <sys/types.h>
14023 #include <signal.h>
14024 #include <stdio.h>
14025 int main() {
14026 printf("$xx %d\n", SIG${xx});
14027 return 0;
14028 }
14029 EOCP
14030                 set signal
14031                 if eval $compile; then
14032                         echo "SIG${xx} found."
14033                         ./signal$_exe  >> signal.ls1
14034                 else
14035                         echo "SIG${xx} NOT found."
14036                 fi
14037         done
14038         if $test -s signal.ls1; then
14039                 $cat signal.nsg signal.ls1 |
14040                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14041         fi
14042
14043 fi
14044 if $test -s signal.lst; then
14045         :
14046 else
14047         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14048         echo 'kill -l' >signal
14049         set X `csh -f <signal`
14050         $rm -f signal
14051         shift
14052         case $# in
14053         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14054         esac
14055         echo $@ | $tr ' ' $trnl | \
14056             $awk '{ printf "%s %d\n", $1, ++s; }
14057                   END { printf "NSIG %d\n", ++s }' >signal.lst
14058 fi
14059 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14060 EOS
14061 chmod a+x signal_cmd
14062 $eunicefix signal_cmd
14063
14064 : generate list of signal names
14065 echo " "
14066 case "$sig_name_init" in
14067 '') doinit=yes ;;
14068 *)  case "$sig_num_init" in
14069     ''|*,*) doinit=yes ;;
14070     esac ;;
14071 esac
14072 case "$doinit" in
14073 yes)
14074         echo "Generating a list of signal names and numbers..." >&4
14075         . ./signal_cmd
14076         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14077         sig_name=`$awk 'BEGIN { printf "ZERO " }
14078                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14079         sig_num=`$awk  'BEGIN { printf "0 " }
14080                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14081         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14082                              !/^NSIG/   { printf "\"%s\", ", $1 }
14083                              END        { printf "0\n" }' signal.lst`
14084         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14085                              !/^NSIG/   { printf "%d, ", $2}
14086                              END        { printf "0\n"}' signal.lst`
14087         ;;
14088 esac
14089 echo "The following $sig_count signals are available:"
14090 echo " "
14091 echo $sig_name | $awk \
14092 'BEGIN { linelen = 0 }
14093 {
14094         for (i = 1; i <= NF; i++) {
14095                 name = "SIG" $i " "
14096                 linelen = linelen + length(name)
14097                 if (linelen > 70) {
14098                         printf "\n"
14099                         linelen = length(name)
14100                 }
14101                 printf "%s", name
14102         }
14103         printf "\n"
14104 }'
14105 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14106
14107 echo " "
14108 case "$sizetype" in
14109 *_t) zzz="$sizetype"    ;;
14110 *)   zzz="filesize"     ;;
14111 esac
14112 echo "Checking the size of $zzz..." >&4 
14113 cat > try.c <<EOCP
14114 #include <sys/types.h>
14115 #include <stdio.h>
14116 int main() {
14117     printf("%d\n", (int)sizeof($sizetype));
14118     exit(0);
14119 }
14120 EOCP
14121 set try
14122 if eval $compile_ok; then
14123         yyy=`./try`
14124         case "$yyy" in
14125         '')     sizesize=4
14126                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14127                 ;;
14128         *)      sizesize=$yyy
14129                 echo "Your $zzz size is $sizesize bytes."
14130                 ;;
14131         esac
14132 else
14133         sizesize=4
14134         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14135 fi
14136
14137
14138 : check for socklen_t
14139 echo " "
14140 echo "Checking to see if you have socklen_t..." >&4
14141 $cat >try.c <<EOCP
14142 #include <sys/types.h>
14143 #$d_socket HAS_SOCKET
14144 #ifdef HAS_SOCKET
14145 #include <sys/socket.h>
14146 #endif
14147 int main() { socklen_t x = 16; }
14148 EOCP
14149 set try
14150 if eval $compile; then
14151         val="$define"
14152         echo "You have socklen_t."
14153 else
14154         val="$undef"
14155         echo "You do not have socklen_t."
14156         case "$sizetype" in
14157         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14158         esac
14159 fi
14160 $rm -f try try.*
14161 set d_socklen_t
14162 eval $setvar
14163
14164 : check for type of the size argument to socket calls
14165 case "$d_socket" in
14166 "$define")
14167         $cat <<EOM
14168
14169 Checking to see what type is the last argument of accept().
14170 EOM
14171         hdrs="$define sys/types.h $d_socket sys/socket.h" 
14172         yyy=''
14173         case "$d_socklen_t" in
14174         "$define") yyy="$yyy socklen_t"
14175         esac
14176         yyy="$yyy $sizetype int long unsigned"
14177         for xxx in $yyy; do
14178                 case "$socksizetype" in
14179                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14180                         if ./protochk "$try" $hdrs; then
14181                                 echo "Your system accepts '$xxx *' for the last argument of accept()."
14182                                 socksizetype="$xxx"
14183                         fi
14184                         ;;
14185                 esac
14186         done
14187 : In case none of those worked, prompt the user.
14188         case "$socksizetype" in
14189         '')     rp='What is the type for socket address structure sizes?'
14190                 dflt='int'
14191                 . ./myread
14192                 socksizetype=$ans
14193                 ;;
14194         esac
14195         ;;
14196 *)      : no sockets, so pick relatively harmless default
14197         socksizetype='int'
14198         ;;
14199 esac
14200
14201 : see what type is used for signed size_t
14202 set ssize_t ssizetype int stdio.h sys/types.h
14203 eval $typedef
14204 dflt="$ssizetype"
14205 $cat > ssize.c <<EOM
14206 #include <stdio.h>
14207 #include <sys/types.h>
14208 #define Size_t $sizetype
14209 #define SSize_t $dflt
14210 int main()
14211 {
14212         if (sizeof(Size_t) == sizeof(SSize_t))
14213                 printf("$dflt\n");
14214         else if (sizeof(Size_t) == sizeof(int))
14215                 printf("int\n");
14216         else 
14217                 printf("long\n");
14218         exit(0);
14219 }
14220 EOM
14221 echo " "
14222 set ssize
14223 if eval $compile_ok && ./ssize > /dev/null; then
14224         ssizetype=`./ssize`
14225         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14226 else
14227         $cat >&4 <<EOM
14228 Help! I can't compile and run the ssize_t test program: please enlighten me!
14229 (This is probably a misconfiguration in your system or libraries, and
14230 you really ought to fix it.  Still, I'll try anyway.)
14231
14232 I need a type that is the same size as $sizetype, but is guaranteed to
14233 be signed.  Common values are ssize_t, int and long.
14234
14235 EOM
14236         rp="What signed type is the same size as $sizetype?"
14237         . ./myread
14238         ssizetype="$ans"
14239 fi
14240 $rm -f ssize ssize.*
14241
14242 : see what type of char stdio uses.
14243 echo " "
14244 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
14245         echo "Your stdio uses unsigned chars." >&4
14246         stdchar="unsigned char"
14247 else
14248         echo "Your stdio uses signed chars." >&4
14249         stdchar="char"
14250 fi
14251
14252 : see if time exists
14253 echo " "
14254 if test "X$d_time" = X -o X"$timetype" = X; then
14255     if set time val -f d_time; eval $csym; $val; then
14256                 echo 'time() found.' >&4
14257                 val="$define"
14258                 rp="What is the type returned by time() on this system?"
14259                 set time_t timetype long stdio.h sys/types.h
14260                 eval $typedef_ask
14261     else
14262                 echo 'time() not found, hope that will do.' >&4
14263                 val="$undef"
14264                 timetype='int';
14265     fi
14266     set d_time
14267     eval $setvar
14268 fi
14269
14270 : see what type uids are declared as in the kernel
14271 echo " "
14272 echo "Looking for the type for user ids returned by getuid()."
14273 set uid_t uidtype xxx stdio.h sys/types.h
14274 eval $typedef
14275 case "$uidtype" in
14276 xxx)
14277         xxx=`./findhdr sys/user.h`
14278         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14279         case $1 in
14280         unsigned) dflt="$1 $2" ;;
14281         *) dflt="$1" ;;
14282         esac
14283         ;;
14284 *) dflt="$uidtype";;
14285 esac
14286 case "$uidtype" in
14287 uid_t)  echo "uid_t found." ;;
14288 *)      rp="What is the type for user ids returned by getuid()?"
14289         . ./myread
14290         uidtype="$ans"
14291         ;;
14292 esac
14293
14294 echo " "
14295 case "$uidtype" in
14296 *_t) zzz="$uidtype"     ;;
14297 *)   zzz="uid"          ;;
14298 esac
14299 echo "Checking the size of $zzz..." >&4 
14300 cat > try.c <<EOCP
14301 #include <sys/types.h>
14302 #include <stdio.h>
14303 int main() {
14304     printf("%d\n", (int)sizeof($uidtype));
14305     exit(0);
14306 }
14307 EOCP
14308 set try
14309 if eval $compile_ok; then
14310         yyy=`./try`
14311         case "$yyy" in
14312         '')     uidsize=4
14313                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14314                 ;;
14315         *)      uidsize=$yyy
14316                 echo "Your $zzz is $uidsize bytes long."
14317                 ;;
14318         esac
14319 else
14320         uidsize=4
14321         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14322 fi
14323
14324 echo " "
14325 case "$uidtype" in
14326 *_t) zzz="$uidtype"     ;;
14327 *)   zzz="uid"          ;;
14328 esac
14329 echo "Checking the sign of $zzz..." >&4
14330 cat > try.c <<EOCP
14331 #include <sys/types.h>
14332 #include <stdio.h>
14333 int main() {
14334         $uidtype foo = -1;
14335         if (foo < 0)
14336                 printf("-1\n");
14337         else
14338                 printf("1\n");
14339 }
14340 EOCP
14341 set try
14342 if eval $compile; then
14343         yyy=`./try`
14344         case "$yyy" in
14345         '')     uidsign=1
14346                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14347                 ;;
14348         *)      uidsign=$yyy
14349                 case "$uidsign" in
14350                  1) echo "Your $zzz is unsigned." ;;
14351                 -1) echo "Your $zzz is signed."   ;;
14352                 esac
14353                 ;;
14354         esac
14355 else
14356         uidsign=1
14357         echo "(I can't compile the test program--guessing unsigned.)" >&4
14358 fi
14359
14360
14361
14362 echo " "
14363 $echo "Checking the format string to be used for uids..." >&4
14364
14365 case "$uidsign" in
14366 -1)     if $test X"$uidsize" = X"$ivsize"; then
14367                 uidformat="$ivdformat"
14368         else
14369                 if $test X"$uidsize" = X"$longsize"; then
14370                         uidformat='"ld"'
14371                 else
14372                         if $test X"$uidsize" = X"$intsize"; then
14373                                 uidformat='"d"'
14374                         else
14375                                 if $test X"$uidsize" = X"$shortsize"; then
14376                                         uidformat='"hd"'
14377                                 fi
14378                         fi
14379                 fi
14380         fi
14381         ;;
14382 *)      if $test X"$uidsize" = X"$uvsize"; then
14383                 uidformat="$uvuformat"
14384         else
14385                 if $test X"$uidsize" = X"$longsize"; then
14386                         uidformat='"lu"'
14387                 else
14388                         if $test X"$uidsize" = X"$intsize"; then
14389                                 uidformat='"u"'
14390                         else
14391                                 if $test X"$uidsize" = X"$shortsize"; then
14392                                         uidformat='"hu"'
14393                                 fi
14394                         fi
14395                 fi
14396         fi
14397         ;;
14398 esac
14399
14400 : see if dbm.h is available
14401 : see if dbmclose exists
14402 set dbmclose d_dbmclose
14403 eval $inlibc
14404
14405 case "$d_dbmclose" in
14406 $define)
14407         set dbm.h i_dbm
14408         eval $inhdr
14409         case "$i_dbm" in
14410         $define)
14411                 val="$undef"
14412                 set i_rpcsvcdbm
14413                 eval $setvar
14414                 ;;
14415         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14416                 eval $inhdr
14417                 ;;
14418         esac
14419         ;;
14420 *)      echo "We won't be including <dbm.h>"
14421         val="$undef"
14422         set i_dbm
14423         eval $setvar
14424         val="$undef"
14425         set i_rpcsvcdbm
14426         eval $setvar
14427         ;;
14428 esac
14429
14430 : see if this is a sys/file.h system
14431 val=''
14432 set sys/file.h val
14433 eval $inhdr
14434
14435 : do we need to include sys/file.h ?
14436 case "$val" in
14437 "$define")
14438         echo " "
14439         if $h_sysfile; then
14440                 val="$define"
14441                 echo "We'll be including <sys/file.h>." >&4
14442         else
14443                 val="$undef"
14444                 echo "We won't be including <sys/file.h>." >&4
14445         fi
14446         ;;
14447 *)
14448         h_sysfile=false
14449         ;;
14450 esac
14451 set i_sysfile
14452 eval $setvar
14453
14454 : see if fcntl.h is there
14455 val=''
14456 set fcntl.h val
14457 eval $inhdr
14458
14459 : see if we can include fcntl.h
14460 case "$val" in
14461 "$define")
14462         echo " "
14463         if $h_fcntl; then
14464                 val="$define"
14465                 echo "We'll be including <fcntl.h>." >&4
14466         else
14467                 val="$undef"
14468                 if $h_sysfile; then
14469         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14470                 else
14471                         echo "We won't be including <fcntl.h>." >&4
14472                 fi
14473         fi
14474         ;;
14475 *)
14476         h_fcntl=false
14477         val="$undef"
14478         ;;
14479 esac
14480 set i_fcntl
14481 eval $setvar
14482
14483 : see if this is a iconv.h system
14484 set iconv.h i_iconv
14485 eval $inhdr
14486
14487 : see if this is a ieeefp.h system
14488 set ieeefp.h i_ieeefp
14489 eval $inhdr
14490
14491 : see if this is a libutil.h system
14492 set libutil.h i_libutil
14493 eval $inhdr
14494
14495 : see if locale.h is available
14496 set locale.h i_locale
14497 eval $inhdr
14498
14499 : see if mach cthreads are available
14500 if test "X$usethreads" = "X$define"; then
14501         set mach/cthreads.h i_machcthr
14502         eval $inhdr
14503 else
14504         i_machcthr="$undef"
14505 fi
14506
14507
14508
14509 : see if this is a math.h system
14510 set math.h i_math
14511 eval $inhdr
14512
14513 : see if this is a mntent.h system
14514 set mntent.h i_mntent
14515 eval $inhdr
14516
14517 : see if ndbm.h is available
14518 set ndbm.h t_ndbm
14519 eval $inhdr
14520 case "$t_ndbm" in
14521 $define)
14522         : see if dbm_open exists
14523         set dbm_open d_dbm_open
14524         eval $inlibc
14525         case "$d_dbm_open" in
14526         $undef)
14527                 t_ndbm="$undef"
14528                 echo "We won't be including <ndbm.h>"
14529                 ;;
14530         esac
14531         ;;
14532 esac
14533 val="$t_ndbm"
14534 set i_ndbm
14535 eval $setvar
14536
14537 : see if net/errno.h is available
14538 val=''
14539 set net/errno.h val
14540 eval $inhdr
14541
14542 : Unfortunately, it causes problems on some systems.  Arrgh.
14543 case "$val" in
14544 $define)
14545         cat > try.c <<'EOM'
14546 #include <stdio.h>
14547 #include <errno.h>
14548 #include <net/errno.h>
14549 int func()
14550 {
14551         return ENOTSOCK;
14552 }
14553 EOM
14554         if $cc $ccflags -c try.c >/dev/null 2>&1; then
14555                 echo "We'll be including <net/errno.h>." >&4
14556         else
14557                 echo "We won't be including <net/errno.h>." >&4
14558                 val="$undef"
14559         fi
14560         $rm -f try.* try
14561         ;;
14562 esac
14563 set i_neterrno
14564 eval $setvar
14565
14566 : see if netinet/tcp.h is available
14567 set netinet/tcp.h i_netinettcp
14568 eval $inhdr
14569
14570 : see if this is a poll.h system
14571 set poll.h i_poll
14572 eval $inhdr
14573
14574 : see if this is a prot.h system
14575 set prot.h i_prot
14576 eval $inhdr
14577
14578 echo " "
14579 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
14580 $cat <<'EOSH' > Cppsym.know
14581 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
14582 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
14583 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
14584 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
14585 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
14586 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
14587 bull c cadmus clipper CMU COFF COMPILER_VERSION
14588 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
14589 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
14590 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
14591 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
14592 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
14593 H3050R H3050RX hbullx20 hcx host_mips
14594 hp200 hp300 hp700 HP700 hp800 hp9000
14595 hp9000s200 hp9000s300 hp9000s400 hp9000s500
14596 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
14597 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
14598 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
14599 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
14600 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
14601 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
14602 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
14603 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
14604 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
14605 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
14606 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
14607 MATH_HAS_NO_SIDE_EFFECTS
14608 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
14609 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
14610 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
14611 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
14612 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
14613 NetBSD news1500 news1700 news1800 news1900 news3700
14614 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
14615 ns32016 ns32332 ns32k nsc32000
14616 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
14617 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
14618 pc532 pdp11 PGC PIC plexus PORTAR posix
14619 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
14620 POSIX_C_SOURCE POSIX_SOURCE POWER
14621 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
14622 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
14623 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
14624 sony sony_news sonyrisc sparc sparclite spectrum
14625 stardent stdc STDC_EXT stratos sun sun3 sun386
14626 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
14627 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
14628 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
14629 sysV68 sysV88 Tek4132 Tek4300 titan
14630 tower tower32 tower32_200 tower32_600 tower32_700
14631 tower32_800 tower32_850 tss
14632 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
14633 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
14634 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
14635 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
14636 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
14637 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
14638 z8000
14639 EOSH
14640 # Maybe put other stuff here too.
14641 cat <<EOSH >>Cppsym.know
14642 $osname
14643 EOSH
14644 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
14645 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
14646 $cat Cppsym.know > Cppsym.c
14647 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
14648 $rm -f Cppsym.a Cppsym.b Cppsym.c
14649 cat <<EOSH > Cppsym
14650 $startsh
14651 if $test \$# -gt 0; then
14652     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
14653     if $test -s Cppsym.got; then
14654         $rm -f Cppsym.got
14655         exit 0
14656     fi
14657     $rm -f Cppsym.got
14658     exit 1
14659 else
14660     $tr " " "$trnl" | ./Cppsym.try
14661     exit 0
14662 fi
14663 EOSH
14664 chmod +x Cppsym
14665 $eunicefix Cppsym
14666 cat <<EOSH > Cppsym.try
14667 $startsh
14668 cat <<'EOCP' > try.c
14669 #include <stdio.h>
14670 int main() {
14671 EOCP
14672 $awk \\
14673 EOSH
14674 cat <<'EOSH' >> Cppsym.try
14675 'length($1) > 0 {
14676     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
14677     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
14678     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
14679     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
14680 }'       >> try.c
14681 echo '}' >> try.c
14682 EOSH
14683 cat <<EOSH >> Cppsym.try
14684 ccflags="$ccflags"
14685 case "$osname-$gccversion" in
14686 irix-) ccflags="\$ccflags -woff 1178" ;;
14687 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
14688 esac
14689 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
14690 EOSH
14691 chmod +x Cppsym.try
14692 $eunicefix Cppsym.try
14693 ./Cppsym < Cppsym.know > Cppsym.true
14694 : now check the C compiler for additional symbols
14695 postprocess_cc_v=''
14696 case "$osname" in
14697 aix) postprocess_cc_v="|$tr , ' '" ;;
14698 esac
14699 $cat >ccsym <<EOS
14700 $startsh
14701 $cat >tmp.c <<EOF
14702 extern int foo;
14703 EOF
14704 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
14705 do
14706         case "\$i" in
14707         -D*) echo "\$i" | $sed 's/^-D//';;
14708         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
14709         esac
14710 done
14711 $rm -f try.c
14712 EOS
14713 postprocess_cc_v=''
14714 chmod +x ccsym
14715 $eunicefix ccsym
14716 ./ccsym > ccsym1.raw
14717 if $test -s ccsym1.raw; then
14718        $sort ccsym1.raw | $uniq >ccsym.raw
14719 else
14720        mv ccsym1.raw ccsym.raw
14721 fi
14722
14723 $awk '/\=/ { print $0; next }
14724         { print $0"=1" }' ccsym.raw >ccsym.list
14725 $awk '/\=/ { print $0; next }
14726         { print $0"=1" }' Cppsym.true >ccsym.true
14727 $comm -13 ccsym.true ccsym.list >ccsym.own
14728 $comm -12 ccsym.true ccsym.list >ccsym.com
14729 $comm -23 ccsym.true ccsym.list >ccsym.cpp
14730 also=''
14731 if $test -z ccsym.raw; then
14732         echo "Your C compiler doesn't seem to define any symbols!" >&4
14733         echo " "
14734         echo "However, your C preprocessor defines the following symbols:"
14735         $cat Cppsym.true
14736         ccsymbols=''
14737         cppsymbols=`$cat Cppsym.true`
14738         cppsymbols=`echo $cppsymbols`
14739         cppccsymbols="$cppsymbols"
14740 else
14741         if $test -s ccsym.com; then
14742                 echo "Your C compiler and pre-processor define these symbols:"
14743                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
14744                 also='also '
14745                 symbols='ones'
14746                 cppccsymbols=`$cat ccsym.com`
14747                 cppccsymbols=`echo $cppccsymbols`
14748                 $test "$silent" || sleep 1
14749         fi
14750         if $test -s ccsym.cpp; then
14751                 $test "$also" && echo " "
14752                 echo "Your C pre-processor ${also}defines the following symbols:"
14753                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
14754                 also='further '
14755                 cppsymbols=`$cat ccsym.cpp`
14756                 cppsymbols=`echo $cppsymbols`
14757                 $test "$silent" || sleep 1
14758         fi
14759         if $test -s ccsym.own; then
14760                 $test "$also" && echo " "
14761                 echo "Your C compiler ${also}defines the following cpp symbols:"
14762                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
14763                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
14764                 ccsymbols=`$cat ccsym.own`
14765                 ccsymbols=`echo $ccsymbols`
14766                 $test "$silent" || sleep 1
14767         fi
14768 fi
14769 $rm -f ccsym* Cppsym.*
14770
14771 : see if this is a termio system
14772 val="$undef"
14773 val2="$undef"
14774 val3="$undef"
14775 if $test `./findhdr termios.h`; then
14776         set tcsetattr i_termios
14777         eval $inlibc
14778         val3="$i_termios"
14779 fi
14780 echo " "
14781 case "$val3" in
14782 "$define") echo "You have POSIX termios.h... good!" >&4;;
14783 *) if ./Cppsym pyr; then
14784                 case "`/bin/universe`" in
14785                 ucb) if $test `./findhdr sgtty.h`; then
14786                                 val2="$define"
14787                                 echo "<sgtty.h> found." >&4
14788                         else
14789                                 echo "System is pyramid with BSD universe."
14790                                 echo "<sgtty.h> not found--you could have problems." >&4
14791                         fi;;
14792                 *) if $test `./findhdr termio.h`; then
14793                                 val="$define"
14794                                 echo "<termio.h> found." >&4
14795                         else
14796                                 echo "System is pyramid with USG universe."
14797                                 echo "<termio.h> not found--you could have problems." >&4
14798                         fi;;
14799                 esac
14800         elif ./usg; then
14801                 if $test `./findhdr termio.h`; then
14802                         echo "<termio.h> found." >&4
14803                         val="$define"
14804                 elif $test `./findhdr sgtty.h`; then
14805                         echo "<sgtty.h> found." >&4
14806                         val2="$define"
14807                 else
14808 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
14809                 fi
14810         else
14811                 if $test `./findhdr sgtty.h`; then
14812                         echo "<sgtty.h> found." >&4
14813                         val2="$define"
14814                 elif $test `./findhdr termio.h`; then
14815                         echo "<termio.h> found." >&4
14816                         val="$define"
14817                 else
14818 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
14819                 fi
14820         fi;;
14821 esac
14822 set i_termio; eval $setvar
14823 val=$val2; set i_sgtty; eval $setvar
14824 val=$val3; set i_termios; eval $setvar
14825
14826 : see if this is a shadow.h system
14827 set shadow.h i_shadow
14828 eval $inhdr
14829
14830 : see if this is a socks.h system
14831 set socks.h i_socks
14832 eval $inhdr
14833
14834 : see if stdarg is available
14835 echo " "
14836 if $test `./findhdr stdarg.h`; then
14837         echo "<stdarg.h> found." >&4
14838         valstd="$define"
14839 else
14840         echo "<stdarg.h> NOT found." >&4
14841         valstd="$undef"
14842 fi
14843
14844 : see if varags is available
14845 echo " "
14846 if $test `./findhdr varargs.h`; then
14847         echo "<varargs.h> found." >&4
14848 else
14849         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14850 fi
14851
14852 : set up the varargs testing programs
14853 $cat > varargs.c <<EOP
14854 #ifdef I_STDARG
14855 #include <stdarg.h>
14856 #endif
14857 #ifdef I_VARARGS
14858 #include <varargs.h>
14859 #endif
14860
14861 #ifdef I_STDARG
14862 int f(char *p, ...)
14863 #else
14864 int f(va_alist)
14865 va_dcl
14866 #endif
14867 {
14868         va_list ap;
14869 #ifndef I_STDARG
14870         char *p;
14871 #endif
14872 #ifdef I_STDARG
14873         va_start(ap,p);
14874 #else
14875         va_start(ap);
14876         p = va_arg(ap, char *);
14877 #endif
14878         va_end(ap);
14879 }
14880 EOP
14881 $cat > varargs <<EOP
14882 $startsh
14883 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14884         echo "true"
14885 else
14886         echo "false"
14887 fi
14888 $rm -f varargs$_o
14889 EOP
14890 chmod +x varargs
14891
14892 : now check which varargs header should be included
14893 echo " "
14894 i_varhdr=''
14895 case "$valstd" in
14896 "$define")
14897         if `./varargs I_STDARG`; then
14898                 val='stdarg.h'
14899         elif `./varargs I_VARARGS`; then
14900                 val='varargs.h'
14901         fi
14902         ;;
14903 *)
14904         if `./varargs I_VARARGS`; then
14905                 val='varargs.h'
14906         fi
14907         ;;
14908 esac
14909 case "$val" in
14910 '')
14911 echo "I could not find the definition for va_dcl... You have problems..." >&4
14912         val="$undef"; set i_stdarg; eval $setvar
14913         val="$undef"; set i_varargs; eval $setvar
14914         ;;
14915 *) 
14916         set i_varhdr
14917         eval $setvar
14918         case "$i_varhdr" in
14919         stdarg.h)
14920                 val="$define"; set i_stdarg; eval $setvar
14921                 val="$undef"; set i_varargs; eval $setvar
14922                 ;;
14923         varargs.h)
14924                 val="$undef"; set i_stdarg; eval $setvar
14925                 val="$define"; set i_varargs; eval $setvar
14926                 ;;
14927         esac
14928         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14929 esac
14930 $rm -f varargs*
14931
14932 : see if stddef is available
14933 set stddef.h i_stddef
14934 eval $inhdr
14935
14936 : see if this is a sunmath.h system
14937 set sunmath.h i_sunmath
14938 eval $inhdr
14939
14940 : see if sys/access.h is available
14941 set sys/access.h i_sysaccess
14942 eval $inhdr
14943
14944 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14945 set sys/filio.h i_sysfilio
14946 eval $inhdr
14947 echo " "
14948 if $test `./findhdr sys/ioctl.h`; then
14949         val="$define"
14950         echo '<sys/ioctl.h> found.' >&4
14951 else
14952         val="$undef"
14953         if $test $i_sysfilio = "$define"; then
14954             echo '<sys/ioctl.h> NOT found.' >&4
14955         else
14956                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14957                 $test $i_termio = "$define" && xxx="termio.h"
14958                 $test $i_termios = "$define" && xxx="termios.h"
14959 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14960         fi
14961 fi
14962 set i_sysioctl
14963 eval $setvar
14964
14965
14966 : see if this is a syslog.h system
14967 set syslog.h i_syslog
14968 eval $inhdr
14969
14970
14971 : see if this is a sys/mode.h system
14972 set sys/mode.h i_sysmode
14973 eval $inhdr
14974
14975 : see if sys/resource.h has to be included
14976 set sys/resource.h i_sysresrc
14977 eval $inhdr
14978
14979 : see if sys/security.h is available
14980 set sys/security.h i_syssecrt
14981 eval $inhdr
14982
14983 : see if this is a sys/statvfs.h system
14984 set sys/statvfs.h i_sysstatvfs
14985 eval $inhdr
14986
14987 : see if this is a sys/uio.h system
14988 set sys/uio.h i_sysuio
14989 eval $inhdr
14990
14991 : see if this is a sys/un.h system
14992 set sys/un.h i_sysun
14993 eval $inhdr
14994
14995
14996 : see if this is a sys/utsname.h system
14997 set sys/utsname.h i_sysutsname
14998 eval $inhdr
14999
15000 : see if this is a syswait system
15001 set sys/wait.h i_syswait
15002 eval $inhdr
15003
15004 : see if this is a ustat.h system
15005 set ustat.h i_ustat
15006 eval $inhdr
15007
15008 : see if this is an utime system
15009 set utime.h i_utime
15010 eval $inhdr
15011
15012 : see if this is a values.h system
15013 set values.h i_values
15014 eval $inhdr
15015
15016 : see if this is a vfork system
15017 case "$d_vfork" in
15018 "$define")
15019         set vfork.h i_vfork
15020         eval $inhdr
15021         ;;
15022 *)
15023         i_vfork="$undef"
15024         ;;
15025 esac
15026
15027 : see if gdbm.h is available
15028 set gdbm.h t_gdbm
15029 eval $inhdr
15030 case "$t_gdbm" in
15031 $define)
15032         : see if gdbm_open exists
15033         set gdbm_open d_gdbm_open
15034         eval $inlibc
15035         case "$d_gdbm_open" in
15036         $undef)
15037                 t_gdbm="$undef"
15038                 echo "We won't be including <gdbm.h>"
15039                 ;;
15040         esac
15041         ;;
15042 esac
15043 val="$t_gdbm"
15044 set i_gdbm
15045 eval $setvar
15046
15047 echo " "
15048 echo "Looking for extensions..." >&4
15049 : If we are using the old config.sh, known_extensions may contain
15050 : old or inaccurate or duplicate values.
15051 known_extensions=''
15052 nonxs_extensions=''
15053 : We do not use find because it might not be available.
15054 : We do not just use MANIFEST because the user may have dropped
15055 : some additional extensions into the source tree and expect them
15056 : to be built.
15057
15058 : Function to recursively find available extensions, ignoring DynaLoader
15059 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15060 find_extensions='
15061     for xxx in *; do
15062        case "$xxx" in
15063            DynaLoader|dynaload) ;;
15064            *)
15065            if $test -f $xxx/$xxx.xs; then
15066                known_extensions="$known_extensions $1$xxx";
15067            elif $test -f $xxx/Makefile.PL; then
15068                nonxs_extensions="$nonxs_extensions $1$xxx";
15069            else
15070                if $test -d $xxx -a $# -lt 10; then
15071                    set $1$xxx/ $*;
15072                    cd $xxx;
15073                    eval $find_extensions;
15074                    cd ..;
15075                    shift;
15076                fi;
15077            fi
15078            ;;
15079        esac;
15080     done'
15081 tdir=`pwd`
15082 cd $rsrc/ext
15083 set X
15084 shift
15085 eval $find_extensions
15086 set X $nonxs_extensions
15087 shift
15088 nonxs_extensions="$*"
15089 set X $known_extensions
15090 shift
15091 known_extensions="$*"
15092 cd $tdir
15093
15094 : Now see which are supported on this system.
15095 avail_ext=''
15096 for xxx in $known_extensions ; do
15097         case "$xxx" in
15098         DB_File|db_file)
15099                 case "$i_db" in
15100                 $define) avail_ext="$avail_ext $xxx" ;;
15101                 esac
15102                 ;;
15103         GDBM_File|gdbm_fil)
15104                 case "$i_gdbm" in 
15105                 $define) avail_ext="$avail_ext $xxx" ;;
15106                 esac
15107                 ;;
15108         NDBM_File|ndbm_fil)
15109                 case "$i_ndbm" in
15110                 $define)
15111                     case "$osname-$use64bitint" in
15112                     hpux-define)
15113                         case "$libs" in
15114                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15115                         esac
15116                         ;;
15117                     *) avail_ext="$avail_ext $xxx" ;;
15118                     esac
15119                     ;;
15120                 esac
15121                 ;;
15122         ODBM_File|odbm_fil) 
15123                 case "${i_dbm}${i_rpcsvcdbm}" in
15124                 *"${define}"*)
15125                     case "$osname-$use64bitint" in
15126                     hpux-define)
15127                         case "$libs" in
15128                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15129                         esac
15130                         ;;
15131                     *) avail_ext="$avail_ext $xxx" ;;
15132                     esac
15133                     ;;
15134                 esac
15135                 ;;
15136         POSIX|posix)
15137                 case "$useposix" in
15138                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15139                 esac
15140                 ;;
15141         Opcode|opcode)
15142                 case "$useopcode" in
15143                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15144                 esac
15145                 ;;
15146         Socket|socket)
15147                 case "$d_socket" in 
15148                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15149                 esac
15150                 ;;
15151         Sys/Syslog|sys/syslog)
15152                 : XXX syslog requires socket
15153                 case "$d_socket" in 
15154                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15155                 esac
15156                 ;;
15157         Thread|thread)
15158                 case "$usethreads" in 
15159                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15160                 esac
15161                 ;;
15162         IPC/SysV|ipc/sysv)
15163                 : XXX Do we need a useipcsysv variable here
15164                 case "${d_msg}${d_sem}${d_shm}" in 
15165                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15166                 esac
15167                 ;;
15168         *)      avail_ext="$avail_ext $xxx"
15169                 ;;
15170         esac
15171 done
15172
15173 set X $avail_ext
15174 shift
15175 avail_ext="$*"
15176
15177 : Now see which nonxs extensions are supported on this system.
15178 : For now assume all are.
15179 nonxs_ext=''
15180 for xxx in $nonxs_extensions ; do
15181         case "$xxx" in
15182         *)      nonxs_ext="$nonxs_ext $xxx"
15183                 ;;
15184         esac
15185 done
15186
15187 set X $nonxs_ext
15188 shift
15189 nonxs_ext="$*"
15190
15191 case $usedl in
15192 $define)
15193         $cat <<EOM
15194 A number of extensions are supplied with $package.  You may choose to
15195 compile these extensions for dynamic loading (the default), compile
15196 them into the $package executable (static loading), or not include
15197 them at all.  Answer "none" to include no extensions.
15198 Note that DynaLoader is always built and need not be mentioned here.
15199
15200 EOM
15201         case "$dynamic_ext" in
15202         '') dflt="$avail_ext" ;;
15203         *)      dflt="$dynamic_ext"
15204                 # Perhaps we are reusing an old out-of-date config.sh.
15205                 case "$hint" in
15206                 previous)
15207                         if test X"$dynamic_ext" != X"$avail_ext"; then
15208                                 $cat <<EOM
15209 NOTICE:  Your previous config.sh list may be incorrect. 
15210 The extensions now available to you are 
15211         ${avail_ext}
15212 but the default list from your previous config.sh is
15213         ${dynamic_ext} 
15214
15215 EOM
15216                         fi
15217                         ;;
15218                 esac
15219                 ;;
15220         esac
15221         case "$dflt" in
15222         '')     dflt=none;;
15223         esac
15224         rp="What extensions do you wish to load dynamically?"
15225         . ./myread
15226         case "$ans" in
15227         none) dynamic_ext=' ' ;;
15228         *) dynamic_ext="$ans" ;;
15229         esac
15230
15231         case "$static_ext" in
15232         '')
15233                 : Exclude those already listed in dynamic linking
15234                 dflt=''
15235                 for xxx in $avail_ext; do
15236                         case " $dynamic_ext " in
15237                         *" $xxx "*) ;;
15238                         *) dflt="$dflt $xxx" ;;
15239                         esac
15240                 done
15241                 set X $dflt
15242                 shift
15243                 dflt="$*"
15244                 ;;
15245         *)  dflt="$static_ext" 
15246                 ;;
15247         esac
15248
15249         case "$dflt" in
15250         '')     dflt=none;;
15251         esac
15252         rp="What extensions do you wish to load statically?"
15253         . ./myread
15254         case "$ans" in
15255         none) static_ext=' ' ;;
15256         *) static_ext="$ans" ;;
15257         esac
15258         ;;
15259 *)
15260         $cat <<EOM
15261 A number of extensions are supplied with $package.  Answer "none" 
15262 to include no extensions. 
15263 Note that DynaLoader is always built and need not be mentioned here.
15264
15265 EOM
15266         case "$static_ext" in
15267         '') dflt="$avail_ext" ;;
15268         *)      dflt="$static_ext"
15269                 # Perhaps we are reusing an old out-of-date config.sh.
15270                 case "$hint" in
15271                 previous)
15272                         if test X"$static_ext" != X"$avail_ext"; then
15273                                 $cat <<EOM
15274 NOTICE:  Your previous config.sh list may be incorrect. 
15275 The extensions now available to you are 
15276         ${avail_ext}
15277 but the default list from your previous config.sh is
15278         ${static_ext} 
15279
15280 EOM
15281                         fi
15282                         ;;
15283                 esac
15284                 ;;
15285         esac
15286         : Exclude those that are not xs extensions
15287         case "$dflt" in
15288         '')     dflt=none;;
15289         esac
15290         rp="What extensions do you wish to include?"
15291         . ./myread
15292         case "$ans" in
15293         none) static_ext=' ' ;;
15294         *) static_ext="$ans" ;;
15295         esac
15296         ;;
15297 esac
15298
15299 set X $dynamic_ext $static_ext $nonxs_ext
15300 shift
15301 extensions="$*"
15302
15303 : Remove libraries needed only for extensions
15304 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15305 : The exception is SunOS 4.x, which needs them.
15306 case "${osname}X${osvers}" in
15307 sunos*X4*)
15308     perllibs="$libs"
15309     ;;
15310 *) case "$usedl" in
15311     $define|true|[yY]*)
15312             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15313             shift
15314             perllibs="$*"
15315             ;;
15316     *)  perllibs="$libs"
15317             ;;
15318     esac
15319     ;;
15320 esac
15321
15322 : Remove build directory name from cppstdin so it can be used from
15323 : either the present location or the final installed location.
15324 echo " "
15325 : Get out of the UU directory to get correct path name.
15326 cd ..
15327 case "$cppstdin" in
15328 `pwd`/cppstdin)
15329         echo "Stripping down cppstdin path name"
15330         cppstdin=cppstdin
15331         ;;
15332 esac
15333 cd UU
15334
15335 : end of configuration questions
15336 echo " "
15337 echo "End of configuration questions."
15338 echo " "
15339
15340 : back to where it started
15341 if test -d ../UU; then
15342         cd ..
15343 fi
15344
15345 : configuration may be patched via a 'config.over' file
15346 if $test -f config.over; then
15347         echo " "
15348         dflt=y
15349         rp='I see a config.over file.  Do you wish to load it?'
15350         . UU/myread
15351         case "$ans" in
15352         n*) echo "OK, I'll ignore it.";;
15353         *)      . ./config.over
15354                 echo "Configuration override changes have been loaded."
15355                 ;;
15356         esac
15357 fi
15358
15359 : in case they want portability, strip down executable paths
15360 case "$d_portable" in
15361 "$define")
15362         echo " "
15363         echo "Stripping down executable paths..." >&4
15364         for file in $loclist $trylist; do
15365                 eval temp=\$$file
15366                 eval $file=`basename $temp`
15367         done
15368         ;;
15369 esac
15370
15371 : create config.sh file
15372 echo " "
15373 echo "Creating config.sh..." >&4
15374 $spitshell <<EOT >config.sh
15375 $startsh
15376 #
15377 # This file was produced by running the Configure script. It holds all the
15378 # definitions figured out by Configure. Should you modify one of these values,
15379 # do not forget to propagate your changes by running "Configure -der". You may
15380 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15381 #
15382
15383 # Package name      : $package
15384 # Source directory  : $src
15385 # Configuration time: $cf_time
15386 # Configured by     : $cf_by
15387 # Target system     : $myuname
15388
15389 Author='$Author'
15390 Date='$Date'
15391 Header='$Header'
15392 Id='$Id'
15393 Locker='$Locker'
15394 Log='$Log'
15395 Mcc='$Mcc'
15396 RCSfile='$RCSfile'
15397 Revision='$Revision'
15398 Source='$Source'
15399 State='$State'
15400 _a='$_a'
15401 _exe='$_exe'
15402 _o='$_o'
15403 afs='$afs'
15404 alignbytes='$alignbytes'
15405 ansi2knr='$ansi2knr'
15406 aphostname='$aphostname'
15407 api_revision='$api_revision'
15408 api_subversion='$api_subversion'
15409 api_version='$api_version'
15410 api_versionstring='$api_versionstring'
15411 ar='$ar'
15412 archlib='$archlib'
15413 archlibexp='$archlibexp'
15414 archname64='$archname64'
15415 archname='$archname'
15416 archobjs='$archobjs'
15417 awk='$awk'
15418 baserev='$baserev'
15419 bash='$bash'
15420 bin='$bin'
15421 bincompat5005='$bincompat5005'
15422 binexp='$binexp'
15423 bison='$bison'
15424 byacc='$byacc'
15425 byteorder='$byteorder'
15426 c='$c'
15427 castflags='$castflags'
15428 cat='$cat'
15429 cc='$cc'
15430 cccdlflags='$cccdlflags'
15431 ccdlflags='$ccdlflags'
15432 ccflags='$ccflags'
15433 ccflags_uselargefiles='$ccflags_uselargefiles'
15434 ccname='$ccname'
15435 ccsymbols='$ccsymbols'
15436 ccversion='$ccversion'
15437 cf_by='$cf_by'
15438 cf_email='$cf_email'
15439 cf_time='$cf_time'
15440 charsize='$charsize'
15441 chgrp='$chgrp'
15442 chmod='$chmod'
15443 chown='$chown'
15444 clocktype='$clocktype'
15445 comm='$comm'
15446 compress='$compress'
15447 contains='$contains'
15448 cp='$cp'
15449 cpio='$cpio'
15450 cpp='$cpp'
15451 cpp_stuff='$cpp_stuff'
15452 cppccsymbols='$cppccsymbols'
15453 cppflags='$cppflags'
15454 cpplast='$cpplast'
15455 cppminus='$cppminus'
15456 cpprun='$cpprun'
15457 cppstdin='$cppstdin'
15458 cppsymbols='$cppsymbols'
15459 crosscompile='$crosscompile'
15460 cryptlib='$cryptlib'
15461 csh='$csh'
15462 d_Gconvert='$d_Gconvert'
15463 d_PRIEUldbl='$d_PRIEUldbl'
15464 d_PRIFUldbl='$d_PRIFUldbl'
15465 d_PRIGUldbl='$d_PRIGUldbl'
15466 d_PRIXU64='$d_PRIXU64'
15467 d_PRId64='$d_PRId64'
15468 d_PRIeldbl='$d_PRIeldbl'
15469 d_PRIfldbl='$d_PRIfldbl'
15470 d_PRIgldbl='$d_PRIgldbl'
15471 d_PRIi64='$d_PRIi64'
15472 d_PRIo64='$d_PRIo64'
15473 d_PRIu64='$d_PRIu64'
15474 d_PRIx64='$d_PRIx64'
15475 d_SCNfldbl='$d_SCNfldbl'
15476 d_access='$d_access'
15477 d_accessx='$d_accessx'
15478 d_alarm='$d_alarm'
15479 d_archlib='$d_archlib'
15480 d_atolf='$d_atolf'
15481 d_atoll='$d_atoll'
15482 d_attribut='$d_attribut'
15483 d_bcmp='$d_bcmp'
15484 d_bcopy='$d_bcopy'
15485 d_bincompat5005='$d_bincompat5005'
15486 d_bsd='$d_bsd'
15487 d_bsdgetpgrp='$d_bsdgetpgrp'
15488 d_bsdsetpgrp='$d_bsdsetpgrp'
15489 d_bzero='$d_bzero'
15490 d_casti32='$d_casti32'
15491 d_castneg='$d_castneg'
15492 d_charvspr='$d_charvspr'
15493 d_chown='$d_chown'
15494 d_chroot='$d_chroot'
15495 d_chsize='$d_chsize'
15496 d_closedir='$d_closedir'
15497 d_const='$d_const'
15498 d_crypt='$d_crypt'
15499 d_csh='$d_csh'
15500 d_cuserid='$d_cuserid'
15501 d_dbl_dig='$d_dbl_dig'
15502 d_difftime='$d_difftime'
15503 d_dirnamlen='$d_dirnamlen'
15504 d_dlerror='$d_dlerror'
15505 d_dlopen='$d_dlopen'
15506 d_dlsymun='$d_dlsymun'
15507 d_dosuid='$d_dosuid'
15508 d_drand48proto='$d_drand48proto'
15509 d_dup2='$d_dup2'
15510 d_eaccess='$d_eaccess'
15511 d_endgrent='$d_endgrent'
15512 d_endhent='$d_endhent'
15513 d_endnent='$d_endnent'
15514 d_endpent='$d_endpent'
15515 d_endpwent='$d_endpwent'
15516 d_endsent='$d_endsent'
15517 d_eofnblk='$d_eofnblk'
15518 d_eunice='$d_eunice'
15519 d_fchmod='$d_fchmod'
15520 d_fchown='$d_fchown'
15521 d_fcntl='$d_fcntl'
15522 d_fcntl_can_lock='$d_fcntl_can_lock'
15523 d_fd_macros='$d_fd_macros'
15524 d_fd_set='$d_fd_set'
15525 d_fds_bits='$d_fds_bits'
15526 d_fgetpos='$d_fgetpos'
15527 d_flexfnam='$d_flexfnam'
15528 d_flock='$d_flock'
15529 d_fork='$d_fork'
15530 d_fpathconf='$d_fpathconf'
15531 d_fpos64_t='$d_fpos64_t'
15532 d_frexpl='$d_frexpl'
15533 d_fs_data_s='$d_fs_data_s'
15534 d_fseeko='$d_fseeko'
15535 d_fsetpos='$d_fsetpos'
15536 d_fstatfs='$d_fstatfs'
15537 d_fstatvfs='$d_fstatvfs'
15538 d_ftello='$d_ftello'
15539 d_ftime='$d_ftime'
15540 d_getcwd='$d_getcwd'
15541 d_getespwnam='$d_getespwnam'
15542 d_getfsstat='$d_getfsstat'
15543 d_getgrent='$d_getgrent'
15544 d_getgrps='$d_getgrps'
15545 d_gethbyaddr='$d_gethbyaddr'
15546 d_gethbyname='$d_gethbyname'
15547 d_gethent='$d_gethent'
15548 d_gethname='$d_gethname'
15549 d_gethostprotos='$d_gethostprotos'
15550 d_getlogin='$d_getlogin'
15551 d_getmnt='$d_getmnt'
15552 d_getmntent='$d_getmntent'
15553 d_getnbyaddr='$d_getnbyaddr'
15554 d_getnbyname='$d_getnbyname'
15555 d_getnent='$d_getnent'
15556 d_getnetprotos='$d_getnetprotos'
15557 d_getpbyname='$d_getpbyname'
15558 d_getpbynumber='$d_getpbynumber'
15559 d_getpent='$d_getpent'
15560 d_getpgid='$d_getpgid'
15561 d_getpgrp2='$d_getpgrp2'
15562 d_getpgrp='$d_getpgrp'
15563 d_getppid='$d_getppid'
15564 d_getprior='$d_getprior'
15565 d_getprotoprotos='$d_getprotoprotos'
15566 d_getprpwnam='$d_getprpwnam'
15567 d_getpwent='$d_getpwent'
15568 d_getsbyname='$d_getsbyname'
15569 d_getsbyport='$d_getsbyport'
15570 d_getsent='$d_getsent'
15571 d_getservprotos='$d_getservprotos'
15572 d_getspnam='$d_getspnam'
15573 d_gettimeod='$d_gettimeod'
15574 d_gnulibc='$d_gnulibc'
15575 d_grpasswd='$d_grpasswd'
15576 d_hasmntopt='$d_hasmntopt'
15577 d_htonl='$d_htonl'
15578 d_iconv='$d_iconv'
15579 d_index='$d_index'
15580 d_inetaton='$d_inetaton'
15581 d_int64_t='$d_int64_t'
15582 d_isascii='$d_isascii'
15583 d_isnan='$d_isnan'
15584 d_isnanl='$d_isnanl'
15585 d_killpg='$d_killpg'
15586 d_lchown='$d_lchown'
15587 d_ldbl_dig='$d_ldbl_dig'
15588 d_link='$d_link'
15589 d_locconv='$d_locconv'
15590 d_lockf='$d_lockf'
15591 d_longdbl='$d_longdbl'
15592 d_longlong='$d_longlong'
15593 d_lseekproto='$d_lseekproto'
15594 d_lstat='$d_lstat'
15595 d_madvise='$d_madvise'
15596 d_mblen='$d_mblen'
15597 d_mbstowcs='$d_mbstowcs'
15598 d_mbtowc='$d_mbtowc'
15599 d_memchr='$d_memchr'
15600 d_memcmp='$d_memcmp'
15601 d_memcpy='$d_memcpy'
15602 d_memmove='$d_memmove'
15603 d_memset='$d_memset'
15604 d_mkdir='$d_mkdir'
15605 d_mkdtemp='$d_mkdtemp'
15606 d_mkfifo='$d_mkfifo'
15607 d_mkstemp='$d_mkstemp'
15608 d_mkstemps='$d_mkstemps'
15609 d_mktime='$d_mktime'
15610 d_mmap='$d_mmap'
15611 d_modfl='$d_modfl'
15612 d_mprotect='$d_mprotect'
15613 d_msg='$d_msg'
15614 d_msg_ctrunc='$d_msg_ctrunc'
15615 d_msg_dontroute='$d_msg_dontroute'
15616 d_msg_oob='$d_msg_oob'
15617 d_msg_peek='$d_msg_peek'
15618 d_msg_proxy='$d_msg_proxy'
15619 d_msgctl='$d_msgctl'
15620 d_msgget='$d_msgget'
15621 d_msgrcv='$d_msgrcv'
15622 d_msgsnd='$d_msgsnd'
15623 d_msync='$d_msync'
15624 d_munmap='$d_munmap'
15625 d_mymalloc='$d_mymalloc'
15626 d_nice='$d_nice'
15627 d_nv_preserves_uv='$d_nv_preserves_uv'
15628 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
15629 d_off64_t='$d_off64_t'
15630 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
15631 d_oldpthreads='$d_oldpthreads'
15632 d_oldsock='$d_oldsock'
15633 d_open3='$d_open3'
15634 d_pathconf='$d_pathconf'
15635 d_pause='$d_pause'
15636 d_perl_otherlibdirs='$d_perl_otherlibdirs'
15637 d_phostname='$d_phostname'
15638 d_pipe='$d_pipe'
15639 d_poll='$d_poll'
15640 d_portable='$d_portable'
15641 d_pthread_yield='$d_pthread_yield'
15642 d_pwage='$d_pwage'
15643 d_pwchange='$d_pwchange'
15644 d_pwclass='$d_pwclass'
15645 d_pwcomment='$d_pwcomment'
15646 d_pwexpire='$d_pwexpire'
15647 d_pwgecos='$d_pwgecos'
15648 d_pwpasswd='$d_pwpasswd'
15649 d_pwquota='$d_pwquota'
15650 d_qgcvt='$d_qgcvt'
15651 d_quad='$d_quad'
15652 d_readdir='$d_readdir'
15653 d_readlink='$d_readlink'
15654 d_rename='$d_rename'
15655 d_rewinddir='$d_rewinddir'
15656 d_rmdir='$d_rmdir'
15657 d_safebcpy='$d_safebcpy'
15658 d_safemcpy='$d_safemcpy'
15659 d_sanemcmp='$d_sanemcmp'
15660 d_sched_yield='$d_sched_yield'
15661 d_scm_rights='$d_scm_rights'
15662 d_seekdir='$d_seekdir'
15663 d_select='$d_select'
15664 d_sem='$d_sem'
15665 d_semctl='$d_semctl'
15666 d_semctl_semid_ds='$d_semctl_semid_ds'
15667 d_semctl_semun='$d_semctl_semun'
15668 d_semget='$d_semget'
15669 d_semop='$d_semop'
15670 d_setegid='$d_setegid'
15671 d_seteuid='$d_seteuid'
15672 d_setgrent='$d_setgrent'
15673 d_setgrps='$d_setgrps'
15674 d_sethent='$d_sethent'
15675 d_setlinebuf='$d_setlinebuf'
15676 d_setlocale='$d_setlocale'
15677 d_setnent='$d_setnent'
15678 d_setpent='$d_setpent'
15679 d_setpgid='$d_setpgid'
15680 d_setpgrp2='$d_setpgrp2'
15681 d_setpgrp='$d_setpgrp'
15682 d_setprior='$d_setprior'
15683 d_setproctitle='$d_setproctitle'
15684 d_setpwent='$d_setpwent'
15685 d_setregid='$d_setregid'
15686 d_setresgid='$d_setresgid'
15687 d_setresuid='$d_setresuid'
15688 d_setreuid='$d_setreuid'
15689 d_setrgid='$d_setrgid'
15690 d_setruid='$d_setruid'
15691 d_setsent='$d_setsent'
15692 d_setsid='$d_setsid'
15693 d_setvbuf='$d_setvbuf'
15694 d_sfio='$d_sfio'
15695 d_shm='$d_shm'
15696 d_shmat='$d_shmat'
15697 d_shmatprototype='$d_shmatprototype'
15698 d_shmctl='$d_shmctl'
15699 d_shmdt='$d_shmdt'
15700 d_shmget='$d_shmget'
15701 d_sigaction='$d_sigaction'
15702 d_sigsetjmp='$d_sigsetjmp'
15703 d_socket='$d_socket'
15704 d_socklen_t='$d_socklen_t'
15705 d_sockpair='$d_sockpair'
15706 d_socks5_init='$d_socks5_init'
15707 d_sqrtl='$d_sqrtl'
15708 d_statblks='$d_statblks'
15709 d_statfs_f_flags='$d_statfs_f_flags'
15710 d_statfs_s='$d_statfs_s'
15711 d_statvfs='$d_statvfs'
15712 d_stdio_cnt_lval='$d_stdio_cnt_lval'
15713 d_stdio_ptr_lval='$d_stdio_ptr_lval'
15714 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
15715 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
15716 d_stdio_stream_array='$d_stdio_stream_array'
15717 d_stdiobase='$d_stdiobase'
15718 d_stdstdio='$d_stdstdio'
15719 d_strchr='$d_strchr'
15720 d_strcoll='$d_strcoll'
15721 d_strctcpy='$d_strctcpy'
15722 d_strerrm='$d_strerrm'
15723 d_strerror='$d_strerror'
15724 d_strtod='$d_strtod'
15725 d_strtol='$d_strtol'
15726 d_strtold='$d_strtold'
15727 d_strtoll='$d_strtoll'
15728 d_strtoul='$d_strtoul'
15729 d_strtoull='$d_strtoull'
15730 d_strtouq='$d_strtouq'
15731 d_strxfrm='$d_strxfrm'
15732 d_suidsafe='$d_suidsafe'
15733 d_symlink='$d_symlink'
15734 d_syscall='$d_syscall'
15735 d_sysconf='$d_sysconf'
15736 d_sysernlst='$d_sysernlst'
15737 d_syserrlst='$d_syserrlst'
15738 d_system='$d_system'
15739 d_tcgetpgrp='$d_tcgetpgrp'
15740 d_tcsetpgrp='$d_tcsetpgrp'
15741 d_telldir='$d_telldir'
15742 d_telldirproto='$d_telldirproto'
15743 d_time='$d_time'
15744 d_times='$d_times'
15745 d_truncate='$d_truncate'
15746 d_tzname='$d_tzname'
15747 d_umask='$d_umask'
15748 d_uname='$d_uname'
15749 d_union_semun='$d_union_semun'
15750 d_ustat='$d_ustat'
15751 d_vendorarch='$d_vendorarch'
15752 d_vendorbin='$d_vendorbin'
15753 d_vendorlib='$d_vendorlib'
15754 d_vfork='$d_vfork'
15755 d_void_closedir='$d_void_closedir'
15756 d_voidsig='$d_voidsig'
15757 d_voidtty='$d_voidtty'
15758 d_volatile='$d_volatile'
15759 d_vprintf='$d_vprintf'
15760 d_wait4='$d_wait4'
15761 d_waitpid='$d_waitpid'
15762 d_wcstombs='$d_wcstombs'
15763 d_wctomb='$d_wctomb'
15764 d_xenix='$d_xenix'
15765 date='$date'
15766 db_hashtype='$db_hashtype'
15767 db_prefixtype='$db_prefixtype'
15768 defvoidused='$defvoidused'
15769 direntrytype='$direntrytype'
15770 dlext='$dlext'
15771 dlsrc='$dlsrc'
15772 doublesize='$doublesize'
15773 drand01='$drand01'
15774 dynamic_ext='$dynamic_ext'
15775 eagain='$eagain'
15776 ebcdic='$ebcdic'
15777 echo='$echo'
15778 egrep='$egrep'
15779 emacs='$emacs'
15780 eunicefix='$eunicefix'
15781 exe_ext='$exe_ext'
15782 expr='$expr'
15783 extensions='$extensions'
15784 fflushNULL='$fflushNULL'
15785 fflushall='$fflushall'
15786 find='$find'
15787 firstmakefile='$firstmakefile'
15788 flex='$flex'
15789 fpossize='$fpossize'
15790 fpostype='$fpostype'
15791 freetype='$freetype'
15792 full_ar='$full_ar'
15793 full_csh='$full_csh'
15794 full_sed='$full_sed'
15795 gccosandvers='$gccosandvers'
15796 gccversion='$gccversion'
15797 gidformat='$gidformat'
15798 gidsign='$gidsign'
15799 gidsize='$gidsize'
15800 gidtype='$gidtype'
15801 glibpth='$glibpth'
15802 grep='$grep'
15803 groupcat='$groupcat'
15804 groupstype='$groupstype'
15805 gzip='$gzip'
15806 h_fcntl='$h_fcntl'
15807 h_sysfile='$h_sysfile'
15808 hint='$hint'
15809 hostcat='$hostcat'
15810 i16size='$i16size'
15811 i16type='$i16type'
15812 i32size='$i32size'
15813 i32type='$i32type'
15814 i64size='$i64size'
15815 i64type='$i64type'
15816 i8size='$i8size'
15817 i8type='$i8type'
15818 i_arpainet='$i_arpainet'
15819 i_bsdioctl='$i_bsdioctl'
15820 i_db='$i_db'
15821 i_dbm='$i_dbm'
15822 i_dirent='$i_dirent'
15823 i_dld='$i_dld'
15824 i_dlfcn='$i_dlfcn'
15825 i_fcntl='$i_fcntl'
15826 i_float='$i_float'
15827 i_gdbm='$i_gdbm'
15828 i_grp='$i_grp'
15829 i_iconv='$i_iconv'
15830 i_ieeefp='$i_ieeefp'
15831 i_inttypes='$i_inttypes'
15832 i_libutil='$i_libutil'
15833 i_limits='$i_limits'
15834 i_locale='$i_locale'
15835 i_machcthr='$i_machcthr'
15836 i_malloc='$i_malloc'
15837 i_math='$i_math'
15838 i_memory='$i_memory'
15839 i_mntent='$i_mntent'
15840 i_ndbm='$i_ndbm'
15841 i_netdb='$i_netdb'
15842 i_neterrno='$i_neterrno'
15843 i_netinettcp='$i_netinettcp'
15844 i_niin='$i_niin'
15845 i_poll='$i_poll'
15846 i_prot='$i_prot'
15847 i_pthread='$i_pthread'
15848 i_pwd='$i_pwd'
15849 i_rpcsvcdbm='$i_rpcsvcdbm'
15850 i_sfio='$i_sfio'
15851 i_sgtty='$i_sgtty'
15852 i_shadow='$i_shadow'
15853 i_socks='$i_socks'
15854 i_stdarg='$i_stdarg'
15855 i_stddef='$i_stddef'
15856 i_stdlib='$i_stdlib'
15857 i_string='$i_string'
15858 i_sunmath='$i_sunmath'
15859 i_sysaccess='$i_sysaccess'
15860 i_sysdir='$i_sysdir'
15861 i_sysfile='$i_sysfile'
15862 i_sysfilio='$i_sysfilio'
15863 i_sysin='$i_sysin'
15864 i_sysioctl='$i_sysioctl'
15865 i_syslog='$i_syslog'
15866 i_sysmman='$i_sysmman'
15867 i_sysmode='$i_sysmode'
15868 i_sysmount='$i_sysmount'
15869 i_sysndir='$i_sysndir'
15870 i_sysparam='$i_sysparam'
15871 i_sysresrc='$i_sysresrc'
15872 i_syssecrt='$i_syssecrt'
15873 i_sysselct='$i_sysselct'
15874 i_syssockio='$i_syssockio'
15875 i_sysstat='$i_sysstat'
15876 i_sysstatfs='$i_sysstatfs'
15877 i_sysstatvfs='$i_sysstatvfs'
15878 i_systime='$i_systime'
15879 i_systimek='$i_systimek'
15880 i_systimes='$i_systimes'
15881 i_systypes='$i_systypes'
15882 i_sysuio='$i_sysuio'
15883 i_sysun='$i_sysun'
15884 i_sysutsname='$i_sysutsname'
15885 i_sysvfs='$i_sysvfs'
15886 i_syswait='$i_syswait'
15887 i_termio='$i_termio'
15888 i_termios='$i_termios'
15889 i_time='$i_time'
15890 i_unistd='$i_unistd'
15891 i_ustat='$i_ustat'
15892 i_utime='$i_utime'
15893 i_values='$i_values'
15894 i_varargs='$i_varargs'
15895 i_varhdr='$i_varhdr'
15896 i_vfork='$i_vfork'
15897 ignore_versioned_solibs='$ignore_versioned_solibs'
15898 inc_version_list='$inc_version_list'
15899 inc_version_list_init='$inc_version_list_init'
15900 incpath='$incpath'
15901 inews='$inews'
15902 installarchlib='$installarchlib'
15903 installbin='$installbin'
15904 installman1dir='$installman1dir'
15905 installman3dir='$installman3dir'
15906 installprefix='$installprefix'
15907 installprefixexp='$installprefixexp'
15908 installprivlib='$installprivlib'
15909 installscript='$installscript'
15910 installsitearch='$installsitearch'
15911 installsitebin='$installsitebin'
15912 installsitelib='$installsitelib'
15913 installstyle='$installstyle'
15914 installusrbinperl='$installusrbinperl'
15915 installvendorarch='$installvendorarch'
15916 installvendorbin='$installvendorbin'
15917 installvendorlib='$installvendorlib'
15918 intsize='$intsize'
15919 ivdformat='$ivdformat'
15920 ivsize='$ivsize'
15921 ivtype='$ivtype'
15922 known_extensions='$known_extensions'
15923 ksh='$ksh'
15924 ld='$ld'
15925 lddlflags='$lddlflags'
15926 ldflags='$ldflags'
15927 ldflags_uselargefiles='$ldflags_uselargefiles'
15928 ldlibpthname='$ldlibpthname'
15929 less='$less'
15930 lib_ext='$lib_ext'
15931 libc='$libc'
15932 libperl='$libperl'
15933 libpth='$libpth'
15934 libs='$libs'
15935 libsdirs='$libsdirs'
15936 libsfiles='$libsfiles'
15937 libsfound='$libsfound'
15938 libspath='$libspath'
15939 libswanted='$libswanted'
15940 libswanted_uselargefiles='$libswanted_uselargefiles'
15941 line='$line'
15942 lint='$lint'
15943 lkflags='$lkflags'
15944 ln='$ln'
15945 lns='$lns'
15946 locincpth='$locincpth'
15947 loclibpth='$loclibpth'
15948 longdblsize='$longdblsize'
15949 longlongsize='$longlongsize'
15950 longsize='$longsize'
15951 lp='$lp'
15952 lpr='$lpr'
15953 ls='$ls'
15954 lseeksize='$lseeksize'
15955 lseektype='$lseektype'
15956 mail='$mail'
15957 mailx='$mailx'
15958 make='$make'
15959 make_set_make='$make_set_make'
15960 mallocobj='$mallocobj'
15961 mallocsrc='$mallocsrc'
15962 malloctype='$malloctype'
15963 man1dir='$man1dir'
15964 man1direxp='$man1direxp'
15965 man1ext='$man1ext'
15966 man3dir='$man3dir'
15967 man3direxp='$man3direxp'
15968 man3ext='$man3ext'
15969 mips_type='$mips_type'
15970 mkdir='$mkdir'
15971 mmaptype='$mmaptype'
15972 modetype='$modetype'
15973 more='$more'
15974 multiarch='$multiarch'
15975 mv='$mv'
15976 myarchname='$myarchname'
15977 mydomain='$mydomain'
15978 myhostname='$myhostname'
15979 myuname='$myuname'
15980 n='$n'
15981 netdb_hlen_type='$netdb_hlen_type'
15982 netdb_host_type='$netdb_host_type'
15983 netdb_name_type='$netdb_name_type'
15984 netdb_net_type='$netdb_net_type'
15985 nm='$nm'
15986 nm_opt='$nm_opt'
15987 nm_so_opt='$nm_so_opt'
15988 nonxs_ext='$nonxs_ext'
15989 nroff='$nroff'
15990 nvEUformat='$nvEUformat'
15991 nvFUformat='$nvFUformat'
15992 nvGUformat='$nvGUformat'
15993 nveformat='$nveformat'
15994 nvfformat='$nvfformat'
15995 nvgformat='$nvgformat'
15996 nvsize='$nvsize'
15997 nvtype='$nvtype'
15998 o_nonblock='$o_nonblock'
15999 obj_ext='$obj_ext'
16000 old_pthread_create_joinable='$old_pthread_create_joinable'
16001 optimize='$optimize'
16002 orderlib='$orderlib'
16003 osname='$osname'
16004 osvers='$osvers'
16005 otherlibdirs='$otherlibdirs'
16006 package='$package'
16007 pager='$pager'
16008 passcat='$passcat'
16009 patchlevel='$patchlevel'
16010 path_sep='$path_sep'
16011 perl5='$perl5'
16012 perl='$perl'
16013 perladmin='$perladmin'
16014 perllibs='$perllibs'
16015 perlpath='$perlpath'
16016 pg='$pg'
16017 phostname='$phostname'
16018 pidtype='$pidtype'
16019 plibpth='$plibpth'
16020 pm_apiversion='$pm_apiversion'
16021 pmake='$pmake'
16022 pr='$pr'
16023 prefix='$prefix'
16024 prefixexp='$prefixexp'
16025 privlib='$privlib'
16026 privlibexp='$privlibexp'
16027 prototype='$prototype'
16028 ptrsize='$ptrsize'
16029 quadkind='$quadkind'
16030 quadtype='$quadtype'
16031 randbits='$randbits'
16032 randfunc='$randfunc'
16033 randseedtype='$randseedtype'
16034 ranlib='$ranlib'
16035 rd_nodata='$rd_nodata'
16036 revision='$revision'
16037 rm='$rm'
16038 rmail='$rmail'
16039 runnm='$runnm'
16040 sPRIEUldbl='$sPRIEUldbl'
16041 sPRIFUldbl='$sPRIFUldbl'
16042 sPRIGUldbl='$sPRIGUldbl'
16043 sPRIXU64='$sPRIXU64'
16044 sPRId64='$sPRId64'
16045 sPRIeldbl='$sPRIeldbl'
16046 sPRIfldbl='$sPRIfldbl'
16047 sPRIgldbl='$sPRIgldbl'
16048 sPRIi64='$sPRIi64'
16049 sPRIo64='$sPRIo64'
16050 sPRIu64='$sPRIu64'
16051 sPRIx64='$sPRIx64'
16052 sSCNfldbl='$sSCNfldbl'
16053 sched_yield='$sched_yield'
16054 scriptdir='$scriptdir'
16055 scriptdirexp='$scriptdirexp'
16056 sed='$sed'
16057 seedfunc='$seedfunc'
16058 selectminbits='$selectminbits'
16059 selecttype='$selecttype'
16060 sendmail='$sendmail'
16061 sh='$sh'
16062 shar='$shar'
16063 sharpbang='$sharpbang'
16064 shmattype='$shmattype'
16065 shortsize='$shortsize'
16066 shrpenv='$shrpenv'
16067 shsharp='$shsharp'
16068 sig_count='$sig_count'
16069 sig_name='$sig_name'
16070 sig_name_init='$sig_name_init'
16071 sig_num='$sig_num'
16072 sig_num_init='$sig_num_init'
16073 signal_t='$signal_t'
16074 sitearch='$sitearch'
16075 sitearchexp='$sitearchexp'
16076 sitebin='$sitebin'
16077 sitebinexp='$sitebinexp'
16078 sitelib='$sitelib'
16079 sitelib_stem='$sitelib_stem'
16080 sitelibexp='$sitelibexp'
16081 siteprefix='$siteprefix'
16082 siteprefixexp='$siteprefixexp'
16083 sizesize='$sizesize'
16084 sizetype='$sizetype'
16085 sleep='$sleep'
16086 smail='$smail'
16087 so='$so'
16088 sockethdr='$sockethdr'
16089 socketlib='$socketlib'
16090 socksizetype='$socksizetype'
16091 sort='$sort'
16092 spackage='$spackage'
16093 spitshell='$spitshell'
16094 src='$src'
16095 ssizetype='$ssizetype'
16096 startperl='$startperl'
16097 startsh='$startsh'
16098 static_ext='$static_ext'
16099 stdchar='$stdchar'
16100 stdio_base='$stdio_base'
16101 stdio_bufsiz='$stdio_bufsiz'
16102 stdio_cnt='$stdio_cnt'
16103 stdio_filbuf='$stdio_filbuf'
16104 stdio_ptr='$stdio_ptr'
16105 stdio_stream_array='$stdio_stream_array'
16106 strings='$strings'
16107 submit='$submit'
16108 subversion='$subversion'
16109 sysman='$sysman'
16110 tail='$tail'
16111 tar='$tar'
16112 tbl='$tbl'
16113 tee='$tee'
16114 test='$test'
16115 timeincl='$timeincl'
16116 timetype='$timetype'
16117 touch='$touch'
16118 tr='$tr'
16119 trnl='$trnl'
16120 troff='$troff'
16121 u16size='$u16size'
16122 u16type='$u16type'
16123 u32size='$u32size'
16124 u32type='$u32type'
16125 u64size='$u64size'
16126 u64type='$u64type'
16127 u8size='$u8size'
16128 u8type='$u8type'
16129 uidformat='$uidformat'
16130 uidsign='$uidsign'
16131 uidsize='$uidsize'
16132 uidtype='$uidtype'
16133 uname='$uname'
16134 uniq='$uniq'
16135 uquadtype='$uquadtype'
16136 use5005threads='$use5005threads'
16137 use64bitall='$use64bitall'
16138 use64bitint='$use64bitint'
16139 usedl='$usedl'
16140 useithreads='$useithreads'
16141 uselargefiles='$uselargefiles'
16142 uselongdouble='$uselongdouble'
16143 usemorebits='$usemorebits'
16144 usemultiplicity='$usemultiplicity'
16145 usemymalloc='$usemymalloc'
16146 usenm='$usenm'
16147 useopcode='$useopcode'
16148 useperlio='$useperlio'
16149 useposix='$useposix'
16150 usesfio='$usesfio'
16151 useshrplib='$useshrplib'
16152 usesocks='$usesocks'
16153 usethreads='$usethreads'
16154 usevendorprefix='$usevendorprefix'
16155 usevfork='$usevfork'
16156 usrinc='$usrinc'
16157 uuname='$uuname'
16158 uvXUformat='$uvXUformat'
16159 uvoformat='$uvoformat'
16160 uvsize='$uvsize'
16161 uvtype='$uvtype'
16162 uvuformat='$uvuformat'
16163 uvxformat='$uvxformat'
16164 vendorarch='$vendorarch'
16165 vendorarchexp='$vendorarchexp'
16166 vendorbin='$vendorbin'
16167 vendorbinexp='$vendorbinexp'
16168 vendorlib='$vendorlib'
16169 vendorlib_stem='$vendorlib_stem'
16170 vendorlibexp='$vendorlibexp'
16171 vendorprefix='$vendorprefix'
16172 vendorprefixexp='$vendorprefixexp'
16173 version='$version'
16174 versiononly='$versiononly'
16175 vi='$vi'
16176 voidflags='$voidflags'
16177 xlibpth='$xlibpth'
16178 xs_apiversion='$xs_apiversion'
16179 zcat='$zcat'
16180 zip='$zip'
16181 EOT
16182
16183 : Add in command line options if available
16184 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16185
16186 : add special variables
16187 $test -f $src/patchlevel.h && \
16188 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16189 echo "CONFIGDOTSH=true" >>config.sh
16190
16191 : propagate old symbols
16192 if $test -f UU/config.sh; then
16193         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16194         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16195         $sort | $uniq -u >UU/oldsyms
16196         set X `cat UU/oldsyms`
16197         shift
16198         case $# in
16199         0) ;;
16200         *)
16201                 cat <<EOM
16202 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16203 EOM
16204                 echo "# Variables propagated from previous config.sh file." >>config.sh
16205                 for sym in `cat UU/oldsyms`; do
16206                         echo "    Propagating $hint variable "'$'"$sym..."
16207                         eval 'tmp="$'"${sym}"'"'
16208                         echo "$tmp" | \
16209                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16210                 done
16211                 ;;
16212         esac
16213 fi
16214
16215 : Finish up by extracting the .SH files
16216 case "$alldone" in
16217 exit)
16218         $rm -rf UU
16219         echo "Done."
16220         exit 0
16221         ;;
16222 cont)
16223         ;;
16224 '')
16225         dflt=''
16226         nostick=true
16227         $cat <<EOM
16228
16229 If you'd like to make any changes to the config.sh file before I begin
16230 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16231
16232 EOM
16233         rp="Press return or use a shell escape to edit config.sh:"
16234         . UU/myread
16235         nostick=''
16236         case "$ans" in
16237         '') ;;
16238         *) : in case they cannot read
16239                 sh 1>&4 -c "$ans";;
16240         esac
16241         ;;
16242 esac
16243
16244 : if this fails, just run all the .SH files by hand
16245 . ./config.sh
16246
16247 echo " "
16248 exec 1>&4
16249 . ./UU/extract
16250
16251 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16252         dflt=y
16253         case "$silent" in
16254         true) ;;
16255         *)
16256                 $cat <<EOM
16257
16258 Now you need to generate make dependencies by running "$make depend".
16259 You might prefer to run it in background: "$make depend > makedepend.out &"
16260 It can take a while, so you might not want to run it right now.
16261
16262 EOM
16263                 ;;
16264         esac
16265         rp="Run $make depend now?"
16266         . UU/myread
16267         case "$ans" in
16268         y*)
16269                 $make depend && echo "Now you must run '$make'."
16270                 ;;
16271         *)
16272                 echo "You must run '$make depend' then '$make'."
16273                 ;;
16274         esac
16275 elif test -f [Mm]akefile; then
16276         echo " "
16277         echo "Now you must run a $make."
16278 else
16279         echo "Done."
16280 fi
16281
16282 if $test -f Policy.sh; then
16283     $cat <<EOM
16284
16285 If you compile $package on a different machine or from a different object
16286 directory, copy the Policy.sh file from this object directory to the
16287 new one before you run Configure -- this will help you with most of
16288 the policy defaults.
16289
16290 EOM
16291 fi
16292 if $test -f config.msg; then
16293     echo "Hmm.  I also noted the following information while running:"
16294     echo " "
16295     $cat config.msg >&4
16296     $rm -f config.msg
16297 fi
16298 $rm -f kit*isdone ark*isdone
16299 $rm -rf UU
16300
16301 : End of Configure
16302