0d215f1bd37f8e09359a690bf3141bcbcf1f9022
[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 Fri Feb  4 21:57:24 EET 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 charsize=''
302 contains=''
303 cpp_stuff=''
304 cpplast=''
305 cppminus=''
306 cpprun=''
307 cppstdin=''
308 crosscompile=''
309 d_access=''
310 d_accessx=''
311 d_alarm=''
312 d_attribut=''
313 d_bcmp=''
314 d_bcopy=''
315 d_bzero=''
316 d_casti32=''
317 castflags=''
318 d_castneg=''
319 d_chown=''
320 d_chroot=''
321 d_chsize=''
322 d_closedir=''
323 d_void_closedir=''
324 d_const=''
325 cryptlib=''
326 d_crypt=''
327 d_csh=''
328 full_csh=''
329 d_cuserid=''
330 d_dbl_dig=''
331 d_difftime=''
332 d_dlerror=''
333 d_dlopen=''
334 d_dlsymun=''
335 d_dosuid=''
336 d_suidsafe=''
337 d_drand48proto=''
338 d_dup2=''
339 d_eaccess=''
340 d_endgrent=''
341 d_endhent=''
342 d_endnent=''
343 d_endpent=''
344 d_endpwent=''
345 d_endsent=''
346 d_endspent=''
347 d_fchmod=''
348 d_fchown=''
349 d_fcntl=''
350 d_fd_macros=''
351 d_fd_set=''
352 d_fds_bits=''
353 d_fgetpos=''
354 d_flexfnam=''
355 d_flock=''
356 d_fork=''
357 d_fs_data_s=''
358 d_fseeko=''
359 d_fsetpos=''
360 d_fstatfs=''
361 d_ftello=''
362 d_ftime=''
363 d_gettimeod=''
364 d_Gconvert=''
365 d_getgrent=''
366 d_getgrps=''
367 d_gethbyaddr=''
368 d_gethbyname=''
369 d_gethent=''
370 aphostname=''
371 d_gethname=''
372 d_phostname=''
373 d_uname=''
374 d_gethostprotos=''
375 d_getlogin=''
376 d_getmnt=''
377 d_getmntent=''
378 d_getnbyaddr=''
379 d_getnbyname=''
380 d_getnent=''
381 d_getnetprotos=''
382 d_getpent=''
383 d_getpgid=''
384 d_getpgrp2=''
385 d_bsdgetpgrp=''
386 d_getpgrp=''
387 d_getppid=''
388 d_getprior=''
389 d_getpbyname=''
390 d_getpbynumber=''
391 d_getprotoprotos=''
392 d_getpwent=''
393 d_getsent=''
394 d_getservprotos=''
395 d_getspent=''
396 d_getspnam=''
397 d_getsbyname=''
398 d_getsbyport=''
399 d_gnulibc=''
400 d_hasmntopt=''
401 d_htonl=''
402 d_iconv=''
403 d_inetaton=''
404 d_int64t=''
405 d_isascii=''
406 d_killpg=''
407 d_lchown=''
408 d_ldbl_dig=''
409 d_link=''
410 d_locconv=''
411 d_lockf=''
412 d_longdbl=''
413 longdblsize=''
414 d_longlong=''
415 longlongsize=''
416 d_lstat=''
417 d_mblen=''
418 d_mbstowcs=''
419 d_mbtowc=''
420 d_memchr=''
421 d_memcmp=''
422 d_memcpy=''
423 d_memmove=''
424 d_memset=''
425 d_mkdir=''
426 d_mkfifo=''
427 d_mktime=''
428 d_msg=''
429 d_msgctl=''
430 d_msgget=''
431 d_msgrcv=''
432 d_msgsnd=''
433 d_nice=''
434 d_open3=''
435 d_fpathconf=''
436 d_pathconf=''
437 d_pause=''
438 d_pipe=''
439 d_poll=''
440 d_portable=''
441 d_old_pthread_create_joinable=''
442 old_pthread_create_joinable=''
443 d_pthread_yield=''
444 d_sched_yield=''
445 sched_yield=''
446 d_readdir=''
447 d_rewinddir=''
448 d_seekdir=''
449 d_telldir=''
450 d_readlink=''
451 d_rename=''
452 d_rmdir=''
453 d_safebcpy=''
454 d_safemcpy=''
455 d_sanemcmp=''
456 d_select=''
457 d_sem=''
458 d_semctl=''
459 d_semget=''
460 d_semop=''
461 d_setegid=''
462 d_seteuid=''
463 d_setgrent=''
464 d_setgrps=''
465 d_sethent=''
466 d_setlinebuf=''
467 d_setlocale=''
468 d_setnent=''
469 d_setpent=''
470 d_setpgid=''
471 d_setpgrp2=''
472 d_bsdsetpgrp=''
473 d_setpgrp=''
474 d_setprior=''
475 d_setpwent=''
476 d_setregid=''
477 d_setresgid=''
478 d_setresuid=''
479 d_setreuid=''
480 d_setrgid=''
481 d_setruid=''
482 d_setsent=''
483 d_setsid=''
484 d_setspent=''
485 d_setvbuf=''
486 d_sfio=''
487 usesfio=''
488 d_shm=''
489 d_shmat=''
490 d_shmatprototype=''
491 shmattype=''
492 d_shmctl=''
493 d_shmdt=''
494 d_shmget=''
495 d_sigaction=''
496 d_sigsetjmp=''
497 d_msg_ctrunc=''
498 d_msg_dontroute=''
499 d_msg_oob=''
500 d_msg_peek=''
501 d_msg_proxy=''
502 d_oldsock=''
503 d_scm_rights=''
504 d_socket=''
505 d_sockpair=''
506 sockethdr=''
507 socketlib=''
508 d_sqrtl=''
509 d_statblks=''
510 d_statfs_f_flags=''
511 d_statfs_s=''
512 d_fstatvfs=''
513 d_statvfs=''
514 d_stdio_cnt_lval=''
515 d_stdio_ptr_lval=''
516 d_stdiobase=''
517 d_stdstdio=''
518 stdio_base=''
519 stdio_bufsiz=''
520 stdio_cnt=''
521 stdio_filbuf=''
522 stdio_ptr=''
523 d_index=''
524 d_strchr=''
525 d_strcoll=''
526 d_strctcpy=''
527 d_strerrm=''
528 d_strerror=''
529 d_sysernlst=''
530 d_syserrlst=''
531 d_strtod=''
532 d_strtol=''
533 d_strtold=''
534 d_strtoll=''
535 d_strtoul=''
536 d_strtoull=''
537 d_strtouq=''
538 d_strxfrm=''
539 d_symlink=''
540 d_syscall=''
541 d_sysconf=''
542 d_system=''
543 d_tcgetpgrp=''
544 d_tcsetpgrp=''
545 d_telldirproto=''
546 d_time=''
547 timetype=''
548 clocktype=''
549 d_times=''
550 d_truncate=''
551 d_tzname=''
552 d_umask=''
553 d_semctl_semid_ds=''
554 d_semctl_semun=''
555 d_union_semun=''
556 d_ustat=''
557 d_vfork=''
558 usevfork=''
559 d_voidsig=''
560 signal_t=''
561 d_volatile=''
562 d_charvspr=''
563 d_vprintf=''
564 d_wait4=''
565 d_waitpid=''
566 d_wcstombs=''
567 d_wctomb=''
568 dlext=''
569 cccdlflags=''
570 ccdlflags=''
571 dlsrc=''
572 ld=''
573 lddlflags=''
574 usedl=''
575 doublesize=''
576 ebcdic=''
577 fflushNULL=''
578 fflushall=''
579 fpossize=''
580 fpostype=''
581 gidformat=''
582 gidsign=''
583 gidsize=''
584 gidtype=''
585 groupstype=''
586 h_fcntl=''
587 h_sysfile=''
588 i_arpainet=''
589 db_hashtype=''
590 db_prefixtype=''
591 i_db=''
592 i_dbm=''
593 i_rpcsvcdbm=''
594 d_dirnamlen=''
595 direntrytype=''
596 i_dirent=''
597 i_dld=''
598 i_dlfcn=''
599 i_fcntl=''
600 i_float=''
601 i_gdbm=''
602 d_grpasswd=''
603 i_grp=''
604 i_iconv=''
605 i_inttypes=''
606 i_limits=''
607 i_locale=''
608 i_machcthr=''
609 i_malloc=''
610 i_math=''
611 i_memory=''
612 i_mntent=''
613 i_ndbm=''
614 i_netdb=''
615 i_neterrno=''
616 i_netinettcp=''
617 i_niin=''
618 i_sysin=''
619 i_poll=''
620 i_pthread=''
621 d_pwage=''
622 d_pwchange=''
623 d_pwclass=''
624 d_pwcomment=''
625 d_pwexpire=''
626 d_pwgecos=''
627 d_pwpasswd=''
628 d_pwquota=''
629 i_pwd=''
630 i_sfio=''
631 i_shadow=''
632 i_socks=''
633 i_stddef=''
634 i_stdlib=''
635 i_string=''
636 strings=''
637 i_sysaccess=''
638 i_sysdir=''
639 i_sysfile=''
640 d_voidtty=''
641 i_bsdioctl=''
642 i_sysfilio=''
643 i_sysioctl=''
644 i_syssockio=''
645 i_sysmount=''
646 i_sysndir=''
647 i_sysparam=''
648 i_sysresrc=''
649 i_syssecrt=''
650 i_sysselct=''
651 i_sysstat=''
652 i_sysstatfs=''
653 i_sysstatvfs=''
654 i_systimes=''
655 i_systypes=''
656 i_sysuio=''
657 i_sysun=''
658 i_sysvfs=''
659 i_syswait=''
660 i_sgtty=''
661 i_termio=''
662 i_termios=''
663 i_systime=''
664 i_systimek=''
665 i_time=''
666 timeincl=''
667 i_unistd=''
668 i_ustat=''
669 i_utime=''
670 i_values=''
671 i_stdarg=''
672 i_varargs=''
673 i_varhdr=''
674 i_vfork=''
675 inc_version_list=''
676 inc_version_list_init=''
677 installprefix=''
678 installprefixexp=''
679 installstyle=''
680 installusrbinperl=''
681 intsize=''
682 longsize=''
683 shortsize=''
684 d_fpos64_t=''
685 d_off64_t=''
686 libc=''
687 ldlibpthname=''
688 libperl=''
689 shrpenv=''
690 useshrplib=''
691 glibpth=''
692 libpth=''
693 loclibpth=''
694 plibpth=''
695 xlibpth=''
696 ignore_versioned_solibs=''
697 libs=''
698 libsdirs=''
699 libsfiles=''
700 libsfound=''
701 lns=''
702 d_PRIEldbl=''
703 d_PRIFldbl=''
704 d_PRIGldbl=''
705 d_PRIeldbl=''
706 d_PRIfldbl=''
707 d_PRIgldbl=''
708 sPRIEldbl=''
709 sPRIFldbl=''
710 sPRIGldbl=''
711 sPRIeldbl=''
712 sPRIfldbl=''
713 sPRIgldbl=''
714 lseeksize=''
715 lseektype=''
716 make_set_make=''
717 d_mymalloc=''
718 freetype=''
719 mallocobj=''
720 mallocsrc=''
721 malloctype=''
722 usemymalloc=''
723 installman1dir=''
724 man1dir=''
725 man1direxp=''
726 man1ext=''
727 installman3dir=''
728 man3dir=''
729 man3direxp=''
730 man3ext=''
731 huge=''
732 large=''
733 medium=''
734 models=''
735 small=''
736 split=''
737 modetype=''
738 multiarch=''
739 mydomain=''
740 myhostname=''
741 phostname=''
742 c=''
743 n=''
744 d_eofnblk=''
745 eagain=''
746 o_nonblock=''
747 rd_nodata=''
748 netdb_hlen_type=''
749 netdb_host_type=''
750 netdb_name_type=''
751 netdb_net_type=''
752 groupcat=''
753 hostcat=''
754 passcat=''
755 orderlib=''
756 ranlib=''
757 package=''
758 spackage=''
759 pager=''
760 api_revision=''
761 api_subversion=''
762 api_version=''
763 api_versionstring=''
764 patchlevel=''
765 subversion=''
766 version=''
767 perladmin=''
768 perlpath=''
769 d_nv_preserves_uv=''
770 i16size=''
771 i16type=''
772 i32size=''
773 i32type=''
774 i64size=''
775 i64type=''
776 i8size=''
777 i8type=''
778 ivsize=''
779 ivtype=''
780 nvsize=''
781 nvtype=''
782 u16size=''
783 u16type=''
784 u32size=''
785 u32type=''
786 u64size=''
787 u64type=''
788 u8size=''
789 u8type=''
790 uvsize=''
791 uvtype=''
792 ivdformat=''
793 uvoformat=''
794 uvuformat=''
795 uvxformat=''
796 pidtype=''
797 prefix=''
798 prefixexp=''
799 installprivlib=''
800 privlib=''
801 privlibexp=''
802 prototype=''
803 ptrsize=''
804 d_PRIX64=''
805 d_PRId64=''
806 d_PRIi64=''
807 d_PRIo64=''
808 d_PRIu64=''
809 d_PRIx64=''
810 sPRIX64=''
811 sPRId64=''
812 sPRIi64=''
813 sPRIo64=''
814 sPRIu64=''
815 sPRIx64=''
816 d_quad=''
817 quadkind=''
818 quadtype=''
819 uquadtype=''
820 drand01=''
821 randbits=''
822 randfunc=''
823 randseedtype=''
824 seedfunc=''
825 installscript=''
826 scriptdir=''
827 scriptdirexp=''
828 selectminbits=''
829 selecttype=''
830 sh=''
831 sig_count=''
832 sig_name=''
833 sig_name_init=''
834 sig_num=''
835 sig_num_init=''
836 installsitearch=''
837 sitearch=''
838 sitearchexp=''
839 installsitebin=''
840 sitebin=''
841 sitebinexp=''
842 installsitelib=''
843 sitelib=''
844 sitelibexp=''
845 siteprefix=''
846 siteprefixexp=''
847 sizetype=''
848 so=''
849 sharpbang=''
850 shsharp=''
851 spitshell=''
852 src=''
853 ssizetype=''
854 startperl=''
855 startsh=''
856 stdchar=''
857 d_stdio_stream_array=''
858 stdio_stream_array=''
859 sysman=''
860 trnl=''
861 uidformat=''
862 uidsign=''
863 uidsize=''
864 uidtype=''
865 archname64=''
866 use64bits=''
867 uselargefiles=''
868 uselongdouble=''
869 uselonglong=''
870 usemorebits=''
871 usemultiplicity=''
872 nm_opt=''
873 nm_so_opt=''
874 runnm=''
875 usenm=''
876 useperlio=''
877 usesocks=''
878 d_oldpthreads=''
879 use5005threads=''
880 useithreads=''
881 usethreads=''
882 incpath=''
883 mips_type=''
884 usrinc=''
885 d_vendorbin=''
886 installvendorbin=''
887 vendorbin=''
888 vendorbinexp=''
889 d_vendorlib=''
890 installvendorlib=''
891 vendorlib=''
892 vendorlibexp=''
893 usevendorprefix=''
894 vendorprefix=''
895 vendorprefixexp=''
896 defvoidused=''
897 voidflags=''
898 CONFIG=''
899
900 define='define'
901 undef='undef'
902 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
903 rmlist=''
904
905 : We must find out about Eunice early
906 eunicefix=':'
907 if test -f /etc/unixtovms; then
908         eunicefix=/etc/unixtovms
909 fi
910 if test -f /etc/unixtovms.exe; then
911         eunicefix=/etc/unixtovms.exe
912 fi
913
914 i_whoami=''
915 : set useposix=false in your hint file to disable the POSIX extension.
916 useposix=true
917 : set useopcode=false in your hint file to disable the Opcode extension.
918 useopcode=true
919 : Trailing extension.  Override this in a hint file, if needed.
920 _exe=''
921 : Extra object files, if any, needed on this platform.
922 archobjs=''
923 : Possible local include directories to search.
924 : Set locincpth to "" in a hint file to defeat local include searches.
925 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
926 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
927 :
928 : no include file wanted by default
929 inclwanted=''
930
931 groupstype=''
932 : change the next line if compiling for Xenix/286 on Xenix/386
933 xlibpth='/usr/lib/386 /lib/386'
934
935 : Possible local library directories to search.
936 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
937 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
938
939 : general looking path for locating libraries
940 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
941 glibpth="$glibpth /lib /usr/lib $xlibpth"
942 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
943 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
944
945 : Private path used by Configure to find libraries.  Its value
946 : is prepended to libpth. This variable takes care of special
947 : machines, like the mips.  Usually, it should be empty.
948 plibpth=''
949
950 : default library list
951 libswanted=''
952 : some systems want to use only the non-versioned libso:s
953 ignore_versioned_solibs=''
954 : set usemultiplicity on the Configure command line to enable multiplicity.
955 : set usesocks on the Configure command line to enable socks.
956 : set usethreads on the Configure command line to enable threads.
957 : full support for void wanted by default
958 defvoidused=15
959
960 : List of libraries we want.
961 : If anyone needs -lnet, put it in a hint file.
962 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
963 libswanted="$libswanted dld ld sun m c cposix posix"
964 libswanted="$libswanted ndir dir crypt sec"
965 libswanted="$libswanted ucb bsd BSD PW x"
966 : We probably want to search /usr/shlib before most other libraries.
967 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
968 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
969 glibpth="/usr/shlib $glibpth"
970 : Do not use vfork unless overridden by a hint file.
971 usevfork=false
972
973 : Find the basic shell for Bourne shell scripts
974 case "$sh" in
975 '')
976         case "$SYSTYPE" in
977         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
978         *) xxx='/bin/sh';;
979         esac
980         if test -f "$xxx"; then
981                 sh="$xxx"
982         else
983                 : Build up a list and do a single loop so we can 'break' out.
984                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
985                 for xxx in sh bash ksh pdksh ash; do
986                         for p in $pth; do
987                                 try="$try ${p}/${xxx}"
988                         done
989                 done
990                 for xxx in $try; do
991                         if test -f "$xxx"; then
992                                 sh="$xxx";
993                                 break
994                         elif test -f "$xxx.exe"; then
995                                 sh="$xxx";
996                                 break
997                         fi
998                 done
999         fi
1000         ;;
1001 esac
1002
1003 case "$sh" in
1004 '')     cat <<EOM >&2
1005 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1006
1007 Usually it's in /bin/sh.  How did you even get this far?
1008 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1009 we'll try to straighten this all out.
1010 EOM
1011         exit 1
1012         ;;
1013 esac
1014
1015 : see if sh knows # comments
1016 if `$sh -c '#' >/dev/null 2>&1`; then
1017         shsharp=true
1018         spitshell=cat
1019         xcat=/bin/cat
1020         test -f $xcat || xcat=/usr/bin/cat
1021         echo "#!$xcat" >try
1022         $eunicefix try
1023         chmod +x try
1024         ./try > today
1025         if test -s today; then
1026                 sharpbang='#!'
1027         else
1028                 echo "#! $xcat" > try
1029                 $eunicefix try
1030                 chmod +x try
1031                 ./try > today
1032                 if test -s today; then
1033                         sharpbang='#! '
1034                 else
1035                         sharpbang=': use '
1036                 fi
1037         fi
1038 else
1039         echo " "
1040         echo "Your $sh doesn't grok # comments--I will strip them later on."
1041         shsharp=false
1042         cd ..
1043         echo "exec grep -v '^[  ]*#'" >spitshell
1044         chmod +x spitshell
1045         $eunicefix spitshell
1046         spitshell=`pwd`/spitshell
1047         cd UU
1048         echo "I presume that if # doesn't work, #! won't work either!"
1049         sharpbang=': use '
1050 fi
1051 rm -f try today
1052
1053 : figure out how to guarantee sh startup
1054 case "$startsh" in
1055 '') startsh=${sharpbang}${sh} ;;
1056 *)
1057 esac
1058 cat >try <<EOSS
1059 $startsh
1060 set abc
1061 test "$?abc" != 1
1062 EOSS
1063
1064 chmod +x try
1065 $eunicefix try
1066 if ./try; then
1067         : echo "Yup, it does."
1068 else
1069         echo "Hmm... '$startsh' does not guarantee sh startup..."
1070         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1071 fi
1072 rm -f try
1073
1074
1075 : Save command line options in file UU/cmdline.opt for later use in
1076 : generating config.sh.
1077 cat > cmdline.opt <<EOSH
1078 # Configure command line arguments.
1079 config_arg0='$0'
1080 config_args='$*'
1081 config_argc=$#
1082 EOSH
1083 argn=1
1084 for arg in "$@"; do
1085         cat >>cmdline.opt <<EOSH
1086 config_arg$argn='$arg'
1087 EOSH
1088         argn=`expr $argn + 1`
1089 done
1090
1091 : produce awk script to parse command line options
1092 cat >options.awk <<'EOF'
1093 BEGIN {
1094         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1095
1096         len = length(optstr);
1097         for (i = 1; i <= len; i++) {
1098                 c = substr(optstr, i, 1);
1099                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1100                 if (a == ":") {
1101                         arg[c] = 1;
1102                         i++;
1103                 }
1104                 opt[c] = 1;
1105         }
1106 }
1107 {
1108         expect = 0;
1109         str = $0;
1110         if (substr(str, 1, 1) != "-") {
1111                 printf("'%s'\n", str);
1112                 next;
1113         }
1114         len = length($0);
1115         for (i = 2; i <= len; i++) {
1116                 c = substr(str, i, 1);
1117                 if (!opt[c]) {
1118                         printf("-%s\n", substr(str, i));
1119                         next;
1120                 }
1121                 printf("-%s\n", c);
1122                 if (arg[c]) {
1123                         if (i < len)
1124                                 printf("'%s'\n", substr(str, i + 1));
1125                         else
1126                                 expect = 1;
1127                         next;
1128                 }
1129         }
1130 }
1131 END {
1132         if (expect)
1133                 print "?";
1134 }
1135 EOF
1136
1137 : process the command line options
1138 set X `for arg in "$@"; do echo "X$arg"; done |
1139         sed -e s/X// | awk -f options.awk`
1140 eval "set $*"
1141 shift
1142 rm -f options.awk
1143
1144 : set up default values
1145 fastread=''
1146 reuseval=false
1147 config_sh=''
1148 alldone=''
1149 error=''
1150 silent=''
1151 extractsh=''
1152 override=''
1153 knowitall=''
1154 rm -f optdef.sh posthint.sh
1155 cat >optdef.sh <<EOS
1156 $startsh
1157 EOS
1158
1159
1160 : option parsing
1161 while test $# -gt 0; do
1162         case "$1" in
1163         -d) shift; fastread=yes;;
1164         -e) shift; alldone=cont;;
1165         -f)
1166                 shift
1167                 cd ..
1168                 if test -r "$1"; then
1169                         config_sh="$1"
1170                 else
1171                         echo "$me: cannot read config file $1." >&2
1172                         error=true
1173                 fi
1174                 cd UU
1175                 shift;;
1176         -h) shift; error=true;;
1177         -r) shift; reuseval=true;;
1178         -s) shift; silent=true; realsilent=true;;
1179         -E) shift; alldone=exit;;
1180         -K) shift; knowitall=true;;
1181         -O) shift; override=true;;
1182         -S) shift; silent=true; extractsh=true;;
1183         -D)
1184                 shift
1185                 case "$1" in
1186                 *=)
1187                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1188                         echo "$me: ignoring -D $1" >&2
1189                         ;;
1190                 *=*) echo "$1" | \
1191                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1192                 *) echo "$1='define'" >> optdef.sh;;
1193                 esac
1194                 shift
1195                 ;;
1196         -U)
1197                 shift
1198                 case "$1" in
1199                 *=) echo "$1" >> optdef.sh;;
1200                 *=*)
1201                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1202                         echo "$me: ignoring -U $1" >&2
1203                         ;;
1204                 *) echo "$1='undef'" >> optdef.sh;;
1205                 esac
1206                 shift
1207                 ;;
1208         -A)
1209             shift
1210             xxx=''
1211             yyy="$1"
1212             zzz=''
1213             uuu=undef
1214             case "$yyy" in
1215             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1216                  case "$zzz" in
1217                  *:*) zzz='' ;;
1218                  *)   xxx=append
1219                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1220                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1221                  esac
1222                  ;;
1223             esac
1224             case "$xxx" in
1225             '')  case "$yyy" in
1226                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1227                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1228                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1229                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1230                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1231                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1232                  esac
1233                  ;;       
1234             esac
1235             case "$xxx" in
1236             append)
1237                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1238             clear)
1239                 echo "$yyy=''"                  >> posthint.sh ;;
1240             define)
1241                 case "$zzz" in
1242                 '') zzz=define ;;
1243                 esac
1244                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1245             eval)
1246                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1247             prepend)
1248                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1249             undef)
1250                 case "$zzz" in
1251                 '') zzz="$uuu" ;;
1252                 esac
1253                 echo "$yyy=$zzz"                >> posthint.sh ;;
1254             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1255             esac
1256             ;;
1257         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1258             exit 0;;
1259         --) break;;
1260         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1261         *) break;;
1262         esac
1263 done
1264
1265 case "$error" in
1266 true)
1267         cat >&2 <<EOM
1268 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1269                  [-U symbol] [-U symbol=] [-A command:symbol...]
1270   -d : use defaults for all answers.
1271   -e : go on without questioning past the production of config.sh.
1272   -f : specify an alternate default configuration file.
1273   -h : print this help message and exit (with an error status).
1274   -r : reuse C symbols value if possible (skips costly nm extraction).
1275   -s : silent mode, only echoes questions and essential information.
1276   -D : define symbol to have some value:
1277          -D symbol         symbol gets the value 'define'
1278          -D symbol=value   symbol gets the value 'value'
1279   -E : stop at the end of questions, after having produced config.sh.
1280   -K : do not use unless you know what you are doing.
1281   -O : let -D and -U override definitions from loaded configuration file.
1282   -S : perform variable substitutions on all .SH files (can mix with -f)
1283   -U : undefine symbol:
1284          -U symbol    symbol gets the value 'undef'
1285          -U symbol=   symbol gets completely empty
1286   -A : manipulate symbol after the platform specific hints have been applied:
1287          -A symbol=value                append " "value to symbol
1288          -A append:symbol=value         append value to symbol
1289          -A define:symbol=value         define symbol to have value
1290          -A clear:symbol                define symbol to be ''
1291          -A define:symbol               define symbol to be 'define'
1292          -A eval:symbol=value           define symbol to be eval of value
1293          -A prepend:symbol=value        prepend value to symbol
1294          -A undef:symbol                define symbol to be 'undef'
1295          -A undef:symbol=               define symbol to be ''
1296   -V : print version number and exit (with a zero status).
1297 EOM
1298         exit 1
1299         ;;
1300 esac
1301
1302 : Sanity checks
1303 case "$fastread$alldone" in
1304 yescont|yesexit) ;;
1305 *)
1306         if test ! -t 0; then
1307                 echo "Say 'sh Configure', not 'sh <Configure'"
1308                 exit 1
1309         fi
1310         ;;
1311 esac
1312
1313 exec 4>&1
1314 case "$silent" in
1315 true) exec 1>/dev/null;;
1316 esac
1317
1318 : run the defines and the undefines, if any, but leave the file out there...
1319 touch optdef.sh
1320 . ./optdef.sh
1321 : create the posthint manipulation script and leave the file out there...
1322 touch posthint.sh
1323
1324 : set package name
1325 package=perl5
1326 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1327 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1328 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1329 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1330 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1331 esac
1332
1333 : Some greps do not return status, grrr.
1334 echo "grimblepritz" >grimble
1335 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1336         contains=contains
1337 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1338         contains=grep
1339 else
1340         contains=contains
1341 fi
1342 rm -f grimble
1343 : the following should work in any shell
1344 case "$contains" in
1345 contains*)
1346         echo " "
1347         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1348         cat >contains <<'EOSS'
1349 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1350 EOSS
1351 chmod +x contains
1352 esac
1353
1354 : Find the path to the source tree
1355 case "$src" in
1356 '') case "$0" in
1357     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1358          case "$src" in
1359          /*)    ;;
1360          *)     src=`cd ../$src && pwd` ;;
1361          esac
1362          ;;
1363     *)   src='.';;
1364     esac;;
1365 esac
1366 case "$src" in
1367 '')     src=/
1368         rsrc=/
1369         ;;
1370 /*) rsrc="$src";;
1371 *) rsrc="../$src";;
1372 esac
1373 if test -f $rsrc/Configure && \
1374         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1375 then
1376    : found it, so we are ok.
1377 else
1378         rsrc=''
1379         for src in . .. ../.. ../../.. ../../../..; do
1380                 if test -f ../$src/Configure && \
1381                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1382                 then
1383                         rsrc=../$src
1384                         break
1385                 fi
1386         done
1387 fi
1388 case "$rsrc" in
1389 '')
1390         cat <<EOM >&4
1391
1392 Sorry, I can't seem to locate the source dir for $package.  Please start
1393 Configure with an explicit path -- i.e. /some/path/Configure.
1394
1395 EOM
1396         exit 1
1397         ;;
1398 ../.)   rsrc='..';;
1399 *)
1400         echo " "
1401         echo "Sources for $package found in \"$src\"." >&4
1402         ;;
1403 esac
1404
1405 : script used to extract .SH files with variable substitutions
1406 cat >extract <<'EOS'
1407 CONFIGDOTSH=true
1408 echo "Doing variable substitutions on .SH files..."
1409 if test -f $src/MANIFEST; then
1410         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1411 else
1412         echo "(Looking for .SH files under the source directory.)"
1413         set x `(cd $src; find . -name "*.SH" -print)`
1414 fi
1415 shift
1416 case $# in
1417 0) set x `(cd $src; echo *.SH)`; shift;;
1418 esac
1419 if test ! -f $src/$1; then
1420         shift
1421 fi
1422 mkdir_p='
1423 name=$1;
1424 create="";
1425 while test $name; do
1426         if test ! -d "$name"; then
1427                 create="$name $create";
1428                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1429                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1430         else
1431                 name="";
1432         fi;
1433 done;
1434 for file in $create; do
1435         mkdir $file;
1436 done
1437 '
1438 for file in $*; do
1439         case "$src" in
1440         ".")
1441                 case "$file" in
1442                 */*)
1443                         dir=`expr X$file : 'X\(.*\)/'`
1444                         file=`expr X$file : 'X.*/\(.*\)'`
1445                         (cd $dir && . ./$file)
1446                         ;;
1447                 *)
1448                         . ./$file
1449                         ;;
1450                 esac
1451                 ;;
1452         *)
1453                 case "$file" in
1454                 */*)
1455                         dir=`expr X$file : 'X\(.*\)/'`
1456                         file=`expr X$file : 'X.*/\(.*\)'`
1457                         (set x $dir; shift; eval $mkdir_p)
1458                         sh <$src/$dir/$file
1459                         ;;
1460                 *)
1461                         sh <$src/$file
1462                         ;;
1463                 esac
1464                 ;;
1465         esac
1466 done
1467 if test -f $src/config_h.SH; then
1468         if test ! -f config.h; then
1469         : oops, they left it out of MANIFEST, probably, so do it anyway.
1470         . $src/config_h.SH
1471         fi
1472 fi
1473 EOS
1474
1475 : extract files and exit if asked to do so
1476 case "$extractsh" in
1477 true)
1478         case "$realsilent" in
1479         true) ;;
1480         *) exec 1>&4;;
1481         esac
1482         case "$config_sh" in
1483         '') config_sh='config.sh';;
1484         esac
1485         echo " "
1486         echo "Fetching answers from $config_sh..."
1487         cd ..
1488         . $config_sh
1489         test "$override" && . ./optdef.sh
1490         echo " "
1491         . UU/extract
1492         rm -rf UU
1493         echo "Done."
1494         exit 0
1495         ;;
1496 esac
1497
1498 : Eunice requires " " instead of "", can you believe it
1499 echo " "
1500 : Here we go...
1501 echo "Beginning of configuration questions for $package."
1502
1503 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1504
1505 : first determine how to suppress newline on echo command
1506 echo " "
1507 echo "Checking echo to see how to suppress newlines..."
1508 (echo "hi there\c" ; echo " ") >.echotmp
1509 if $contains c .echotmp >/dev/null 2>&1 ; then
1510         echo "...using -n."
1511         n='-n'
1512         c=''
1513 else
1514         cat <<'EOM'
1515 ...using \c
1516 EOM
1517         n=''
1518         c='\c'
1519 fi
1520 echo $n "The star should be here-->$c"
1521 echo '*'
1522 rm -f .echotmp
1523
1524 : Now test for existence of everything in MANIFEST
1525 echo " "
1526 if test -f $rsrc/MANIFEST; then
1527         echo "First let's make sure your kit is complete.  Checking..." >&4
1528         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1529         rm -f missing
1530         tmppwd=`pwd`
1531         for filelist in x??; do
1532                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1533         done
1534         if test -s missing; then
1535                 cat missing >&4
1536                 cat >&4 <<'EOM'
1537
1538 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1539
1540 You have the option of continuing the configuration process, despite the
1541 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1542 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1543 and contact the author (perlbug@perl.com).
1544
1545 EOM
1546                 echo $n "Continue? [n] $c" >&4
1547                 read ans
1548                 case "$ans" in
1549                 y*)
1550                         echo "Continuing..." >&4
1551                         rm -f missing
1552                         ;;
1553                 *)
1554                         echo "ABORTING..." >&4
1555                         kill $$
1556                         ;;
1557                 esac
1558         else
1559                 echo "Looks good..."
1560         fi
1561 else
1562         echo "There is no MANIFEST file.  I hope your kit is complete !"
1563 fi
1564 rm -f missing x??
1565
1566 echo " "
1567 : Find the appropriate value for a newline for tr
1568 if test -n "$DJGPP"; then
1569        trnl='\012'
1570 fi
1571 if test X"$trnl" = X; then
1572         case "`echo foo|tr '\n' x 2>/dev/null`" in
1573         foox) trnl='\n' ;;
1574         esac
1575 fi
1576 if test X"$trnl" = X; then
1577         case "`echo foo|tr '\012' x 2>/dev/null`" in
1578         foox) trnl='\012' ;;
1579         esac
1580 fi
1581 if test X"$trnl" = X; then
1582         cat <<EOM >&2
1583
1584 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1585
1586 EOM
1587         exit 1
1588 fi
1589
1590 : compute the number of columns on the terminal for proper question formatting
1591 case "$COLUMNS" in
1592 '') COLUMNS='80';;
1593 esac
1594
1595 : set up the echo used in my read
1596 myecho="case \"\$xxxm\" in
1597 '') echo $n \"\$rp $c\" >&4;;
1598 *) case \"\$rp\" in
1599         '') echo $n \"[\$xxxm] $c\";;
1600         *)
1601                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1602                         echo \"\$rp\" >&4
1603                         echo $n \"[\$xxxm] $c\" >&4
1604                 else
1605                         echo $n \"\$rp [\$xxxm] $c\" >&4
1606                 fi
1607                 ;;
1608         esac;;
1609 esac"
1610
1611 : now set up to do reads with possible shell escape and default assignment
1612 cat <<EOSC >myread
1613 $startsh
1614 xxxm=\$dflt
1615 $myecho
1616 ans='!'
1617 case "\$fastread" in
1618 yes) case "\$dflt" in
1619         '') ;;
1620         *) ans='';
1621                 case "\$silent-\$rp" in
1622                 true-) ;;
1623                 *) echo " " >&4;;
1624                 esac;;
1625         esac;;
1626 *) case "\$silent" in
1627         true) case "\$rp" in
1628                 '') ans='';;
1629                 esac;;
1630         esac;;
1631 esac
1632 while expr "X\$ans" : "X!" >/dev/null; do
1633         read answ
1634         set x \$xxxm
1635         shift
1636         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1637         case  "\$answ" in
1638         "!")
1639                 sh 1>&4
1640                 echo " "
1641                 $myecho
1642                 ;;
1643         !*)
1644                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1645                 shift
1646                 sh 1>&4 -c "\$*"
1647                 echo " "
1648                 $myecho
1649                 ;;
1650         "\$ans")
1651                 case "\$ans" in
1652                 \\&*)
1653                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1654                         shift
1655                         case "\$1" in
1656                         -d)
1657                                 fastread=yes
1658                                 echo "(OK, I'll run with -d after this question.)" >&4
1659                                 ;;
1660                         -*)
1661                                 echo "*** Sorry, \$1 not supported yet." >&4
1662                                 ;;
1663                         esac
1664                         $myecho
1665                         ans=!
1666                         ;;
1667                 esac;;
1668         *)
1669                 case "\$aok" in
1670                 y)
1671                         echo "*** Substitution done -- please confirm."
1672                         xxxm="\$ans"
1673                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1674                         xxxm="\$ans"
1675                         ans=!
1676                         ;;
1677                 *)
1678                         echo "*** Error -- try again."
1679                         ans=!
1680                         ;;
1681                 esac
1682                 $myecho
1683                 ;;
1684         esac
1685         case "\$ans\$xxxm\$nostick" in
1686         '')
1687                 ans=!
1688                 $myecho
1689                 ;;
1690         esac
1691 done
1692 case "\$ans" in
1693 '') ans="\$xxxm";;
1694 esac
1695 EOSC
1696
1697 : create .config dir to save info across Configure sessions
1698 test -d ../.config || mkdir ../.config
1699 cat >../.config/README <<EOF
1700 This directory created by Configure to save information that should
1701 persist across sessions for $package.
1702
1703 You may safely delete it if you wish.
1704 EOF
1705
1706 : general instructions
1707 needman=true
1708 firsttime=true
1709 user=`(logname) 2>/dev/null`
1710 case "$user" in
1711 '') user=`whoami 2>&1`;;
1712 esac
1713 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1714         firsttime=false
1715         echo " "
1716         rp='Would you like to see the instructions?'
1717         dflt=n
1718         . ./myread
1719         case "$ans" in
1720         [yY]*) ;;
1721         *) needman=false;;
1722         esac
1723 fi
1724 if $needman; then
1725         cat <<EOH
1726
1727 This installation shell script will examine your system and ask you questions
1728 to determine how the perl5 package should be installed. If you get
1729 stuck on a question, you may use a ! shell escape to start a subshell or
1730 execute a command.  Many of the questions will have default answers in square
1731 brackets; typing carriage return will give you the default.
1732
1733 On some of the questions which ask for file or directory names you are allowed
1734 to use the ~name construct to specify the login directory belonging to "name",
1735 even if you don't have a shell which knows about that.  Questions where this is
1736 allowed will be marked "(~name ok)".
1737
1738 EOH
1739         rp=''
1740         dflt='Type carriage return to continue'
1741         . ./myread
1742         cat <<'EOH'
1743
1744 The prompter used in this script allows you to use shell variables and
1745 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1746 in the default answer, as if the default line was a set of arguments given to a
1747 script shell.  This means you may also use $* to repeat the whole default line,
1748 so you do not have to re-type everything to add something to the default.
1749
1750 Everytime there is a substitution, you will have to confirm.  If there is an
1751 error (e.g. an unmatched backtick), the default answer will remain unchanged
1752 and you will be prompted again.
1753
1754 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1755 the questions and use the computed defaults (or the previous answers if there
1756 was already a config.sh file). Type 'Configure -h' for a list of options.
1757 You may also start interactively and then answer '& -d' at any prompt to turn
1758 on the non-interactive behaviour for the remainder of the execution.
1759
1760 EOH
1761         . ./myread
1762         cat <<EOH
1763
1764 Much effort has been expended to ensure that this shell script will run on any
1765 Unix system.  If despite that it blows up on yours, your best bet is to edit
1766 Configure and run it again.  If you can't run Configure for some reason,
1767 you'll have to generate a config.sh file by hand.  Whatever problems you
1768 have, let me (perlbug@perl.com) know how I blew it.
1769
1770 This installation script affects things in two ways:
1771
1772 1) it may do direct variable substitutions on some of the files included
1773    in this kit.
1774 2) it builds a config.h file for inclusion in C programs.  You may edit
1775    any of these files as the need arises after running this script.
1776
1777 If you make a mistake on a question, there is no easy way to back up to it
1778 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1779 files.  Configure will offer to let you do this before it runs the SH files.
1780
1781 EOH
1782         dflt='Type carriage return to continue'
1783         . ./myread
1784         case "$firsttime" in
1785         true) echo $user >>../.config/instruct;;
1786         esac
1787 fi
1788
1789 : find out where common programs are
1790 echo " "
1791 echo "Locating common programs..." >&4
1792 cat <<EOSC >loc
1793 $startsh
1794 case \$# in
1795 0) exit 1;;
1796 esac
1797 thing=\$1
1798 shift
1799 dflt=\$1
1800 shift
1801 for dir in \$*; do
1802         case "\$thing" in
1803         .)
1804         if test -d \$dir/\$thing; then
1805                 echo \$dir
1806                 exit 0
1807         fi
1808         ;;
1809         *)
1810         for thisthing in \$dir/\$thing; do
1811                 : just loop through to pick last item
1812         done
1813         if test -f \$thisthing; then
1814                 echo \$thisthing
1815                 exit 0
1816         elif test -f \$dir/\$thing.exe; then
1817                 if test -n "$DJGPP"; then
1818                         echo \$dir/\$thing.exe
1819                 else
1820                         : on Eunice apparently
1821                         echo \$dir/\$thing
1822                 fi
1823                 exit 0
1824         fi
1825         ;;
1826         esac
1827 done
1828 echo \$dflt
1829 exit 1
1830 EOSC
1831 chmod +x loc
1832 $eunicefix loc
1833 loclist="
1834 awk
1835 cat
1836 comm
1837 cp
1838 echo
1839 expr
1840 grep
1841 ls
1842 make
1843 mkdir
1844 rm
1845 sed
1846 sort
1847 touch
1848 tr
1849 uniq
1850 "
1851 trylist="
1852 Mcc
1853 ar
1854 byacc
1855 cpp
1856 csh
1857 date
1858 egrep
1859 gzip
1860 less
1861 ln
1862 more
1863 nm
1864 nroff
1865 perl
1866 pg
1867 test
1868 uname
1869 zip
1870 "
1871 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1872 pth="$pth /lib /usr/lib"
1873 for file in $loclist; do
1874         eval xxx=\$$file
1875         case "$xxx" in
1876         /*|?:[\\/]*)
1877                 if test -f "$xxx"; then
1878                         : ok
1879                 else
1880                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1881                         xxx=`./loc $file $file $pth`
1882                 fi
1883                 ;;
1884         '') xxx=`./loc $file $file $pth`;;
1885         *) xxx=`./loc $xxx $xxx $pth`;;
1886         esac
1887         eval $file=$xxx
1888         eval _$file=$xxx
1889         case "$xxx" in
1890         /*)
1891                 echo $file is in $xxx.
1892                 ;;
1893         ?:[\\/]*)
1894                 echo $file is in $xxx.
1895                 ;;
1896         *)
1897                 echo "I don't know where '$file' is, and my life depends on it." >&4
1898                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1899                 exit 1
1900                 ;;
1901         esac
1902 done
1903 echo " "
1904 echo "Don't worry if any of the following aren't found..."
1905 say=offhand
1906 for file in $trylist; do
1907         eval xxx=\$$file
1908         case "$xxx" in
1909         /*|?:[\\/]*)
1910                 if test -f "$xxx"; then
1911                         : ok
1912                 else
1913                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1914                         xxx=`./loc $file $file $pth`
1915                 fi
1916                 ;;
1917         '') xxx=`./loc $file $file $pth`;;
1918         *) xxx=`./loc $xxx $xxx $pth`;;
1919         esac
1920         eval $file=$xxx
1921         eval _$file=$xxx
1922         case "$xxx" in
1923         /*)
1924                 echo $file is in $xxx.
1925                 ;;
1926         ?:[\\/]*)
1927                 echo $file is in $xxx.
1928                 ;;
1929         *)
1930                 echo "I don't see $file out there, $say."
1931                 say=either
1932                 ;;
1933         esac
1934 done
1935 case "$egrep" in
1936 egrep)
1937         echo "Substituting grep for egrep."
1938         egrep=$grep
1939         ;;
1940 esac
1941 case "$ln" in
1942 ln)
1943         echo "Substituting cp for ln."
1944         ln=$cp
1945         ;;
1946 esac
1947 case "$test" in
1948 test)
1949         echo "Hopefully test is built into your sh."
1950         ;;
1951 *)
1952         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1953                 echo "Using the test built into your sh."
1954                 test=test
1955                 _test=test
1956         fi
1957         ;;
1958 esac
1959 case "$echo" in
1960 echo)
1961         echo "Hopefully echo is built into your sh."
1962         ;;
1963 '') ;;
1964 *)
1965         echo " "
1966 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1967         $echo $n "hi there$c" >foo1
1968         echo $n "hi there$c" >foo2
1969         if cmp foo1 foo2 >/dev/null 2>&1; then
1970                 echo "They are compatible.  In fact, they may be identical."
1971         else
1972                 case "$n" in
1973                 '-n') n='' c='\c';;
1974                 *) n='-n' c='';;
1975                 esac
1976                 cat <<FOO
1977 They are not compatible!  You are probably running ksh on a non-USG system.
1978 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1979 have echo built in and we may have to run some Bourne shell scripts.  That
1980 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1981
1982 FOO
1983                 $echo $n "The star should be here-->$c"
1984                 $echo "*"
1985         fi
1986         $rm -f foo1 foo2
1987         ;;
1988 esac
1989
1990 : determine whether symbolic links are supported
1991 echo " "
1992 $touch blurfl
1993 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1994         echo "Symbolic links are supported." >&4
1995         lns="$ln -s"
1996 else
1997         echo "Symbolic links are NOT supported." >&4
1998         lns="$ln"
1999 fi
2000 $rm -f blurfl sym
2001
2002 : see whether [:lower:] and [:upper:] are supported character classes
2003 echo " "
2004 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2005 ABYZ)
2006         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2007         up='[:upper:]'
2008         low='[:lower:]'
2009         ;;
2010 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2011         # (0xc9 and 0xd1), therefore that is a nice testing point.
2012         if test "X$up" = X -o "X$low" = X; then
2013             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2014             ij) up='[A-Z]'
2015                 low='[a-z]'
2016                 ;;
2017             esac
2018         fi
2019         if test "X$up" = X -o "X$low" = X; then
2020             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2021             ij) up='A-Z'
2022                 low='a-z'
2023                 ;;
2024             esac
2025         fi
2026         if test "X$up" = X -o "X$low" = X; then
2027             case "`echo IJ | od -x 2>/dev/null`" in
2028             *C9D1*|*c9d1*)
2029                 echo "Hey, this might be EBCDIC." >&4
2030                 if test "X$up" = X -o "X$low" = X; then
2031                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2032                     ij) up='[A-IJ-RS-Z]'
2033                         low='[a-ij-rs-z]'
2034                         ;;
2035                     esac
2036                 fi
2037                 if test "X$up" = X -o "X$low" = X; then
2038                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2039                     ij) up='A-IJ-RS-Z'
2040                         low='a-ij-rs-z'
2041                         ;;
2042                     esac
2043                 fi
2044                 ;;
2045             esac
2046         fi
2047 esac
2048 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2049 ij)
2050     echo "Using $up and $low to convert case." >&4
2051     ;;
2052 *)
2053     echo "I don't know how to translate letters from upper to lower case." >&4
2054     echo "Your tr is not acting any way I know of." >&4
2055     exit 1
2056     ;;
2057 esac
2058 : set up the translation script tr, must be called with ./tr of course
2059 cat >tr <<EOSC
2060 $startsh
2061 case "\$1\$2" in
2062 '[A-Z][a-z]') exec $tr '$up' '$low';;
2063 '[a-z][A-Z]') exec $tr '$low' '$up';;
2064 esac
2065 exec $tr "\$@"
2066 EOSC
2067 chmod +x tr
2068 $eunicefix tr
2069
2070 : Try to determine whether config.sh was made on this system
2071 case "$config_sh" in
2072 '')
2073 myuname=`$uname -a 2>/dev/null`
2074 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2075 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2076 # because the A-Z/a-z are not consecutive.
2077 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2078         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2079 newmyuname="$myuname"
2080 dflt=n
2081 case "$knowitall" in
2082 '')
2083         if test -f ../config.sh; then
2084                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2085                         eval "`grep myuname= ../config.sh`"
2086                 fi
2087                 if test "X$myuname" = "X$newmyuname"; then
2088                         dflt=y
2089                 fi
2090         fi
2091         ;;
2092 *) dflt=y;;
2093 esac
2094
2095 : Get old answers from old config file if Configure was run on the
2096 : same system, otherwise use the hints.
2097 hint=default
2098 cd ..
2099 if test -f config.sh; then
2100         echo " "
2101         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2102         . UU/myread
2103         case "$ans" in
2104         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2105         *)  echo "Fetching default answers from your old config.sh file..." >&4
2106                 tmp_n="$n"
2107                 tmp_c="$c"
2108                 tmp_sh="$sh"
2109                 . ./config.sh
2110                 cp config.sh UU
2111                 n="$tmp_n"
2112                 c="$tmp_c"
2113                 : Older versions did not always set $sh.  Catch re-use of such
2114                 : an old config.sh.
2115                 case "$sh" in
2116                 '') sh="$tmp_sh" ;;
2117                 esac
2118                 hint=previous
2119                 ;;
2120         esac
2121 fi
2122 if test ! -f config.sh; then
2123         $cat <<EOM
2124
2125 First time through, eh?  I have some defaults handy for some systems
2126 that need some extra help getting the Configure answers right:
2127
2128 EOM
2129         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2130         dflt=''
2131         : Half the following guesses are probably wrong... If you have better
2132         : tests or hints, please send them to perlbug@perl.com
2133         : The metaconfig authors would also appreciate a copy...
2134         $test -f /irix && osname=irix
2135         $test -f /xenix && osname=sco_xenix
2136         $test -f /dynix && osname=dynix
2137         $test -f /dnix && osname=dnix
2138         $test -f /lynx.os && osname=lynxos
2139         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2140         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2141         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2142         $test -f /bin/mips && /bin/mips && osname=mips
2143         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2144                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2145         $test -d /usr/apollo/bin && osname=apollo
2146         $test -f /etc/saf/_sactab && osname=svr4
2147         $test -d /usr/include/minix && osname=minix
2148         if $test -d /MachTen -o -d /MachTen_Folder; then
2149                 osname=machten
2150                 if $test -x /sbin/version; then
2151                         osvers=`/sbin/version | $awk '{print $2}' |
2152                         $sed -e 's/[A-Za-z]$//'`
2153                 elif $test -x /usr/etc/version; then
2154                         osvers=`/usr/etc/version | $awk '{print $2}' |
2155                         $sed -e 's/[A-Za-z]$//'`
2156                 else
2157                         osvers="$2.$3"
2158                 fi
2159         fi
2160
2161         $test -f /sys/posix.dll &&
2162                 $test -f /usr/bin/what &&
2163                 set X `/usr/bin/what /sys/posix.dll` &&
2164                 $test "$3" = UWIN &&
2165                 osname=uwin &&
2166                 osvers="$5"
2167
2168         if $test -f $uname; then
2169                 set X $myuname
2170                 shift
2171
2172                 case "$5" in
2173                 fps*) osname=fps ;;
2174                 mips*)
2175                         case "$4" in
2176                         umips) osname=umips ;;
2177                         *) osname=mips ;;
2178                         esac;;
2179                 [23]100) osname=mips ;;
2180                 next*) osname=next ;;
2181                 i386*)
2182                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2183                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2184                                 osname='sco'
2185                                 osvers=$tmp
2186                         elif $test -f /etc/kconfig; then
2187                                 osname=isc
2188                                 if test "$lns" = "$ln -s"; then
2189                                         osvers=4
2190                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2191                                         osvers=3
2192                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2193                                         osvers=2
2194                                 fi
2195                         fi
2196                         tmp=''
2197                         ;;
2198                 pc*)
2199                         if test -n "$DJGPP"; then
2200                                 osname=dos
2201                                 osvers=djgpp
2202                         fi
2203                         ;;
2204                 esac
2205
2206                 case "$1" in
2207                 aix) osname=aix
2208                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2209                         case "$tmp" in
2210                         'not found') osvers="$4"."$3" ;;
2211                         '<3240'|'<>3240') osvers=3.2.0 ;;
2212                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2213                         '=3250'|'>3250') osvers=3.2.5 ;;
2214                         *) osvers=$tmp;;
2215                         esac
2216                         ;;
2217                 bsd386) osname=bsd386
2218                         osvers=`$uname -r`
2219                         ;;
2220                 cygwin*) osname=cygwin
2221                         osvers="$3"
2222                         ;;
2223                 *dc.osx) osname=dcosx
2224                         osvers="$3"
2225                         ;;
2226                 dnix) osname=dnix
2227                         osvers="$3"
2228                         ;;
2229                 domainos) osname=apollo
2230                         osvers="$3"
2231                         ;;
2232                 dgux) osname=dgux 
2233                         osvers="$3"
2234                         ;;
2235                 dynixptx*) osname=dynixptx
2236                         osvers=`echo "$4"|sed 's/^v//'`
2237                         ;;
2238                 freebsd) osname=freebsd 
2239                         osvers="$3" ;;
2240                 genix) osname=genix ;;
2241                 hp*) osname=hpux 
2242                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2243                         ;;
2244                 irix*) osname=irix
2245                         case "$3" in
2246                         4*) osvers=4 ;;
2247                         5*) osvers=5 ;;
2248                         *)      osvers="$3" ;;
2249                         esac
2250                         ;;
2251                 linux) osname=linux
2252                         case "$3" in
2253                         *)      osvers="$3" ;;
2254                         esac
2255                         ;;
2256                 MiNT) osname=mint
2257                         ;;
2258                 netbsd*) osname=netbsd
2259                         osvers="$3"
2260                         ;;
2261                 news-os) osvers="$3"
2262                         case "$3" in
2263                         4*) osname=newsos4 ;;
2264                         *) osname=newsos ;;
2265                         esac
2266                         ;;
2267                 next*) osname=next ;;
2268                 POSIX-BC | posix-bc ) osname=posix-bc
2269                         osvers="$3"
2270                         ;;
2271                 powerux | power_ux | powermax_os | powermaxos | \
2272                 powerunix | power_unix) osname=powerux
2273                         osvers="$3"
2274                         ;;
2275                 qnx) osname=qnx
2276                         osvers="$4"
2277                         ;;
2278                 solaris) osname=solaris
2279                         case "$3" in
2280                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2281                         *)      osvers="$3" ;;
2282                         esac
2283                         ;;
2284                 sunos) osname=sunos
2285                         case "$3" in
2286                         5*) osname=solaris
2287                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2288                         *)      osvers="$3" ;;
2289                         esac
2290                         ;;
2291                 titanos) osname=titanos
2292                         case "$3" in
2293                         1*) osvers=1 ;;
2294                         2*) osvers=2 ;;
2295                         3*) osvers=3 ;;
2296                         4*) osvers=4 ;;
2297                         *)      osvers="$3" ;;
2298                         esac
2299                         ;;
2300                 ultrix) osname=ultrix
2301                         osvers="$3"
2302                         ;;
2303                 osf1|mls+)      case "$5" in
2304                                 alpha)
2305                                         osname=dec_osf
2306                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2307                                         ;;
2308                         hp*)    osname=hp_osf1  ;;
2309                         mips)   osname=mips_osf1 ;;
2310                         esac
2311                         ;;
2312                 unixware) osname=svr5
2313                         osvers="$4"
2314                         ;;
2315                 uts) osname=uts
2316                         osvers="$3"
2317                         ;;
2318                 $2) case "$osname" in
2319                         *isc*) ;;
2320                         *freebsd*) ;;
2321                         svr*)
2322                                 : svr4.x or possibly later
2323                                 case "svr$3" in 
2324                                 ${osname}*)
2325                                         osname=svr$3
2326                                         osvers=$4
2327                                         ;;
2328                                 esac
2329                                 case "$osname" in
2330                                 svr4.0)
2331                                         : Check for ESIX
2332                                         if test -f /stand/boot ; then
2333                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2334                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2335                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2336                                                         if test -n "$isesix"; then
2337                                                                 osname=esix4
2338                                                         fi
2339                                                 fi
2340                                         fi
2341                                         ;;
2342                                 esac
2343                                 ;;
2344                         *)      if test -f /etc/systemid; then
2345                                         osname=sco
2346                                         set `echo $3 | $sed 's/\./ /g'` $4
2347                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2348                                                 osvers=$1.$2.$3
2349                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2350                                                 osvers=$1.$2
2351                                         elif $test -f $src/hints/sco_$1.sh; then
2352                                                 osvers=$1
2353                                         fi
2354                                 else
2355                                         case "$osname" in
2356                                         '') : Still unknown.  Probably a generic Sys V.
2357                                                 osname="sysv"
2358                                                 osvers="$3"
2359                                                 ;;
2360                                         esac
2361                                 fi
2362                                 ;;
2363                         esac
2364                         ;;
2365                 *)      case "$osname" in
2366                         '') : Still unknown.  Probably a generic BSD.
2367                                 osname="$1"
2368                                 osvers="$3"
2369                                 ;;
2370                         esac
2371                         ;;
2372                 esac
2373         else
2374                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2375                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2376                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2377                                 osname=news_os
2378                         fi
2379                         $rm -f UU/kernel.what
2380                 elif test -d c:/.; then
2381                         set X $myuname
2382                         osname=os2
2383                         osvers="$5"
2384                 fi
2385         fi
2386         
2387         : Now look for a hint file osname_osvers, unless one has been
2388         : specified already.
2389         case "$hintfile" in
2390         ''|' ')
2391                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2392                 : Also try without trailing minor version numbers.
2393                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2394                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2395                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2396                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2397                 case "$file" in
2398                 '') dflt=none ;;
2399                 *)  case "$osvers" in
2400                         '') dflt=$file
2401                                 ;;
2402                         *)  if $test -f $src/hints/$file.sh ; then
2403                                         dflt=$file
2404                                 elif $test -f $src/hints/$xfile.sh ; then
2405                                         dflt=$xfile
2406                                 elif $test -f $src/hints/$xxfile.sh ; then
2407                                         dflt=$xxfile
2408                                 elif $test -f $src/hints/$xxxfile.sh ; then
2409                                         dflt=$xxxfile
2410                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2411                                         dflt=$xxxxfile
2412                                 elif $test -f "$src/hints/${osname}.sh" ; then
2413                                         dflt="${osname}"
2414                                 else
2415                                         dflt=none
2416                                 fi
2417                                 ;;
2418                         esac
2419                         ;;
2420                 esac
2421                 if $test -f Policy.sh ; then
2422                         case "$dflt" in
2423                         *Policy*) ;;
2424                         none) dflt="Policy" ;;
2425                         *) dflt="Policy $dflt" ;;
2426                         esac
2427                 fi
2428                 ;;
2429         *)
2430                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2431                 ;;
2432         esac
2433
2434         if $test -f Policy.sh ; then
2435                 $cat <<EOM
2436
2437 There's also a Policy hint file available, which should make the
2438 site-specific (policy) questions easier to answer.
2439 EOM
2440
2441         fi
2442
2443         $cat <<EOM
2444
2445 You may give one or more space-separated answers, or "none" if appropriate.
2446 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2447 is a good thing.  DO NOT give a wrong version or a wrong OS.
2448
2449 EOM
2450
2451         rp="Which of these apply, if any?"
2452         . UU/myread
2453         tans=$ans
2454         for file in $tans; do
2455                 if $test X$file = XPolicy -a -f Policy.sh; then
2456                         . Policy.sh
2457                         $cat Policy.sh >> UU/config.sh
2458                 elif $test -f $src/hints/$file.sh; then
2459                         . $src/hints/$file.sh
2460                         $cat $src/hints/$file.sh >> UU/config.sh
2461                 elif $test X$tans = X -o X$tans = Xnone ; then
2462                         : nothing
2463                 else
2464                         : Give one chance to correct a possible typo.
2465                         echo "$file.sh does not exist"
2466                         dflt=$file
2467                         rp="hint to use instead?"
2468                         . UU/myread
2469                         for file in $ans; do
2470                                 if $test -f "$src/hints/$file.sh"; then
2471                                         . $src/hints/$file.sh
2472                                         $cat $src/hints/$file.sh >> UU/config.sh
2473                                 elif $test X$ans = X -o X$ans = Xnone ; then
2474                                         : nothing
2475                                 else
2476                                         echo "$file.sh does not exist -- ignored."
2477                                 fi
2478                         done
2479                 fi
2480         done
2481
2482         hint=recommended
2483         : Remember our hint file for later.
2484         if $test -f "$src/hints/$file.sh" ; then
2485                 hintfile="$file"
2486         else
2487                 hintfile=''
2488         fi
2489 fi
2490 cd UU
2491 ;;
2492 *)
2493         echo " "
2494         echo "Fetching default answers from $config_sh..." >&4
2495         tmp_n="$n"
2496         tmp_c="$c"
2497         cd ..
2498         cp $config_sh config.sh 2>/dev/null
2499         chmod +w config.sh
2500         . ./config.sh
2501         cd UU
2502         cp ../config.sh .
2503         n="$tmp_n"
2504         c="$tmp_c"
2505         hint=previous
2506         ;;
2507 esac
2508 test "$override" && . ./optdef.sh
2509 myuname="$newmyuname"
2510
2511 : Restore computed paths
2512 for file in $loclist $trylist; do
2513         eval $file="\$_$file"
2514 done
2515
2516 cat << EOM
2517
2518 Configure uses the operating system name and version to set some defaults.
2519 The default value is probably right if the name rings a bell. Otherwise,
2520 since spelling matters for me, either accept the default or answer "none"
2521 to leave it blank.
2522
2523 EOM
2524 case "$osname" in
2525         ''|' ')
2526                 case "$hintfile" in
2527                 ''|' '|none) dflt=none ;;
2528                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2529                 esac
2530                 ;;
2531         *) dflt="$osname" ;;
2532 esac
2533 rp="Operating system name?"
2534 . ./myread
2535 case "$ans" in
2536 none)  osname='' ;;
2537 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2538 esac
2539 echo " "
2540 case "$osvers" in
2541         ''|' ')
2542                 case "$hintfile" in
2543                 ''|' '|none) dflt=none ;;
2544                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2545                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2546                         case "$dflt" in
2547                         ''|' ') dflt=none ;;
2548                         esac
2549                         ;;
2550                 esac
2551                 ;;
2552         *) dflt="$osvers" ;;
2553 esac
2554 rp="Operating system version?"
2555 . ./myread
2556 case "$ans" in
2557 none)  osvers='' ;;
2558 *) osvers="$ans" ;;
2559 esac
2560
2561
2562 . ./posthint.sh
2563
2564 : who configured the system
2565 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2566 cf_by=`(logname) 2>/dev/null`
2567 case "$cf_by" in
2568 "")
2569         cf_by=`(whoami) 2>/dev/null`
2570         case "$cf_by" in
2571         "") cf_by=unknown ;;
2572         esac ;;
2573 esac
2574
2575 : set up the script used to warn in case of inconsistency
2576 cat <<EOS >whoa
2577 $startsh
2578 EOS
2579 cat <<'EOSC' >>whoa
2580 dflt=y
2581 echo " "
2582 echo "*** WHOA THERE!!! ***" >&4
2583 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2584 rp="    Keep the $hint value?"
2585 . ./myread
2586 case "$ans" in
2587 y) td=$was; tu=$was;;
2588 esac
2589 EOSC
2590
2591 : function used to set $1 to $val
2592 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2593 case "$val$was" in
2594 $define$undef) . ./whoa; eval "$var=\$td";;
2595 $undef$define) . ./whoa; eval "$var=\$tu";;
2596 *) eval "$var=$val";;
2597 esac'
2598
2599 cat <<EOM
2600
2601 Perl can be built to take advantage of threads on some systems.
2602 To do so, Configure must be run with -Dusethreads.
2603
2604 Note that threading is a highly experimental feature, and
2605 some known race conditions still remain.  If you choose to try
2606 it, be very sure to not actually deploy it for production
2607 purposes.  README.threads has more details, and is required
2608 reading if you enable threads.
2609 EOM
2610 case "$usethreads" in
2611 $define|true|[yY]*)     dflt='y';;
2612 *) dflt='n';;
2613 esac
2614 rp='Build a threading Perl?'
2615 . ./myread
2616 case "$ans" in
2617 y|Y)    val="$define" ;;
2618 *)      val="$undef" ;;
2619 esac
2620 set usethreads
2621 eval $setvar
2622
2623 case "$usethreads" in
2624 $define)
2625         $cat <<EOM
2626
2627 As of 5.5.640, Perl has two different internal threading implementations,
2628 the 5.005 version (5005threads) and an interpreter-based version
2629 (ithreads) that has one interpreter per thread.  Both are very 
2630 experimental.  This arrangement exists to help developers work out
2631 which one is better.
2632
2633 If you're a casual user, you probably don't want interpreter-threads
2634 at this time.  There doesn't yet exist a way to create threads from
2635 within Perl in this model, i.e., "use Thread;" will NOT work.
2636 EOM
2637         : Default to ithreads unless overridden on command line or with
2638         : old config.sh
2639         dflt='y'
2640         case "$use5005threads" in
2641                 $define|true|[yY]*) dflt='n';;
2642         esac
2643         case "$useithreads" in
2644                 $undef|false|[nN]*) dflt='n';;
2645         esac
2646         rp='Use interpreter-based ithreads?'
2647         . ./myread
2648         case "$ans" in
2649         y|Y)    val="$define" ;;
2650         *)      val="$undef" ;;
2651         esac
2652         set useithreads
2653         eval $setvar
2654         : Now set use5005threads to the opposite value.
2655         case "$useithreads" in
2656         $define) val="$undef" ;;
2657         *) val="$define" ;;
2658         esac
2659         set use5005threads
2660         eval $setvar
2661         ;;
2662 *)
2663         useithreads="$undef"
2664         use5005threads="$undef"
2665         ;;
2666 esac
2667
2668 case "$d_oldpthreads" in
2669 '')     : Configure tests would be welcome here.  For now, assume undef.
2670         val="$undef" ;;
2671 *)      val="$d_oldpthreads" ;;
2672 esac
2673 set d_oldpthreads
2674 eval $setvar
2675
2676
2677 case "$usethreads" in
2678 "$define"|true|[yY]*)
2679 : Look for a hint-file generated 'call-back-unit'.  If the
2680 : user has specified that a threading perl is to be built,
2681 : we may need to set or change some other defaults.
2682         if $test -f usethreads.cbu; then
2683                 echo "Your platform has some specific hints for threaded builds, using them..."
2684                 . ./usethreads.cbu
2685         else
2686                 $cat <<EOM
2687 (Your platform doesn't have any specific hints for threaded builds.
2688  Assuming POSIX threads, then.)
2689 EOM
2690         fi
2691         ;;
2692 esac
2693
2694 cat <<EOM
2695
2696 Perl can be built so that multiple Perl interpreters can coexist
2697 within the same Perl executable.
2698 EOM
2699
2700 case "$useithreads" in
2701 $define)
2702         cat <<EOM
2703 This multiple interpreter support is required for interpreter-based threads.
2704 EOM
2705         val="$define"
2706         ;;
2707 *)
2708         echo 'Normally you do not need this and you should answer no.'
2709         case "$usemultiplicity" in
2710         $define|true|[yY]*)     dflt='y';;
2711         *) dflt='n';;
2712         esac
2713         rp='Build Perl for multiplicity?'
2714         . ./myread
2715         case "$ans" in
2716         y|Y)    val="$define" ;;
2717         *)      val="$undef" ;;
2718         esac
2719         ;;
2720 esac
2721 set usemultiplicity
2722 eval $setvar
2723
2724 : determine where manual pages are on this system
2725 echo " "
2726 case "$sysman" in
2727 '') 
2728         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2729         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2730         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2731         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2732         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2733         sysman=`./loc . /usr/man/man1 $syspath`
2734         ;;
2735 esac
2736 if $test -d "$sysman"; then
2737         echo "System manual is in $sysman." >&4
2738 else
2739         echo "Could not find manual pages in source form." >&4
2740 fi
2741
2742 : see what memory models we can support
2743 case "$models" in
2744 '')
2745         $cat >pdp11.c <<'EOP'
2746 int main() {
2747 #ifdef pdp11
2748         exit(0);
2749 #else
2750         exit(1);
2751 #endif
2752 }
2753 EOP
2754         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2755         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2756                 dflt='unsplit split'
2757         else
2758                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2759                 case "$tans" in
2760                 X) dflt='none';;
2761                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2762                                 dflt='small'
2763                         else
2764                                 dflt=''
2765                         fi
2766                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2767                                 dflt="$dflt medium"
2768                         fi
2769                         if $test -d /lib/large || $test -d /usr/lib/large; then
2770                                 dflt="$dflt large"
2771                         fi
2772                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2773                                 dflt="$dflt huge"
2774                         fi
2775                 esac
2776         fi;;
2777 *) dflt="$models";;
2778 esac
2779 $cat <<EOM
2780  
2781 Some systems have different model sizes.  On most systems they are called
2782 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2783 split.  If your system doesn't support different memory models, say "none".
2784 If you wish to force everything to one memory model, say "none" here and
2785 put the appropriate flags later when it asks you for other cc and ld flags.
2786 Venix systems may wish to put "none" and let the compiler figure things out.
2787 (In the following question multiple model names should be space separated.)
2788
2789 The default for most systems is "none".
2790
2791 EOM
2792 rp="Which memory models are supported?"
2793 . ./myread
2794 models="$ans"
2795
2796 case "$models" in
2797 none)
2798         small=''
2799         medium=''
2800         large=''
2801         huge=''
2802         unsplit=''
2803         split=''
2804         ;;
2805 *split)
2806         case "$split" in
2807         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2808                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2809                         dflt='-i'
2810                 else
2811                         dflt='none'
2812                 fi;;
2813         *) dflt="$split";;
2814         esac
2815         rp="What flag indicates separate I and D space?"
2816         . ./myread
2817         tans="$ans"
2818         case "$tans" in
2819         none) tans='';;
2820         esac
2821         split="$tans"
2822         unsplit='';;
2823 *large*|*small*|*medium*|*huge*)
2824         case "$models" in
2825         *large*)
2826                 case "$large" in
2827                 '') dflt='-Ml';;
2828                 *) dflt="$large";;
2829                 esac
2830         rp="What flag indicates large model?"
2831         . ./myread
2832         tans="$ans"
2833         case "$tans" in
2834         none) tans='';
2835         esac
2836         large="$tans";;
2837         *) large='';;
2838         esac
2839         case "$models" in
2840         *huge*) case "$huge" in
2841                 '') dflt='-Mh';;
2842                 *) dflt="$huge";;
2843                 esac
2844                 rp="What flag indicates huge model?"
2845                 . ./myread
2846                 tans="$ans"
2847                 case "$tans" in
2848                 none) tans='';
2849                 esac
2850                 huge="$tans";;
2851         *) huge="$large";;
2852         esac
2853         case "$models" in
2854         *medium*) case "$medium" in
2855                 '') dflt='-Mm';;
2856                 *) dflt="$medium";;
2857                 esac
2858                 rp="What flag indicates medium model?"
2859                 . ./myread
2860                 tans="$ans"
2861                 case "$tans" in
2862                 none) tans='';
2863                 esac
2864                 medium="$tans";;
2865         *) medium="$large";;
2866         esac
2867         case "$models" in
2868         *small*) case "$small" in
2869                 '') dflt='none';;
2870                 *) dflt="$small";;
2871                 esac
2872                 rp="What flag indicates small model?"
2873                 . ./myread
2874                 tans="$ans"
2875                 case "$tans" in
2876                 none) tans='';
2877                 esac
2878                 small="$tans";;
2879         *) small='';;
2880         esac
2881         ;;
2882 *)
2883         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2884         ;;
2885 esac
2886 $rm -f pdp11.* pdp11
2887
2888 : make some quick guesses about what we are up against
2889 echo " "
2890 $echo $n "Hmm...  $c"
2891 echo exit 1 >bsd
2892 echo exit 1 >usg
2893 echo exit 1 >v7
2894 echo exit 1 >osf1
2895 echo exit 1 >eunice
2896 echo exit 1 >xenix
2897 echo exit 1 >venix
2898 echo exit 1 >os2
2899 d_bsd="$undef"
2900 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2901 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2902 then
2903         echo "Looks kind of like an OSF/1 system, but we'll see..."
2904         echo exit 0 >osf1
2905 elif test `echo abc | tr a-z A-Z` = Abc ; then
2906         xxx=`./loc addbib blurfl $pth`
2907         if $test -f $xxx; then
2908         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2909                 echo exit 0 >bsd
2910                 echo exit 0 >usg
2911         else
2912                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2913                         echo "Looks kind of like an extended USG system, but we'll see..."
2914                 else
2915                         echo "Looks kind of like a USG system, but we'll see..."
2916                 fi
2917                 echo exit 0 >usg
2918         fi
2919 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2920         echo "Looks kind of like a BSD system, but we'll see..."
2921         d_bsd="$define"
2922         echo exit 0 >bsd
2923 else
2924         echo "Looks kind of like a Version 7 system, but we'll see..."
2925         echo exit 0 >v7
2926 fi
2927 case "$eunicefix" in
2928 *unixtovms*)
2929         $cat <<'EOI'
2930 There is, however, a strange, musty smell in the air that reminds me of
2931 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2932 EOI
2933         echo exit 0 >eunice
2934         d_eunice="$define"
2935 : it so happens the Eunice I know will not run shell scripts in Unix format
2936         ;;
2937 *)
2938         echo " "
2939         echo "Congratulations.  You aren't running Eunice."
2940         d_eunice="$undef"
2941         ;;
2942 esac
2943 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2944 case "$p_" in
2945 :) ;;
2946 *)
2947         $cat <<'EOI'
2948 I have the feeling something is not exactly right, however...don't tell me...
2949 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2950 EOI
2951         echo exit 0 >os2
2952         ;;
2953 esac
2954 if test -f /xenix; then
2955         echo "Actually, this looks more like a XENIX system..."
2956         echo exit 0 >xenix
2957         d_xenix="$define"
2958 else
2959         echo " "
2960         echo "It's not Xenix..."
2961         d_xenix="$undef"
2962 fi
2963 chmod +x xenix
2964 $eunicefix xenix
2965 if test -f /venix; then
2966         echo "Actually, this looks more like a VENIX system..."
2967         echo exit 0 >venix
2968 else
2969         echo " "
2970         if ./xenix; then
2971                 : null
2972         else
2973                 echo "Nor is it Venix..."
2974         fi
2975 fi
2976 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2977 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2978 $rm -f foo
2979
2980 : see if we need a special compiler
2981 echo " "
2982 if ./usg; then
2983         case "$cc" in
2984         '') case "$Mcc" in
2985                 /*) dflt='Mcc';;
2986                 *) case "$large" in
2987                         -M*) dflt='cc';;
2988                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2989                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2990                                                 dflt='cc'
2991                                         else
2992                                                 dflt='cc -M'
2993                                         fi
2994                                 else
2995                                         dflt='cc'
2996                                 fi;;
2997                         esac;;
2998                 esac;;
2999         *)  dflt="$cc";;
3000         esac
3001         case "$dflt" in
3002         *M*)    $cat <<'EOM'
3003 On some older systems the default C compiler will not resolve multiple global
3004 references that happen to have the same name.  On some such systems the "Mcc"
3005 command may be used to force these to be resolved.  On other systems a "cc -M"
3006 command is required.  (Note that the -M flag on other systems indicates a
3007 memory model to use!) If you have the Gnu C compiler, you might wish to use
3008 that instead.
3009
3010 EOM
3011         ;;
3012         esac
3013         rp="Use which C compiler?"
3014         . ./myread
3015         cc="$ans"
3016 else
3017         case "$cc" in
3018         '') dflt=cc;;
3019         *) dflt="$cc";;
3020         esac
3021         rp="Use which C compiler?"
3022         . ./myread
3023         cc="$ans"
3024 fi
3025 : Look for a hint-file generated 'call-back-unit'.  Now that the
3026 : user has specified the compiler, we may need to set or change some
3027 : other defaults.
3028 if $test -f cc.cbu; then
3029     . ./cc.cbu
3030 fi
3031 echo " "
3032 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3033 $cat >gccvers.c <<EOM
3034 #include <stdio.h>
3035 int main() {
3036 #ifdef __GNUC__
3037 #ifdef __VERSION__
3038         printf("%s\n", __VERSION__);
3039 #else
3040         printf("%s\n", "1");
3041 #endif
3042 #endif
3043         exit(0);
3044 }
3045 EOM
3046 if $cc -o gccvers gccvers.c; then
3047         gccversion=`./gccvers`
3048         case "$gccversion" in
3049         '') echo "You are not using GNU cc." ;;
3050         *)  echo "You are using GNU cc $gccversion."
3051             ;;
3052         esac
3053 else
3054         echo " "
3055         echo "*** WHOA THERE!!! ***" >&4
3056         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3057         case "$knowitall" in
3058         '')
3059         echo "    You'd better start hunting for one and let me know about it." >&4
3060                 exit 1
3061                 ;;
3062         esac
3063 fi
3064 $rm -f gccvers*
3065 case "$gccversion" in
3066 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3067 esac
3068
3069 : decide how portable to be.  Allow command line overrides.
3070 case "$d_portable" in
3071 "$undef") ;;
3072 *)      d_portable="$define" ;;
3073 esac
3074
3075 : set up shell script to do ~ expansion
3076 cat >filexp <<EOSS
3077 $startsh
3078 : expand filename
3079 case "\$1" in
3080  ~/*|~)
3081         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3082         ;;
3083  ~*)
3084         if $test -f /bin/csh; then
3085                 /bin/csh -f -c "glob \$1"
3086                 failed=\$?
3087                 echo ""
3088                 exit \$failed
3089         else
3090                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3091                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3092                 if $test ! -d "\$dir"; then
3093                         me=\`basename \$0\`
3094                         echo "\$me: can't locate home directory for: \$name" >&2
3095                         exit 1
3096                 fi
3097                 case "\$1" in
3098                 */*)
3099                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3100                         ;;
3101                 *)
3102                         echo \$dir
3103                         ;;
3104                 esac
3105         fi
3106         ;;
3107 *)
3108         echo \$1
3109         ;;
3110 esac
3111 EOSS
3112 chmod +x filexp
3113 $eunicefix filexp
3114
3115 : now set up to get a file name
3116 cat <<EOS >getfile
3117 $startsh
3118 EOS
3119 cat <<'EOSC' >>getfile
3120 tilde=''
3121 fullpath=''
3122 already=''
3123 skip=''
3124 none_ok=''
3125 exp_file=''
3126 nopath_ok=''
3127 orig_rp="$rp"
3128 orig_dflt="$dflt"
3129 case "$gfpth" in
3130 '') gfpth='.' ;;
3131 esac
3132
3133 case "$fn" in
3134 *\(*)
3135         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3136         fn=`echo $fn | sed 's/(.*)//'`
3137         ;;
3138 esac
3139
3140 case "$fn" in
3141 *:*)
3142         loc_file=`expr $fn : '.*:\(.*\)'`
3143         fn=`expr $fn : '\(.*\):.*'`
3144         ;;
3145 esac
3146
3147 case "$fn" in
3148 *~*) tilde=true;;
3149 esac
3150 case "$fn" in
3151 */*) fullpath=true;;
3152 esac
3153 case "$fn" in
3154 *+*) skip=true;;
3155 esac
3156 case "$fn" in
3157 *n*) none_ok=true;;
3158 esac
3159 case "$fn" in
3160 *e*) exp_file=true;;
3161 esac
3162 case "$fn" in
3163 *p*) nopath_ok=true;;
3164 esac
3165
3166 case "$fn" in
3167 *f*) type='File';;
3168 *d*) type='Directory';;
3169 *l*) type='Locate';;
3170 esac
3171
3172 what="$type"
3173 case "$what" in
3174 Locate) what='File';;
3175 esac
3176
3177 case "$exp_file" in
3178 '')
3179         case "$d_portable" in
3180         "$define") ;;
3181         *) exp_file=true;;
3182         esac
3183         ;;
3184 esac
3185
3186 cd ..
3187 while test "$type"; do
3188         redo=''
3189         rp="$orig_rp"
3190         dflt="$orig_dflt"
3191         case "$tilde" in
3192         true) rp="$rp (~name ok)";;
3193         esac
3194         . UU/myread
3195         if test -f UU/getfile.ok && \
3196                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3197         then
3198                 value="$ans"
3199                 ansexp="$ans"
3200                 break
3201         fi
3202         case "$ans" in
3203         none)
3204                 value=''
3205                 ansexp=''
3206                 case "$none_ok" in
3207                 true) type='';;
3208                 esac
3209                 ;;
3210         *)
3211                 case "$tilde" in
3212                 '') value="$ans"
3213                         ansexp="$ans";;
3214                 *)
3215                         value=`UU/filexp $ans`
3216                         case $? in
3217                         0)
3218                                 if test "$ans" != "$value"; then
3219                                         echo "(That expands to $value on this system.)"
3220                                 fi
3221                                 ;;
3222                         *) value="$ans";;
3223                         esac
3224                         ansexp="$value"
3225                         case "$exp_file" in
3226                         '') value="$ans";;
3227                         esac
3228                         ;;
3229                 esac
3230                 case "$fullpath" in
3231                 true)
3232                         case "$ansexp" in
3233                         /*) value="$ansexp" ;;
3234                         *)
3235                                 redo=true
3236                                 case "$already" in
3237                                 true)
3238                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3239                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3240                                         ;;
3241                                 *)
3242                                 echo "Please give a full path name, starting with slash." >&4
3243                                         case "$tilde" in
3244                                         true)
3245                                 echo "Note that using ~name is ok provided it expands well." >&4
3246                                                 already=true
3247                                                 ;;
3248                                         esac
3249                                 esac
3250                                 ;;
3251                         esac
3252                         ;;
3253                 esac
3254                 case "$redo" in
3255                 '')
3256                         case "$type" in
3257                         File)
3258                                 for fp in $gfpth; do
3259                                         if test "X$fp" = X.; then
3260                                             pf="$ansexp"
3261                                         else    
3262                                             pf="$fp/$ansexp"
3263                                         fi
3264                                         if test -f "$pf"; then
3265                                                 type=''
3266                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3267                                         then
3268                                                 echo "($value is not a plain file, but that's ok.)"
3269                                                 type=''
3270                                         fi
3271                                         if test X"$type" = X; then
3272                                             value="$pf"
3273                                             break
3274                                         fi
3275                                 done
3276                                 ;;
3277                         Directory)
3278                                 for fp in $gfpth; do
3279                                         if test "X$fp" = X.; then
3280                                             pf="$ansexp"
3281                                         else    
3282                                             pf="$fp/$ansexp"
3283                                         fi
3284                                         if test -d "$pf"; then
3285                                                 type=''
3286                                                 value="$pf"
3287                                                 break
3288                                         fi
3289                                 done
3290                                 ;;
3291                         Locate)
3292                                 if test -d "$ansexp"; then
3293                                         echo "(Looking for $loc_file in directory $value.)"
3294                                         value="$value/$loc_file"
3295                                         ansexp="$ansexp/$loc_file"
3296                                 fi
3297                                 if test -f "$ansexp"; then
3298                                         type=''
3299                                 fi
3300                                 case "$nopath_ok" in
3301                                 true)   case "$value" in
3302                                         */*) ;;
3303                                         *)      echo "Assuming $value will be in people's path."
3304                                                 type=''
3305                                                 ;;
3306                                         esac
3307                                         ;;
3308                                 esac
3309                                 ;;
3310                         esac
3311
3312                         case "$skip" in
3313                         true) type='';
3314                         esac
3315
3316                         case "$type" in
3317                         '') ;;
3318                         *)
3319                                 if test "$fastread" = yes; then
3320                                         dflt=y
3321                                 else
3322                                         dflt=n
3323                                 fi
3324                                 rp="$what $value doesn't exist.  Use that name anyway?"
3325                                 . UU/myread
3326                                 dflt=''
3327                                 case "$ans" in
3328                                 y*) type='';;
3329                                 *) echo " ";;
3330                                 esac
3331                                 ;;
3332                         esac
3333                         ;;
3334                 esac
3335                 ;;
3336         esac
3337 done
3338 cd UU
3339 ans="$value"
3340 rp="$orig_rp"
3341 dflt="$orig_dflt"
3342 rm -f getfile.ok
3343 test "X$gfpthkeep" != Xy && gfpth=""
3344 EOSC
3345
3346 : What should the include directory be ?
3347 echo " "
3348 $echo $n "Hmm...  $c"
3349 dflt='/usr/include'
3350 incpath=''
3351 mips_type=''
3352 if $test -f /bin/mips && /bin/mips; then
3353         echo "Looks like a MIPS system..."
3354         $cat >usr.c <<'EOCP'
3355 #ifdef SYSTYPE_BSD43
3356 /bsd43
3357 #endif
3358 EOCP
3359         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3360                 dflt='/bsd43/usr/include'
3361                 incpath='/bsd43'
3362                 mips_type='BSD 4.3'
3363         else
3364                 mips_type='System V'
3365         fi
3366         $rm -f usr.c usr.out
3367         echo "and you're compiling with the $mips_type compiler and libraries."
3368         xxx_prompt=y
3369         echo "exit 0" >mips
3370 else
3371         echo "Doesn't look like a MIPS system."
3372         xxx_prompt=n
3373         echo "exit 1" >mips
3374 fi
3375 chmod +x mips
3376 $eunicefix mips
3377 case "$usrinc" in
3378 '') ;;
3379 *) dflt="$usrinc";;
3380 esac
3381 case "$xxx_prompt" in
3382 y)      fn=d/
3383         echo " "
3384         rp='Where are the include files you want to use?'
3385         . ./getfile
3386         usrinc="$ans"
3387         ;;
3388 *)      usrinc="$dflt"
3389         ;;
3390 esac
3391
3392 : see how we invoke the C preprocessor
3393 echo " "
3394 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3395 cat <<'EOT' >testcpp.c
3396 #define ABC abc
3397 #define XYZ xyz
3398 ABC.XYZ
3399 EOT
3400 cd ..
3401 if test ! -f cppstdin; then
3402         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3403                 # AIX cc -E doesn't show the absolute headerfile
3404                 # locations but we'll cheat by using the -M flag.
3405                 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
3406         else
3407                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3408         fi
3409 else
3410         echo "Keeping your $hint cppstdin wrapper."
3411 fi
3412 chmod 755 cppstdin
3413 wrapper=`pwd`/cppstdin
3414 ok='false'
3415 cd UU
3416
3417 if $test "X$cppstdin" != "X" && \
3418         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3419         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3420 then
3421         echo "You used to use $cppstdin $cppminus so we'll use that again."
3422         case "$cpprun" in
3423         '') echo "But let's see if we can live without a wrapper..." ;;
3424         *)
3425                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3426                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3427                 then
3428                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3429                         ok='true'
3430                 else
3431                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3432                 fi
3433                 ;;
3434         esac
3435 else
3436         case "$cppstdin" in
3437         '') ;;
3438         *)
3439                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3440                 ;;
3441         esac
3442 fi
3443
3444 if $ok; then
3445         : nothing
3446 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3447         $cc -E <testcpp.c >testcpp.out 2>&1; \
3448         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3449         echo "Yup, it does."
3450         x_cpp="$cc -E"
3451         x_minus='';
3452 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3453         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3454         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3455         echo "Yup, it does."
3456         x_cpp="$cc -E"
3457         x_minus='-';
3458 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3459         $cc -P <testcpp.c >testcpp.out 2>&1; \
3460         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3461         echo "Yipee, that works!"
3462         x_cpp="$cc -P"
3463         x_minus='';
3464 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3465         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3466         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3467         echo "At long last!"
3468         x_cpp="$cc -P"
3469         x_minus='-';
3470 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3471         $cpp <testcpp.c >testcpp.out 2>&1; \
3472         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3473         echo "It works!"
3474         x_cpp="$cpp"
3475         x_minus='';
3476 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3477         $cpp - <testcpp.c >testcpp.out 2>&1; \
3478         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3479         echo "Hooray, it works!  I was beginning to wonder."
3480         x_cpp="$cpp"
3481         x_minus='-';
3482 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3483         $wrapper <testcpp.c >testcpp.out 2>&1; \
3484         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3485         x_cpp="$wrapper"
3486         x_minus=''
3487         echo "Eureka!"
3488 else
3489         dflt=''
3490         rp="No dice.  I can't find a C preprocessor.  Name one:"
3491         . ./myread
3492         x_cpp="$ans"
3493         x_minus=''
3494         $x_cpp <testcpp.c >testcpp.out 2>&1
3495         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3496                 echo "OK, that will do." >&4
3497         else
3498 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3499                 exit 1
3500         fi
3501 fi
3502
3503 case "$ok" in
3504 false)
3505         cppstdin="$x_cpp"
3506         cppminus="$x_minus"
3507         cpprun="$x_cpp"
3508         cpplast="$x_minus"
3509         set X $x_cpp
3510         shift
3511         case "$1" in
3512         "$cpp")
3513                 echo "Perhaps can we force $cc -E using a wrapper..."
3514                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3515                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3516                 then
3517                         echo "Yup, we can."
3518                         cppstdin="$wrapper"
3519                         cppminus='';
3520                 else
3521                         echo "Nope, we'll have to live without it..."
3522                 fi
3523                 ;;
3524         esac
3525         case "$cpprun" in
3526         "$wrapper")
3527                 cpprun=''
3528                 cpplast=''
3529                 ;;
3530         esac
3531         ;;
3532 esac
3533
3534 case "$cppstdin" in
3535 "$wrapper"|'cppstdin') ;;
3536 *) $rm -f $wrapper;;
3537 esac
3538 $rm -f testcpp.c testcpp.out
3539
3540 : Set private lib path
3541 case "$plibpth" in
3542 '') if ./mips; then
3543                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3544         fi;;
3545 esac
3546 case "$libpth" in
3547 ' ') dlist='';;
3548 '') dlist="$loclibpth $plibpth $glibpth";;
3549 *) dlist="$libpth";;
3550 esac
3551
3552 : Now check and see which directories actually exist, avoiding duplicates
3553 libpth=''
3554 for xxx in $dlist
3555 do
3556     if $test -d $xxx; then
3557                 case " $libpth " in
3558                 *" $xxx "*) ;;
3559                 *) libpth="$libpth $xxx";;
3560                 esac
3561     fi
3562 done
3563 $cat <<'EOM'
3564
3565 Some systems have incompatible or broken versions of libraries.  Among
3566 the directories listed in the question below, please remove any you
3567 know not to be holding relevant libraries, and add any that are needed.
3568 Say "none" for none.
3569
3570 EOM
3571 case "$libpth" in
3572 '') dflt='none';;
3573 *)
3574         set X $libpth
3575         shift
3576         dflt=${1+"$@"}
3577         ;;
3578 esac
3579 rp="Directories to use for library searches?"
3580 . ./myread
3581 case "$ans" in
3582 none) libpth=' ';;
3583 *) libpth="$ans";;
3584 esac
3585
3586 : compute shared library extension
3587 case "$so" in
3588 '')
3589         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3590                 dflt='sl'
3591         else
3592                 dflt='so'
3593         fi
3594         ;;
3595 *) dflt="$so";;
3596 esac
3597 $cat <<EOM
3598
3599 On some systems, shared libraries may be available.  Answer 'none' if
3600 you want to suppress searching of shared libraries for the remainder
3601 of this configuration.
3602
3603 EOM
3604 rp='What is the file extension used for shared libraries?'
3605 . ./myread
3606 so="$ans"
3607
3608 : Define several unixisms.
3609 : Hints files or command line option can be used to override them.
3610 : The convoluted testing is in case hints files set either the old
3611 : or the new name.
3612 case "$_exe" in
3613 '')     case "$exe_ext" in
3614     '') ;;
3615         *)      _exe="$exe_ext" ;;
3616         esac
3617         ;;
3618 esac
3619 case "$_a" in
3620 '')     case "$lib_ext" in
3621     '') _a='.a';;
3622         *)      _a="$lib_ext" ;;
3623         esac
3624         ;;
3625 esac
3626 case "$_o" in
3627 '') case "$obj_ext" in
3628         '')     _o='.o';;
3629         *)      _o="$obj_ext";;
3630         esac
3631         ;;
3632 esac
3633 case "$p_" in
3634 '') case "$path_sep" in
3635         '')     p_=':';;
3636         *)      p_="$path_sep";;
3637         esac
3638         ;;
3639 esac
3640 exe_ext=$_exe
3641 lib_ext=$_a
3642 obj_ext=$_o
3643 path_sep=$p_
3644
3645 : Which makefile gets called first.  This is used by make depend.
3646 case "$firstmakefile" in
3647 '') firstmakefile='makefile';;
3648 esac
3649
3650 cat <<EOM
3651
3652 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3653 Configure must be run with -Dusesocks.
3654
3655 Normally you do not need this and you should answer no.
3656
3657 EOM
3658 case "$usesocks" in
3659 $define|true|[yY]*)     dflt='y';;
3660 *) dflt='n';;
3661 esac
3662 rp='Build Perl for SOCKS?'
3663 . ./myread
3664 case "$ans" in
3665 y|Y)    val="$define" ;;     
3666 *)      val="$undef" ;;
3667 esac
3668 set usesocks
3669 eval $setvar
3670
3671 : Looking for optional libraries
3672 echo " "
3673 echo "Checking for optional libraries..." >&4
3674 case "$libs" in
3675 ' '|'') dflt='';;
3676 *) dflt="$libs";;
3677 esac
3678 case "$libswanted" in
3679 '') libswanted='c_s';;
3680 esac
3681 case "$usesocks" in
3682 $define)
3683         libswanted="$libswanted socks5 socks5_sh"
3684         ;;
3685 esac
3686 for thislib in $libswanted; do
3687         
3688         libname="$thislib"
3689         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3690                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3691                 libstyle=shared
3692         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3693                 libstyle=shared
3694         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3695                 libstyle=static
3696         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3697                 libstyle=static
3698         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3699                 libstyle=static
3700                 libname=${thislib}_s
3701         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3702                 libstyle="static"
3703         fi
3704         if $test -f "$xxx"; then
3705                 eval $libscheck
3706         fi
3707         if $test -f "$xxx"; then
3708                 case "$libstyle" in
3709                 shared) echo "Found -l$libname (shared)." ;;
3710                 static) echo "Found -l$libname." ;;
3711                 *)      echo "Found -l$libname ($libstyle)." ;;
3712                 esac
3713                 case " $dflt " in
3714                 *"-l$thislib "*);;
3715                 *) dflt="$dflt -l$libname"
3716                    libsfound="$libsfound $xxx"
3717                    yyy=`basename $xxx`
3718                    libsfiles="$libsfiles $yyy"
3719                    yyy=`echo $xxx|sed "s@/$yyy\\$@@"`
3720                    case " $libsdirs " in
3721                    *" $yyy "*) ;;
3722                    *) libsdirs="$libsdirs $yyy" ;;
3723                    esac
3724                    ;;
3725                 esac
3726         else
3727                 echo "No -l$thislib."
3728         fi
3729 done
3730 set X $dflt
3731 shift
3732 dflt="$*"
3733 case "$libs" in
3734 '') dflt="$dflt";;
3735 *) dflt="$libs";;
3736 esac
3737 case "$dflt" in
3738 ' '|'') dflt='none';;
3739 esac
3740
3741 case "$libsfound" in
3742 *libm*) ;;
3743 *) cat <<EOM >&4
3744
3745 I could not find -lm, the mathematics library.
3746 This means that something went awfully wrong.
3747
3748 EOM
3749    exit 1
3750    ;;
3751 esac
3752
3753 $cat <<EOM
3754
3755 In order to compile $package on your machine, a number of libraries
3756 are usually needed.  Include any other special libraries here as well.
3757 Say "none" for none.  The default list is almost always right.
3758 EOM
3759
3760 echo " "
3761 rp="What libraries to use?"
3762 . ./myread
3763 case "$ans" in
3764 none) libs=' ';;
3765 *) libs="$ans";;
3766 esac
3767
3768 : determine optimization, if desired, or use for debug flag also
3769 case "$optimize" in
3770 ' '|$undef) dflt='none';;
3771 '') dflt='-O';;
3772 *) dflt="$optimize";;
3773 esac
3774 $cat <<EOH
3775
3776 By default, $package compiles with the -O flag to use the optimizer.
3777 Alternately, you might want to use the symbolic debugger, which uses
3778 the -g flag (on traditional Unix systems).  Either flag can be
3779 specified here.  To use neither flag, specify the word "none".
3780
3781 EOH
3782 rp="What optimizer/debugger flag should be used?"
3783 . ./myread
3784 optimize="$ans"
3785 case "$optimize" in
3786 'none') optimize=" ";;
3787 esac
3788
3789 dflt=''
3790 : We will not override a previous value, but we might want to
3791 : augment a hint file
3792 case "$hint" in
3793 default|recommended)
3794         case "$gccversion" in
3795         1*) dflt='-fpcc-struct-return' ;;
3796         esac
3797         case "$optimize" in
3798         *-g*) dflt="$dflt -DDEBUGGING";;
3799         esac
3800         case "$gccversion" in
3801         2*) if test -d /etc/conf/kconfig.d &&
3802                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3803                 then
3804                         dflt="$dflt -posix"
3805                 fi
3806                 ;;
3807         esac
3808         case "$gccversion" in
3809         1*) ;;
3810         2.[0-8]*) ;;
3811         ?*)     echo " "
3812                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3813                 echo 'int main(void) { return 0; }' > gcctest.c
3814                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3815                         echo "Yes, it does." 2>&1
3816                         case "$ccflags" in
3817                         *strict-aliasing*) 
3818                                 echo "Leaving current flags $ccflags alone." 2>&1
3819                                 ;;
3820                         *) dflt="$dflt -fno-strict-aliasing" ;;
3821                         esac
3822                 else
3823                         echo "Nope, it doesn't, but that's ok." 2>&1
3824                 fi
3825                 ;;
3826         esac
3827         ;;
3828 esac
3829
3830 case "$mips_type" in
3831 *BSD*|'') inclwanted="$locincpth $usrinc";;
3832 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3833 esac
3834 for thisincl in $inclwanted; do
3835         if $test -d $thisincl; then
3836                 if $test x$thisincl != x$usrinc; then
3837                         case "$dflt" in
3838                         *$thisincl*);;
3839                         *) dflt="$dflt -I$thisincl";;
3840                         esac
3841                 fi
3842         fi
3843 done
3844
3845 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3846         xxx=true;
3847 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3848         xxx=true;
3849 else
3850         xxx=false;
3851 fi;
3852 if $xxx; then
3853         case "$dflt" in
3854         *$2*);;
3855         *) dflt="$dflt -D$2";;
3856         esac;
3857 fi'
3858
3859 set signal.h LANGUAGE_C; eval $inctest
3860
3861 case "$usesocks" in
3862 $define)
3863         ccflags="$ccflags -DSOCKS"
3864         ;;
3865 esac
3866
3867 case "$hint" in
3868 default|recommended) dflt="$ccflags $dflt" ;;
3869 *) dflt="$ccflags";;
3870 esac
3871
3872 case "$dflt" in
3873 ''|' ') dflt=none;;
3874 esac
3875 $cat <<EOH
3876
3877 Your C compiler may want other flags.  For this question you should include
3878 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3879 but you should NOT include libraries or ld flags like -lwhatever.  If you
3880 want $package to honor its debug switch, you should include -DDEBUGGING here.
3881 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3882
3883 To use no flags, specify the word "none".
3884
3885 EOH
3886 set X $dflt
3887 shift
3888 dflt=${1+"$@"}
3889 rp="Any additional cc flags?"
3890 . ./myread
3891 case "$ans" in
3892 none) ccflags='';;
3893 *) ccflags="$ans";;
3894 esac
3895
3896 : the following weeds options from ccflags that are of no interest to cpp
3897 cppflags="$ccflags"
3898 case "$gccversion" in
3899 1*) cppflags="$cppflags -D__GNUC__"
3900 esac
3901 case "$mips_type" in
3902 '');;
3903 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3904 esac
3905 case "$cppflags" in
3906 '');;
3907 *)
3908         echo " "
3909         echo "Let me guess what the preprocessor flags are..." >&4
3910         set X $cppflags
3911         shift
3912         cppflags=''
3913         $cat >cpp.c <<'EOM'
3914 #define BLURFL foo
3915
3916 BLURFL xx LFRULB
3917 EOM
3918         previous=''
3919         for flag in $*
3920         do
3921                 case "$flag" in
3922                 -*) ftry="$flag";;
3923                 *) ftry="$previous $flag";;
3924                 esac
3925                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3926                         >cpp1.out 2>/dev/null && \
3927                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3928                         >cpp2.out 2>/dev/null && \
3929                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3930                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3931                 then
3932                         cppflags="$cppflags $ftry"
3933                         previous=''
3934                 else
3935                         previous="$flag"
3936                 fi
3937         done
3938         set X $cppflags
3939         shift
3940         cppflags=${1+"$@"}
3941         case "$cppflags" in
3942         *-*)  echo "They appear to be: $cppflags";;
3943         esac
3944         $rm -f cpp.c cpp?.out
3945         ;;
3946 esac
3947
3948 : flags used in final linking phase
3949 case "$ldflags" in
3950 '') if ./venix; then
3951                 dflt='-i -z'
3952         else
3953                 dflt=''
3954         fi
3955         case "$ccflags" in
3956         *-posix*) dflt="$dflt -posix" ;;
3957         esac
3958         ;;
3959 *) dflt="$ldflags";;
3960 esac
3961
3962 : Try to guess additional flags to pick up local libraries.
3963 for thislibdir in $libpth; do
3964         case " $loclibpth " in
3965         *" $thislibdir "*)
3966                 case "$dflt " in 
3967                 *"-L$thislibdir "*) ;;
3968                 *)  dflt="$dflt -L$thislibdir" ;;
3969                 esac
3970                 ;;
3971         esac
3972 done
3973
3974 case "$dflt" in
3975 '') dflt='none' ;;
3976 esac
3977
3978 $cat <<EOH
3979
3980 Your C linker may need flags.  For this question you should
3981 include -L/whatever and any other flags used by the C linker, but you
3982 should NOT include libraries like -lwhatever.
3983
3984 Make sure you include the appropriate -L/path flags if your C linker
3985 does not normally search all of the directories you specified above,
3986 namely
3987         $libpth
3988 To use no flags, specify the word "none".
3989
3990 EOH
3991
3992 rp="Any additional ld flags (NOT including libraries)?"
3993 . ./myread
3994 case "$ans" in
3995 none) ldflags='';;
3996 *) ldflags="$ans";;
3997 esac
3998 rmlist="$rmlist pdp11"
3999
4000 : coherency check
4001 echo " "
4002 echo "Checking your choice of C compiler and flags for coherency..." >&4
4003 $cat > try.c <<'EOF'
4004 #include <stdio.h>
4005 int main() { printf("Ok\n"); exit(0); }
4006 EOF
4007 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4008 shift
4009 $cat >try.msg <<'EOM'
4010 I've tried to compile and run the following simple program:
4011
4012 EOM
4013 $cat try.c >> try.msg
4014
4015 $cat >> try.msg <<EOM
4016
4017 I used the command:
4018
4019         $*
4020         ./try
4021
4022 and I got the following output:
4023
4024 EOM
4025 dflt=y
4026 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4027         if sh -c './try' >>try.msg 2>&1; then
4028                 xxx=`./try`
4029                 case "$xxx" in
4030                 "Ok") dflt=n ;;
4031                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4032                         case " $libs " in
4033                         *" -lsfio "*)
4034                                 cat >> try.msg <<'EOQS'
4035 If $libs contains -lsfio, and sfio is mis-configured, then it
4036 sometimes (apparently) runs and exits with a 0 status, but with no
4037 output!  It may have to do with sfio's use of _exit vs. exit.
4038
4039 EOQS
4040                                 rp="You have a big problem.  Shall I abort Configure"
4041                                 dflt=y
4042                                 ;;
4043                         esac
4044                         ;;
4045                 esac
4046         else
4047                 echo "The program compiled OK, but exited with status $?." >>try.msg
4048                 rp="You have a problem.  Shall I abort Configure"
4049                 dflt=y
4050         fi
4051 else
4052         echo "I can't compile the test program." >>try.msg
4053         rp="You have a BIG problem.  Shall I abort Configure"
4054         dflt=y
4055 fi
4056 case "$dflt" in
4057 y)
4058         $cat try.msg >&4
4059         case "$knowitall" in
4060         '')
4061                 echo "(The supplied flags or libraries might be incorrect.)"
4062                 ;;
4063         *) dflt=n;;
4064         esac
4065         echo " "
4066         . ./myread
4067         case "$ans" in
4068         n*|N*) ;;
4069         *)      echo "Ok.  Stopping Configure." >&4
4070                 exit 1
4071                 ;;
4072         esac
4073         ;;
4074 n) echo "OK, that should do.";;
4075 esac
4076 $rm -f try try.* core
4077
4078 : define an is-a-typedef? function
4079 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4080 case "$inclist" in
4081 "") inclist="sys/types.h";;
4082 esac;
4083 eval "varval=\$$var";
4084 case "$varval" in
4085 "")
4086         $rm -f temp.c;
4087         for inc in $inclist; do
4088                 echo "#include <$inc>" >>temp.c;
4089         done;
4090         echo "#ifdef $type" >> temp.c;
4091         echo "printf(\"We have $type\");" >> temp.c;
4092         echo "#endif" >> temp.c;
4093         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4094         if $contains $type temp.E >/dev/null 2>&1; then
4095                 eval "$var=\$type";
4096         else
4097                 eval "$var=\$def";
4098         fi;
4099         $rm -f temp.?;;
4100 *) eval "$var=\$varval";;
4101 esac'
4102
4103 : define an is-a-typedef? function that prompts if the type is not available.
4104 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4105 case "$inclist" in
4106 "") inclist="sys/types.h";;
4107 esac;
4108 eval "varval=\$$var";
4109 case "$varval" in
4110 "")
4111         $rm -f temp.c;
4112         for inc in $inclist; do
4113                 echo "#include <$inc>" >>temp.c;
4114         done;
4115         echo "#ifdef $type" >> temp.c;
4116         echo "printf(\"We have $type\");" >> temp.c;
4117         echo "#endif" >> temp.c;
4118         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4119         echo " " ;
4120         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4121         if $contains $type temp.E >/dev/null 2>&1; then
4122                 echo "$type found." >&4;
4123                 eval "$var=\$type";
4124         else
4125                 echo "$type NOT found." >&4;
4126                 dflt="$def";
4127                 . ./myread ;
4128                 eval "$var=\$ans";
4129         fi;
4130         $rm -f temp.?;;
4131 *) eval "$var=\$varval";;
4132 esac'
4133
4134 : define a shorthand compile call
4135 compile='
4136 mc_file=$1;
4137 shift;
4138 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4139 : define a shorthand compile call for compilations that should be ok.
4140 compile_ok='
4141 mc_file=$1;
4142 shift;
4143 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4144
4145 : check for lengths of integral types
4146 echo " "
4147 case "$intsize" in
4148 '')
4149         echo "Checking to see how big your integers are..." >&4
4150         $cat >intsize.c <<'EOCP'
4151 #include <stdio.h>
4152 int main()
4153 {
4154         printf("intsize=%d;\n", (int)sizeof(int));
4155         printf("longsize=%d;\n", (int)sizeof(long));
4156         printf("shortsize=%d;\n", (int)sizeof(short));
4157         exit(0);
4158 }
4159 EOCP
4160         set intsize
4161         if eval $compile_ok && ./intsize > /dev/null; then
4162                 eval `./intsize`
4163                 echo "Your integers are $intsize bytes long."
4164                 echo "Your long integers are $longsize bytes long."
4165                 echo "Your short integers are $shortsize bytes long."
4166         else
4167                 $cat >&4 <<EOM
4168 !
4169 Help! I can't compile and run the intsize test program: please enlighten me!
4170 (This is probably a misconfiguration in your system or libraries, and
4171 you really ought to fix it.  Still, I'll try anyway.)
4172 !
4173 EOM
4174                 dflt=4
4175                 rp="What is the size of an integer (in bytes)?"
4176                 . ./myread
4177                 intsize="$ans"
4178                 dflt=$intsize
4179                 rp="What is the size of a long integer (in bytes)?"
4180                 . ./myread
4181                 longsize="$ans"
4182                 dflt=2
4183                 rp="What is the size of a short integer (in bytes)?"
4184                 . ./myread
4185                 shortsize="$ans"
4186         fi
4187         ;;
4188 esac
4189 $rm -f intsize intsize.*
4190
4191 : see what type lseek is declared as in the kernel
4192 rp="What is the type used for lseek's offset on this system?"
4193 set off_t lseektype long stdio.h sys/types.h
4194 eval $typedef_ask
4195
4196 echo " "
4197 $echo $n "Checking to see how big your file offsets are...$c" >&4
4198 $cat >try.c <<EOCP
4199 #include <sys/types.h>
4200 #include <stdio.h>
4201 int main()
4202 {
4203     printf("%d\n", (int)sizeof($lseektype));
4204     return(0); 
4205 }
4206 EOCP
4207 set try
4208 if eval $compile_ok; then
4209         lseeksize=`./try`
4210         $echo " $lseeksize bytes." >&4
4211 else
4212         dflt=$longsize
4213         echo " "
4214         echo "(I can't seem to compile the test program.  Guessing...)"
4215         rp="What is the size of your file offsets (in bytes)?"
4216         . ./myread
4217         lseeksize="$ans"
4218 fi
4219 $rm -f try.c try
4220
4221 : see what type file positions are declared as in the library
4222 rp="What is the type for file position used by fsetpos()?"
4223 set fpos_t fpostype long stdio.h sys/types.h
4224 eval $typedef_ask
4225
4226 echo " "
4227 case "$fpostype" in
4228 *_t) zzz="$fpostype"    ;;
4229 *)   zzz="fpos_t"       ;;
4230 esac
4231 $echo $n "Checking the size of $zzz...$c" >&4 
4232 cat > try.c <<EOCP
4233 #include <sys/types.h>
4234 #include <stdio.h>
4235 int main() {
4236     printf("%d\n", (int)sizeof($fpostype));
4237     exit(0);
4238 }
4239 EOCP
4240 set try
4241 if eval $compile_ok; then
4242         yyy=`./try`
4243         case "$yyy" in
4244         '')     fpossize=4
4245                 echo " "
4246                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4247                 ;;
4248         *)      fpossize=$yyy
4249                 echo " $fpossize bytes."
4250                 ;;
4251         esac
4252 else
4253         dflt="$longsize"
4254         echo " "
4255         echo "(I can't compile the test program.  Guessing...)" >&4
4256         rp="What is the size of your file positions (in bytes)?"
4257         . ./myread
4258         fpossize="$ans"
4259 fi
4260
4261
4262
4263 case "$lseeksize:$fpossize" in
4264 8:8) cat <<EOM
4265
4266 You can have files larger than 2 gigabytes.
4267 EOM
4268    val="$define" ;;
4269 *) cat <<EOM
4270
4271 Perl can be built to understand large files (files larger than 2 gigabytes)
4272 on some systems.  To do so, Configure must be run with -Duselargefiles.
4273
4274 If this doesn't make any sense to you, just accept the default 'y'.
4275 EOM
4276    case "$uselargefiles" in
4277    "$undef"|false|[nN]*) dflt='n' ;;
4278    *)   dflt='y' ;;
4279    esac
4280    rp='Try to understand large files, if available?'
4281    . ./myread
4282    case "$ans" in
4283    y|Y)         val="$define" ;;
4284    *)           val="$undef"  ;;
4285    esac
4286    ;;
4287 esac
4288 set uselargefiles
4289 eval $setvar
4290 case "$uselargefiles" in
4291 "$define")
4292 : Look for a hint-file generated 'call-back-unit'.  If the
4293 : user has specified that a large files perl is to be built,
4294 : we may need to set or change some other defaults.
4295         if $test -f uselfs.cbu; then
4296                 echo "Your platform has some specific hints for large file builds, using them..."
4297                 . ./uselfs.cbu
4298                 echo " "
4299                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
4300                 $cat >try.c <<EOCP
4301 #include <sys/types.h>
4302 #include <stdio.h>
4303 int main()
4304 {
4305     printf("%d\n", (int)sizeof($lseektype));
4306     return(0); 
4307 }
4308 EOCP
4309                 set try
4310                 if eval $compile_ok; then
4311                         lseeksize=`./try`
4312                         $echo " $lseeksize bytes." >&4
4313                 else
4314                         dflt="$lseeksize"
4315                         echo " "
4316                         echo "(I can't seem to compile the test program.  Guessing...)"
4317                         rp="What is the size of your file offsets (in bytes)?"
4318                         . ./myread
4319                         lseeksize="$ans"
4320                 fi
4321                 case "$fpostype" in
4322                 *_t) zzz="$fpostype"    ;;
4323                 *)   zzz="fpos_t"       ;;
4324                 esac
4325                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4326                 $cat > try.c <<EOCP
4327 #include <sys/types.h>
4328 #include <stdio.h>
4329 int main() {
4330     printf("%d\n", (int)sizeof($fpostype));
4331     exit(0);
4332 }
4333 EOCP
4334                 set try
4335                 if eval $compile_ok; then
4336                         yyy=`./try`
4337                         dflt="$lseeksize"
4338                         case "$yyy" in
4339                         '')     echo " "
4340                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4341                                 ;;
4342                         *)      fpossize=$yyy
4343                                 echo " $fpossize bytes."
4344                                 ;;
4345                         esac
4346                 else
4347                         dflt="$fpossize"
4348                         echo " "
4349                         echo "(I can't compile the test program.  Guessing...)" >&4
4350                         rp="What is the size of your file positions (in bytes)?"
4351                         . ./myread
4352                         fpossize="$ans"
4353                 fi
4354                 $rm -f try.c try
4355         fi
4356         ;;
4357 esac
4358
4359
4360 case "$usemorebits" in
4361 "$define"|true|[yY]*)
4362         use64bits="$define"
4363         uselongdouble="$define"
4364         usemorebits="$define"
4365         ;;
4366 *)      usemorebits="$undef"
4367         ;;
4368 esac
4369
4370
4371 case "$intsize:$longsize" in
4372 8:*|*:8) cat <<EOM
4373
4374 You have natively 64-bit integers.
4375 EOM
4376    val="$define" ;;
4377 *) cat <<EOM
4378
4379 Perl can be built to take advantage of 64-bit integer types
4380 on some systems.  To do so, Configure must be run with -Duse64bits.
4381
4382 If this doesn't make any sense to you, just accept the default.
4383 EOM
4384   case "$use64bits" in
4385   $define|true|[yY]*)   dflt='y';;
4386   *) dflt='n';;
4387   esac
4388   rp='Try to use 64-bit integers, if available?'
4389   . ./myread
4390   case "$ans" in
4391   y|Y) val="$define" ;;
4392   *)   val="$undef"  ;;
4393   esac
4394   ;;
4395 esac
4396 set use64bits
4397 eval $setvar
4398
4399 case "$archname64" in
4400 '') archname64='' ;;    # not a typo
4401 esac
4402
4403 case "$use64bits" in
4404 "$define"|true|[yY]*)
4405 : Look for a hint-file generated 'call-back-unit'.  If the
4406 : user has specified that a 64-bit perl is to be built,
4407 : we may need to set or change some other defaults.
4408         if $test -f use64bits.cbu; then
4409                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4410                 . ./use64bits.cbu
4411         else
4412                 $cat <<EOM
4413 (Your platform doesn't have any specific hints for 64-bit builds.)
4414 EOM
4415                 case "$intsize:$longsize" in
4416 8:*|*:8) cat <<EOM
4417 (This is probably okay, as your system is a natively 64-bit system.)
4418 EOM
4419                   ;;
4420                 esac
4421                 case "$gccversion" in
4422                 '')     ;;
4423                 *)      case "$ccflags" in
4424                         *-DUSE_LONG_LONG*) ;;
4425                         *) $cat <<EOM
4426 But since you seem to be using gcc, I will now add -DUSE_LONG_LONG
4427 to the compilation flags.
4428 EOM
4429                            ccflags="$ccflags -DUSE_LONG_LONG"
4430                            ;;
4431                         esac
4432                         ;;
4433                 esac
4434         fi
4435         ;;
4436 esac
4437
4438 : determine the architecture name
4439 echo " "
4440 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
4441         tarch=`arch`"-$osname"
4442 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
4443         if uname -m > tmparch 2>&1 ; then
4444                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
4445                         -e 's/$/'"-$osname/" tmparch`
4446         else
4447                 tarch="$osname"
4448         fi
4449         $rm -f tmparch
4450 else
4451         tarch="$osname"
4452 fi
4453 case "$myarchname" in
4454 ''|"$tarch") ;;
4455 *)
4456         echo "(Your architecture name used to be $myarchname.)"
4457         archname=''
4458         ;;
4459 esac
4460 myarchname="$tarch"
4461 case "$archname" in
4462 '') dflt="$tarch";;
4463 *) dflt="$archname";;
4464 esac
4465 rp='What is your architecture name'
4466 . ./myread
4467 archname="$ans"
4468 case "$usethreads" in
4469 $define)
4470         echo "Threads selected." >&4
4471         case "$archname" in
4472         *-thread*) echo "...and architecture name already has -thread." >&4
4473                 ;;
4474         *)      archname="$archname-thread"
4475                 echo "...setting architecture name to $archname." >&4
4476                 ;;
4477         esac
4478         ;;
4479 esac
4480 case "$usemultiplicity" in
4481 $define)
4482         echo "Multiplicity selected." >&4
4483         case "$archname" in
4484         *-multi*) echo "...and architecture name already has -multi." >&4
4485                 ;;
4486         *)      archname="$archname-multi"
4487                 echo "...setting architecture name to $archname." >&4
4488                 ;;
4489         esac
4490         ;;
4491 esac
4492 case "$use64bits" in
4493 $define)
4494         case "$archname64" in
4495         '')
4496                 ;;
4497         *)
4498                 case "$archname" in
4499                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
4500                         ;;
4501                 *)      archname="$archname-$archname64"
4502                         echo "...setting architecture name to $archname." >&4
4503                         ;;
4504                 esac
4505                 ;;
4506         esac
4507 esac
4508
4509 : determine root of directory hierarchy where package will be installed.
4510 case "$prefix" in
4511 '')
4512         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4513         ;;
4514 *)
4515         dflt="$prefix"
4516         ;;
4517 esac
4518 $cat <<EOM
4519
4520 By default, $package will be installed in $dflt/bin, manual pages
4521 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4522 installation directories. Typically this is something like /usr/local.
4523 If you wish to have binaries under /usr/bin but other parts of the
4524 installation under /usr/local, that's ok: you will be prompted
4525 separately for each of the installation directories, the prefix being
4526 only used to set the defaults.
4527
4528 EOM
4529 fn=d~
4530 rp='Installation prefix to use?'
4531 . ./getfile
4532 oldprefix=''
4533 case "$prefix" in
4534 '') ;;
4535 *)
4536         case "$ans" in
4537         "$prefix") ;;
4538         *) oldprefix="$prefix";;
4539         esac
4540         ;;
4541 esac
4542 prefix="$ans"
4543 prefixexp="$ansexp"
4544
4545 : is AFS running?
4546 echo " "
4547 case "$afs" in
4548 $define|true)   afs=true ;;
4549 $undef|false)   afs=false ;;
4550 *)      if test -d /afs; then
4551                 afs=true
4552         else
4553                 afs=false
4554         fi
4555         ;;
4556 esac
4557 if $afs; then
4558         echo "AFS may be running... I'll be extra cautious then..." >&4
4559 else
4560         echo "AFS does not seem to be running..." >&4
4561 fi
4562
4563 : determine installation prefix for where package is to be installed.
4564 if $afs; then 
4565 $cat <<EOM
4566
4567 Since you are running AFS, I need to distinguish the directory in which
4568 files will reside from the directory in which they are installed (and from
4569 which they are presumably copied to the former directory by occult means).
4570
4571 EOM
4572         case "$installprefix" in
4573         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4574         *) dflt="$installprefix";;
4575         esac
4576 else
4577 $cat <<EOM
4578
4579 In some special cases, particularly when building $package for distribution,
4580 it is convenient to distinguish between the directory in which files should 
4581 be installed from the directory ($prefix) in which they 
4582 will eventually reside.  For most users, these two directories are the same.
4583
4584 EOM
4585         case "$installprefix" in
4586         '') dflt=$prefix ;;
4587         *) dflt=$installprefix;;
4588         esac
4589 fi
4590 fn=d~
4591 rp='What installation prefix should I use for installing files?'
4592 . ./getfile
4593 installprefix="$ans"
4594 installprefixexp="$ansexp"
4595
4596 : set the prefixit variable, to compute a suitable default value
4597 prefixit='case "$3" in
4598 ""|none)
4599         case "$oldprefix" in
4600         "") eval "$1=\"\$$2\"";;
4601         *)
4602                 case "$3" in
4603                 "") eval "$1=";;
4604                 none)
4605                         eval "tp=\"\$$2\"";
4606                         case "$tp" in
4607                         ""|" ") eval "$1=\"\$$2\"";;
4608                         *) eval "$1=";;
4609                         esac;;
4610                 esac;;
4611         esac;;
4612 *)
4613         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
4614         case "$tp" in
4615         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
4616         /*-$oldprefix/*|\~*-$oldprefix/*)
4617                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
4618         *) eval "$1=\"\$$2\"";;
4619         esac;;
4620 esac'
4621
4622 : set the base revision
4623 baserev=5.0
4624
4625
4626 : get the patchlevel
4627 echo " "
4628 echo "Getting the current patchlevel..." >&4
4629 if $test -r $rsrc/patchlevel.h;then
4630         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4631         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4632         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4633         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4634         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4635 else
4636         patchlevel=0
4637         subversion=0
4638         api_revision=0
4639         api_version=0
4640         api_subversion=0
4641 fi
4642 $echo $n "(You have $package" $c
4643 case "$package" in
4644 "*$baserev")    ;;
4645 *)              $echo $n " $baserev" $c ;;
4646 esac
4647 $echo $n " patchlevel $patchlevel" $c
4648 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
4649 echo ".)"
4650 case "$osname" in
4651 dos|vms)
4652         : XXX Should be a Configure test for double-dots in filenames.
4653         version=`echo $baserev $patchlevel $subversion | \
4654                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4655         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4656                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4657         ;;
4658 *)
4659         version=`echo $baserev $patchlevel $subversion | \
4660                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4661         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4662                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4663         ;;
4664 esac
4665 : Special case the 5.005_xx maintenance series, which used 5.005
4666 : without any subversion label as a subdirectory in $sitelib
4667 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4668         api_versionstring='5.005'
4669 fi
4670
4671 : determine installation style
4672 : For now, try to deduce it from prefix unless it is already set.
4673 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
4674 case "$installstyle" in
4675 '')     case "$prefix" in
4676                 *perl*) dflt='lib';;
4677                 *) dflt='lib/perl5' ;;
4678         esac
4679         ;;
4680 *)      dflt='lib/perl5' ;;
4681 esac
4682 : Probably not worth prompting for this since we prompt for all
4683 : the directories individually, and the prompt would be too long and
4684 : confusing anyway.
4685 installstyle=$dflt
4686
4687 : determine where private library files go
4688 : Usual default is /usr/local/lib/perl5/$version.
4689 : Also allow things like /opt/perl/lib/$version, since 
4690 : /opt/perl/lib/perl5... would be redundant.
4691 : The default "style" setting is made in installstyle.U
4692 case "$installstyle" in
4693 *lib/perl5*) set dflt privlib lib/$package/$version ;;
4694 *)       set dflt privlib lib/$version ;;
4695 esac
4696 eval $prefixit
4697 $cat <<EOM
4698
4699 There are some auxiliary files for $package that need to be put into a
4700 private library directory that is accessible by everyone.
4701
4702 EOM
4703 fn=d~+
4704 rp='Pathname where the private library files will reside?'
4705 . ./getfile
4706 privlib="$ans"
4707 privlibexp="$ansexp"
4708 : Change installation prefix, if necessary.
4709 if $test X"$prefix" != X"$installprefix"; then
4710         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
4711 else
4712         installprivlib="$privlibexp"
4713 fi
4714
4715 : set the prefixup variable, to restore leading tilda escape
4716 prefixup='case "$prefixexp" in
4717 "$prefix") ;;
4718 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
4719 esac'
4720
4721 : determine where public architecture dependent libraries go
4722 set archlib archlib
4723 eval $prefixit
4724 : privlib default is /usr/local/lib/$package/$version
4725 : archlib default is /usr/local/lib/$package/$version/$archname
4726 : privlib may have an optional trailing /share.
4727 tdflt=`echo $privlib | $sed 's,/share$,,'`
4728 tdflt=$tdflt/$archname
4729 case "$archlib" in
4730 '')     dflt=$tdflt
4731         ;;
4732 *)      dflt="$archlib"
4733     ;;
4734 esac
4735 $cat <<EOM
4736
4737 $spackage contains architecture-dependent library files.  If you are
4738 sharing libraries in a heterogeneous environment, you might store
4739 these files in a separate location.  Otherwise, you can just include
4740 them with the rest of the public library files.
4741
4742 EOM
4743 fn=d+~
4744 rp='Where do you want to put the public architecture-dependent libraries?'
4745 . ./getfile
4746 archlib="$ans"
4747 archlibexp="$ansexp"
4748 if $test X"$archlib" = X"$privlib"; then
4749         d_archlib="$undef"
4750 else
4751         d_archlib="$define"
4752 fi
4753 : Change installation prefix, if necessary.
4754 if $test X"$prefix" != X"$installprefix"; then
4755         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
4756 else
4757         installarchlib="$archlibexp"
4758 fi
4759
4760
4761 : Binary compatibility with 5.005 is not possible for builds
4762 : with advanced features
4763 case "$usethreads$usemultiplicity" in
4764 *define*)
4765         bincompat5005="$undef"
4766         d_bincompat5005="$undef"
4767         ;;
4768 *)      $cat <<EOM
4769
4770 Perl 5.006 can be compiled for binary compatibility with 5.005.
4771 If you decide to do so, you will be able to continue using most
4772 of the extensions that were compiled for Perl 5.005.
4773
4774 EOM
4775         case "$bincompat5005$d_bincompat5005" in
4776         *"$undef"*) dflt=n ;;
4777         *) dflt=y ;;
4778         esac
4779         rp='Binary compatibility with Perl 5.005?'
4780         . ./myread
4781         case "$ans" in
4782         y*) val="$define" ;;
4783         *)  val="$undef" ;;
4784         esac
4785         set d_bincompat5005
4786         eval $setvar
4787         case "$d_bincompat5005" in
4788         "$define")
4789                 bincompat5005="$define"
4790                 ;;
4791         *)      bincompat5005="$undef"
4792                 d_bincompat5005="$undef"
4793                 ;;
4794         esac
4795         ;;
4796 esac
4797
4798
4799 : see if setuid scripts can be secure
4800 $cat <<EOM
4801
4802 Some kernels have a bug that prevents setuid #! scripts from being
4803 secure.  Some sites have disabled setuid #! scripts because of this.
4804
4805 First let's decide if your kernel supports secure setuid #! scripts.
4806 (If setuid #! scripts would be secure but have been disabled anyway,
4807 don't say that they are secure if asked.)
4808
4809 EOM
4810
4811 val="$undef"
4812 if $test -d /dev/fd; then
4813         echo "#!$ls" >reflect
4814         chmod +x,u+s reflect
4815         ./reflect >flect 2>&1
4816         if $contains "/dev/fd" flect >/dev/null; then
4817                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4818                 val="$define"
4819         else
4820                 $cat <<EOM
4821 If you are not sure if they are secure, I can check but I'll need a
4822 username and password different from the one you are using right now.
4823 If you don't have such a username or don't want me to test, simply
4824 enter 'none'.
4825
4826 EOM
4827                 rp='Other username to test security of setuid scripts with?'
4828                 dflt='none'
4829                 . ./myread
4830                 case "$ans" in
4831                 n|none)
4832                         case "$d_suidsafe" in
4833                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
4834                                 dflt=n;;
4835                         "$undef")
4836                                 echo "Well, the $hint value is *not* secure." >&4
4837                                 dflt=n;;
4838                         *)      echo "Well, the $hint value *is* secure." >&4
4839                                 dflt=y;;
4840                         esac
4841                         ;;
4842                 *)
4843                         $rm -f reflect flect
4844                         echo "#!$ls" >reflect
4845                         chmod +x,u+s reflect
4846                         echo >flect
4847                         chmod a+w flect
4848                         echo '"su" will (probably) prompt you for '"$ans's password."
4849                         su $ans -c './reflect >flect'
4850                         if $contains "/dev/fd" flect >/dev/null; then
4851                                 echo "Okay, it looks like setuid scripts are secure." >&4
4852                                 dflt=y
4853                         else
4854                                 echo "I don't think setuid scripts are secure." >&4
4855                                 dflt=n
4856                         fi
4857                         ;;
4858                 esac
4859                 rp='Does your kernel have *secure* setuid scripts?'
4860                 . ./myread
4861                 case "$ans" in
4862                 [yY]*)  val="$define";;
4863                 *)      val="$undef";;
4864                 esac
4865         fi
4866 else
4867         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4868         echo "(That's for file descriptors, not floppy disks.)"
4869         val="$undef"
4870 fi
4871 set d_suidsafe
4872 eval $setvar
4873
4874 $rm -f reflect flect
4875
4876 : now see if they want to do setuid emulation
4877 echo " "
4878 val="$undef"
4879 case "$d_suidsafe" in
4880 "$define")
4881         val="$undef"
4882         echo "No need to emulate SUID scripts since they are secure here." >& 4
4883         ;;
4884 *)
4885         $cat <<EOM
4886 Some systems have disabled setuid scripts, especially systems where
4887 setuid scripts cannot be secure.  On systems where setuid scripts have
4888 been disabled, the setuid/setgid bits on scripts are currently
4889 useless.  It is possible for $package to detect those bits and emulate
4890 setuid/setgid in a secure fashion.  This emulation will only work if
4891 setuid scripts have been disabled in your kernel.
4892
4893 EOM
4894         case "$d_dosuid" in
4895         "$define") dflt=y ;;
4896         *) dflt=n ;;
4897         esac
4898         rp="Do you want to do setuid/setgid emulation?"
4899         . ./myread
4900         case "$ans" in
4901         [yY]*)  val="$define";;
4902         *)      val="$undef";;
4903         esac
4904         ;;
4905 esac
4906 set d_dosuid
4907 eval $setvar
4908
4909 : determine filename position in cpp output
4910 echo " "
4911 echo "Computing filename position in cpp output for #include directives..." >&4
4912 echo '#include <stdio.h>' > foo.c
4913 $cat >fieldn <<EOF
4914 $startsh
4915 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4916 $grep '^[       ]*#.*stdio\.h' | \
4917 while read cline; do
4918         pos=1
4919         set \$cline
4920         while $test \$# -gt 0; do
4921                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4922                         echo "\$pos"
4923                         exit 0
4924                 fi
4925                 shift
4926                 pos=\`expr \$pos + 1\`
4927         done
4928 done
4929 EOF
4930 chmod +x fieldn
4931 fieldn=`./fieldn`
4932 $rm -f foo.c fieldn
4933 case $fieldn in
4934 '') pos='???';;
4935 1) pos=first;;
4936 2) pos=second;;
4937 3) pos=third;;
4938 *) pos="${fieldn}th";;
4939 esac
4940 echo "Your cpp writes the filename in the $pos field of the line."
4941
4942 : locate header file
4943 $cat >findhdr <<EOF
4944 $startsh
4945 wanted=\$1
4946 name=''
4947 for usrincdir in $usrinc
4948 do
4949         if test -f \$usrincdir/\$wanted; then
4950                 echo "\$usrincdir/\$wanted"
4951                 exit 0
4952         fi
4953 done
4954 awkprg='{ print \$$fieldn }'
4955 echo "#include <\$wanted>" > foo\$\$.c
4956 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4957 $grep "^[       ]*#.*\$wanted" | \
4958 while read cline; do
4959         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4960         case "\$name" in
4961         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4962         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4963         *) exit 2;;
4964         esac;
4965 done;
4966 #
4967 # status = 0: grep returned 0 lines, case statement not executed
4968 # status = 1: headerfile found
4969 # status = 2: while loop executed, no headerfile found
4970 #
4971 status=\$?
4972 $rm -f foo\$\$.c;
4973 if test \$status -eq 1; then
4974         exit 0;
4975 fi
4976 exit 1
4977 EOF
4978 chmod +x findhdr
4979
4980 : define an alternate in-header-list? function
4981 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4982 cont=true; xxf="echo \"<\$1> found.\" >&4";
4983 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4984 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4985 esac;
4986 case $# in 4) instead=instead;; *) instead="at last";; esac;
4987 while $test "$cont"; do
4988         xxx=`./findhdr $1`
4989         var=$2; eval "was=\$$2";
4990         if $test "$xxx" && $test -r "$xxx";
4991         then eval $xxf;
4992         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4993                 cont="";
4994         else eval $xxnf;
4995         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4996         set $yyy; shift; shift; yyy=$@;
4997         case $# in 0) cont="";;
4998         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4999                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5000         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5001                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5002         esac;
5003 done;
5004 while $test "$yyy";
5005 do set $yyy; var=$2; eval "was=\$$2";
5006         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5007         set $yyy; shift; shift; yyy=$@;
5008 done'
5009
5010 : see if this is a malloc.h system
5011 set malloc.h i_malloc
5012 eval $inhdr
5013
5014 : see if stdlib is available
5015 set stdlib.h i_stdlib
5016 eval $inhdr
5017
5018 : determine which malloc to compile in
5019 echo " "
5020 case "$usemymalloc" in
5021 ''|[yY]*|true|$define)  dflt='y' ;;
5022 *)      dflt='n' ;;
5023 esac
5024 rp="Do you wish to attempt to use the malloc that comes with $package?"
5025 . ./myread
5026 usemymalloc="$ans"
5027 case "$ans" in
5028 y*|true)
5029         usemymalloc='y'
5030         mallocsrc='malloc.c'
5031         mallocobj="malloc$_o"
5032         d_mymalloc="$define"
5033         case "$libs" in
5034         *-lmalloc*)
5035                 : Remove malloc from list of libraries to use
5036                 echo "Removing unneeded -lmalloc from library list" >&4
5037                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5038                 shift
5039                 libs="$*"
5040                 echo "libs = $libs" >&4
5041                 ;;
5042         esac
5043         ;;
5044 *)
5045         usemymalloc='n'
5046         mallocsrc=''
5047         mallocobj=''
5048         d_mymalloc="$undef"
5049         ;;
5050 esac
5051
5052 : compute the return types of malloc and free
5053 echo " "
5054 $cat >malloc.c <<END
5055 #$i_malloc I_MALLOC
5056 #$i_stdlib I_STDLIB
5057 #include <stdio.h>
5058 #include <sys/types.h>
5059 #ifdef I_MALLOC
5060 #include <malloc.h>
5061 #endif
5062 #ifdef I_STDLIB
5063 #include <stdlib.h>
5064 #endif
5065 #ifdef TRY_MALLOC
5066 void *malloc();
5067 #endif
5068 #ifdef TRY_FREE
5069 void free();
5070 #endif
5071 END
5072 case "$malloctype" in
5073 '')
5074         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5075                 malloctype='void *'
5076         else
5077                 malloctype='char *'
5078         fi
5079         ;;
5080 esac
5081 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5082
5083 case "$freetype" in
5084 '')
5085         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5086                 freetype='void'
5087         else
5088                 freetype='int'
5089         fi
5090         ;;
5091 esac
5092 echo "Your system uses $freetype free(), it would seem." >&4
5093 $rm -f malloc.[co]
5094 $cat <<EOM
5095
5096 The installation process will also create a directory for
5097 vendor-supplied add-ons.  Vendors who supply perl with their system
5098 may find it convenient to place all vendor-supplied files in this
5099 directory rather than in the main distribution directory.  This will
5100 ease upgrades between binary-compatible maintenance versions of perl.
5101
5102 Of course you may also use these directories in whatever way you see
5103 fit.  For example, you might use them to access modules shared over a
5104 company-wide network.
5105
5106 The default answer should be fine for most people.
5107 This causes further questions about vendor add-ons to be skipped
5108 and no vendor-specific directories will be configured for perl.
5109
5110 EOM
5111 rp='Do you want to configure vendor-specific add-on directories?'
5112 case "$usevendorprefix" in
5113 define|true|[yY]*) dflt=y ;;
5114 *) dflt=n ;;
5115 esac
5116 . ./myread
5117 case "$ans" in
5118 [yY]*)  fn=d~+
5119         rp='Installation prefix to use for vendor-supplied add-ons?'
5120         case "$vendorprefix" in
5121         '') dflt='' ;;
5122         *)  dflt=$vendorprefix ;;
5123         esac
5124         . ./getfile
5125         oldvendorprefix=''
5126         case "$vendorprefix" in
5127         '') ;;
5128         *)      case "$ans" in
5129                 "$prefix") ;;
5130                 *) oldvendorprefix="$prefix";;
5131                 esac
5132                 ;;
5133         esac
5134         usevendorprefix="$define"
5135         vendorprefix="$ans"
5136         vendorprefixexp="$ansexp"
5137         ;;
5138 *)      usevendorprefix="$undef"
5139         vendorprefix=''
5140         vendorprefixexp=''
5141         ;;
5142 esac
5143
5144 case "$vendorprefix" in
5145 '')     d_vendorlib="$undef"
5146         vendorlib=''
5147         vendorlibexp=''
5148         ;;
5149 *)      d_vendorlib="$define"
5150         : determine where vendor-supplied modules go.
5151         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
5152         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5153         case "$installstyle" in
5154         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
5155         *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
5156         esac
5157         fn=d~+
5158         rp='Pathname for the vendor-supplied library files?'
5159         . ./getfile
5160         vendorlib="$ans"
5161         vendorlibexp="$ansexp"
5162         : Change installation prefix, if necessary.
5163         if $test X"$prefix" != X"$installprefix"; then
5164                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
5165         else
5166                 installvendorlib="$vendorlibexp"
5167         fi
5168         ;;
5169 esac
5170
5171 : Cruising for prototypes
5172 echo " "
5173 echo "Checking out function prototypes..." >&4
5174 $cat >prototype.c <<'EOCP'
5175 int main(int argc, char *argv[]) {
5176         exit(0);}
5177 EOCP
5178 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
5179         echo "Your C compiler appears to support function prototypes."
5180         val="$define"
5181 else
5182         echo "Your C compiler doesn't seem to understand function prototypes."
5183         val="$undef"
5184 fi
5185 set prototype
5186 eval $setvar
5187 $rm -f prototype*
5188
5189 case "$prototype" in
5190 "$define") ;;
5191 *)      ansi2knr='ansi2knr'
5192         echo " "
5193         cat <<EOM >&4
5194
5195 $me:  FATAL ERROR:
5196 This version of $package can only be compiled by a compiler that 
5197 understands function prototypes.  Unfortunately, your C compiler 
5198         $cc $ccflags
5199 doesn't seem to understand them.  Sorry about that.
5200
5201 If GNU cc is available for your system, perhaps you could try that instead.  
5202
5203 Eventually, we hope to support building Perl with pre-ANSI compilers.
5204 If you would like to help in that effort, please contact <perlbug@perl.org>.
5205
5206 Aborting Configure now.
5207 EOM
5208         exit 2
5209         ;;
5210 esac
5211
5212 : determine where public executables go
5213 echo " "
5214 set dflt bin bin
5215 eval $prefixit
5216 fn=d~
5217 rp='Pathname where the public executables will reside?'
5218 . ./getfile
5219 if $test "X$ansexp" != "X$binexp"; then
5220         installbin=''
5221 fi
5222 bin="$ans"
5223 binexp="$ansexp"
5224 : Change installation prefix, if necessary.
5225 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
5226 if $test X"$prefix" != X"$installprefix"; then
5227         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
5228 else
5229         installbin="$binexp"
5230 fi
5231
5232 $cat <<EOM
5233
5234 After $package is installed, you may wish to install various
5235 add-on modules and utilities.  Typically, these add-ons will
5236 be installed under $prefix with the rest
5237 of this package.  However, you may wish to install such add-ons
5238 elsewhere under a different prefix.
5239
5240 If you do not wish to put everything under a single prefix, that's
5241 ok.  You will be prompted for the individual locations; this siteprefix
5242 is only used to suggest the defaults.
5243
5244 The default should be fine for most people.
5245
5246 EOM
5247 fn=d~+
5248 rp='Installation prefix to use for add-on modules and utilities?'
5249 : XXX Here might be another good place for an installstyle setting.
5250 case "$siteprefix" in
5251 '') dflt=$prefix ;;
5252 *)  dflt=$siteprefix ;;
5253 esac
5254 . ./getfile
5255 oldsiteprefix=''
5256 case "$siteprefix" in
5257 '') ;;
5258 *)
5259         case "$ans" in
5260         "$prefix") ;;
5261         *) oldsiteprefix="$prefix";;
5262         esac
5263         ;;
5264 esac
5265 siteprefix="$ans"
5266 siteprefixexp="$ansexp"
5267
5268 : determine where site specific libraries go.
5269 : Usual default is /usr/local/lib/perl5/site_perl/$version
5270 : The default "style" setting is made in installstyle.U
5271 : XXX No longer works with Prefixit stuff.
5272 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5273 case "$installstyle" in
5274 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5275 *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5276 esac
5277 $cat <<EOM
5278
5279 The installation process will create a directory for
5280 site-specific extensions and modules.  Most users find it convenient
5281 to place all site-specific files in this directory rather than in the
5282 main distribution directory.
5283
5284 EOM
5285 fn=d~+
5286 rp='Pathname for the site-specific library files?'
5287 . ./getfile
5288 sitelib="$ans"
5289 sitelibexp="$ansexp"
5290 : Change installation prefix, if necessary.
5291 if $test X"$prefix" != X"$installprefix"; then
5292         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
5293 else
5294         installsitelib="$sitelibexp"
5295 fi
5296
5297 : Determine list of previous versions to include in @INC
5298 $cat > getverlist <<EOPL
5299 #!$perl -w
5300 use File::Basename;
5301 \$api_versionstring = "$api_versionstring";
5302 \$version = "$version";
5303 \$sitelib = "$sitelib";
5304 \$archname = "$archname";
5305 EOPL
5306         $cat >> getverlist <<'EOPL'
5307 # Can't have leading @ because metaconfig interprets it as a command!
5308 ;@inc_version_list=();
5309 $stem=dirname($sitelib);
5310 # Redo to do opendir/readdir? 
5311 if (-d $stem) {
5312     chdir($stem);
5313     ;@candidates = glob("5.*");
5314 }
5315 else {
5316     ;@candidates = ();
5317 }
5318
5319 # XXX ToDo:  These comparisons must be reworked when two-digit
5320 # subversions come along, so that 5.7.10 compares as greater than
5321 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
5322 # widespread that we can use the built-in version vectors rather
5323 # than reinventing them here.  For 5.6.0, however, we must
5324 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
5325 foreach $d (@candidates) {
5326     if ($d lt $version) {
5327         if ($d ge $api_versionstring) {
5328             unshift(@inc_version_list, "$d/$archname", $d);
5329         }
5330         elsif ($d ge "5.005") {
5331             unshift(@inc_version_list, $d);
5332         }
5333     }
5334     else {
5335         # Skip newer version.  I.e. don't look in
5336         # 5.7.0 if we're installing 5.6.1.
5337     }
5338 }
5339
5340 if (@inc_version_list) {
5341     print join(' ', @inc_version_list);
5342 }
5343 else {
5344     # Blank space to preserve value for next Configure run.
5345     print " ";
5346 }
5347 EOPL
5348 chmod +x getverlist
5349 case "$inc_version_list" in
5350 '')     if test -x $perl; then
5351                 dflt=`$perl getverlist`
5352         else
5353                 dflt='none'
5354         fi
5355         ;;
5356 $undef) dflt='none' ;;
5357 *)  dflt="$inc_version_list" ;;
5358 esac
5359 $cat <<'EOM'
5360
5361 In order to ease the process of upgrading, this version of perl 
5362 can be configured to use modules built and installed with earlier 
5363 versions of perl that were installed under $prefix.  Specify here
5364 the list of earlier versions that this version of perl should check.
5365 If Configure detected no earlier versions of perl installed under
5366 $prefix, then the list will be empty.  Answer 'none' to tell perl
5367 to not search earlier versions.
5368
5369 The default should almost always be sensible, so if you're not sure,
5370 just accept the default.
5371 EOM
5372
5373 rp='List of earlier versions to include in @INC?'
5374 . ./myread
5375 case "$ans" in
5376 [Nn]one) inc_version_list=' ' ;;
5377 *) inc_version_list="$ans" ;;
5378 esac
5379 case "$inc_version_list" in
5380 ''|' ') 
5381         inc_version_list_init='0';;
5382 *)      inc_version_list_init=`echo $inc_version_list |
5383                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
5384         ;;
5385 esac
5386 $rm -f getverlist
5387
5388 : determine whether to install perl also as /usr/bin/perl
5389
5390 echo " "
5391 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
5392         $cat <<EOM
5393 Many scripts expect to perl to be installed as /usr/bin/perl.
5394 I can install the perl you are about to compile also as /usr/bin/perl
5395 (in addition to $installbin/perl).
5396 EOM
5397         case "$installusrbinperl" in
5398         "$undef"|[nN]*) dflt='n';;
5399         *)              dflt='y';;
5400         esac
5401         rp="Do you want to install perl as /usr/bin/perl?"
5402         . ./myread
5403         case "$ans" in
5404         [yY]*)  val="$define";;
5405         *)      val="$undef" ;;
5406         esac
5407 else
5408         val="$undef"
5409 fi
5410 set installusrbinperl
5411 eval $setvar
5412
5413 echo " "
5414 echo "Checking for GNU C Library..." >&4
5415 cat >gnulibc.c <<EOM
5416 #include <stdio.h>
5417 int main()
5418 {
5419 #ifdef __GLIBC__
5420     exit(0);
5421 #else
5422     exit(1);
5423 #endif
5424 }
5425 EOM
5426 set gnulibc
5427 if eval $compile_ok && ./gnulibc; then
5428         val="$define"
5429         echo "You are using the GNU C Library"
5430 else
5431         val="$undef"
5432         echo "You are not using the GNU C Library"
5433 fi
5434 $rm -f gnulibc*
5435 set d_gnulibc
5436 eval $setvar
5437
5438 : see if nm is to be used to determine whether a symbol is defined or not
5439 case "$usenm" in
5440 '')
5441         dflt=''
5442         case "$d_gnulibc" in
5443         "$define")
5444                 echo " "
5445                 echo "nm probably won't work on the GNU C Library." >&4
5446                 dflt=n
5447                 ;;
5448         esac
5449         case "$dflt" in
5450         '') 
5451                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5452                         echo " "
5453                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5454                         echo "'nm' won't be sufficient on this sytem." >&4
5455                         dflt=n
5456                 fi
5457                 ;;
5458         esac
5459         case "$dflt" in
5460         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5461                 if $test $dflt -gt 20; then
5462                         dflt=y
5463                 else
5464                         dflt=n
5465                 fi
5466                 ;;
5467         esac
5468         ;;
5469 *)
5470         case "$usenm" in
5471         true|$define) dflt=y;;
5472         *) dflt=n;;
5473         esac
5474         ;;
5475 esac
5476 $cat <<EOM
5477
5478 I can use $nm to extract the symbols from your C libraries. This
5479 is a time consuming task which may generate huge output on the disk (up
5480 to 3 megabytes) but that should make the symbols extraction faster. The
5481 alternative is to skip the 'nm' extraction part and to compile a small
5482 test program instead to determine whether each symbol is present. If
5483 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5484 this may be the best solution.
5485
5486 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5487
5488 EOM
5489 rp="Shall I use $nm to extract C symbols from the libraries?"
5490 . ./myread
5491 case "$ans" in
5492 [Nn]*) usenm=false;;
5493 *) usenm=true;;
5494 esac
5495
5496 runnm=$usenm
5497 case "$reuseval" in
5498 true) runnm=false;;
5499 esac
5500
5501 : nm options which may be necessary
5502 case "$nm_opt" in
5503 '') if $test -f /mach_boot; then
5504                 nm_opt=''       # Mach
5505         elif $test -d /usr/ccs/lib; then
5506                 nm_opt='-p'     # Solaris (and SunOS?)
5507         elif $test -f /dgux; then
5508                 nm_opt='-p'     # DG-UX
5509         elif $test -f /lib64/rld; then
5510                 nm_opt='-p'     # 64-bit Irix
5511         else
5512                 nm_opt=''
5513         fi;;
5514 esac
5515
5516 : nm options which may be necessary for shared libraries but illegal
5517 : for archive libraries.  Thank you, Linux.
5518 case "$nm_so_opt" in
5519 '')     case "$myuname" in
5520         *linux*)
5521                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5522                         nm_so_opt='--dynamic'
5523                 fi
5524                 ;;
5525         esac
5526         ;;
5527 esac
5528
5529 case "$runnm" in
5530 true)
5531 : get list of predefined functions in a handy place
5532 echo " "
5533 case "$libc" in
5534 '') libc=unknown
5535         case "$libs" in
5536         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5537         esac
5538         ;;
5539 esac
5540 libnames='';
5541 case "$libs" in
5542 '') ;;
5543 *)  for thislib in $libs; do
5544         case "$thislib" in
5545         -lc|-lc_s)
5546                 : Handle C library specially below.
5547                 ;;
5548         -l*)
5549                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5550                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5551                         :
5552                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5553                         :
5554                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5555                         :
5556                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5557                         :
5558                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5559                         :
5560                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5561                         :
5562                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5563                         :
5564                 else
5565                         try=''
5566                 fi
5567                 libnames="$libnames $try"
5568                 ;;
5569         *) libnames="$libnames $thislib" ;;
5570         esac
5571         done
5572         ;;
5573 esac
5574 xxx=normal
5575 case "$libc" in
5576 unknown)
5577         set /lib/libc.$so
5578         for xxx in $libpth; do
5579                 $test -r $1 || set $xxx/libc.$so
5580                 : The messy sed command sorts on library version numbers.
5581                 $test -r $1 || \
5582                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5583                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5584                                 h
5585                                 s/[0-9][0-9]*/0000&/g
5586                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5587                                 G
5588                                 s/\n/ /' | \
5589                          sort | $sed -e 's/^.* //'`
5590                 eval set \$$#
5591         done
5592         $test -r $1 || set /usr/ccs/lib/libc.$so
5593         $test -r $1 || set /lib/libsys_s$_a
5594         ;;
5595 *)
5596         set blurfl
5597         ;;
5598 esac
5599 if $test -r "$1"; then
5600         echo "Your (shared) C library seems to be in $1."
5601         libc="$1"
5602 elif $test -r /lib/libc && $test -r /lib/clib; then
5603         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5604         xxx=apollo
5605         libc='/lib/clib /lib/libc'
5606         if $test -r /lib/syslib; then
5607                 echo "(Your math library is in /lib/syslib.)"
5608                 libc="$libc /lib/syslib"
5609         fi
5610 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5611         echo "Your C library seems to be in $libc, as you said before."
5612 elif $test -r $incpath/usr/lib/libc$_a; then
5613         libc=$incpath/usr/lib/libc$_a;
5614         echo "Your C library seems to be in $libc.  That's fine."
5615 elif $test -r /lib/libc$_a; then
5616         libc=/lib/libc$_a;
5617         echo "Your C library seems to be in $libc.  You're normal."
5618 else
5619         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5620                 :
5621         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5622                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5623         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5624                 :
5625         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5626                 :
5627         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5628                 :
5629         else
5630                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5631         fi
5632         if $test -r "$tans"; then
5633                 echo "Your C library seems to be in $tans, of all places."
5634                 libc=$tans
5635         else
5636                 libc='blurfl'
5637         fi
5638 fi
5639 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5640         dflt="$libc"
5641         cat <<EOM
5642
5643 If the guess above is wrong (which it might be if you're using a strange
5644 compiler, or your machine supports multiple models), you can override it here.
5645
5646 EOM
5647 else
5648         dflt=''
5649         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5650         cat >&4 <<EOM
5651 I can't seem to find your C library.  I've looked in the following places:
5652
5653 EOM
5654         $sed 's/^/      /' libpath
5655         cat <<EOM
5656
5657 None of these seems to contain your C library. I need to get its name...
5658
5659 EOM
5660 fi
5661 fn=f
5662 rp='Where is your C library?'
5663 . ./getfile
5664 libc="$ans"
5665
5666 echo " "
5667 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5668 set X `cat libnames`
5669 shift
5670 xxx=files
5671 case $# in 1) xxx=file; esac
5672 echo "Extracting names from the following $xxx for later perusal:" >&4
5673 echo " "
5674 $sed 's/^/      /' libnames >&4
5675 echo " "
5676 $echo $n "This may take a while...$c" >&4
5677
5678 for file in $*; do
5679         case $file in
5680         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5681         *) $nm $nm_opt $file 2>/dev/null;;
5682         esac
5683 done >libc.tmp
5684
5685 $echo $n ".$c"
5686 $grep fprintf libc.tmp > libc.ptf
5687 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5688 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5689 xxx='[ADTSIW]'
5690 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5691         eval $xscan;\
5692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5693                 eval $xrun
5694 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5695         eval $xscan;\
5696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5697                 eval $xrun
5698 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5699         eval $xscan;\
5700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5701                 eval $xrun
5702 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5703         eval $xscan;\
5704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5705                 eval $xrun
5706 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5707         eval $xscan;\
5708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5709                 eval $xrun
5710 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5711         eval $xscan;\
5712         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5713                 eval $xrun
5714 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5715                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5724         eval $xscan;\
5725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5726                 eval $xrun
5727 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5728         eval $xscan;\
5729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730                 eval $xrun
5731 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5736         eval $xscan;\
5737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5738                 eval $xrun
5739 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5740         eval $xscan;\
5741         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5742                 eval $xrun
5743 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5744         eval $xscan;\
5745         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5746                 eval $xrun
5747 else
5748         $nm -p $* 2>/dev/null >libc.tmp
5749         $grep fprintf libc.tmp > libc.ptf
5750         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5751                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5752         then
5753                 nm_opt='-p'
5754                 eval $xrun
5755         else
5756                 echo " "
5757                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5758                 com=''
5759                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5760                         for thisname in $libnames $libc; do
5761                                 $ar t $thisname >>libc.tmp
5762                         done
5763                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5764                         echo "Ok." >&4
5765                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5766                         # Repeat libc to extract forwarders to DLL entries too
5767                         for thisname in $libnames $libc; do
5768                                 $ar tv $thisname >>libc.tmp
5769                                 # Revision 50 of EMX has bug in $ar.
5770                                 # it will not extract forwarders to DLL entries
5771                                 # Use emximp which will extract exactly them.
5772                                 emximp -o tmp.imp $thisname \
5773                                     2>/dev/null && \
5774                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5775                                     < tmp.imp >>libc.tmp
5776                                 $rm tmp.imp
5777                         done
5778                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5779                         echo "Ok." >&4
5780                 else
5781                         echo "$ar didn't seem to work right." >&4
5782                         echo "Maybe this is a Cray...trying bld instead..." >&4
5783                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5784                         then
5785                                 for thisname in $libnames; do
5786                                         bld t $libnames | \
5787                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5788                                         $ar t $thisname >>libc.tmp
5789                                 done
5790                                 echo "Ok." >&4
5791                         else
5792                                 echo "That didn't work either.  Giving up." >&4
5793                                 exit 1
5794                         fi
5795                 fi
5796         fi
5797 fi
5798 nm_extract="$com"
5799 if $test -f /lib/syscalls.exp; then
5800         echo " "
5801         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5802         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5803 fi
5804 ;;
5805 esac
5806 $rm -f libnames libpath
5807
5808 : see if dld is available
5809 set dld.h i_dld
5810 eval $inhdr
5811
5812 : is a C symbol defined?
5813 csym='tlook=$1;
5814 case "$3" in
5815 -v) tf=libc.tmp; tc=""; tdc="";;
5816 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5817 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5818 esac;
5819 tx=yes;
5820 case "$reuseval-$4" in
5821 true-) ;;
5822 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5823 esac;
5824 case "$tx" in
5825 yes)
5826         case "$runnm" in
5827         true)
5828                 if $contains $tlook $tf >/dev/null 2>&1;
5829                 then tval=true;
5830                 else tval=false;
5831                 fi;;
5832         *)
5833                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5834                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5835                 then tval=true;
5836                 else tval=false;
5837                 fi;
5838                 $rm -f t t.c;;
5839         esac;;
5840 *)
5841         case "$tval" in
5842         $define) tval=true;;
5843         *) tval=false;;
5844         esac;;
5845 esac;
5846 eval "$2=$tval"'
5847
5848 : define an is-in-libc? function
5849 inlibc='echo " "; td=$define; tu=$undef;
5850 sym=$1; var=$2; eval "was=\$$2";
5851 tx=yes;
5852 case "$reuseval$was" in
5853 true) ;;
5854 true*) tx=no;;
5855 esac;
5856 case "$tx" in
5857 yes)
5858         set $sym tres -f;
5859         eval $csym;
5860         case "$tres" in
5861         true)
5862                 echo "$sym() found." >&4;
5863                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5864         *)
5865                 echo "$sym() NOT found." >&4;
5866                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5867         esac;;
5868 *)
5869         case "$was" in
5870         $define) echo "$sym() found." >&4;;
5871         *) echo "$sym() NOT found." >&4;;
5872         esac;;
5873 esac'
5874
5875 : see if dlopen exists
5876 xxx_runnm="$runnm"
5877 runnm=false
5878 set dlopen d_dlopen
5879 eval $inlibc
5880 runnm="$xxx_runnm"
5881
5882 : determine which dynamic loading, if any, to compile in
5883 echo " "
5884 dldir="ext/DynaLoader"
5885 case "$usedl" in
5886 $define|y|true)
5887         dflt='y'
5888         usedl="$define"
5889         ;;
5890 $undef|n|false)
5891         dflt='n'
5892         usedl="$undef"
5893         ;;
5894 *) 
5895         dflt='n'
5896         case "$d_dlopen" in
5897             $define) dflt='y' ;;
5898         esac
5899         case "$i_dld" in
5900             $define) dflt='y' ;;
5901         esac
5902         : Does a dl_xxx.xs file exist for this operating system
5903         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5904         ;;
5905 esac
5906 rp="Do you wish to use dynamic loading?"
5907 . ./myread
5908 usedl="$ans"
5909 case "$ans" in
5910 y*) usedl="$define"
5911         case "$dlsrc" in
5912         '')
5913                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5914                         dflt="$dldir/dl_${osname}.xs"
5915                 elif $test "$d_dlopen" = "$define" ; then
5916                         dflt="$dldir/dl_dlopen.xs"
5917                 elif $test "$i_dld" = "$define" ; then
5918                         dflt="$dldir/dl_dld.xs"
5919                 else
5920                         dflt=''
5921                 fi
5922                 ;;
5923         *)      dflt="$dldir/$dlsrc"
5924                 ;;
5925         esac
5926     echo "The following dynamic loading files are available:"
5927         : Can not go over to $dldir because getfile has path hard-coded in.
5928         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5929         rp="Source file to use for dynamic loading"
5930         fn="fne"
5931         gfpth="$src"
5932         . ./getfile
5933         usedl="$define"
5934         : emulate basename
5935         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5936
5937         $cat << EOM
5938
5939 Some systems may require passing special flags to $cc -c to
5940 compile modules that will be used to create a shared library.
5941 To use no flags, say "none".
5942
5943 EOM
5944     case "$cccdlflags" in
5945     '') case "$gccversion" in
5946                 '') case "$osname" in
5947                         hpux)   dflt='+z' ;;
5948                         next)   dflt='none' ;;
5949                         irix*)  dflt='-KPIC' ;;
5950                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5951                         sunos)  dflt='-pic' ;;
5952                         *)      dflt='none' ;;
5953                     esac
5954                         ;;
5955                 *)  case "$osname" in
5956                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5957                         *)      dflt='-fpic' ;;
5958                     esac ;;
5959             esac ;;
5960         ' ') dflt='none' ;;
5961     *)  dflt="$cccdlflags" ;;
5962     esac
5963     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5964     . ./myread
5965     case "$ans" in
5966     none) cccdlflags=' ' ;;
5967     *) cccdlflags="$ans" ;;
5968     esac
5969
5970     cat << EOM
5971
5972 Some systems use ld to create libraries that can be dynamically loaded,
5973 while other systems (such as those using ELF) use $cc.
5974
5975 EOM
5976         case "$ld" in
5977         '')     $cat >try.c <<'EOM'
5978 /* Test for whether ELF binaries are produced */
5979 #include <fcntl.h>
5980 #include <stdlib.h>
5981 int main() {
5982         char b[4];
5983         int i = open("a.out",O_RDONLY);
5984         if(i == -1) 
5985                 exit(1); /* fail */
5986         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5987                 exit(0); /* succeed (yes, it's ELF) */
5988         else
5989                 exit(1); /* fail */
5990 }
5991 EOM
5992                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5993                         cat <<EOM
5994 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5995 EOM
5996                         dflt="$cc"
5997                 else
5998                         echo "I'll use ld to build dynamic libraries."
5999                         dflt='ld'
6000                 fi
6001                 rm -f try.c a.out
6002                 ;;
6003         *)      dflt="$ld"
6004                 ;;
6005         esac
6006
6007     rp="What command should be used to create dynamic libraries?"
6008     . ./myread
6009         ld="$ans"
6010
6011     cat << EOM
6012
6013 Some systems may require passing special flags to $ld to create a
6014 library that can be dynamically loaded.  If your ld flags include
6015 -L/other/path options to locate libraries outside your loader's normal
6016 search path, you may need to specify those -L options here as well.  To
6017 use no flags, say "none".
6018
6019 EOM
6020     case "$lddlflags" in
6021     '') case "$osname" in
6022                         beos) dflt='-nostart' ;;
6023                         hpux)  dflt='-b' ;;
6024                         linux|irix*)    dflt='-shared' ;;
6025                         next)  dflt='none' ;;
6026                         solaris) dflt='-G' ;;
6027                         sunos) dflt='-assert nodefinitions' ;;
6028                         svr4*|esix*) dflt="-G $ldflags" ;;
6029                 *)     dflt='none' ;;
6030                         esac
6031                         ;;
6032     *) dflt="$lddlflags" ;;
6033     esac
6034
6035         : Try to guess additional flags to pick up local libraries.
6036         : Be careful not to append to a plain 'none'
6037         case "$dflt" in
6038         none) dflt='' ;;
6039         esac
6040         for thisflag in $ldflags; do
6041                 case "$thisflag" in
6042                 -L*)
6043                         case " $dflt " in
6044                         *" $thisflag "*) ;;
6045                         *) dflt="$dflt $thisflag" ;;
6046                         esac
6047                         ;;
6048                 esac
6049         done
6050
6051         case "$dflt" in
6052         ''|' ') dflt='none' ;;
6053         esac
6054
6055     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6056     . ./myread
6057     case "$ans" in
6058     none) lddlflags=' ' ;;
6059     *) lddlflags="$ans" ;;
6060     esac
6061
6062         cat <<EOM
6063
6064 Some systems may require passing special flags to $cc to indicate that
6065 the resulting executable will use dynamic linking.  To use no flags,
6066 say "none".
6067
6068 EOM
6069     case "$ccdlflags" in
6070     '') case "$osname" in
6071                 hpux)   dflt='-Wl,-E' ;;
6072                 linux)  dflt='-rdynamic' ;;
6073                 next)   dflt='none' ;;
6074                 sunos)  dflt='none' ;;
6075                 *)      dflt='none' ;;
6076             esac ;;
6077     ' ')  dflt='none' ;;
6078     *)  dflt="$ccdlflags" ;;
6079     esac
6080     rp="Any special flags to pass to $cc to use dynamic linking?"
6081     . ./myread
6082     case "$ans" in
6083     none) ccdlflags=' ' ;;
6084     *) ccdlflags="$ans" ;;
6085     esac
6086     ;;
6087 *)  usedl="$undef"
6088         ld='ld'
6089     dlsrc='dl_none.xs'
6090     lddlflags=''
6091     ccdlflags=''
6092     ;;
6093 esac
6094
6095 also=''
6096 case "$usedl" in
6097 $undef)
6098         # No dynamic loading being used, so don't bother even to prompt.
6099         useshrplib='false'
6100         ;;
6101 *)      case "$useshrplib" in
6102         '')     case "$osname" in
6103                 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
6104                         dflt=y
6105                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6106                         ;;
6107                 next*)
6108                         case "$osvers" in
6109                         4*)     dflt=y
6110                                 also='Building a shared libperl is needed for MAB support.'
6111                                 ;;
6112                         *)      dflt=n
6113                                 ;;
6114                         esac
6115                         ;;
6116                 *)      dflt=n
6117                         ;;
6118                 esac
6119                 ;;
6120         $define|true|[Yy]*)
6121                 dflt=y
6122                 ;;
6123         *)      dflt=n
6124                 ;;
6125         esac
6126         $cat << EOM
6127
6128 The perl executable is normally obtained by linking perlmain.c with
6129 libperl${_a}, any static extensions (usually just DynaLoader), and
6130 any other libraries needed on this system (such as -lm, etc.).  Since
6131 your system supports dynamic loading, it is probably possible to build
6132 a shared libperl.$so.  If you will have more than one executable linked
6133 to libperl.$so, this will significantly reduce the size of each
6134 executable, but it may have a noticeable affect on performance.  The
6135 default is probably sensible for your system.
6136 $also
6137
6138 EOM
6139         rp="Build a shared libperl.$so (y/n)"
6140         . ./myread
6141         case "$ans" in
6142         true|$define|[Yy]*)
6143                 useshrplib='true'  ;;
6144         *)      useshrplib='false' ;;
6145         esac
6146         ;;
6147 esac
6148
6149 case "$useshrplib" in
6150 true)
6151         case "$libperl" in
6152         '')
6153                 # Figure out a good name for libperl.so.  Since it gets stored in
6154                 # a version-specific architecture-dependent library, the version
6155                 # number isn't really that important, except for making cc/ld happy.
6156                 #
6157                 # A name such as libperl.so.3.1
6158                 majmin="libperl.$so.$patchlevel.$subversion"
6159                 # A name such as libperl.so.301
6160                 majonly=`echo $patchlevel $subversion |
6161                         $awk '{printf "%d%02d", $1, $2}'`
6162                 majonly=libperl.$so.$majonly
6163                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6164                 # rely on figuring it out from the naming of libc.
6165                 case "${osname}${osvers}" in
6166                 next4*)
6167                         dflt=libperl.5.$so
6168                         # XXX How handle the --version stuff for MAB?
6169                         ;;
6170                 linux*)  # ld won't link with a bare -lperl otherwise.
6171                         dflt=libperl.$so
6172                         ;;
6173                 cygwin*) # include version
6174                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6175                         ;;
6176                 *)      # Try to guess based on whether libc has major.minor.
6177                         case "$libc" in
6178                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6179                         *libc.$so.[0-9]*) dflt=$majonly ;;
6180                         *)      dflt=libperl.$so ;;
6181                         esac
6182                         ;;
6183                 esac
6184                 ;;
6185         *)      dflt=$libperl
6186                 ;;
6187         esac
6188         cat << EOM
6189
6190 I need to select a good name for the shared libperl.  If your system uses
6191 library names with major and minor numbers, then you might want something
6192 like $majmin.  Alternatively, if your system uses a single version
6193 number for shared libraries, then you might want to use $majonly.
6194 Or, your system might be quite happy with a simple libperl.$so.
6195
6196 Since the shared libperl will get installed into a version-specific
6197 architecture-dependent directory, the version number of the shared perl
6198 library probably isn't important, so the default should be o.k.
6199
6200 EOM
6201         rp='What name do you want to give to the shared libperl?'
6202         . ./myread
6203         libperl=$ans
6204         echo "Ok, I'll use $libperl"
6205         ;;
6206 *)
6207         libperl="libperl${_a}"
6208         ;;
6209 esac
6210
6211 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6212 case "$shrpdir" in
6213 '') ;;
6214 *)      $cat >&4 <<EOM
6215 WARNING:  Use of the shrpdir variable for the installation location of
6216 the shared $libperl is not supported.  It was never documented and
6217 will not work in this version.  Let me (perlbug@perl.com)
6218 know of any problems this may cause.
6219
6220 EOM
6221         case "$shrpdir" in
6222         "$archlibexp/CORE")
6223                 $cat >&4 <<EOM
6224 But your current setting of $shrpdir is
6225 the default anyway, so it's harmless.
6226 EOM
6227                 ;;
6228         *)
6229                 $cat >&4 <<EOM
6230 Further, your current attempted setting of $shrpdir
6231 conflicts with the value of $archlibexp/CORE
6232 that installperl will use.
6233 EOM
6234                 ;;
6235         esac
6236         ;;
6237 esac
6238
6239 # How will the perl executable find the installed shared $libperl?
6240 # Add $xxx to ccdlflags.
6241 # If we can't figure out a command-line option, use $shrpenv to
6242 # set env LD_RUN_PATH.  The main perl makefile uses this.
6243 shrpdir=$archlibexp/CORE
6244 xxx=''
6245 tmp_shrpenv=''
6246 if "$useshrplib"; then
6247     case "$osname" in 
6248         aix)
6249                 # We'll set it in Makefile.SH...
6250                 ;;
6251         solaris|netbsd)
6252                 xxx="-R $shrpdir"
6253                 ;;
6254         freebsd)
6255                 xxx="-Wl,-R$shrpdir"
6256                 ;;
6257         linux|irix*|dec_osf)
6258                 xxx="-Wl,-rpath,$shrpdir"
6259                 ;;
6260         next)
6261                 # next doesn't like the default...
6262                 ;;
6263         beos)
6264                 # beos doesn't like the default, either.
6265                 ;;
6266         hpux*)
6267                 # hpux doesn't like the default, either.
6268                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6269                 ;;
6270         *)
6271                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6272                 ;;
6273         esac
6274         case "$xxx" in
6275         '') ;;
6276         *)      
6277                 # Only add $xxx if it isn't already in ccdlflags.
6278                 case " $ccdlflags " in
6279                 *" $xxx "*)     ;;
6280                 *)      ccdlflags="$ccdlflags $xxx"
6281                         cat <<EOM >&4
6282
6283 Adding $xxx to the flags
6284 passed to $ld so that the perl executable will find the 
6285 installed shared $libperl.
6286
6287 EOM
6288                         ;;
6289                 esac
6290                 ;;
6291         esac
6292 fi
6293 # Fix ccdlflags in AIX for building external extensions.
6294 # (For building Perl itself bare -bE:perl.exp is needed,
6295 #  Makefile.SH takes care of this.)
6296 case "$osname" in
6297 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6298 esac
6299 # Respect a hint or command-line value.
6300 case "$shrpenv" in
6301 '') shrpenv="$tmp_shrpenv" ;;
6302 esac
6303 case "$ldlibpthname" in
6304 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6305 none)   ldlibpthname='' ;;
6306 esac
6307
6308 : determine where manual pages go
6309 set man1dir man1dir none
6310 eval $prefixit
6311 $cat <<EOM
6312
6313 $spackage has manual pages available in source form.
6314 EOM
6315 case "$nroff" in
6316 nroff)
6317         echo "However, you don't have nroff, so they're probably useless to you."
6318         case "$man1dir" in
6319         '') man1dir="none";;
6320         esac;;
6321 esac
6322 echo "If you don't want the manual sources installed, answer 'none'."
6323 case "$man1dir" in
6324 ' ') dflt=none
6325         ;;
6326 '')
6327         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6328         lookpath="$lookpath $prefixexp/man/p_man/man1"
6329         lookpath="$lookpath $prefixexp/man/u_man/man1"
6330         lookpath="$lookpath $prefixexp/man/man.1"
6331         case "$sysman" in
6332         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6333         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6334         esac
6335         set dflt
6336         eval $prefixup
6337         ;;
6338 *)  dflt="$man1dir"
6339         ;;
6340 esac
6341 echo " "
6342 fn=dn+~
6343 rp="Where do the main $spackage manual pages (source) go?"
6344 . ./getfile
6345 if $test "X$man1direxp" != "X$ansexp"; then
6346         installman1dir=''
6347 fi
6348 man1dir="$ans"
6349 man1direxp="$ansexp"
6350 case "$man1dir" in
6351 '')     man1dir=' '
6352         installman1dir='';;
6353 esac
6354
6355 : Change installation prefix, if necessary.
6356 if $test X"$prefix" != X"$installprefix"; then
6357         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6358 else
6359         installman1dir="$man1direxp"
6360 fi
6361
6362 : What suffix to use on installed man pages
6363
6364 case "$man1dir" in
6365 ' ')
6366         man1ext='0'
6367         ;;
6368 *)
6369         rp="What suffix should be used for the main $spackage man pages?"
6370         case "$man1ext" in
6371         '')     case "$man1dir" in
6372                 *1)  dflt=1 ;;
6373                 *1p) dflt=1p ;;
6374                 *1pm) dflt=1pm ;;
6375                 *l) dflt=l;;
6376                 *n) dflt=n;;
6377                 *o) dflt=o;;
6378                 *p) dflt=p;;
6379                 *C) dflt=C;;
6380                 *L) dflt=L;;
6381                 *L1) dflt=L1;;
6382                 *) dflt=1;;
6383                 esac
6384                 ;;
6385         *)      dflt="$man1ext";;
6386         esac
6387         . ./myread
6388         man1ext="$ans"
6389         ;;
6390 esac
6391
6392 : see if we can have long filenames
6393 echo " "
6394 rmlist="$rmlist /tmp/cf$$"
6395 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
6396 first=123456789abcdef
6397 second=/tmp/cf$$/$first
6398 $rm -f $first $second
6399 if (echo hi >$first) 2>/dev/null; then
6400         if $test -f 123456789abcde; then
6401                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6402                 val="$undef"
6403         else
6404                 if (echo hi >$second) 2>/dev/null; then
6405                         if $test -f /tmp/cf$$/123456789abcde; then
6406                                 $cat <<'EOM'
6407 That's peculiar... You can have filenames longer than 14 characters, but only
6408 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
6409 I shall consider your system cannot support long filenames at all.
6410 EOM
6411                                 val="$undef"
6412                         else
6413                                 echo 'You can have filenames longer than 14 characters.' >&4
6414                                 val="$define"
6415                         fi
6416                 else
6417                         $cat <<'EOM'
6418 How confusing! Some of your filesystems are sane enough to allow filenames
6419 longer than 14 characters but some others like /tmp can't even think about them.
6420 So, for now on, I shall assume your kernel does not allow them at all.
6421 EOM
6422                         val="$undef"
6423                 fi
6424         fi
6425 else
6426         $cat <<'EOM'
6427 You can't have filenames longer than 14 chars.  You can't even think about them!
6428 EOM
6429         val="$undef"
6430 fi 
6431 set d_flexfnam
6432 eval $setvar
6433 $rm -rf /tmp/cf$$ 123456789abcde*
6434
6435 : determine where library module manual pages go
6436 set man3dir man3dir none
6437 eval $prefixit
6438 $cat <<EOM
6439
6440 $spackage has manual pages for many of the library modules.
6441 EOM
6442
6443 case "$nroff" in
6444 nroff)
6445         $cat <<'EOM'
6446 However, you don't have nroff, so they're probably useless to you.
6447 EOM
6448         case "$man3dir" in
6449         '') man3dir="none";;
6450         esac;;
6451 esac
6452
6453 case "$d_flexfnam" in
6454 undef)
6455         $cat <<'EOM'
6456 However, your system can't handle the long file names like File::Basename.3. 
6457 EOM
6458         case "$man3dir" in
6459         '') man3dir="none";;
6460         esac;;
6461 esac
6462
6463 echo "If you don't want the manual sources installed, answer 'none'."
6464 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6465 case "$man3dir" in
6466 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
6467         if $test -d "$privlib/man/man3"; then
6468                 cat <<EOM >&4
6469
6470 WARNING:  Previous versions of perl installed man3 pages into
6471 $privlib/man/man3.  This version will suggest a 
6472 new default of $dflt.  
6473 EOM
6474                 tdflt=$dflt
6475                 dflt='n'
6476                 rp='Do you wish to preserve the old behavior?(y/n)'
6477                 . ./myread
6478                 case "$ans" in
6479                 y*) dflt="$privlib/man/man3" ;;
6480                 *)  dflt=$tdflt ;;
6481                 esac
6482     fi
6483         ;;
6484 ' ') dflt=none;;
6485 *)      dflt="$man3dir" ;;
6486 esac
6487 echo " "
6488 fn=dn+~
6489 rp="Where do the $package library man pages (source) go?"
6490 . ./getfile
6491 man3dir="$ans"
6492 man3direxp="$ansexp"
6493 case "$man1dir" in
6494 '')     man3dir=' '
6495         installman3dir='';;
6496 esac
6497
6498 : Change installation prefix, if necessary.
6499 if $test X"$prefix" != X"$installprefix"; then
6500         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6501 else
6502         installman3dir="$man3direxp"
6503 fi
6504
6505 : What suffix to use on installed man pages
6506 case "$man3dir" in
6507 ' ')
6508         man3ext='0'
6509         ;;
6510 *)
6511         rp="What suffix should be used for the $package library man pages?"
6512         case "$man3ext" in
6513         '')     case "$man3dir" in
6514                 *3)  dflt=3 ;;
6515                 *3p) dflt=3p ;;
6516                 *3pm) dflt=3pm ;;
6517                 *l) dflt=l;;
6518                 *n) dflt=n;;
6519                 *o) dflt=o;;
6520                 *p) dflt=p;;
6521                 *C) dflt=C;;
6522                 *L) dflt=L;;
6523                 *L3) dflt=L3;;
6524                 *) dflt=3;;
6525                 esac
6526                 ;;
6527         *)      dflt="$man3ext";;
6528         esac
6529         . ./myread
6530         man3ext="$ans"
6531         ;;
6532 esac
6533
6534 : see if we have to deal with yellow pages, now NIS.
6535 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6536         if $test -f /usr/etc/nibindd; then
6537                 echo " "
6538                 echo "I'm fairly confident you're on a NeXT."
6539                 echo " "
6540                 rp='Do you get the hosts file via NetInfo?'
6541                 dflt=y
6542                 case "$hostcat" in
6543                 nidump*) ;;
6544                 '') ;;
6545                 *) dflt=n;;
6546                 esac
6547                 . ./myread
6548                 case "$ans" in
6549                 y*) hostcat='nidump hosts .';;
6550                 *)      case "$hostcat" in
6551                         nidump*) hostcat='';;
6552                         esac
6553                         ;;
6554                 esac
6555         fi
6556         case "$hostcat" in
6557         nidump*) ;;
6558         *)
6559                 case "$hostcat" in
6560                 *ypcat*) dflt=y;;
6561                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6562                                 dflt=y
6563                         else
6564                                 dflt=n
6565                         fi;;
6566                 *) dflt=n;;
6567                 esac
6568                 echo " "
6569                 rp='Are you getting the hosts file via yellow pages?'
6570                 . ./myread
6571                 case "$ans" in
6572                 y*) hostcat='ypcat hosts';;
6573                 *) hostcat='cat /etc/hosts';;
6574                 esac
6575                 ;;
6576         esac
6577 fi
6578 case "$hostcat" in
6579 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
6580 esac
6581 case "$groupcat" in
6582 '') test -f /etc/group && groupcat='cat /etc/group';;
6583 esac
6584 case "$passcat" in
6585 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
6586 esac
6587
6588 : now get the host name
6589 echo " "
6590 echo "Figuring out host name..." >&4
6591 case "$myhostname" in
6592 '') cont=true
6593         echo 'Maybe "hostname" will work...'
6594         if tans=`sh -c hostname 2>&1` ; then
6595                 myhostname=$tans
6596                 phostname=hostname
6597                 cont=''
6598         fi
6599         ;;
6600 *) cont='';;
6601 esac
6602 if $test "$cont"; then
6603         if ./xenix; then
6604                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6605                 if tans=`cat /etc/systemid 2>&1` ; then
6606                         myhostname=$tans
6607                         phostname='cat /etc/systemid'
6608                         echo "Whadyaknow.  Xenix always was a bit strange..."
6609                         cont=''
6610                 fi
6611         elif $test -r /etc/systemid; then
6612                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6613         fi
6614 fi
6615 if $test "$cont"; then
6616         echo 'No, maybe "uuname -l" will work...'
6617         if tans=`sh -c 'uuname -l' 2>&1` ; then
6618                 myhostname=$tans
6619                 phostname='uuname -l'
6620         else
6621                 echo 'Strange.  Maybe "uname -n" will work...'
6622                 if tans=`sh -c 'uname -n' 2>&1` ; then
6623                         myhostname=$tans
6624                         phostname='uname -n'
6625                 else
6626                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6627                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6628                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6629                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6630                         else
6631                                 case "$myhostname" in
6632                                 '') echo "Does this machine have an identity crisis or something?"
6633                                         phostname='';;
6634                                 *)
6635                                         echo "Well, you said $myhostname before..."
6636                                         phostname='echo $myhostname';;
6637                                 esac
6638                         fi
6639                 fi
6640         fi
6641 fi
6642 : you do not want to know about this
6643 set $myhostname
6644 myhostname=$1
6645
6646 : verify guess
6647 if $test "$myhostname" ; then
6648         dflt=y
6649         rp='Your host name appears to be "'$myhostname'".'" Right?"
6650         . ./myread
6651         case "$ans" in
6652         y*) ;;
6653         *) myhostname='';;
6654         esac
6655 fi
6656
6657 : bad guess or no guess
6658 while $test "X$myhostname" = X ; do
6659         dflt=''
6660         rp="Please type the (one word) name of your host:"
6661         . ./myread
6662         myhostname="$ans"
6663 done
6664
6665 : translate upper to lower if necessary
6666 case "$myhostname" in
6667 *[A-Z]*)
6668         echo "(Normalizing case in your host name)"
6669         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6670         ;;
6671 esac
6672
6673 case "$myhostname" in
6674 *.*)
6675         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6676         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6677         echo "(Trimming domain name from host name--host name is now $myhostname)"
6678         ;;
6679 *) case "$mydomain" in
6680         '')
6681                 {
6682                         test "X$hostcat" = "Xypcat hosts" &&
6683                         ypmatch "$myhostname" hosts 2>/dev/null |\
6684                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6685                         $test -s hosts
6686                 } || {
6687                         test "X$hostcat" != "X" &&
6688                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6689                                         /[       ]$myhostname[  . ]/p" > hosts
6690                 }
6691                 tmp_re="[       . ]"
6692                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6693                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6694                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6695                         hosts | $sort | $uniq | \
6696                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6697                 case `$echo X$dflt` in
6698                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6699                         dflt=.
6700                         ;;
6701                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6702                         ;;
6703                 esac
6704                 case "$dflt" in
6705                 .)
6706                         tans=`./loc resolv.conf X /etc /usr/etc`
6707                         if $test -f "$tans"; then
6708                                 echo "(Attempting domain name extraction from $tans)"
6709                                 dflt=.`$sed -n -e 's/   / /g' \
6710                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6711                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6712                                 case "$dflt" in
6713                                 .) dflt=.`$sed -n -e 's/        / /g' \
6714                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6715                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6716                                         ;;
6717                                 esac
6718                         fi
6719                         ;;
6720                 esac
6721                 case "$dflt" in
6722                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6723                         dflt=.`sh -c domainname 2>/dev/null`
6724                         case "$dflt" in
6725                         '') dflt='.';;
6726                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6727                         esac
6728                         ;;
6729                 esac
6730                 case "$dflt" in
6731                 .) echo "(Lost all hope -- silly guess then)"
6732                         dflt='.uucp'
6733                         ;;
6734                 esac
6735                 $rm -f hosts
6736                 ;;
6737         *) dflt="$mydomain";;
6738         esac;;
6739 esac
6740 echo " "
6741 rp="What is your domain name?"
6742 . ./myread
6743 tans="$ans"
6744 case "$ans" in
6745 '') ;;
6746 .*) ;;
6747 *) tans=".$tans";;
6748 esac
6749 mydomain="$tans"
6750
6751 : translate upper to lower if necessary
6752 case "$mydomain" in
6753 *[A-Z]*)
6754         echo "(Normalizing case in your domain name)"
6755         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6756         ;;
6757 esac
6758
6759 : a little sanity check here
6760 case "$phostname" in
6761 '') ;;
6762 *)
6763         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6764         $myhostname$mydomain|$myhostname) ;;
6765         *)
6766                 case "$phostname" in
6767                 sed*)
6768                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6769                         ;;
6770                 *)
6771                         echo "(That doesn't agree with your $phostname command, by the way.)"
6772                         ;;
6773                 esac
6774         ;;
6775         esac
6776         ;;
6777 esac
6778
6779 $cat <<EOM
6780
6781 I need to get your e-mail address in Internet format if possible, i.e.
6782 something like user@host.domain. Please answer accurately since I have
6783 no easy means to double check it. The default value provided below
6784 is most probably close to reality but may not be valid from outside
6785 your organization...
6786
6787 EOM
6788 cont=x
6789 while test "$cont"; do
6790         case "$cf_email" in
6791         '') dflt="$cf_by@$myhostname$mydomain";;
6792         *) dflt="$cf_email";;
6793         esac
6794         rp='What is your e-mail address?'
6795         . ./myread
6796         cf_email="$ans"
6797         case "$cf_email" in
6798         *@*.*) cont='' ;;
6799         *)
6800                 rp='Address does not look like an Internet one.  Use it anyway?'
6801                 case "$fastread" in
6802                 yes) dflt=y ;;
6803                 *) dflt=n ;;
6804                 esac
6805                 . ./myread
6806                 case "$ans" in
6807                 y*) cont='' ;;
6808                 *) echo " " ;;
6809                 esac
6810                 ;;
6811         esac
6812 done
6813
6814 $cat <<EOM
6815
6816 If you or somebody else will be maintaining perl at your site, please
6817 fill in the correct e-mail address here so that they may be contacted
6818 if necessary. Currently, the "perlbug" program included with perl
6819 will send mail to this address in addition to perlbug@perl.com. You may
6820 enter "none" for no administrator.
6821
6822 EOM
6823 case "$perladmin" in
6824 '') dflt="$cf_email";;
6825 *) dflt="$perladmin";;
6826 esac
6827 rp='Perl administrator e-mail address'
6828 . ./myread
6829 perladmin="$ans"
6830
6831 : figure out how to guarantee perl startup
6832 case "$startperl" in
6833 '')
6834         case "$sharpbang" in
6835         *!)
6836                 $cat <<EOH
6837
6838 I can use the #! construct to start perl on your system. This will
6839 make startup of perl scripts faster, but may cause problems if you
6840 want to share those scripts and perl is not in a standard place
6841 ($binexp/perl) on all your platforms. The alternative is to force
6842 a shell by starting the script with a single ':' character.
6843
6844 EOH
6845                 dflt="$binexp/perl"
6846                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6847                 . ./myread
6848                 case "$ans" in
6849                 none)   startperl=": # use perl";;
6850                 *)      startperl="#!$ans"
6851                         if $test 30 -lt `echo "$ans" | wc -c`; then
6852                                 $cat >&4 <<EOM
6853
6854 WARNING:  Some systems limit the #! command to 32 characters.
6855 If you experience difficulty running Perl scripts with #!, try
6856 installing Perl in a directory with a shorter pathname.
6857
6858 EOM
6859                         fi ;;
6860                 esac
6861                 ;;
6862         *) startperl=": # use perl"
6863                 ;;
6864         esac
6865         ;;
6866 esac
6867 echo "I'll use $startperl to start perl scripts."
6868
6869 : figure best path for perl in scripts
6870 case "$perlpath" in
6871 '')
6872         perlpath="$binexp/perl"
6873         case "$startperl" in
6874         *!*) ;;
6875         *)
6876                 $cat <<EOH
6877
6878 I will use the "eval 'exec'" idiom to start Perl on your system.
6879 I can use the full path of your Perl binary for this purpose, but
6880 doing so may cause problems if you want to share those scripts and
6881 Perl is not always in a standard place ($binexp/perl).
6882
6883 EOH
6884                 dflt="$binexp/perl"
6885                 rp="What path shall I use in \"eval 'exec'\"?"
6886                 . ./myread
6887                 perlpath="$ans"
6888                 ;;
6889         esac
6890         ;;
6891 esac
6892 case "$startperl" in
6893 *!*)    ;;
6894 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6895 esac
6896
6897 : determine where public executable scripts go
6898 set scriptdir scriptdir
6899 eval $prefixit
6900 case "$scriptdir" in
6901 '')
6902         dflt="$bin"
6903         : guess some guesses
6904         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6905         $test -d /usr/share/bin     && dflt=/usr/share/bin
6906         $test -d /usr/local/script  && dflt=/usr/local/script
6907         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6908         $test -d $prefixexp/script  && dflt=$prefixexp/script
6909         set dflt
6910         eval $prefixup
6911         ;;
6912 *)  dflt="$scriptdir"
6913         ;;
6914 esac
6915 $cat <<EOM
6916  
6917 Some installations have a separate directory just for executable scripts so
6918 that they can mount it across multiple architectures but keep the scripts in
6919 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6920 Or you might just lump your scripts in with all your other executables.
6921  
6922 EOM
6923 fn=d~
6924 rp='Where do you keep publicly executable scripts?'
6925 . ./getfile
6926 if $test "X$ansexp" != "X$scriptdirexp"; then
6927         installscript=''
6928 fi
6929 scriptdir="$ans"
6930 scriptdirexp="$ansexp"
6931 : Change installation prefix, if necessary.
6932 if $test X"$prefix" != X"$installprefix"; then
6933         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6934 else
6935         installscript="$scriptdirexp"
6936 fi
6937
6938 : determine where site specific architecture-dependent libraries go.
6939 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6940 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6941 : sitelib may have an optional trailing /share.
6942 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6943 tdflt="$tdflt/$archname"
6944 set sitearch sitearch none
6945 eval $prefixit
6946 case "$sitearch" in
6947 '')     dflt="$tdflt" ;;
6948 *)      dflt="$sitearch" ;;
6949 esac
6950 $cat <<EOM
6951
6952 The installation process will also create a directory for
6953 architecture-dependent site-specific extensions and modules.
6954
6955 EOM
6956 fn=nd~+
6957 rp='Pathname for the site-specific architecture-dependent library files?'
6958 . ./getfile
6959 sitearch="$ans"
6960 sitearchexp="$ansexp"
6961 : Change installation prefix, if necessary.
6962 if $test X"$prefix" != X"$installprefix"; then
6963         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6964 else
6965         installsitearch="$sitearchexp"
6966 fi
6967
6968 : determine where add-on public executables go
6969 case "$sitebin" in
6970 '')     dflt=$siteprefix/bin ;;
6971 *)      dflt=$sitebin ;;
6972 esac
6973 fn=d~
6974 rp='Pathname where the add-on public executables should be installed?'
6975 . ./getfile
6976 sitebin="$ans"
6977 sitebinexp="$ansexp"
6978 : Change installation prefix, if necessary.
6979 if $test X"$prefix" != X"$installprefix"; then
6980         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
6981 else
6982         installsitebin="$sitebinexp"
6983 fi
6984
6985 : see if sqrtl exists
6986 set sqrtl d_sqrtl
6987 eval $inlibc
6988
6989 cat <<EOM
6990
6991 Perl can be built to take advantage of long doubles which
6992 (if available) may give more accuracy and range for floating point numbers.
6993
6994 If this doesn't make any sense to you, just accept the default 'n'.
6995 EOM
6996
6997 case "$ccflags" in
6998 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6999 esac
7000
7001 case "$uselongdouble" in
7002 $define|true|[yY]*)     dflt='y';;
7003 *) dflt='n';;
7004 esac
7005 rp='Try to use long doubles if available?'
7006 . ./myread
7007 case "$ans" in
7008 y|Y)    val="$define"   ;;
7009 *)      val="$undef"    ;;
7010 esac
7011 set uselongdouble
7012 eval $setvar
7013
7014 case "$uselongdouble" in
7015 true|[yY]*) uselongdouble="$define" ;;
7016 esac
7017
7018 case "$uselongdouble" in
7019 $define)
7020 : Look for a hint-file generated 'call-back-unit'.  If the
7021 : user has specified that long doubles should be used,
7022 : we may need to set or change some other defaults.
7023         if $test -f uselongdouble.cbu; then
7024                 echo "Your platform has some specific hints for long doubles, using them..."
7025                 . ./uselongdouble.cbu
7026         else
7027                 $cat <<EOM
7028 (Your platform doesn't have any specific hints for long doubles.)
7029 EOM
7030         fi
7031         ;;
7032 esac
7033
7034 case "$uselongdouble:$d_sqrtl" in
7035 $define:$undef)
7036                 $cat <<EOM >&4
7037
7038 You requested the use of long doubles but you do not seem to have
7039 the mathematic functions for long doubles.  I'm disabling the use
7040 of long doubles.
7041 EOM
7042         uselongdouble=$undef
7043         ;;
7044 esac
7045
7046 cat <<EOM
7047
7048 Perl can be built to take advantage of long longs which
7049 (if available) may give more range for integer numbers.
7050
7051 If this doesn't make any sense to you, just accept the default 'n'.
7052 EOM
7053
7054 case "$ccflags" in
7055 *-DUSE_LONG_LONG*) uselonglong="$define" ;;
7056 esac
7057
7058 case "$uselonglong" in
7059 '')     dflt='y';;
7060 esac
7061 rp='Try to use long longs if available?'
7062 . ./myread
7063 case "$ans" in
7064 y|Y)    val="$define"   ;;
7065 *)      val="$undef"    ;;
7066 esac
7067 set uselonglong
7068 eval $setvar
7069
7070 case "$uselonglong" in
7071 true|[yY]*) uselonglong="$define" ;;
7072 esac
7073
7074 case "$uselonglong" in
7075 $define)
7076 : Look for a hint-file generated 'call-back-unit'.  If the
7077 : user has specified that long longs should be used,
7078 : we may need to set or change some other defaults.
7079         if $test -f uselonglong.cbu; then
7080                 echo "Your platform has some specific hints for long longs, using them..."
7081                 . ./uselonglong.cbu
7082         else
7083                 $cat <<EOM
7084 (Your platform doesn't have any specific hints for long longs.)
7085 EOM
7086         fi
7087         ;;
7088 esac
7089
7090 cat <<EOM
7091
7092 Previous version of $package used the standard IO mechanisms as defined
7093 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
7094 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
7095 the default.  This abstraction layer can use AT&T's sfio (if you already
7096 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
7097 problems with some extension modules.  Using PerlIO with stdio is safe,
7098 but it is slower than plain stdio and therefore is not the default.
7099
7100 If this doesn't make any sense to you, just accept the default 'n'.
7101 EOM
7102 case "$useperlio" in
7103 $define|true|[yY]*)     dflt='y';;
7104 *) dflt='n';;
7105 esac
7106 rp='Use the experimental PerlIO abstraction layer?'
7107 . ./myread
7108 case "$ans" in
7109 y|Y) 
7110         val="$define"
7111         ;;     
7112 *)      
7113         echo "Ok, doing things the stdio way"
7114         val="$undef"
7115         ;;
7116 esac
7117 set useperlio
7118 eval $setvar 
7119
7120 case "$vendorprefix" in
7121 '')     d_vendorbin="$undef"
7122         vendorbin=''
7123         vendorbinexp=''
7124         ;;
7125 *)      d_vendorbin="$define"
7126         : determine where vendor-supplied executables go.
7127         dflt=$vendorprefix/bin
7128         fn=d~+
7129         rp='Pathname for the vendor-supplied executables directory?'
7130         . ./getfile
7131         vendorbin="$ans"
7132         vendorbinexp="$ansexp"
7133         : Change installation prefix, if necessary.
7134         if $test X"$prefix" != X"$installprefix"; then
7135                 installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7136         else
7137                 installvendorbin="$vendorbinexp"
7138         fi
7139         ;;
7140 esac
7141
7142 : check for length of double
7143 echo " "
7144 case "$doublesize" in
7145 '')
7146         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7147         $cat >try.c <<'EOCP'
7148 #include <stdio.h>
7149 int main()
7150 {
7151     printf("%d\n", (int)sizeof(double));
7152     exit(0);
7153 }
7154 EOCP
7155         set try
7156         if eval $compile_ok; then
7157                 doublesize=`./try`
7158                 $echo " $doublesize bytes." >&4
7159         else
7160                 dflt='8'
7161                 echo "(I can't seem to compile the test program.  Guessing...)"
7162                 rp="What is the size of a double precision number (in bytes)?"
7163                 . ./myread
7164                 doublesize="$ans"
7165         fi
7166         ;;
7167 esac
7168 $rm -f try.c try
7169
7170 : check for long doubles
7171 echo " "
7172 $echo $n "Checking to see if your system supports long double..." $c >&4
7173 echo 'int main() { long double x = 7.0; }' > try.c
7174 set try
7175 if eval $compile; then
7176         val="$define"
7177         echo " Yes, it does." >&4
7178 else
7179         val="$undef"
7180         echo " No, it doesn't." >&4
7181 fi
7182 $rm try.*
7183 set d_longdbl
7184 eval $setvar
7185
7186 : check for length of long double
7187 case "${d_longdbl}${longdblsize}" in
7188 $define)
7189         echo " "
7190         $echo $n "Checking to see how big your long doubles are..." $c >&4
7191         $cat >try.c <<'EOCP'
7192 #include <stdio.h>
7193 int main()
7194 {
7195         printf("%d\n", sizeof(long double));
7196 }
7197 EOCP
7198         set try
7199         set try
7200         if eval $compile; then
7201                 longdblsize=`./try$exe_ext`
7202                 $echo " $longdblsize bytes." >&4
7203         else
7204                 dflt='8'
7205                 echo " "
7206                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7207                 rp="What is the size of a long double (in bytes)?"
7208                 . ./myread
7209                 longdblsize="$ans"
7210         fi
7211         if $test "X$doublesize" = "X$longdblsize"; then
7212                 echo "(That isn't any different from an ordinary double.)"
7213         fi      
7214         ;;
7215 esac
7216 $rm -f try.* try
7217
7218 : Check how to convert floats to strings.
7219 if test "X$d_Gconvert" = X; then
7220         echo " "
7221         echo "Checking for an efficient way to convert floats to strings."
7222         $cat >try.c <<EOP
7223 #ifdef TRY_gconvert
7224 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7225 char *myname = "gconvert";
7226 #endif
7227 #ifdef TRY_gcvt
7228 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7229 char *myname = "gcvt";
7230 #endif
7231 #ifdef TRY_qgcvt
7232 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7233 char *myname = "qgcvt";
7234 #define DOUBLETYPE long double
7235 #endif
7236 #ifdef TRY_sprintf
7237 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7238 char *myname = "sprintf";
7239 #endif
7240
7241 #ifndef DOUBLETYPE
7242 #define DOUBLETYPE double
7243 #endif
7244
7245 #include <stdio.h>
7246
7247 #define I_STDLIB $i_stdlib
7248 #ifdef I_STDLIB
7249 #include <stdlib.h>
7250 #endif
7251
7252 int
7253 checkit(expect, got)
7254 char *expect;
7255 char *got;
7256 {
7257     if (strcmp(expect, got)) {
7258                 printf("%s oddity:  Expected %s, got %s\n",
7259                         myname, expect, got);
7260                 exit(1);
7261         }
7262 }
7263
7264 int main()
7265
7266         char buf[64]; 
7267         buf[63] = '\0';
7268
7269         /* This must be 1st test on (which?) platform */
7270         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7271         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7272         checkit("0.1", buf);
7273
7274         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7275         checkit("1", buf);
7276
7277         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7278         checkit("0", buf);
7279
7280         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7281         checkit("-1", buf);
7282
7283         /* Some Linux gcvt's give 1.e+5 here. */
7284         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7285         checkit("100000", buf);
7286         
7287         /* Some Linux gcvt's give -1.e+5 here. */
7288         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7289         checkit("-100000", buf);
7290
7291         exit(0);
7292 }
7293 EOP
7294         case "$d_Gconvert" in
7295         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7296         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7297         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7298         *) xxx_list='gconvert gcvt sprintf' ;;
7299         esac
7300
7301         case "$d_longdbl$uselongdouble" in
7302         definedefine) xxx_list="`echo $xxx_list|sed 's/gcvt/qgcvt gcvt/'`" ;;
7303         esac
7304
7305         for xxx_convert in $xxx_list; do
7306                 echo "Trying $xxx_convert..."
7307                 $rm -f try try$_o
7308                 set try -DTRY_$xxx_convert
7309                 if eval $compile; then
7310                         echo "$xxx_convert() found." >&4
7311                         if ./try; then
7312                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
7313                                 break;
7314                         else
7315                                 echo "...But $xxx_convert didn't work as I expected."
7316                         fi
7317                 else
7318                         echo "$xxx_convert NOT found." >&4
7319                 fi
7320         done
7321                 
7322         case "$xxx_convert" in
7323         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7324         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7325         qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7326         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7327         esac
7328 fi
7329
7330 echo " "
7331
7332 if $test X"$d_longdbl" = X"$define"; then
7333
7334 echo "Checking how to print long doubles..." >&4
7335
7336 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7337         $cat >try.c <<'EOCP'
7338 #include <sys/types.h>
7339 #include <stdio.h>
7340 int main() {
7341   double d = 123.456;
7342   printf("%.3f\n", d);
7343 }
7344 EOCP
7345         set try
7346         if eval $compile; then
7347                 yyy=`./try$exe_ext`
7348                 case "$yyy" in
7349                 123.456)
7350                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7351                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7352                         echo "We will use %f."
7353                         ;;
7354                 esac
7355         fi
7356 fi
7357
7358 if $test X"$sPRIfldbl" = X; then
7359         $cat >try.c <<'EOCP'
7360 #include <sys/types.h>
7361 #include <stdio.h>
7362 int main() {
7363   long double d = 123.456;
7364   printf("%.3llf\n", d);
7365 }
7366 EOCP
7367         set try
7368         if eval $compile; then
7369                 yyy=`./try$exe_ext`
7370                 case "$yyy" in
7371                 123.456)
7372                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7373                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7374                         echo "We will use %llf."
7375                         ;;
7376                 esac
7377         fi
7378 fi
7379
7380 if $test X"$sPRIfldbl" = X; then
7381         $cat >try.c <<'EOCP'
7382 #include <sys/types.h>
7383 #include <stdio.h>
7384 int main() {
7385   long double d = 123.456;
7386   printf("%.3Lf\n", d);
7387 }
7388 EOCP
7389         set try
7390         if eval $compile; then
7391                 yyy=`./try$exe_ext`
7392                 case "$yyy" in
7393                 123.456)
7394                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7395                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7396                         echo "We will use %Lf."
7397                         ;;
7398                 esac
7399         fi
7400 fi
7401
7402 if $test X"$sPRIfldbl" = X; then
7403         $cat >try.c <<'EOCP'
7404 #include <sys/types.h>
7405 #include <stdio.h>
7406 int main() {
7407   long double d = 123.456;
7408   printf("%.3lf\n", d);
7409 }
7410 EOCP
7411         set try
7412         if eval $compile; then
7413                 yyy=`./try$exe_ext`
7414                 case "$yyy" in
7415                 123.456)
7416                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7417                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7418                         echo "We will use %lf."
7419                         ;;
7420                 esac
7421         fi
7422 fi
7423
7424 if $test X"$sPRIfldbl" = X; then
7425         echo "Cannot figure out how to print long doubles." >&4
7426 fi
7427
7428 $rm -f try try.*
7429
7430 fi # d_longdbl
7431
7432 case "$sPRIfldbl" in
7433 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7434         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7435         ;;
7436 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7437         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7438         ;;
7439 esac
7440
7441 : Initialize h_fcntl
7442 h_fcntl=false
7443
7444 : Initialize h_sysfile
7445 h_sysfile=false
7446
7447 : access call always available on UNIX
7448 set access d_access
7449 eval $inlibc
7450
7451 : locate the flags for 'access()'
7452 case "$d_access" in
7453 "$define")
7454         echo " "
7455         $cat >access.c <<'EOCP'
7456 #include <sys/types.h>
7457 #ifdef I_FCNTL
7458 #include <fcntl.h>
7459 #endif
7460 #ifdef I_SYS_FILE
7461 #include <sys/file.h>
7462 #endif
7463 #ifdef I_UNISTD
7464 #include <unistd.h>
7465 #endif
7466 int main() {
7467         exit(R_OK);
7468 }
7469 EOCP
7470         : check sys/file.h first, no particular reason here
7471         if $test `./findhdr sys/file.h` && \
7472                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7473                 h_sysfile=true;
7474                 echo "<sys/file.h> defines the *_OK access constants." >&4
7475         elif $test `./findhdr fcntl.h` && \
7476                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7477                 h_fcntl=true;
7478                 echo "<fcntl.h> defines the *_OK access constants." >&4
7479         elif $test `./findhdr unistd.h` && \
7480                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7481                 echo "<unistd.h> defines the *_OK access constants." >&4
7482         else
7483                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7484         fi
7485         ;;
7486 esac
7487 $rm -f access*
7488
7489 : see if accessx exists
7490 set accessx d_accessx
7491 eval $inlibc
7492
7493 : see if alarm exists
7494 set alarm d_alarm
7495 eval $inlibc
7496
7497 : see if atolf exists
7498 set atolf d_atolf
7499 eval $inlibc
7500
7501 : see if atoll exists
7502 set atoll d_atoll
7503 eval $inlibc
7504
7505 : Look for GNU-cc style attribute checking
7506 echo " "
7507 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7508 $cat >attrib.c <<'EOCP'
7509 #include <stdio.h>
7510 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7511 EOCP
7512 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7513         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7514                 echo "Your C compiler doesn't fully support __attribute__."
7515                 val="$undef"
7516         else
7517                 echo "Your C compiler supports __attribute__."
7518                 val="$define"
7519         fi
7520 else
7521         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7522         val="$undef"
7523 fi
7524 set d_attribut
7525 eval $setvar
7526 $rm -f attrib*
7527
7528 : see if bcmp exists
7529 set bcmp d_bcmp
7530 eval $inlibc
7531
7532 : see if bcopy exists
7533 set bcopy d_bcopy
7534 eval $inlibc
7535
7536 : see if this is a unistd.h system
7537 set unistd.h i_unistd
7538 eval $inhdr
7539
7540 : see if getpgrp exists
7541 set getpgrp d_getpgrp
7542 eval $inlibc
7543
7544 case "$d_getpgrp" in
7545 "$define")
7546         echo " "
7547         echo "Checking to see which flavor of getpgrp is in use..."
7548         $cat >set.c <<EOP
7549 #$i_unistd I_UNISTD
7550 #include <sys/types.h>
7551 #ifdef I_UNISTD
7552 #  include <unistd.h>
7553 #endif
7554 int main()
7555 {
7556         if (getuid() == 0) {
7557                 printf("(I see you are running Configure as super-user...)\n");
7558                 setuid(1);
7559         }
7560 #ifdef TRY_BSD_PGRP
7561         if (getpgrp(1) == 0)
7562                 exit(0);
7563 #else
7564         if (getpgrp() > 0)
7565                 exit(0);
7566 #endif
7567         exit(1);
7568 }
7569 EOP
7570         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7571                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7572                 val="$define"
7573         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7574                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7575                 val="$undef"
7576         else
7577                 echo "I can't seem to compile and run the test program."
7578                 if ./usg; then
7579                         xxx="a USG one, i.e. you use getpgrp()."
7580                 else
7581                         # SVR4 systems can appear rather BSD-ish.
7582                         case "$i_unistd" in
7583                         $undef)
7584                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7585                                 val="$define"
7586                                 ;;
7587                         $define)
7588                                 xxx="probably a USG one, i.e. you use getpgrp()."
7589                                 val="$undef"
7590                                 ;;
7591                         esac
7592                 fi
7593                 echo "Assuming your getpgrp is $xxx" >&4
7594         fi
7595         ;;
7596 *) val="$undef";;
7597 esac
7598 set d_bsdgetpgrp
7599 eval $setvar
7600 $rm -f set set.c
7601
7602 : see if setpgrp exists
7603 set setpgrp d_setpgrp
7604 eval $inlibc
7605
7606 case "$d_setpgrp" in
7607 "$define")
7608         echo " "
7609         echo "Checking to see which flavor of setpgrp is in use..."
7610         $cat >set.c <<EOP
7611 #$i_unistd I_UNISTD
7612 #include <sys/types.h>
7613 #ifdef I_UNISTD
7614 #  include <unistd.h>
7615 #endif
7616 int main()
7617 {
7618         if (getuid() == 0) {
7619                 printf("(I see you are running Configure as super-user...)\n");
7620                 setuid(1);
7621         }
7622 #ifdef TRY_BSD_PGRP
7623         if (-1 == setpgrp(1, 1))
7624                 exit(0);
7625 #else
7626         if (setpgrp() != -1)
7627                 exit(0);
7628 #endif
7629         exit(1);
7630 }
7631 EOP
7632         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7633                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7634                 val="$define"
7635         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7636                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7637                 val="$undef"
7638         else
7639                 echo "(I can't seem to compile and run the test program.)"
7640                 if ./usg; then
7641                         xxx="a USG one, i.e. you use setpgrp()."
7642                 else
7643                         # SVR4 systems can appear rather BSD-ish.
7644                         case "$i_unistd" in
7645                         $undef)
7646                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7647                                 val="$define"
7648                                 ;;
7649                         $define)
7650                                 xxx="probably a USG one, i.e. you use setpgrp()."
7651                                 val="$undef"
7652                                 ;;
7653                         esac
7654                 fi
7655                 echo "Assuming your setpgrp is $xxx" >&4
7656         fi
7657         ;;
7658 *) val="$undef";;
7659 esac
7660 set d_bsdsetpgrp
7661 eval $setvar
7662 $rm -f set set.c
7663 : see if bzero exists
7664 set bzero d_bzero
7665 eval $inlibc
7666
7667 : see if signal is declared as pointer to function returning int or void
7668 echo " "
7669 xxx=`./findhdr signal.h`
7670 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7671 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7672         echo "You have int (*signal())() instead of void." >&4
7673         val="$undef"
7674 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7675         echo "You have void (*signal())()." >&4
7676         val="$define"
7677 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7678         echo "You have int (*signal())() instead of void." >&4
7679         val="$undef"
7680 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7681         echo "You have void (*signal())()." >&4
7682         val="$define"
7683 else
7684         case "$d_voidsig" in
7685         '')
7686         echo "I can't determine whether signal handler returns void or int..." >&4
7687                 dflt=void
7688                 rp="What type does your signal handler return?"
7689                 . ./myread
7690                 case "$ans" in
7691                 v*) val="$define";;
7692                 *) val="$undef";;
7693                 esac;;
7694         "$define")
7695                 echo "As you already told me, signal handler returns void." >&4
7696                 val="$define"
7697                 ;;
7698         *)      echo "As you already told me, signal handler returns int." >&4
7699                 val="$undef"
7700                 ;;
7701         esac
7702 fi
7703 set d_voidsig
7704 eval $setvar
7705 case "$d_voidsig" in
7706 "$define") signal_t="void";;
7707 *) signal_t="int";;
7708 esac
7709 $rm -f $$.tmp
7710
7711 : check for ability to cast large floats to 32-bit ints.
7712 echo " "
7713 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7714 if $test "$intsize" -ge 4; then
7715         xxx=int
7716 else
7717         xxx=long
7718 fi
7719 $cat >try.c <<EOCP
7720 #include <stdio.h>
7721 #include <sys/types.h>
7722 #include <signal.h>
7723 $signal_t blech(s) int s; { exit(3); }
7724 int main()
7725 {
7726         $xxx i32;
7727         double f, g;
7728         int result = 0;
7729         char str[16];
7730         signal(SIGFPE, blech);
7731
7732         /* Don't let compiler optimize the test away.  Store the number 
7733            in a writable string for gcc to pass to sscanf under HP/UX.
7734         */
7735         sprintf(str, "2147483647");
7736         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7737         g = 10 * f;
7738         i32  = ($xxx) g;
7739
7740         /* x86 processors will probably give 0x8000 0000, which is a
7741        sign change.  We don't want that.  We want to mimic SPARC
7742            behavior here, which is to preserve the sign and give
7743            back 0x7fff ffff.
7744         */
7745         if (i32 != ($xxx) f)
7746                 result |= 1;
7747         exit(result);
7748 }
7749 EOCP
7750 set try
7751 if eval $compile_ok; then
7752         ./try
7753         yyy=$?
7754 else
7755         echo "(I can't seem to compile the test program--assuming it can't)"
7756         yyy=1
7757 fi
7758 case "$yyy" in
7759 0)      val="$define"
7760         echo "Yup, it can."
7761         ;;
7762 *)      val="$undef"
7763         echo "Nope, it can't."
7764         ;;
7765 esac
7766 set d_casti32
7767 eval $setvar
7768 $rm -f try try.*
7769
7770 : check for ability to cast negative floats to unsigned
7771 echo " "
7772 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7773 $cat >try.c <<EOCP
7774 #include <stdio.h>
7775 #include <sys/types.h>
7776 #include <signal.h>
7777 $signal_t blech(s) int s; { exit(7); }
7778 $signal_t blech_in_list(s) int s; { exit(4); }
7779 unsigned long dummy_long(p) unsigned long p; { return p; }
7780 unsigned int dummy_int(p) unsigned int p; { return p; }
7781 unsigned short dummy_short(p) unsigned short p; { return p; }
7782 int main()
7783 {
7784         double f;
7785         unsigned long along;
7786         unsigned int aint;
7787         unsigned short ashort;
7788         int result = 0;
7789         char str[16];
7790         
7791         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7792            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7793            optimized the whole file away
7794         */
7795         /* Store the number in a writable string for gcc to pass to 
7796            sscanf under HP/UX.
7797         */
7798         sprintf(str, "-123");
7799         sscanf(str, "%lf", &f);  /* f = -123.; */
7800
7801         signal(SIGFPE, blech);
7802         along = (unsigned long)f;
7803         aint = (unsigned int)f;
7804         ashort = (unsigned short)f;
7805         if (along != (unsigned long)-123)
7806                 result |= 1;
7807         if (aint != (unsigned int)-123)
7808                 result |= 1;
7809         if (ashort != (unsigned short)-123)
7810                 result |= 1;
7811         sprintf(str, "1073741824.");
7812         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7813         f = f + f;
7814         along = 0;
7815         along = (unsigned long)f;
7816         if (along != 0x80000000)
7817                 result |= 2;
7818         f -= 1.;
7819         along = 0;
7820         along = (unsigned long)f;
7821         if (along != 0x7fffffff)
7822                 result |= 1;
7823         f += 2.;
7824         along = 0;
7825         along = (unsigned long)f;
7826         if (along != 0x80000001)
7827                 result |= 2;
7828         if (result)
7829                 exit(result);
7830         signal(SIGFPE, blech_in_list);
7831         sprintf(str, "123.");
7832         sscanf(str, "%lf", &f);  /* f = 123.; */
7833         along = dummy_long((unsigned long)f);
7834         aint = dummy_int((unsigned int)f);
7835         ashort = dummy_short((unsigned short)f);
7836         if (along != (unsigned long)123)
7837                 result |= 4;
7838         if (aint != (unsigned int)123)
7839                 result |= 4;
7840         if (ashort != (unsigned short)123)
7841                 result |= 4;
7842         exit(result);
7843
7844 }
7845 EOCP
7846 set try
7847 if eval $compile_ok; then
7848         ./try
7849         castflags=$?
7850 else
7851         echo "(I can't seem to compile the test program--assuming it can't)"
7852         castflags=7
7853 fi
7854 case "$castflags" in
7855 0)      val="$define"
7856         echo "Yup, it can."
7857         ;;
7858 *)      val="$undef"
7859         echo "Nope, it can't."
7860         ;;
7861 esac
7862 set d_castneg
7863 eval $setvar
7864 $rm -f try.*
7865
7866 : see if vprintf exists
7867 echo " "
7868 if set vprintf val -f d_vprintf; eval $csym; $val; then
7869         echo 'vprintf() found.' >&4
7870         val="$define"
7871         $cat >vprintf.c <<'EOF'
7872 #include <varargs.h>
7873
7874 int main() { xxx("foo"); }
7875
7876 xxx(va_alist)
7877 va_dcl
7878 {
7879         va_list args;
7880         char buf[10];
7881
7882         va_start(args);
7883         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7884 }
7885 EOF
7886         set vprintf
7887         if eval $compile && ./vprintf; then
7888                 echo "Your vsprintf() returns (int)." >&4
7889                 val2="$undef"
7890         else
7891                 echo "Your vsprintf() returns (char*)." >&4
7892                 val2="$define"
7893         fi
7894 else
7895         echo 'vprintf() NOT found.' >&4
7896                 val="$undef"
7897                 val2="$undef"
7898 fi
7899 set d_vprintf
7900 eval $setvar
7901 val=$val2
7902 set d_charvspr
7903 eval $setvar
7904
7905 : see if chown exists
7906 set chown d_chown
7907 eval $inlibc
7908
7909 : see if chroot exists
7910 set chroot d_chroot
7911 eval $inlibc
7912
7913 : see if chsize exists
7914 set chsize d_chsize
7915 eval $inlibc
7916
7917 : check for const keyword
7918 echo " "
7919 echo 'Checking to see if your C compiler knows about "const"...' >&4
7920 $cat >const.c <<'EOCP'
7921 typedef struct spug { int drokk; } spug;
7922 int main()
7923 {
7924         const char *foo;
7925         const spug y;
7926 }
7927 EOCP
7928 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7929         val="$define"
7930         echo "Yup, it does."
7931 else
7932         val="$undef"
7933         echo "Nope, it doesn't."
7934 fi
7935 set d_const
7936 eval $setvar
7937
7938 : see if crypt exists
7939 echo " "
7940 if set crypt val -f d_crypt; eval $csym; $val; then
7941         echo 'crypt() found.' >&4
7942         val="$define"
7943         cryptlib=''
7944 else
7945         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7946         if $test -z "$cryptlib"; then
7947                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7948         else
7949                 cryptlib=-lcrypt
7950         fi
7951         if $test -z "$cryptlib"; then
7952                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7953         else
7954                 cryptlib=-lcrypt
7955         fi
7956         if $test -z "$cryptlib"; then
7957                 cryptlib=`./loc libcrypt$_a "" $libpth`
7958         else
7959                 cryptlib=-lcrypt
7960         fi
7961         if $test -z "$cryptlib"; then
7962                 echo 'crypt() NOT found.' >&4
7963                 val="$undef"
7964         else
7965                 val="$define"
7966         fi
7967 fi
7968 set d_crypt
7969 eval $setvar
7970
7971 : get csh whereabouts
7972 case "$csh" in
7973 'csh') val="$undef" ;;
7974 *) val="$define" ;;
7975 esac
7976 set d_csh
7977 eval $setvar
7978 : Respect a hint or command line value for full_csh.
7979 case "$full_csh" in
7980 '') full_csh=$csh ;;
7981 esac
7982
7983 : see if cuserid exists
7984 set cuserid d_cuserid
7985 eval $inlibc
7986
7987 : see if this is a limits.h system
7988 set limits.h i_limits
7989 eval $inhdr
7990
7991 : see if this is a float.h system
7992 set float.h i_float
7993 eval $inhdr
7994
7995 : See if number of significant digits in a double precision number is known
7996 echo " "
7997 $cat >dbl_dig.c <<EOM
7998 #$i_limits I_LIMITS
7999 #$i_float I_FLOAT
8000 #ifdef I_LIMITS
8001 #include <limits.h>
8002 #endif
8003 #ifdef I_FLOAT
8004 #include <float.h>
8005 #endif
8006 #ifdef DBL_DIG
8007 printf("Contains DBL_DIG");
8008 #endif
8009 EOM
8010 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8011 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8012         echo "DBL_DIG found." >&4
8013         val="$define"
8014 else
8015         echo "DBL_DIG NOT found." >&4
8016         val="$undef"
8017 fi
8018 $rm -f dbl_dig.?
8019 set d_dbl_dig
8020 eval $setvar
8021
8022 : see if difftime exists
8023 set difftime d_difftime
8024 eval $inlibc
8025
8026 : see if this is a dirent system
8027 echo " "
8028 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8029         val="$define"
8030         echo "<dirent.h> found." >&4
8031 else
8032         val="$undef"
8033         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8034                 echo "<sys/dir.h> found." >&4
8035                 echo " "
8036         else
8037                 xinc=`./findhdr sys/ndir.h`
8038         fi
8039         echo "<dirent.h> NOT found." >&4
8040 fi
8041 set i_dirent
8042 eval $setvar
8043
8044 : Look for type of directory structure.
8045 echo " "
8046 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8047
8048 case "$direntrytype" in
8049 ''|' ')
8050         case "$i_dirent" in
8051         $define) guess1='struct dirent' ;;
8052         *) guess1='struct direct'  ;;
8053         esac
8054         ;;
8055 *)      guess1="$direntrytype"
8056         ;;
8057 esac
8058
8059 case "$guess1" in
8060 'struct dirent') guess2='struct direct' ;;
8061 *) guess2='struct dirent' ;;
8062 esac
8063                 
8064 if $contains "$guess1" try.c >/dev/null 2>&1; then
8065         direntrytype="$guess1"
8066         echo "Your directory entries are $direntrytype." >&4
8067 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8068         direntrytype="$guess2"
8069         echo "Your directory entries seem to be $direntrytype." >&4
8070 else
8071         echo "I don't recognize your system's directory entries." >&4
8072         rp="What type is used for directory entries on this system?"
8073         dflt="$guess1"
8074         . ./myread
8075         direntrytype="$ans"
8076 fi
8077 $rm -f try.c
8078
8079
8080 : see if the directory entry stores field length
8081 echo " "
8082 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8083 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8084         echo "Good, your directory entry keeps length information in d_namlen." >&4
8085         val="$define"
8086 else
8087         echo "Your directory entry does not know about the d_namlen field." >&4
8088         val="$undef"
8089 fi
8090 set d_dirnamlen
8091 eval $setvar
8092 $rm -f try.c
8093
8094 : see if dlerror exists
8095 xxx_runnm="$runnm"
8096 runnm=false
8097 set dlerror d_dlerror
8098 eval $inlibc
8099 runnm="$xxx_runnm"
8100
8101 : see if dlfcn is available
8102 set dlfcn.h i_dlfcn
8103 eval $inhdr
8104
8105 case "$usedl" in
8106 $define|y|true)
8107         $cat << EOM
8108
8109 On a few systems, the dynamically loaded modules that perl generates and uses
8110 will need a different extension than shared libs. The default will probably
8111 be appropriate.
8112
8113 EOM
8114         case "$dlext" in
8115         '')     dflt="$so" ;;
8116         *)      dflt="$dlext" ;;
8117         esac
8118         rp='What is the extension of dynamically loaded modules'
8119         . ./myread
8120         dlext="$ans"
8121         ;;
8122 *)
8123         dlext="none"
8124         ;;
8125 esac
8126
8127 : Check if dlsym need a leading underscore
8128 echo " "
8129 val="$undef"
8130
8131 case "$dlsrc" in
8132 dl_dlopen.xs)
8133         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8134         $cat >dyna.c <<'EOM'
8135 fred () { }
8136 EOM
8137
8138 $cat >fred.c<<EOM
8139
8140 #include <stdio.h>
8141 #$i_dlfcn I_DLFCN
8142 #ifdef I_DLFCN
8143 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8144 #else
8145 #include <sys/types.h>
8146 #include <nlist.h>
8147 #include <link.h>
8148 #endif
8149
8150 extern int fred() ;
8151
8152 int main()
8153 {
8154     void * handle ;
8155     void * symbol ;
8156 #ifndef RTLD_LAZY
8157     int mode = 1 ;
8158 #else
8159     int mode = RTLD_LAZY ;
8160 #endif
8161     handle = dlopen("./dyna.$dlext", mode) ;
8162     if (handle == NULL) {
8163         printf ("1\n") ;
8164         fflush (stdout) ;
8165         exit(0);
8166     }
8167     symbol = dlsym(handle, "fred") ;
8168     if (symbol == NULL) {
8169         /* try putting a leading underscore */
8170         symbol = dlsym(handle, "_fred") ;
8171         if (symbol == NULL) {
8172             printf ("2\n") ;
8173             fflush (stdout) ;
8174             exit(0);
8175         }
8176         printf ("3\n") ;
8177     }
8178     else
8179         printf ("4\n") ;
8180     fflush (stdout) ;
8181     exit(0);
8182 }
8183 EOM
8184         : Call the object file tmp-dyna.o in case dlext=o.
8185         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8186                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8187                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8188                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8189                 xxx=`./fred`
8190                 case $xxx in
8191                 1)      echo "Test program failed using dlopen." >&4
8192                         echo "Perhaps you should not use dynamic loading." >&4;;
8193                 2)      echo "Test program failed using dlsym." >&4
8194                         echo "Perhaps you should not use dynamic loading." >&4;;
8195                 3)      echo "dlsym needs a leading underscore" >&4
8196                         val="$define" ;;
8197                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8198                 esac
8199         else
8200                 echo "I can't compile and run the test program." >&4
8201                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8202         fi
8203         ;;
8204 esac
8205                 
8206 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8207
8208 set d_dlsymun
8209 eval $setvar
8210
8211 hasproto='varname=$1; func=$2; shift; shift;
8212 while $test $# -ge 2; do
8213         case "$1" in
8214         $define) echo "#include <$2>";;
8215         esac ;
8216     shift 2;
8217 done > try.c;
8218 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8219 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8220         echo "$func() prototype found.";
8221         val="$define";
8222 else
8223         echo "$func() prototype NOT found.";
8224         val="$undef";
8225 fi;
8226 set $varname;
8227 eval $setvar;
8228 $rm -f try.c tryout.c'
8229
8230 : see if prototype for drand48 is available
8231 echo " "
8232 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8233 eval $hasproto
8234
8235 : see if dup2 exists
8236 set dup2 d_dup2
8237 eval $inlibc
8238
8239 : see if eaccess exists
8240 set eaccess d_eaccess
8241 eval $inlibc
8242
8243 : see if endgrent exists
8244 set endgrent d_endgrent
8245 eval $inlibc
8246
8247 : see if endhostent exists
8248 set endhostent d_endhent
8249 eval $inlibc
8250
8251 : see if endnetent exists
8252 set endnetent d_endnent
8253 eval $inlibc
8254
8255 : see if endprotoent exists
8256 set endprotoent d_endpent
8257 eval $inlibc
8258
8259 : see if endpwent exists
8260 set endpwent d_endpwent
8261 eval $inlibc
8262
8263 : see if endservent exists
8264 set endservent d_endsent
8265 eval $inlibc
8266
8267 : see if endspent exists
8268 set endspent d_endspent
8269 eval $inlibc
8270
8271 : Locate the flags for 'open()'
8272 echo " "
8273 $cat >open3.c <<'EOCP'
8274 #include <sys/types.h>
8275 #ifdef I_FCNTL
8276 #include <fcntl.h>
8277 #endif
8278 #ifdef I_SYS_FILE
8279 #include <sys/file.h>
8280 #endif
8281 int main() {
8282         if(O_RDONLY);
8283 #ifdef O_TRUNC
8284         exit(0);
8285 #else
8286         exit(1);
8287 #endif
8288 }
8289 EOCP
8290 : check sys/file.h first to get FREAD on Sun
8291 if $test `./findhdr sys/file.h` && \
8292                 set open3 -DI_SYS_FILE && eval $compile; then
8293         h_sysfile=true;
8294         echo "<sys/file.h> defines the O_* constants..." >&4
8295         if ./open3; then
8296                 echo "and you have the 3 argument form of open()." >&4
8297                 val="$define"
8298         else
8299                 echo "but not the 3 argument form of open().  Oh, well." >&4
8300                 val="$undef"
8301         fi
8302 elif $test `./findhdr fcntl.h` && \
8303                 set open3 -DI_FCNTL && eval $compile; then
8304         h_fcntl=true;
8305         echo "<fcntl.h> defines the O_* constants..." >&4
8306         if ./open3; then
8307                 echo "and you have the 3 argument form of open()." >&4
8308                 val="$define"
8309         else
8310                 echo "but not the 3 argument form of open().  Oh, well." >&4
8311                 val="$undef"
8312         fi
8313 else
8314         val="$undef"
8315         echo "I can't find the O_* constant definitions!  You got problems." >&4
8316 fi
8317 set d_open3
8318 eval $setvar
8319 $rm -f open3*
8320
8321 : see which of string.h or strings.h is needed
8322 echo " "
8323 strings=`./findhdr string.h`
8324 if $test "$strings" && $test -r "$strings"; then
8325         echo "Using <string.h> instead of <strings.h>." >&4
8326         val="$define"
8327 else
8328         val="$undef"
8329         strings=`./findhdr strings.h`
8330         if $test "$strings" && $test -r "$strings"; then
8331                 echo "Using <strings.h> instead of <string.h>." >&4
8332         else
8333                 echo "No string header found -- You'll surely have problems." >&4
8334         fi
8335 fi
8336 set i_string
8337 eval $setvar
8338 case "$i_string" in
8339 "$undef") strings=`./findhdr strings.h`;;
8340 *)        strings=`./findhdr string.h`;;
8341 esac
8342
8343 : check for non-blocking I/O stuff
8344 case "$h_sysfile" in
8345 true) echo "#include <sys/file.h>" > head.c;;
8346 *)
8347         case "$h_fcntl" in
8348         true) echo "#include <fcntl.h>" > head.c;;
8349         *) echo "#include <sys/fcntl.h>" > head.c;;
8350         esac
8351         ;;
8352 esac
8353 echo " "
8354 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8355 case "$o_nonblock" in
8356 '')
8357         $cat head.c > try.c
8358         $cat >>try.c <<'EOCP'
8359 #include <stdio.h>
8360 int main() {
8361 #ifdef O_NONBLOCK
8362         printf("O_NONBLOCK\n");
8363         exit(0);
8364 #endif
8365 #ifdef O_NDELAY
8366         printf("O_NDELAY\n");
8367         exit(0);
8368 #endif
8369 #ifdef FNDELAY
8370         printf("FNDELAY\n");
8371         exit(0);
8372 #endif
8373         exit(0);
8374 }
8375 EOCP
8376         set try
8377         if eval $compile_ok; then
8378                 o_nonblock=`./try`
8379                 case "$o_nonblock" in
8380                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8381                 *) echo "Seems like we can use $o_nonblock.";;
8382                 esac
8383         else
8384                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8385         fi
8386         ;;
8387 *) echo "Using $hint value $o_nonblock.";;
8388 esac
8389 $rm -f try try.* .out core
8390
8391 echo " "
8392 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8393 case "$eagain" in
8394 '')
8395         $cat head.c > try.c
8396         $cat >>try.c <<EOCP
8397 #include <errno.h>
8398 #include <sys/types.h>
8399 #include <signal.h>
8400 #include <stdio.h> 
8401 #define MY_O_NONBLOCK $o_nonblock
8402 #ifndef errno  /* XXX need better Configure test */
8403 extern int errno;
8404 #endif
8405 #$i_unistd I_UNISTD
8406 #ifdef I_UNISTD
8407 #include <unistd.h>
8408 #endif
8409 #ifdef $i_string
8410 #include <string.h>
8411 #else
8412 #include <strings.h>
8413 #endif
8414 $signal_t blech(x) int x; { exit(3); }
8415 EOCP
8416         $cat >> try.c <<'EOCP'
8417 int main()
8418 {
8419         int pd[2];
8420         int pu[2];
8421         char buf[1];
8422         char string[100];
8423
8424         pipe(pd);       /* Down: child -> parent */
8425         pipe(pu);       /* Up: parent -> child */
8426         if (0 != fork()) {
8427                 int ret;
8428                 close(pd[1]);   /* Parent reads from pd[0] */
8429                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8430                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8431                         exit(1);
8432                 signal(SIGALRM, blech);
8433                 alarm(5);
8434                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8435                         exit(2);
8436                 sprintf(string, "%d\n", ret);
8437                 write(2, string, strlen(string));
8438                 alarm(0);
8439 #ifdef EAGAIN
8440                 if (errno == EAGAIN) {
8441                         printf("EAGAIN\n");
8442                         goto ok;
8443                 }
8444 #endif
8445 #ifdef EWOULDBLOCK
8446                 if (errno == EWOULDBLOCK)
8447                         printf("EWOULDBLOCK\n");
8448 #endif
8449         ok:
8450                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8451                 sleep(2);                               /* Give it time to close our pipe */
8452                 alarm(5);
8453                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8454                 alarm(0);
8455                 sprintf(string, "%d\n", ret);
8456                 write(3, string, strlen(string));
8457                 exit(0);
8458         }
8459
8460         close(pd[0]);                   /* We write to pd[1] */
8461         close(pu[1]);                   /* We read from pu[0] */
8462         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8463         close(pd[1]);                   /* Pipe pd is now fully closed! */
8464         exit(0);                                /* Bye bye, thank you for playing! */
8465 }
8466 EOCP
8467         set try
8468         if eval $compile_ok; then
8469                 echo "$startsh" >mtry
8470                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8471                 chmod +x mtry
8472                 ./mtry >/dev/null 2>&1
8473                 case $? in
8474                 0) eagain=`$cat try.out`;;
8475                 1) echo "Could not perform non-blocking setting!";;
8476                 2) echo "I did a successful read() for something that was not there!";;
8477                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8478                 *) echo "Something terribly wrong happened during testing.";;
8479                 esac
8480                 rd_nodata=`$cat try.ret`
8481                 echo "A read() system call with no data present returns $rd_nodata."
8482                 case "$rd_nodata" in
8483                 0|-1) ;;
8484                 *)
8485                         echo "(That's peculiar, fixing that to be -1.)"
8486                         rd_nodata=-1
8487                         ;;
8488                 esac
8489                 case "$eagain" in
8490                 '')
8491                         echo "Forcing errno EAGAIN on read() with no data available."
8492                         eagain=EAGAIN
8493                         ;;
8494                 *)
8495                         echo "Your read() sets errno to $eagain when no data is available."
8496                         ;;
8497                 esac
8498                 status=`$cat try.err`
8499                 case "$status" in
8500                 0) echo "And it correctly returns 0 to signal EOF.";;
8501                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8502                 *) echo "However, your read() returns '$status' on EOF??";;
8503                 esac
8504                 val="$define"
8505                 if test "$status" = "$rd_nodata"; then
8506                         echo "WARNING: you can't distinguish between EOF and no data!"
8507                         val="$undef"
8508                 fi
8509         else
8510                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8511                 eagain=EAGAIN
8512         fi
8513         set d_eofnblk
8514         eval $setvar
8515         ;;
8516 *)
8517         echo "Using $hint value $eagain."
8518         echo "Your read() returns $rd_nodata when no data is present."
8519         case "$d_eofnblk" in
8520         "$define") echo "And you can see EOF because read() returns 0.";;
8521         "$undef") echo "But you can't see EOF status from read() returned value.";;
8522         *)
8523                 echo "(Assuming you can't see EOF status from read anyway.)"
8524                 d_eofnblk=$undef
8525                 ;;
8526         esac
8527         ;;
8528 esac
8529 $rm -f try try.* .out core head.c mtry
8530
8531 : see if fchmod exists
8532 set fchmod d_fchmod
8533 eval $inlibc
8534
8535 : see if fchown exists
8536 set fchown d_fchown
8537 eval $inlibc
8538
8539 : see if this is an fcntl system
8540 set fcntl d_fcntl
8541 eval $inlibc
8542
8543 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
8544 while $test $# -ge 2; do
8545         case "$1" in
8546         $define) echo "#include <$2>";;
8547         esac ;
8548     shift 2;
8549 done > try.c;
8550 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
8551 set try;
8552 if eval $compile; then
8553         val="$define";
8554 else
8555         val="$undef";
8556 fi;
8557 set $varname;
8558 eval $setvar;
8559 $rm -f try.c try.o'
8560
8561 socketlib=''
8562 sockethdr=''
8563 : see whether socket exists
8564 echo " "
8565 $echo $n "Hmm... $c" >&4
8566 if set socket val -f d_socket; eval $csym; $val; then
8567         echo "Looks like you have Berkeley networking support." >&4
8568         d_socket="$define"
8569         if set setsockopt val -f; eval $csym; $val; then
8570                 d_oldsock="$undef"
8571         else
8572                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
8573                 d_oldsock="$define"
8574         fi
8575 else
8576         if $contains socklib libc.list >/dev/null 2>&1; then
8577                 echo "Looks like you have Berkeley networking support." >&4
8578                 d_socket="$define"
8579                 : we will have to assume that it supports the 4.2 BSD interface
8580                 d_oldsock="$undef"
8581         else
8582                 echo "You don't have Berkeley networking in libc$_a..." >&4
8583                 if test "X$d_socket" = "X$define"; then
8584                    echo "...but you seem to believe that you have sockets." >&4
8585                 else
8586                         for net in net socket
8587                         do
8588                                 if test -f /usr/lib/lib$net$_a; then
8589                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
8590                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
8591                                         if $contains socket libc.list >/dev/null 2>&1; then
8592                                                 d_socket="$define"
8593                                                 socketlib="-l$net"
8594                                                 case "$net" in
8595                                                 net)
8596                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
8597                                                         sockethdr="-I/usr/netinclude"
8598                                                         ;;
8599                                                 esac
8600                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
8601                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8602                                                         d_oldsock="$undef"
8603                                                 else
8604                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
8605                                                         d_oldsock="$define"
8606                                                 fi
8607                                                 break
8608                                         fi
8609                                 fi
8610                         done
8611                         if test "X$d_socket" != "X$define"; then
8612                            echo "or anywhere else I see." >&4
8613                            d_socket="$undef"
8614                            d_oldsock="$undef"
8615                         fi
8616                 fi
8617         fi
8618 fi
8619
8620 : see if socketpair exists
8621 set socketpair d_sockpair
8622 eval $inlibc
8623
8624
8625 echo " "
8626 echo "Checking the availability of certain socket constants..." >& 4
8627 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
8628         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
8629         $cat >try.c <<EOF
8630 #include <sys/types.h>
8631 #include <sys/socket.h>
8632 int main() {
8633     int i = $ENUM;
8634 }
8635 EOF
8636         val="$undef"
8637         set try; if eval $compile; then
8638                 val="$define"
8639         fi
8640         set d_${enum}; eval $setvar
8641         $rm -f try.c try
8642 done
8643
8644 : see if sys/select.h has to be included
8645 set sys/select.h i_sysselct
8646 eval $inhdr
8647
8648 : see if we should include time.h, sys/time.h, or both
8649 echo " "
8650 if test "X$timeincl" = X; then
8651         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8652         $echo $n "I'm now running the test program...$c"
8653         $cat >try.c <<'EOCP'
8654 #include <sys/types.h>
8655 #ifdef I_TIME
8656 #include <time.h>
8657 #endif
8658 #ifdef I_SYSTIME
8659 #ifdef SYSTIMEKERNEL
8660 #define KERNEL
8661 #endif
8662 #include <sys/time.h>
8663 #endif
8664 #ifdef I_SYSSELECT
8665 #include <sys/select.h>
8666 #endif
8667 int main()
8668 {
8669         struct tm foo;
8670 #ifdef S_TIMEVAL
8671         struct timeval bar;
8672 #endif
8673 #ifdef S_TIMEZONE
8674         struct timezone tzp;
8675 #endif
8676         if (foo.tm_sec == foo.tm_sec)
8677                 exit(0);
8678 #ifdef S_TIMEVAL
8679         if (bar.tv_sec == bar.tv_sec)
8680                 exit(0);
8681 #endif
8682         exit(1);
8683 }
8684 EOCP
8685         flags=''
8686         for s_timezone in '-DS_TIMEZONE' ''; do
8687         sysselect=''
8688         for s_timeval in '-DS_TIMEVAL' ''; do
8689         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8690         for i_time in '' '-DI_TIME'; do
8691         for i_systime in '-DI_SYSTIME' ''; do
8692                 case "$flags" in
8693                 '') $echo $n ".$c"
8694                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8695                         if eval $compile; then
8696                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8697                                 shift
8698                                 flags="$*"
8699                                 echo " "
8700                                 $echo $n "Succeeded with $flags$c"
8701                         fi
8702                         ;;
8703                 esac
8704         done
8705         done
8706         done
8707         done
8708         done
8709         timeincl=''
8710         echo " "
8711         case "$flags" in
8712         *SYSTIMEKERNEL*) i_systimek="$define"
8713                 timeincl=`./findhdr sys/time.h`
8714                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8715         *) i_systimek="$undef";;
8716         esac
8717         case "$flags" in
8718         *I_TIME*) i_time="$define"
8719                 timeincl=`./findhdr time.h`" $timeincl"
8720                 echo "We'll include <time.h>." >&4;;
8721         *) i_time="$undef";;
8722         esac
8723         case "$flags" in
8724         *I_SYSTIME*) i_systime="$define"
8725                 timeincl=`./findhdr sys/time.h`" $timeincl"
8726                 echo "We'll include <sys/time.h>." >&4;;
8727         *) i_systime="$undef";;
8728         esac
8729         $rm -f try.c try
8730 fi
8731
8732 : check for fd_set items
8733 $cat <<EOM
8734
8735 Checking to see how well your C compiler handles fd_set and friends ...
8736 EOM
8737 $cat >fd_set.c <<EOCP
8738 #$i_systime I_SYS_TIME
8739 #$i_sysselct I_SYS_SELECT
8740 #$d_socket HAS_SOCKET
8741 #include <sys/types.h>
8742 #ifdef HAS_SOCKET
8743 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8744 #endif
8745 #ifdef I_SYS_TIME
8746 #include <sys/time.h>
8747 #endif
8748 #ifdef I_SYS_SELECT
8749 #include <sys/select.h>
8750 #endif
8751 int main() {
8752         fd_set fds;
8753
8754 #ifdef TRYBITS
8755         if(fds.fds_bits);
8756 #endif
8757
8758 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8759         exit(0);
8760 #else
8761         exit(1);
8762 #endif
8763 }
8764 EOCP
8765 set fd_set -DTRYBITS
8766 if eval $compile; then
8767         d_fds_bits="$define"
8768         d_fd_set="$define"
8769         echo "Well, your system knows about the normal fd_set typedef..." >&4
8770         if ./fd_set; then
8771                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8772                 d_fd_macros="$define"
8773         else
8774                 $cat >&4 <<'EOM'
8775 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8776 EOM
8777                 d_fd_macros="$undef"
8778         fi
8779 else
8780         $cat <<'EOM'
8781 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8782 EOM
8783         set fd_set
8784         if eval $compile; then
8785                 d_fds_bits="$undef"
8786                 d_fd_set="$define"
8787                 echo "Well, your system has some sort of fd_set available..." >&4
8788                 if ./fd_set; then
8789                         echo "and you have the normal fd_set macros." >&4
8790                         d_fd_macros="$define"
8791                 else
8792                         $cat <<'EOM'
8793 but not the normal fd_set macros!  Gross!  More work for me...
8794 EOM
8795                         d_fd_macros="$undef"
8796                 fi
8797         else
8798         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8799                 d_fd_set="$undef"
8800                 d_fds_bits="$undef"
8801                 d_fd_macros="$undef"
8802         fi
8803 fi
8804 $rm -f fd_set*
8805
8806 : see if fgetpos exists
8807 set fgetpos d_fgetpos
8808 eval $inlibc
8809
8810 : see if flock exists
8811 set flock d_flock
8812 eval $inlibc
8813
8814 : see if fork exists
8815 set fork d_fork
8816 eval $inlibc
8817
8818 : see if pathconf exists
8819 set pathconf d_pathconf
8820 eval $inlibc
8821
8822 : see if fpathconf exists
8823 set fpathconf d_fpathconf
8824 eval $inlibc
8825
8826
8827 : check for off64_t
8828 echo " "
8829 echo "Checking to see if your system supports off64_t..." >&4
8830 $cat >try.c <<EOCP
8831 #include <sys/types.h>
8832 #include <unistd.h>
8833 int main() { off64_t x = 7; }'
8834 EOCP
8835 set try
8836 if eval $compile; then
8837         val="$define"
8838         echo "Yes, it does."
8839 else
8840         val="$undef"
8841         echo "No, it doesn't."
8842         case "$lseeksize" in
8843         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
8844         esac
8845 fi
8846 $rm -f try.* try
8847 set d_off64_t
8848 eval $setvar
8849
8850 : check for fpos64_t
8851 echo " "
8852 echo "Checking to see if your system supports fpos64_t..." >&4
8853 $cat >try.c <<EOCP
8854 #include <sys/stdio.h>
8855 int main() { fpos64_t x x = 7; }'
8856 EOCP
8857 set try
8858 if eval $compile; then
8859         val="$define"
8860         echo "Yes, it does."
8861 else
8862         val="$undef"
8863         echo "No, it doesn't."
8864         case "$fpossize" in
8865         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
8866         esac
8867 fi
8868 $rm -f try.* try
8869 set d_fpos64_t
8870 eval $setvar
8871
8872 hasstruct='varname=$1; struct=$2; shift; shift;
8873 while $test $# -ge 2; do
8874         case "$1" in
8875         $define) echo "#include <$2>";;
8876         esac ;
8877     shift 2;
8878 done > try.c;
8879 echo "int main () { struct $struct foo; }" >> try.c;
8880 set try;
8881 if eval $compile; then
8882         val="$define";
8883 else
8884         val="$undef";
8885 fi;
8886 set $varname;
8887 eval $setvar;
8888 $rm -f try.c try.o'
8889
8890 : see if this is a sys/param system
8891 set sys/param.h i_sysparam
8892 eval $inhdr
8893
8894 : see if this is a sys/mount.h system
8895 set sys/mount.h i_sysmount
8896 eval $inhdr
8897
8898 : see if sys/types.h has to be included
8899 set sys/types.h i_systypes
8900 eval $inhdr
8901
8902
8903 echo " "
8904 echo "Checking to see if your system supports struct fs_data..." >&4
8905 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
8906 eval $hasstruct
8907 case "$d_fs_data_s" in
8908 "$define")      echo "Yes, it does."   ;;
8909 *)              echo "No, it doesn't." ;;
8910 esac
8911
8912 : see if fseeko exists
8913 set fseeko d_fseeko
8914 eval $inlibc
8915 case "$longsize" in
8916 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
8917 esac
8918
8919 : see if fsetpos exists
8920 set fsetpos d_fsetpos
8921 eval $inlibc
8922
8923
8924 : see if fstatfs exists
8925 set fstatfs d_fstatfs
8926 eval $inlibc
8927
8928
8929 : see if statvfs exists
8930 set statvfs d_statvfs
8931 eval $inlibc
8932
8933 : see if fstatvfs exists
8934 set fstatvfs d_fstatvfs
8935 eval $inlibc
8936
8937
8938 : see if ftello exists
8939 set ftello d_ftello
8940 eval $inlibc
8941 case "$longsize" in
8942 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
8943 esac
8944
8945 : see if getgrent exists
8946 set getgrent d_getgrent
8947 eval $inlibc
8948
8949 : see if gethostbyaddr exists
8950 set gethostbyaddr d_gethbyaddr
8951 eval $inlibc
8952
8953 : see if gethostbyname exists
8954 set gethostbyname d_gethbyname
8955 eval $inlibc
8956
8957 : see if gethostent exists
8958 set gethostent d_gethent
8959 eval $inlibc
8960
8961 : see how we will look up host name
8962 echo " "
8963 call=''
8964 if set gethostname val -f d_gethname; eval $csym; $val; then
8965         echo 'gethostname() found.' >&4
8966         d_gethname="$define"
8967         call=gethostname
8968 fi
8969 if set uname val -f d_uname; eval $csym; $val; then
8970         if ./xenix; then
8971                 $cat <<'EOM'
8972 uname() was found, but you're running xenix, and older versions of xenix
8973 have a broken uname(). If you don't really know whether your xenix is old
8974 enough to have a broken system call, use the default answer.
8975
8976 EOM
8977                 dflt=y
8978                 case "$d_uname" in
8979                 "$define") dflt=n;;
8980                 esac
8981                 rp='Is your uname() broken?'
8982                 . ./myread
8983                 case "$ans" in
8984                 n*) d_uname="$define"; call=uname;;
8985                 esac
8986         else
8987                 echo 'uname() found.' >&4
8988                 d_uname="$define"
8989                 case "$call" in
8990                 '') call=uname ;;
8991                 esac
8992         fi
8993 fi
8994 case "$d_gethname" in
8995 '') d_gethname="$undef";;
8996 esac
8997 case "$d_uname" in
8998 '') d_uname="$undef";;
8999 esac
9000 case "$d_uname$d_gethname" in
9001 *define*)
9002         dflt=n
9003         cat <<EOM
9004  
9005 Every now and then someone has a $call() that lies about the hostname
9006 but can't be fixed for political or economic reasons.  If you wish, I can
9007 pretend $call() isn't there and maybe compute hostname at run-time
9008 thanks to the '$phostname' command.
9009
9010 EOM
9011         rp="Shall I ignore $call() from now on?"
9012         . ./myread
9013         case "$ans" in
9014         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9015         esac;;
9016 esac
9017 case "$phostname" in
9018 '') aphostname='';;
9019 *) case "$aphostname" in
9020         /*) ;;
9021         *) set X $phostname
9022                 shift
9023                 file=$1
9024                 shift
9025                 file=`./loc $file $file $pth`
9026                 aphostname=`echo $file $*`
9027                 ;;
9028         esac
9029         ;;
9030 esac
9031 case "$d_uname$d_gethname" in
9032 *define*) ;;
9033 *)
9034         case "$phostname" in
9035         '')
9036                 echo "There will be no way for $package to get your hostname." >&4;;
9037         *)
9038         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9039                 ;;
9040         esac;;
9041 esac
9042 case "$d_phostname" in
9043 '') d_phostname="$undef";;
9044 esac
9045
9046 : see if this is a netdb.h system
9047 set netdb.h i_netdb
9048 eval $inhdr
9049
9050 : see if prototypes for various gethostxxx netdb.h functions are available
9051 echo " "
9052 set d_gethostprotos gethostent $i_netdb netdb.h
9053 eval $hasproto
9054
9055 : see if getlogin exists
9056 set getlogin d_getlogin
9057 eval $inlibc
9058
9059 : see if getmnt exists
9060 set getmnt d_getmnt
9061 eval $inlibc
9062
9063 : see if getmntent exists
9064 set getmntent d_getmntent
9065 eval $inlibc
9066
9067 : see if getnetbyaddr exists
9068 set getnetbyaddr d_getnbyaddr
9069 eval $inlibc
9070
9071 : see if getnetbyname exists
9072 set getnetbyname d_getnbyname
9073 eval $inlibc
9074
9075 : see if getnetent exists
9076 set getnetent d_getnent
9077 eval $inlibc
9078
9079 : see if prototypes for various getnetxxx netdb.h functions are available
9080 echo " "
9081 set d_getnetprotos getnetent $i_netdb netdb.h
9082 eval $hasproto
9083
9084
9085 : see if getprotobyname exists
9086 set getprotobyname d_getpbyname
9087 eval $inlibc
9088
9089 : see if getprotobynumber exists
9090 set getprotobynumber d_getpbynumber
9091 eval $inlibc
9092
9093 : see if getprotoent exists
9094 set getprotoent d_getpent
9095 eval $inlibc
9096
9097 : see if getpgid exists
9098 set getpgid d_getpgid
9099 eval $inlibc
9100
9101 : see if getpgrp2 exists
9102 set getpgrp2 d_getpgrp2
9103 eval $inlibc
9104
9105 : see if getppid exists
9106 set getppid d_getppid
9107 eval $inlibc
9108
9109 : see if getpriority exists
9110 set getpriority d_getprior
9111 eval $inlibc
9112
9113 : see if prototypes for various getprotoxxx netdb.h functions are available
9114 echo " "
9115 set d_getprotoprotos getprotoent $i_netdb netdb.h
9116 eval $hasproto
9117
9118 : see if getpwent exists
9119 set getpwent d_getpwent
9120 eval $inlibc
9121
9122
9123 : see if getservbyname exists
9124 set getservbyname d_getsbyname
9125 eval $inlibc
9126
9127 : see if getservbyport exists
9128 set getservbyport d_getsbyport
9129 eval $inlibc
9130
9131 : see if getservent exists
9132 set getservent d_getsent
9133 eval $inlibc
9134
9135 : see if prototypes for various getservxxx netdb.h functions are available
9136 echo " "
9137 set d_getservprotos getservent $i_netdb netdb.h
9138 eval $hasproto
9139
9140 : see if getspent exists
9141 set getspent d_getspent
9142 eval $inlibc
9143
9144 : see if getspnam exists
9145 set getspnam d_getspnam
9146 eval $inlibc
9147
9148 : see if gettimeofday or ftime exists
9149 set gettimeofday d_gettimeod
9150 eval $inlibc
9151 case "$d_gettimeod" in
9152 "$undef")
9153         set ftime d_ftime 
9154         eval $inlibc
9155         ;;
9156 *)
9157         val="$undef"; set d_ftime; eval $setvar
9158         ;;
9159 esac
9160 case "$d_gettimeod$d_ftime" in
9161 "$undef$undef")
9162         echo " "
9163         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9164         ;;
9165 esac
9166
9167 : see if this is an grp system
9168 set grp.h i_grp
9169 eval $inhdr
9170
9171 case "$i_grp" in
9172 $define)
9173         xxx=`./findhdr grp.h`
9174         $cppstdin $cppflags $cppminus < $xxx >$$.h
9175
9176         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9177                 val="$define"
9178         else
9179                 val="$undef"
9180         fi
9181         set d_grpasswd
9182         eval $setvar
9183
9184         $rm -f $$.h
9185         ;;
9186 *)
9187         val="$undef";
9188         set d_grpasswd; eval $setvar
9189         ;;
9190 esac
9191
9192 : see if hasmntopt exists
9193 set hasmntopt d_hasmntopt
9194 eval $inlibc
9195
9196 : see if this is a netinet/in.h or sys/in.h system
9197 set netinet/in.h i_niin sys/in.h i_sysin
9198 eval $inhdr
9199
9200 : see if arpa/inet.h has to be included
9201 set arpa/inet.h i_arpainet
9202 eval $inhdr
9203
9204 : see if htonl --and friends-- exists
9205 val=''
9206 set htonl val
9207 eval $inlibc
9208
9209 : Maybe they are macros.
9210 case "$val" in
9211 $undef)
9212         $cat >htonl.c <<EOM
9213 #include <stdio.h>
9214 #include <sys/types.h>
9215 #$i_niin I_NETINET_IN
9216 #$i_sysin I_SYS_IN
9217 #$i_arpainet I_ARPA_INET
9218 #ifdef I_NETINET_IN
9219 #include <netinet/in.h>
9220 #endif
9221 #ifdef I_SYS_IN
9222 #include <sys/in.h>
9223 #endif
9224 #ifdef I_ARPA_INET
9225 #include <arpa/inet.h>
9226 #endif
9227 #ifdef htonl
9228 printf("Defined as a macro.");
9229 #endif
9230 EOM
9231         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9232         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9233                 val="$define"
9234                 echo "But it seems to be defined as a macro." >&4
9235         fi
9236         $rm -f htonl.?
9237         ;;
9238 esac
9239 set d_htonl
9240 eval $setvar
9241
9242 : see if iconv exists
9243 set iconv d_iconv
9244 eval $inlibc
9245
9246 : index or strchr
9247 echo " "
9248 if set index val -f; eval $csym; $val; then
9249         if set strchr val -f d_strchr; eval $csym; $val; then
9250                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9251                         val="$define"
9252                         vali="$undef"
9253                         echo "strchr() found." >&4
9254                 else
9255                         val="$undef"
9256                         vali="$define"
9257                         echo "index() found." >&4
9258                 fi
9259         else
9260                 val="$undef"
9261                 vali="$define"
9262                 echo "index() found." >&4
9263         fi
9264 else
9265         if set strchr val -f d_strchr; eval $csym; $val; then
9266                 val="$define"
9267                 vali="$undef"
9268                 echo "strchr() found." >&4
9269         else
9270                 echo "No index() or strchr() found!" >&4
9271                 val="$undef"
9272                 vali="$undef"
9273         fi
9274 fi
9275 set d_strchr; eval $setvar
9276 val="$vali"
9277 set d_index; eval $setvar
9278
9279 : check whether inet_aton exists
9280 set inet_aton d_inetaton
9281 eval $inlibc
9282
9283 : Look for isascii
9284 echo " "
9285 $cat >isascii.c <<'EOCP'
9286 #include <stdio.h>
9287 #include <ctype.h>
9288 int main() {
9289         int c = 'A';
9290         if (isascii(c))
9291                 exit(0);
9292         else
9293                 exit(1);
9294 }
9295 EOCP
9296 set isascii
9297 if eval $compile; then
9298         echo "isascii() found." >&4
9299         val="$define"
9300 else
9301         echo "isascii() NOT found." >&4
9302         val="$undef"
9303 fi
9304 set d_isascii
9305 eval $setvar
9306 $rm -f isascii*
9307
9308 : see if killpg exists
9309 set killpg d_killpg
9310 eval $inlibc
9311
9312 : see if lchown exists
9313 echo " "
9314 $cat > try.c <<'EOCP'
9315 /* System header to define __stub macros and hopefully few prototypes,
9316     which can conflict with char lchown(); below.  */
9317 #include <assert.h>
9318 /* Override any gcc2 internal prototype to avoid an error.  */
9319 /* We use char because int might match the return type of a gcc2
9320    builtin and then its argument prototype would still apply.  */
9321 char lchown();
9322 int main() {
9323     /*  The GNU C library defines this for functions which it implements
9324         to always fail with ENOSYS.  Some functions are actually named
9325         something starting with __ and the normal name is an alias.  */
9326 #if defined (__stub_lchown) || defined (__stub___lchown)
9327 choke me
9328 #else
9329 lchown();
9330 #endif
9331 ; return 0; }
9332 EOCP
9333 set try
9334 if eval $compile; then
9335     $echo "lchown() found." >&4
9336     val="$define"
9337 else
9338     $echo "lchown() NOT found." >&4
9339     val="$undef"
9340 fi
9341 set d_lchown
9342 eval $setvar
9343
9344 : See if number of significant digits in a double precision number is known
9345 echo " "
9346 $cat >ldbl_dig.c <<EOM
9347 #$i_limits I_LIMITS
9348 #$i_float I_FLOAT
9349 #ifdef I_LIMITS
9350 #include <limits.h>
9351 #endif
9352 #ifdef I_FLOAT
9353 #include <float.h>
9354 #endif
9355 #ifdef LDBL_DIG
9356 printf("Contains LDBL_DIG");
9357 #endif
9358 EOM
9359 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9360 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9361         echo "LDBL_DIG found." >&4
9362         val="$define"
9363 else
9364         echo "LDBL_DIG NOT found." >&4
9365         val="$undef"
9366 fi
9367 $rm -f ldbl_dig.?
9368 set d_ldbl_dig
9369 eval $setvar
9370
9371 : see if link exists
9372 set link d_link
9373 eval $inlibc
9374
9375 : see if localeconv exists
9376 set localeconv d_locconv
9377 eval $inlibc
9378
9379 : see if lockf exists
9380 set lockf d_lockf
9381 eval $inlibc
9382
9383 : check for long long
9384 echo " "
9385 $echo $n "Checking to see if your system supports long long..." $c >&4
9386 echo 'int main() { long long x = 7; return 0; }' > try.c
9387 set try
9388 if eval $compile; then
9389         val="$define"
9390         echo " Yes, it does." >&4
9391 else
9392         val="$undef"
9393         echo " No, it doesn't." >&4
9394 fi
9395 $rm try.*
9396 set d_longlong
9397 eval $setvar
9398
9399 : check for length of long long
9400 case "${d_longlong}${longlongsize}" in
9401 $define)
9402         echo " "
9403         $echo $n "Checking to see how big your long longs are..." $c >&4
9404         $cat >try.c <<'EOCP'
9405 #include <stdio.h>
9406 int main()
9407 {
9408     printf("%d\n", (int)sizeof(long long));
9409     return(0);
9410 }
9411 EOCP
9412         set try
9413         if eval $compile_ok; then
9414                 longlongsize=`./try$exe_ext`
9415                 $echo " $longlongsize bytes." >&4
9416         else
9417                 dflt='8'
9418                 echo " "
9419                 echo "(I can't seem to compile the test program.  Guessing...)"
9420                 rp="What is the size of a long long (in bytes)?"
9421                 . ./myread
9422                 longlongsize="$ans"
9423         fi
9424         if $test "X$longsize" = "X$longlongsize"; then
9425                 echo "(That isn't any different from an ordinary long.)"
9426         fi      
9427         ;;
9428 esac
9429 $rm -f try.* try
9430
9431 : see if lstat exists
9432 set lstat d_lstat
9433 eval $inlibc
9434
9435 : see if mblen exists
9436 set mblen d_mblen
9437 eval $inlibc
9438
9439 : see if mbstowcs exists
9440 set mbstowcs d_mbstowcs
9441 eval $inlibc
9442
9443 : see if mbtowc exists
9444 set mbtowc d_mbtowc
9445 eval $inlibc
9446
9447 : see if memchr exists
9448 set memchr d_memchr
9449 eval $inlibc
9450
9451 : see if memcmp exists
9452 set memcmp d_memcmp
9453 eval $inlibc
9454
9455 : see if memcpy exists
9456 set memcpy d_memcpy
9457 eval $inlibc
9458
9459 : see if memmove exists
9460 set memmove d_memmove
9461 eval $inlibc
9462
9463 : see if memset exists
9464 set memset d_memset
9465 eval $inlibc
9466
9467 : see if mkdir exists
9468 set mkdir d_mkdir
9469 eval $inlibc
9470
9471 : see if mkfifo exists
9472 set mkfifo d_mkfifo
9473 eval $inlibc
9474
9475 : see if mktime exists
9476 set mktime d_mktime
9477 eval $inlibc
9478
9479 : see if msgctl exists
9480 set msgctl d_msgctl
9481 eval $inlibc
9482
9483 : see if msgget exists
9484 set msgget d_msgget
9485 eval $inlibc
9486
9487 : see if msgsnd exists
9488 set msgsnd d_msgsnd
9489 eval $inlibc
9490
9491 : see if msgrcv exists
9492 set msgrcv d_msgrcv
9493 eval $inlibc
9494
9495 : see how much of the 'msg*(2)' library is present.
9496 h_msg=true
9497 echo " "
9498 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9499 *"$undef"*) h_msg=false;;
9500 esac
9501 case "$osname" in
9502 freebsd)
9503     case "`ipcs 2>&1`" in
9504     "SVID messages"*"not configured"*)
9505         echo "Your $osname does not have the msg*(2) configured." >&4
9506         h_msg=false
9507         val="$undef"
9508         set msgctl d_msgctl
9509         eval $setvar
9510         set msgget d_msgget
9511         eval $setvar
9512         set msgsnd d_msgsnd
9513         eval $setvar
9514         set msgrcv d_msgrcv
9515         eval $setvar
9516         ;;
9517     esac
9518     ;;
9519 esac
9520 : we could also check for sys/ipc.h ...
9521 if $h_msg && $test `./findhdr sys/msg.h`; then
9522         echo "You have the full msg*(2) library." >&4
9523         val="$define"
9524 else
9525         echo "You don't have the full msg*(2) library." >&4
9526         val="$undef"
9527 fi
9528 set d_msg
9529 eval $setvar
9530
9531 : see if nice exists
9532 set nice d_nice
9533 eval $inlibc
9534
9535 : see if inttypes.h is available
9536 : we want a real compile instead of Inhdr because some systems
9537 : have an inttypes.h which includes non-existent headers
9538 echo " "
9539 $cat >try.c <<EOCP
9540 #include <inttypes.h>
9541 int main() {
9542         static int32_t foo32 = 0x12345678;
9543 }
9544 EOCP
9545 set try
9546 if eval $compile; then
9547         echo "<inttypes.h> found." >&4
9548         val="$define"
9549 else
9550         echo "<inttypes.h> NOT found." >&4
9551         val="$undef"
9552 fi
9553 $rm -f try.c try
9554 set i_inttypes
9555 eval $setvar
9556
9557 : check for int64_t
9558 echo " "
9559 $echo $n "Checking to see if your system supports int64_t...$c" >&4
9560 $cat >try.c <<EOCP
9561 #include <sys/types.h>
9562 #$i_inttypes I_INTTYPES
9563 #ifdef I_INTTYPES
9564 #include <inttypes.h>
9565 #endif
9566 int main() { int64_t x = 7; }
9567 EOCP
9568 set try
9569 if eval $compile; then
9570         val="$define"
9571         echo " Yes, it does." >&4
9572 else
9573         val="$undef"
9574         echo " No, it doesn't." >&4
9575 fi
9576 $rm -f try try.*
9577 set d_int64t
9578 eval $setvar
9579
9580
9581 echo " "
9582 echo "Checking which 64-bit integer type we could use..." >&4
9583
9584 case "$intsize" in
9585 8) val=int
9586    set quadtype
9587    eval $setvar
9588    val='"unsigned int"'
9589    set uquadtype
9590    eval $setvar
9591    quadkind=1
9592    ;;
9593 *) case "$longsize" in
9594    8) val=long
9595       set quadtype
9596       eval $setvar
9597       val='"unsigned long"'
9598       set uquadtype
9599       eval $setvar
9600       quadkind=2
9601       ;;
9602    *) case "$d_longlong:$longlongsize" in
9603       define:8)
9604         val='"long long"'
9605         set quadtype
9606         eval $setvar
9607         val='"unsigned long long"'
9608         set uquadtype
9609         eval $setvar
9610         quadkind=3
9611         ;;
9612       *) case "$d_int64t" in
9613          define)
9614            val=int64_t
9615            set quadtype
9616            eval $setvar
9617            val=uint64_t
9618            set uquadtype
9619            eval $setvar
9620            quadkind=4
9621            ;;
9622          esac
9623          ;;
9624       esac
9625       ;;
9626    esac
9627    ;;
9628 esac
9629
9630 case "$quadtype" in
9631 '')     case "$uselonglong:$d_longlong:$longlongsize" in
9632         undef:define:8)
9633            echo "(You would have 'long long', but you are not using it.)" >&4 ;;
9634         *) echo "Alas, no 64-bit integer types in sight." >&4 ;;
9635         esac
9636         d_quad="$undef"
9637         ;;
9638 *)      if test X"$use64bits" = Xdefine -o X"$longsize" = X8; then
9639             verb="will"
9640         else
9641             verb="could"
9642         fi
9643         echo "We $verb use '$quadtype' for 64-bit integers." >&4
9644         d_quad="$define"
9645         ;;
9646 esac
9647
9648 : check for length of character
9649 echo " "
9650 case "$charsize" in
9651 '')
9652         echo "Checking to see how big your characters are (hey, you never know)..." >&4
9653         $cat >try.c <<'EOCP'
9654 #include <stdio.h>
9655 int main()
9656 {
9657     printf("%d\n", (int)sizeof(char));
9658     exit(0);
9659 }
9660 EOCP
9661         set try
9662         if eval $compile_ok; then
9663                 dflt=`./try`
9664         else
9665                 dflt='1'
9666                 echo "(I can't seem to compile the test program.  Guessing...)"
9667         fi
9668         ;;
9669 *)
9670         dflt="$charsize"
9671         ;;
9672 esac
9673 rp="What is the size of a character (in bytes)?"
9674 . ./myread
9675 charsize="$ans"
9676 $rm -f try.c try
9677
9678
9679 echo " "
9680 $echo "Choosing the C types to be used for Perl's internal types..." >&4
9681
9682 case "$use64bits:$d_quad:$quadtype" in
9683 define:define:?*)
9684         ivtype="$quadtype"
9685         uvtype="$uquadtype"
9686         ivsize=8
9687         uvsize=8
9688         ;;
9689 *)      ivtype="long"
9690         uvtype="unsigned long"
9691         ivsize=$longsize
9692         uvsize=$longsize
9693         ;;
9694 esac
9695
9696 case "$uselongdouble:$d_longdbl" in
9697 define:define)
9698         nvtype="long double"
9699         nvsize=$longdblsize
9700         ;;
9701 *)      nvtype=double
9702         nvsize=$doublesize
9703         ;;
9704 esac
9705
9706 $echo "(IV will be "$ivtype", $ivsize bytes)"
9707 $echo "(UV will be "$uvtype", $uvsize bytes)"
9708 $echo "(NV will be "$nvtype", $nvsize bytes)"
9709
9710 $cat >try.c <<EOCP
9711 #$i_inttypes I_INTTYPES
9712 #ifdef I_INTTYPES
9713 #include <inttypes.h>
9714 #endif
9715 #include <stdio.h>
9716 int main() {
9717 #ifdef INT8
9718    int8_t i =  INT8_MAX;
9719   uint8_t u = UINT8_MAX;
9720   printf("int8_t\n");
9721 #endif
9722 #ifdef INT16
9723    int16_t i =  INT16_MAX;
9724   uint16_t i = UINT16_MAX;
9725   printf("int16_t\n");
9726 #endif
9727 #ifdef INT32
9728    int32_t i =  INT32_MAX;
9729   uint32_t u = UINT32_MAX;
9730   printf("int32_t\n");
9731 #endif
9732 }
9733 EOCP
9734
9735 case "$i8type" in
9736 '')     case "$charsize" in
9737         1)      i8type=char
9738                 u8type="unsigned char"
9739                 i8size=$charsize
9740                 u8size=$charsize
9741                 ;;
9742         esac
9743         ;;
9744 esac
9745 case "$i8type" in
9746 '')     set try -DINT8
9747         if eval $compile; then
9748                 case "`./try$exe_ext`" in
9749                 int8_t) i8type=int8_t
9750                         u8type=uint8_t
9751                         i8size=1
9752                         u8size=1
9753                         ;;
9754                 esac
9755         fi
9756         ;;
9757 esac
9758 case "$i8type" in
9759 '')     if $test $charsize -ge 1; then
9760                 i8type=char
9761                 u8type="unsigned char"
9762                 i8size=$charsize
9763                 u8size=$charsize
9764         fi
9765         ;;
9766 esac
9767
9768 case "$i16type" in
9769 '')     case "$shortsize" in
9770         2)      i16type=short
9771                 u16type="unsigned short"
9772                 i16size=$shortsize
9773                 u16size=$shortsize
9774                 ;;
9775         esac
9776         ;;
9777 esac
9778 case "$i16type" in
9779 '')     set try -DINT16
9780         if eval $compile; then
9781                 case "`./try$exe_ext`" in
9782                 int16_t)
9783                         i16type=int16_t
9784                         u16type=uint16_t
9785                         i16size=2
9786                         u16size=2
9787                         ;;
9788                 esac
9789         fi
9790         ;;
9791 esac
9792 case "$i16type" in
9793 '')     if $test $shortsize -ge 2; then
9794                 i16type=short
9795                 u16type="unsigned short"
9796                 i16size=$shortsize
9797                 u16size=$shortsize
9798         fi
9799         ;;
9800 esac
9801
9802 case "$i32type" in
9803 '')     case "$longsize" in
9804         4)      i32type=long
9805                 u32type="unsigned long"
9806                 i32size=$longsize
9807                 u32size=$longsize
9808                 ;;
9809         *)      case "$intsize" in
9810                 4)      i32type=int
9811                         u32type="unsigned int"
9812                         i32size=$intsize
9813                         u32size=$intsize
9814                         ;;
9815                 esac
9816                 ;;
9817         esac
9818         ;;
9819 esac
9820 case "$i32type" in
9821 '')     set try -DINT32
9822         if eval $compile; then
9823                 case "`./try$exe_ext`" in
9824                 int32_t)
9825                         i32type=int32_t
9826                         u32type=uint32_t
9827                         i32size=4
9828                         u32size=4
9829                         ;;
9830                 esac
9831         fi
9832         ;;
9833 esac
9834 case "$i32type" in
9835 '')     if $test $intsize -ge 4; then
9836                 i32type=int
9837                 u32type="unsigned int"
9838                 i32size=$intsize
9839                 u32size=$intsize
9840         fi
9841         ;;
9842 esac
9843
9844 case "$i64type" in
9845 '')     case "$d_quad:$quadtype" in
9846         define:?*)
9847                 i64type="$quadtype"
9848                 u64type="$uquadtype"
9849                 i64size=8
9850                 u64size=8
9851                 ;;
9852         esac
9853         ;;
9854 esac
9855
9856 $echo "Checking whether your NVs can preserve your UVs..." >&4
9857 $cat <<EOP >try.c
9858 #include <stdio.h>
9859 int main() {
9860     $uvtype k = ($uvtype)~0, l;
9861     $nvtype d;
9862     l = k;
9863     d = ($nvtype)l;
9864     l = ($uvtype)d;
9865     if (l == k)
9866        printf("preserve\n");
9867     exit(0);
9868 }
9869 EOP
9870 set try
9871 if eval $compile; then
9872         case "`./try$exe_ext`" in
9873         preserve) d_nv_preserves_uv="$define" ;;
9874         esac
9875 fi      
9876 case "$d_nv_preserves_uv" in
9877 $define) $echo "Yes, they can."  2>&1 ;;
9878 *)       $echo "No, they can't." 2>&1
9879          d_nv_preserves_uv="$undef"
9880          ;;
9881 esac
9882
9883 $rm -f try.* try
9884
9885 : see if POSIX threads are available
9886 set pthread.h i_pthread
9887 eval $inhdr
9888
9889
9890
9891
9892 : how to create joinable pthreads
9893 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9894         echo " "
9895         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9896         $cat >try.c <<'EOCP'
9897 #include <pthread.h>
9898 int main() {
9899     int detachstate = JOINABLE;
9900 }
9901 EOCP
9902         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9903         if eval $compile; then
9904                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9905                 val="$undef" # Yes, undef.
9906                 set d_old_pthread_create_joinable
9907                 eval $setvar
9908                 val=""
9909                 set old_pthread_create_joinable
9910                 eval $setvar
9911         else
9912                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9913                 if eval $compile; then
9914                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9915                         val="$define"
9916                         set d_old_pthread_create_joinable
9917                         eval $setvar
9918                         val=PTHREAD_CREATE_UNDETACHED
9919                         set old_pthread_create_joinable
9920                         eval $setvar
9921                 else            
9922                         set try -DJOINABLE=__UNDETACHED
9923                         if eval $compile; then
9924                                 echo "You seem to use __UNDETACHED." >&4
9925                                 val="$define"
9926                                 set d_old_pthread_create_joinable
9927                                 eval $setvar
9928                                 val=__UNDETACHED
9929                                 set old_pthread_create_joinable
9930                                 eval $setvar
9931                         else
9932                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9933                                 val="$define"
9934                                 set d_old_pthread_create_joinable
9935                                 eval $setvar
9936                                 val=0
9937                                 set old_pthread_create_joinable
9938                                 eval $setvar
9939                         fi
9940                 fi
9941         fi
9942         $rm -f try try.*
9943 else
9944     d_old_pthread_create_joinable="$undef"
9945     old_pthread_create_joinable=""
9946 fi
9947
9948 : see if pause exists
9949 set pause d_pause
9950 eval $inlibc
9951
9952 : see if pipe exists
9953 set pipe d_pipe
9954 eval $inlibc
9955
9956 : see if poll exists
9957 set poll d_poll
9958 eval $inlibc
9959
9960
9961 : see whether the various POSIXish _yields exist
9962 $cat >try.c <<EOP
9963 #include <pthread.h>
9964 #include <stdio.h>
9965 int main() {
9966 #ifdef SCHED_YIELD
9967         sched_yield();
9968 #else
9969 #ifdef PTHREAD_YIELD
9970         pthread_yield();
9971 #else
9972 #ifdef PTHREAD_YIELD_NULL
9973         pthread_yield(NULL);
9974 #endif
9975 #endif
9976 #endif
9977 }
9978 EOP
9979 : see if sched_yield exists
9980 set try -DSCHED_YIELD
9981 if eval $compile; then
9982     val="$define"
9983     sched_yield='sched_yield()'
9984 else
9985     val="$undef"
9986 fi
9987 case "$usethreads" in
9988 $define)
9989         case "$val" in
9990         $define) echo 'sched_yield() found.' >&4        ;;
9991         *)       echo 'sched_yield() NOT found.' >&4    ;;
9992         esac
9993 esac
9994 set d_sched_yield
9995 eval $setvar
9996
9997 : see if pthread_yield exists
9998 set try -DPTHREAD_YIELD
9999 if eval $compile; then
10000     val="$define"
10001     case "$sched_yield" in
10002     '') sched_yield='pthread_yield()' ;;
10003     esac
10004 else
10005     set try -DPTHREAD_YIELD_NULL
10006     if eval $compile; then
10007         val="$define"
10008         case "$sched_yield" in
10009         '') sched_yield='pthread_yield(NULL)' ;;
10010         esac
10011     else
10012         val="$undef"
10013     fi
10014 fi
10015 case "$usethreads" in
10016 $define)
10017         case "$val" in
10018         $define) echo 'pthread_yield() found.' >&4      ;;
10019         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10020         esac
10021         ;;
10022 esac
10023 set d_pthread_yield
10024 eval $setvar
10025
10026 case "$sched_yield" in
10027 '') sched_yield=undef ;;
10028 esac
10029
10030 $rm -f try try.*
10031
10032 : see if this is a pwd.h system
10033 set pwd.h i_pwd
10034 eval $inhdr
10035
10036 case "$i_pwd" in
10037 $define)
10038         xxx=`./findhdr pwd.h`
10039         $cppstdin $cppflags $cppminus < $xxx >$$.h
10040
10041         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10042                 val="$define"
10043         else
10044                 val="$undef"
10045         fi
10046         set d_pwquota
10047         eval $setvar
10048
10049         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10050                 val="$define"
10051         else
10052                 val="$undef"
10053         fi
10054         set d_pwage
10055         eval $setvar
10056
10057         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10058                 val="$define"
10059         else
10060                 val="$undef"
10061         fi
10062         set d_pwchange
10063         eval $setvar
10064
10065         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10066                 val="$define"
10067         else
10068                 val="$undef"
10069         fi
10070         set d_pwclass
10071         eval $setvar
10072
10073         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10074                 val="$define"
10075         else
10076                 val="$undef"
10077         fi
10078         set d_pwexpire
10079         eval $setvar
10080
10081         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10082                 val="$define"
10083         else
10084                 val="$undef"
10085         fi
10086         set d_pwcomment
10087         eval $setvar
10088
10089         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10090                 val="$define"
10091         else
10092                 val="$undef"
10093         fi
10094         set d_pwgecos
10095         eval $setvar
10096
10097         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10098                 val="$define"
10099         else
10100                 val="$undef"
10101         fi
10102         set d_pwpasswd
10103         eval $setvar
10104
10105         $rm -f $$.h
10106         ;;
10107 *)
10108         val="$undef"; 
10109         set d_pwquota; eval $setvar
10110         set d_pwage; eval $setvar
10111         set d_pwchange; eval $setvar
10112         set d_pwclass; eval $setvar
10113         set d_pwexpire; eval $setvar
10114         set d_pwcomment; eval $setvar
10115         set d_pwgecos; eval $setvar
10116         set d_pwpasswd; eval $setvar
10117         ;;
10118 esac
10119
10120 : see if readdir and friends exist
10121 set readdir d_readdir
10122 eval $inlibc
10123 set seekdir d_seekdir
10124 eval $inlibc
10125 set telldir d_telldir
10126 eval $inlibc
10127 set rewinddir d_rewinddir
10128 eval $inlibc
10129
10130 : see if readlink exists
10131 set readlink d_readlink
10132 eval $inlibc
10133
10134 : see if rename exists
10135 set rename d_rename
10136 eval $inlibc
10137
10138 : see if rmdir exists
10139 set rmdir d_rmdir
10140 eval $inlibc
10141
10142 : see if memory.h is available.
10143 val=''
10144 set memory.h val
10145 eval $inhdr
10146
10147 : See if it conflicts with string.h
10148 case "$val" in
10149 $define)
10150         case "$strings" in
10151         '') ;;
10152         *)
10153                 $cppstdin $cppflags $cppminus < $strings > mem.h
10154                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10155                         echo " "
10156                         echo "We won't be including <memory.h>."
10157                         val="$undef"
10158                 fi
10159                 $rm -f mem.h
10160                 ;;
10161         esac
10162 esac
10163 set i_memory
10164 eval $setvar
10165
10166 : can bcopy handle overlapping blocks?
10167 val="$undef"
10168 case "$d_bcopy" in
10169 "$define")
10170         echo " "
10171         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10172         $cat >try.c <<EOCP
10173 #$i_memory I_MEMORY
10174 #$i_stdlib I_STDLIB
10175 #$i_string I_STRING
10176 #$i_unistd I_UNISTD
10177 EOCP
10178         $cat >>try.c <<'EOCP'
10179 #include <stdio.h>
10180 #ifdef I_MEMORY
10181 #  include <memory.h>
10182 #endif
10183 #ifdef I_STDLIB
10184 #  include <stdlib.h>
10185 #endif
10186 #ifdef I_STRING
10187 #  include <string.h>
10188 #else
10189 #  include <strings.h>
10190 #endif
10191 #ifdef I_UNISTD
10192 #  include <unistd.h>  /* Needed for NetBSD */
10193 #endif
10194 int main()
10195 {
10196 char buf[128], abc[128];
10197 char *b;
10198 int len;
10199 int off;
10200 int align;
10201
10202 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10203
10204 for (align = 7; align >= 0; align--) {
10205         for (len = 36; len; len--) {
10206                 b = buf+align;
10207                 bcopy(abc, b, len);
10208                 for (off = 1; off <= len; off++) {
10209                         bcopy(b, b+off, len);
10210                         bcopy(b+off, b, len);
10211                         if (bcmp(b, abc, len))
10212                                 exit(1);
10213                 }
10214         }
10215 }
10216 exit(0);
10217 }
10218 EOCP
10219         set try
10220         if eval $compile_ok; then
10221                 if ./try 2>/dev/null; then
10222                         echo "Yes, it can."
10223                         val="$define"
10224                 else
10225                         echo "It can't, sorry."
10226                         case "$d_memmove" in
10227                         "$define") echo "But that's Ok since you have memmove()." ;;
10228                         esac
10229                 fi
10230         else
10231                 echo "(I can't compile the test program, so we'll assume not...)"
10232                 case "$d_memmove" in
10233                 "$define") echo "But that's Ok since you have memmove()." ;;
10234                 esac
10235         fi
10236         ;;
10237 esac
10238 $rm -f try.* try core
10239 set d_safebcpy
10240 eval $setvar
10241
10242 : can memcpy handle overlapping blocks?
10243 val="$undef"
10244 case "$d_memcpy" in
10245 "$define")
10246         echo " "
10247         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10248         $cat >try.c <<EOCP
10249 #$i_memory I_MEMORY
10250 #$i_stdlib I_STDLIB
10251 #$i_string I_STRING
10252 #$i_unistd I_UNISTD
10253 EOCP
10254         $cat >>try.c <<'EOCP'
10255 #include <stdio.h>
10256 #ifdef I_MEMORY
10257 #  include <memory.h>
10258 #endif
10259 #ifdef I_STDLIB
10260 #  include <stdlib.h>
10261 #endif
10262 #ifdef I_STRING
10263 #  include <string.h>
10264 #else
10265 #  include <strings.h>
10266 #endif
10267 #ifdef I_UNISTD
10268 #  include <unistd.h>  /* Needed for NetBSD */
10269 #endif
10270 int main()
10271 {
10272 char buf[128], abc[128];
10273 char *b;
10274 int len;
10275 int off;
10276 int align;
10277
10278 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10279    try to store the string in read-only memory. */
10280 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10281
10282 for (align = 7; align >= 0; align--) {
10283         for (len = 36; len; len--) {
10284                 b = buf+align;
10285                 memcpy(b, abc, len);
10286                 for (off = 1; off <= len; off++) {
10287                         memcpy(b+off, b, len);
10288                         memcpy(b, b+off, len);
10289                         if (memcmp(b, abc, len))
10290                                 exit(1);
10291                 }
10292         }
10293 }
10294 exit(0);
10295 }
10296 EOCP
10297         set try
10298         if eval $compile_ok; then
10299                 if ./try 2>/dev/null; then
10300                         echo "Yes, it can."
10301                         val="$define"
10302                 else
10303                         echo "It can't, sorry."
10304                         case "$d_memmove" in
10305                         "$define") echo "But that's Ok since you have memmove()." ;;
10306                         esac
10307                 fi
10308         else
10309                 echo "(I can't compile the test program, so we'll assume not...)"
10310                 case "$d_memmove" in
10311                 "$define") echo "But that's Ok since you have memmove()." ;;
10312                 esac
10313         fi
10314         ;;
10315 esac
10316 $rm -f try.* try core
10317 set d_safemcpy
10318 eval $setvar
10319
10320 : can memcmp be trusted to compare relative magnitude?
10321 val="$undef"
10322 case "$d_memcmp" in
10323 "$define")
10324         echo " "
10325         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10326         $cat >try.c <<EOCP
10327 #$i_memory I_MEMORY
10328 #$i_stdlib I_STDLIB
10329 #$i_string I_STRING
10330 #$i_unistd I_UNISTD
10331 EOCP
10332         $cat >>try.c <<'EOCP'
10333 #include <stdio.h>
10334 #ifdef I_MEMORY
10335 #  include <memory.h>
10336 #endif
10337 #ifdef I_STDLIB
10338 #  include <stdlib.h>
10339 #endif
10340 #ifdef I_STRING
10341 #  include <string.h>
10342 #else
10343 #  include <strings.h>
10344 #endif
10345 #ifdef I_UNISTD
10346 #  include <unistd.h>  /* Needed for NetBSD */
10347 #endif
10348 int main()
10349 {
10350 char a = -1;
10351 char b = 0;
10352 if ((a < b) && memcmp(&a, &b, 1) < 0)
10353         exit(1);
10354 exit(0);
10355 }
10356 EOCP
10357         set try
10358         if eval $compile_ok; then
10359                 if ./try 2>/dev/null; then
10360                         echo "Yes, it can."
10361                         val="$define"
10362                 else
10363                         echo "No, it can't (it uses signed chars)."
10364                 fi
10365         else
10366                 echo "(I can't compile the test program, so we'll assume not...)"
10367         fi
10368         ;;
10369 esac
10370 $rm -f try.* try core
10371 set d_sanemcmp
10372 eval $setvar
10373
10374 : see if select exists
10375 set select d_select
10376 eval $inlibc
10377
10378 : see if semctl exists
10379 set semctl d_semctl
10380 eval $inlibc
10381
10382 : see if semget exists
10383 set semget d_semget
10384 eval $inlibc
10385
10386 : see if semop exists
10387 set semop d_semop
10388 eval $inlibc
10389
10390 : see how much of the 'sem*(2)' library is present.
10391 h_sem=true
10392 echo " "
10393 case "$d_semctl$d_semget$d_semop" in
10394 *"$undef"*) h_sem=false;;
10395 esac
10396 case "$osname" in
10397 freebsd)
10398     case "`ipcs 2>&1`" in
10399     "SVID messages"*"not configured"*)
10400         echo "Your $osname does not have the sem*(2) configured." >&4
10401         h_sem=false
10402         val="$undef"
10403         set semctl d_semctl
10404         eval $setvar
10405         set semget d_semget
10406         eval $setvar
10407         set semop d_semop
10408         eval $setvar
10409         ;;
10410     esac
10411     ;;
10412 esac
10413 : we could also check for sys/ipc.h ...
10414 if $h_sem && $test `./findhdr sys/sem.h`; then
10415         echo "You have the full sem*(2) library." >&4
10416         val="$define"
10417 else
10418         echo "You don't have the full sem*(2) library." >&4
10419         val="$undef"
10420 fi
10421 set d_sem
10422 eval $setvar
10423
10424 : see whether sys/sem.h defines union semun
10425 echo " "
10426 $cat > try.c <<'END'
10427 #include <sys/types.h>
10428 #include <sys/ipc.h>
10429 #include <sys/sem.h>
10430 int main () { union semun semun; semun.buf = 0; }
10431 END
10432 set try
10433 if eval $compile; then
10434     echo "You have union semun in <sys/sem.h>." >&4
10435     val="$define"
10436 else
10437     echo "You do not have union semun in <sys/sem.h>." >&4
10438     val="$undef"
10439 fi
10440 $rm -f try try.c try.h
10441 set d_union_semun
10442 eval $setvar
10443
10444 : see how to do semctl IPC_STAT
10445 case "$d_sem" in
10446 $define)
10447     : see whether semctl IPC_STAT can use union semun
10448     echo " "
10449     $cat > try.h <<END
10450 #ifndef S_IRUSR
10451 #   ifdef S_IREAD
10452 #       define S_IRUSR S_IREAD
10453 #       define S_IWUSR S_IWRITE
10454 #       define S_IXUSR S_IEXEC
10455 #   else
10456 #       define S_IRUSR 0400
10457 #       define S_IWUSR 0200
10458 #       define S_IXUSR 0100
10459 #   endif
10460 #   define S_IRGRP (S_IRUSR>>3)
10461 #   define S_IWGRP (S_IWUSR>>3)
10462 #   define S_IXGRP (S_IXUSR>>3)
10463 #   define S_IROTH (S_IRUSR>>6)
10464 #   define S_IWOTH (S_IWUSR>>6)
10465 #   define S_IXOTH (S_IXUSR>>6)
10466 #endif
10467 #ifndef S_IRWXU
10468 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
10469 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
10470 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
10471 #endif
10472 END
10473
10474     $cat > try.c <<END
10475 #include <sys/types.h>
10476 #include <sys/ipc.h>
10477 #include <sys/sem.h>
10478 #include <sys/stat.h>
10479 #include <stdio.h>
10480 #include <errno.h>
10481 #include "try.h"
10482 #ifndef errno
10483 extern int errno;
10484 #endif
10485 #$d_union_semun HAS_UNION_SEMUN
10486 int main() {
10487     union semun
10488 #ifndef HAS_UNION_SEMUN
10489     {
10490         int val;
10491         struct semid_ds *buf;
10492         unsigned short *array;
10493     }
10494 #endif
10495     arg;
10496     int sem, st;
10497
10498 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
10499     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10500     if (sem > -1) {
10501         struct semid_ds argbuf;
10502         arg.buf = &argbuf;
10503 #       ifdef IPC_STAT
10504         st = semctl(sem, 0, IPC_STAT, arg);
10505         if (st == 0)
10506             printf("semun\n");
10507         else
10508 #       endif /* IPC_STAT */
10509             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10510 #       ifdef IPC_RMID
10511         if (semctl(sem, 0, IPC_RMID, arg) != 0)
10512 #       endif /* IPC_RMID */
10513             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10514     } else
10515 #endif /* IPC_PRIVATE && ... */
10516         printf("semget failed: errno = %d\n", errno);
10517   return 0;
10518 }
10519 END
10520     val="$undef"
10521     set try
10522     if eval $compile; then
10523         xxx=`./try`
10524         case "$xxx" in
10525         semun) val="$define" ;;
10526         esac
10527     fi
10528     $rm -f try try.c
10529     set d_semctl_semun
10530     eval $setvar
10531     case "$d_semctl_semun" in
10532     $define)
10533         echo "You can use union semun for semctl IPC_STAT." >&4
10534         also='also'
10535         ;;
10536     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
10537         also=''
10538         ;;
10539     esac
10540
10541     : see whether semctl IPC_STAT can use struct semid_ds pointer
10542     $cat > try.c <<'END'
10543 #include <sys/types.h>
10544 #include <sys/ipc.h>
10545 #include <sys/sem.h>
10546 #include <sys/stat.h>
10547 #include "try.h"
10548 #include <stdio.h>
10549 #include <errno.h>
10550 #ifndef errno
10551 extern int errno;
10552 #endif
10553 int main() {
10554     struct semid_ds arg;
10555     int sem, st;
10556
10557 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
10558     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
10559     if (sem > -1) {
10560 #       ifdef IPC_STAT
10561         st = semctl(sem, 0, IPC_STAT, &arg);
10562         if (st == 0)
10563             printf("semid_ds\n");
10564         else
10565 #       endif /* IPC_STAT */
10566             printf("semctl IPC_STAT failed: errno = %d\n", errno);
10567 #       ifdef IPC_RMID
10568         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
10569 #       endif /* IPC_RMID */
10570             printf("semctl IPC_RMID failed: errno = %d\n", errno);
10571     } else
10572 #endif /* IPC_PRIVATE && ... */
10573         printf("semget failed: errno = %d\n", errno);
10574
10575     return 0;
10576 }
10577 END
10578     val="$undef"
10579     set try
10580     if eval $compile; then
10581         xxx=`./try`
10582         case "$xxx" in
10583         semid_ds) val="$define" ;;
10584         esac
10585     fi
10586     $rm -f try try.c
10587     set d_semctl_semid_ds
10588     eval $setvar
10589     case "$d_semctl_semid_ds" in
10590     $define)
10591         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10592         ;;
10593     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10594         ;;
10595     esac
10596     $rm -f try.h
10597     ;;
10598 *)  val="$undef"
10599
10600     # We do not have the full sem*(2) library, so assume we can not
10601     # use either.
10602
10603     set d_semctl_semun
10604     eval $setvar
10605
10606     set d_semctl_semid_ds
10607     eval $setvar
10608     ;;
10609 esac
10610
10611 : see if setegid exists
10612 set setegid d_setegid
10613 eval $inlibc
10614
10615 : see if seteuid exists
10616 set seteuid d_seteuid
10617 eval $inlibc
10618
10619 : see if setgrent exists
10620 set setgrent d_setgrent
10621 eval $inlibc
10622
10623 : see if sethostent exists
10624 set sethostent d_sethent
10625 eval $inlibc
10626
10627 : see if setlinebuf exists
10628 set setlinebuf d_setlinebuf
10629 eval $inlibc
10630
10631 : see if setlocale exists
10632 set setlocale d_setlocale
10633 eval $inlibc
10634
10635 : see if setnetent exists
10636 set setnetent d_setnent
10637 eval $inlibc
10638
10639 : see if setprotoent exists
10640 set setprotoent d_setpent
10641 eval $inlibc
10642
10643 : see if setpgid exists
10644 set setpgid d_setpgid
10645 eval $inlibc
10646
10647 : see if setpgrp2 exists
10648 set setpgrp2 d_setpgrp2
10649 eval $inlibc
10650
10651 : see if setpriority exists
10652 set setpriority d_setprior
10653 eval $inlibc
10654
10655 : see if setpwent exists
10656 set setpwent d_setpwent
10657 eval $inlibc
10658
10659 : see if setregid exists
10660 set setregid d_setregid
10661 eval $inlibc
10662 set setresgid d_setresgid
10663 eval $inlibc
10664
10665 : see if setreuid exists
10666 set setreuid d_setreuid
10667 eval $inlibc
10668 set setresuid d_setresuid
10669 eval $inlibc
10670
10671 : see if setrgid exists
10672 set setrgid d_setrgid
10673 eval $inlibc
10674
10675 : see if setruid exists
10676 set setruid d_setruid
10677 eval $inlibc
10678
10679 : see if setservent exists
10680 set setservent d_setsent
10681 eval $inlibc
10682
10683 : see if setsid exists
10684 set setsid d_setsid
10685 eval $inlibc
10686
10687 : see if setspent exists
10688 set setspent d_setspent
10689 eval $inlibc
10690
10691 : see if setvbuf exists
10692 set setvbuf d_setvbuf
10693 eval $inlibc
10694
10695 : see if sfio.h is available
10696 set sfio.h i_sfio
10697 eval $inhdr
10698
10699
10700 : see if sfio library is available
10701 case "$i_sfio" in
10702 $define)
10703         val=''
10704         set sfreserve val
10705         eval $inlibc
10706         ;;
10707 *)
10708         val="$undef"
10709         ;;
10710 esac
10711 : Ok, but do we want to use it.
10712 case "$val" in
10713 $define)
10714         case "$usesfio" in
10715         true|$define|[yY]*) dflt='y';;
10716         *) dflt='n';;
10717         esac
10718         echo "$package can use the sfio library, but it is experimental."
10719         rp="You seem to have sfio available, do you want to try using it?"
10720         . ./myread
10721         case "$ans" in
10722         y|Y) ;;
10723         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10724                 val="$undef"
10725                 : Remove sfio from list of libraries to use
10726                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10727                 shift
10728                 libs="$*"
10729                 echo "libs = $libs" >&4
10730                 ;;
10731         esac
10732         ;;
10733 *)      case "$usesfio" in
10734         true|$define|[yY]*)
10735                 echo "Sorry, cannot find sfio on this machine" >&4
10736                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10737                 ;;
10738         esac
10739         ;;
10740 esac
10741 set d_sfio
10742 eval $setvar
10743 case "$d_sfio" in
10744 $define) usesfio='true';;
10745 *) usesfio='false';;
10746 esac
10747
10748 : see if shmctl exists
10749 set shmctl d_shmctl
10750 eval $inlibc
10751
10752 : see if shmget exists
10753 set shmget d_shmget
10754 eval $inlibc
10755
10756 : see if shmat exists
10757 set shmat d_shmat
10758 eval $inlibc
10759 : see what shmat returns
10760 case "$d_shmat" in
10761 "$define")
10762         $cat >shmat.c <<'END'
10763 #include <sys/shm.h>
10764 void *shmat();
10765 END
10766         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10767                 shmattype='void *'
10768         else
10769                 shmattype='char *'
10770         fi
10771         echo "and it returns ($shmattype)." >&4
10772         : see if a prototype for shmat is available
10773         xxx=`./findhdr sys/shm.h`
10774         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10775         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10776                 val="$define"
10777         else
10778                 val="$undef"
10779         fi
10780         $rm -f shmat.[co]
10781         ;;
10782 *)
10783         val="$undef"
10784         ;;
10785 esac
10786 set d_shmatprototype
10787 eval $setvar
10788
10789 : see if shmdt exists
10790 set shmdt d_shmdt
10791 eval $inlibc
10792
10793 : see how much of the 'shm*(2)' library is present.
10794 h_shm=true
10795 echo " "
10796 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10797 *"$undef"*) h_shm=false;;
10798 esac
10799 case "$osname" in
10800 freebsd)
10801     case "`ipcs 2>&1`" in
10802     "SVID shared memory"*"not configured"*)
10803         echo "Your $osname does not have the shm*(2) configured." >&4
10804         h_shm=false
10805         val="$undef"
10806         set shmctl d_shmctl
10807         evat $setvar
10808         set shmget d_shmget
10809         evat $setvar
10810         set shmat d_shmat
10811         evat $setvar
10812         set shmdt d_shmdt
10813         evat $setvar
10814         ;;
10815     esac
10816     ;;
10817 esac
10818 : we could also check for sys/ipc.h ...
10819 if $h_shm && $test `./findhdr sys/shm.h`; then
10820         echo "You have the full shm*(2) library." >&4
10821         val="$define"
10822 else
10823         echo "You don't have the full shm*(2) library." >&4
10824         val="$undef"
10825 fi
10826 set d_shm
10827 eval $setvar
10828
10829 echo " "
10830 : see if we have sigaction
10831 if set sigaction val -f d_sigaction; eval $csym; $val; then
10832         echo 'sigaction() found.' >&4
10833         $cat > try.c <<'EOP'
10834 #include <stdio.h>
10835 #include <sys/types.h>
10836 #include <signal.h>
10837 int main()
10838 {
10839     struct sigaction act, oact;
10840     act.sa_flags = 0;
10841     oact.sa_handler = 0;
10842     /* so that act and oact are used */
10843     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
10844 }
10845 EOP
10846         set try
10847         if eval $compile_ok; then
10848                 val="$define"
10849         else
10850                 echo "But you don't seem to have a useable struct sigaction." >&4
10851                 val="$undef"
10852         fi
10853 else
10854         echo 'sigaction NOT found.' >&4
10855         val="$undef"
10856 fi
10857 set d_sigaction; eval $setvar
10858 $rm -f try try$_o try.c
10859
10860 : see if sigsetjmp exists
10861 echo " "
10862 case "$d_sigsetjmp" in
10863 '')
10864         $cat >try.c <<'EOP'
10865 #include <setjmp.h>
10866 sigjmp_buf env;
10867 int set = 1;
10868 int main()
10869 {
10870         if (sigsetjmp(env,1))
10871                 exit(set);
10872         set = 0;
10873         siglongjmp(env, 1);
10874         exit(1);
10875 }
10876 EOP
10877         set try
10878         if eval $compile; then
10879                 if ./try >/dev/null 2>&1; then
10880                         echo "POSIX sigsetjmp found." >&4
10881                         val="$define"
10882                 else
10883                         $cat >&4 <<EOM
10884 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10885 I'll ignore them.
10886 EOM
10887                         val="$undef"
10888                 fi
10889         else
10890                 echo "sigsetjmp not found." >&4
10891                 val="$undef"
10892         fi
10893         ;;
10894 *) val="$d_sigsetjmp"
10895         case "$d_sigsetjmp" in
10896         $define) echo "POSIX sigsetjmp found." >&4;;
10897         $undef) echo "sigsetjmp not found." >&4;;
10898         esac
10899         ;;
10900 esac
10901 set d_sigsetjmp
10902 eval $setvar
10903 $rm -f try.c try
10904
10905 : see if sys/stat.h is available
10906 set sys/stat.h i_sysstat
10907 eval $inhdr
10908
10909
10910 : see if stat knows about block sizes
10911 echo " "
10912 echo "Checking to see if your struct stat has st_blocks field..." >&4
10913 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10914 eval $hasfield
10915
10916
10917 : see if this is a sys/vfs.h system
10918 set sys/vfs.h i_sysvfs
10919 eval $inhdr
10920
10921
10922 : see if this is a sys/statfs.h system
10923 set sys/statfs.h i_sysstatfs
10924 eval $inhdr
10925
10926
10927 echo " "
10928 echo "Checking to see if your system supports struct statfs..." >&4
10929 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
10930 eval $hasstruct
10931 case "$d_statfs_s" in
10932 "$define")      echo "Yes, it does."   ;;
10933 *)              echo "No, it doesn't." ;;
10934 esac
10935
10936
10937
10938 : see if struct statfs knows about f_flags
10939 case "$d_statfs_s" in
10940 define) 
10941         echo " "
10942         echo "Checking to see if your struct statfs has f_flags field..." >&4
10943         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
10944         eval $hasfield
10945         ;;
10946 *)      val="$undef"
10947         set d_statfs_f_flags
10948         eval $setvar
10949         ;;
10950 esac
10951 case "$d_statfs_f_flags" in
10952 "$define")      echo "Yes, it does."   ;;
10953 *)              echo "No, it doesn't." ;;
10954 esac
10955
10956 : see if _ptr and _cnt from stdio act std
10957 echo " "
10958 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10959         echo "(Looks like you have stdio.h from Linux.)"
10960         case "$stdio_ptr" in
10961         '') stdio_ptr='((fp)->_IO_read_ptr)'
10962                 ptr_lval=$define
10963                 ;;
10964         *)      ptr_lval=$d_stdio_ptr_lval;;
10965         esac
10966         case "$stdio_cnt" in
10967         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10968                 cnt_lval=$undef
10969                 ;;
10970         *)      cnt_lval=$d_stdio_cnt_lval;;
10971         esac
10972         case "$stdio_base" in
10973         '') stdio_base='((fp)->_IO_read_base)';;
10974         esac
10975         case "$stdio_bufsiz" in
10976         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10977         esac
10978 else
10979         case "$stdio_ptr" in
10980         '') stdio_ptr='((fp)->_ptr)'
10981                 ptr_lval=$define
10982                 ;;
10983         *)      ptr_lval=$d_stdio_ptr_lval;;
10984         esac
10985         case "$stdio_cnt" in
10986         '') stdio_cnt='((fp)->_cnt)'
10987                 cnt_lval=$define
10988                 ;;
10989         *)      cnt_lval=$d_stdio_cnt_lval;;
10990         esac
10991         case "$stdio_base" in
10992         '') stdio_base='((fp)->_base)';;
10993         esac
10994         case "$stdio_bufsiz" in
10995         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10996         esac
10997 fi
10998 : test whether _ptr and _cnt really work
10999 echo "Checking how std your stdio is..." >&4
11000 $cat >try.c <<EOP
11001 #include <stdio.h>
11002 #define FILE_ptr(fp)    $stdio_ptr
11003 #define FILE_cnt(fp)    $stdio_cnt
11004 int main() {
11005         FILE *fp = fopen("try.c", "r");
11006         char c = getc(fp);
11007         if (
11008                 18 <= FILE_cnt(fp) &&
11009                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11010         )
11011                 exit(0);
11012         exit(1);
11013 }
11014 EOP
11015 val="$undef"
11016 set try
11017 if eval $compile; then
11018         if ./try; then
11019                 echo "Your stdio acts pretty std."
11020                 val="$define"
11021         else
11022                 echo "Your stdio isn't very std."
11023         fi
11024 else
11025         echo "Your stdio doesn't appear very std."
11026 fi
11027 $rm -f try.c try
11028 set d_stdstdio
11029 eval $setvar
11030
11031 : Can _ptr be used as an lvalue?
11032 case "$d_stdstdio$ptr_lval" in
11033 $define$define) val=$define ;;
11034 *) val=$undef ;;
11035 esac
11036 set d_stdio_ptr_lval
11037 eval $setvar
11038
11039 : Can _cnt be used as an lvalue?
11040 case "$d_stdstdio$cnt_lval" in
11041 $define$define) val=$define ;;
11042 *) val=$undef ;;
11043 esac
11044 set d_stdio_cnt_lval
11045 eval $setvar
11046
11047 : see if _base is also standard
11048 val="$undef"
11049 case "$d_stdstdio" in
11050 $define)
11051         $cat >try.c <<EOP
11052 #include <stdio.h>
11053 #define FILE_base(fp)   $stdio_base
11054 #define FILE_bufsiz(fp) $stdio_bufsiz
11055 int main() {
11056         FILE *fp = fopen("try.c", "r");
11057         char c = getc(fp);
11058         if (
11059                 19 <= FILE_bufsiz(fp) &&
11060                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11061         )
11062                 exit(0);
11063         exit(1);
11064 }
11065 EOP
11066         set try
11067         if eval $compile; then
11068                 if ./try; then
11069                         echo "And its _base field acts std."
11070                         val="$define"
11071                 else
11072                         echo "But its _base field isn't std."
11073                 fi
11074         else
11075                 echo "However, it seems to be lacking the _base field."
11076         fi
11077         $rm -f try.c try
11078         ;;
11079 esac
11080 set d_stdiobase
11081 eval $setvar
11082
11083 $cat >&4 <<EOM
11084 Checking how to access stdio streams by file descriptor number...
11085 EOM
11086 case "$stdio_stream_array" in
11087 '')     $cat >try.c <<EOCP
11088 #include <stdio.h>
11089 int main() {
11090   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11091     printf("yes\n");
11092 }
11093 EOCP
11094         for s in _iob __iob __sF
11095         do
11096                 set try -DSTDIO_STREAM_ARRAY=$s
11097                 if eval $compile; then
11098                         case "`./try$exe_ext`" in
11099                         yes)    stdio_stream_array=$s; break ;;
11100                         esac
11101                 fi
11102         done
11103         $rm -f try.* try$exe_ext
11104 esac
11105 case "$stdio_stream_array" in
11106 '')     $cat >&4 <<EOM
11107 I can't figure out how to access stdio streams by file descriptor number.
11108 EOM
11109         d_stdio_stream_array="$undef"
11110         ;;
11111 *)      $cat >&4 <<EOM
11112 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11113 EOM
11114         d_stdio_stream_array="$define"
11115         ;;
11116 esac
11117
11118 : see if strcoll exists
11119 set strcoll d_strcoll
11120 eval $inlibc
11121
11122 : check for structure copying
11123 echo " "
11124 echo "Checking to see if your C compiler can copy structs..." >&4
11125 $cat >try.c <<'EOCP'
11126 int main()
11127 {
11128         struct blurfl {
11129                 int dyick;
11130         } foo, bar;
11131
11132         foo = bar;
11133 }
11134 EOCP
11135 if $cc -c try.c >/dev/null 2>&1 ; then
11136         val="$define"
11137         echo "Yup, it can."
11138 else
11139         val="$undef"
11140         echo "Nope, it can't."
11141 fi
11142 set d_strctcpy
11143 eval $setvar
11144 $rm -f try.*
11145
11146 : see if strerror and/or sys_errlist[] exist
11147 echo " "
11148 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11149     if set strerror val -f d_strerror; eval $csym; $val; then
11150                 echo 'strerror() found.' >&4
11151                 d_strerror="$define"
11152                 d_strerrm='strerror(e)'
11153                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11154                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11155                         d_syserrlst="$define"
11156                 else
11157                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11158                         d_syserrlst="$undef"
11159                 fi
11160     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11161                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11162                 echo 'strerror() found in string header.' >&4
11163                 d_strerror="$define"
11164                 d_strerrm='strerror(e)'
11165                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11166                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11167                                 d_syserrlst="$define"
11168                 else
11169                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11170                         d_syserrlst="$undef"
11171                 fi
11172     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11173                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11174                 d_strerror="$undef"
11175                 d_syserrlst="$define"
11176                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11177     else
11178                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11179                 d_strerror="$undef"
11180                 d_syserrlst="$undef"
11181                 d_strerrm='"unknown"'
11182     fi
11183 fi
11184
11185 : see if strtod exists
11186 set strtod d_strtod
11187 eval $inlibc
11188
11189 : see if strtol exists
11190 set strtol d_strtol
11191 eval $inlibc
11192
11193 : see if strtold exists
11194 set strtold d_strtold
11195 eval $inlibc
11196
11197 : see if strtoll exists
11198 set strtoll d_strtoll
11199 eval $inlibc
11200
11201 : see if strtoul exists
11202 set strtoul d_strtoul
11203 eval $inlibc
11204
11205 : see if strtoull exists
11206 set strtoull d_strtoull
11207 eval $inlibc
11208
11209 : see if strtouq exists
11210 set strtouq d_strtouq
11211 eval $inlibc
11212
11213 : see if strxfrm exists
11214 set strxfrm d_strxfrm
11215 eval $inlibc
11216
11217 : see if symlink exists
11218 set symlink d_symlink
11219 eval $inlibc
11220
11221 : see if syscall exists
11222 set syscall d_syscall
11223 eval $inlibc
11224
11225 : see if sysconf exists
11226 set sysconf d_sysconf
11227 eval $inlibc
11228
11229 : see if system exists
11230 set system d_system
11231 eval $inlibc
11232
11233 : see if tcgetpgrp exists
11234 set tcgetpgrp d_tcgetpgrp
11235 eval $inlibc
11236
11237 : see if tcsetpgrp exists
11238 set tcsetpgrp d_tcsetpgrp
11239 eval $inlibc
11240
11241 : see if prototype for telldir is available
11242 echo " "
11243 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
11244 eval $hasproto
11245
11246 : see if this is a sys/times.h system
11247 set sys/times.h i_systimes
11248 eval $inhdr
11249
11250 : see if times exists
11251 echo " "
11252 if set times val -f d_times; eval $csym; $val; then
11253         echo 'times() found.' >&4
11254         d_times="$define"
11255         inc=''
11256         case "$i_systimes" in
11257         "$define") inc='sys/times.h';;
11258         esac
11259         rp="What is the type returned by times() on this system?"
11260         set clock_t clocktype long stdio.h sys/types.h $inc
11261         eval $typedef_ask
11262 else
11263         echo 'times() NOT found, hope that will do.' >&4
11264         d_times="$undef"
11265         clocktype='int'
11266 fi
11267
11268 : see if truncate exists
11269 set truncate d_truncate
11270 eval $inlibc
11271
11272 : see if tzname[] exists
11273 echo " "
11274 if set tzname val -a d_tzname; eval $csym; $val; then
11275         val="$define"
11276         echo 'tzname[] found.' >&4
11277 else
11278         val="$undef"
11279         echo 'tzname[] NOT found.' >&4
11280 fi
11281 set d_tzname
11282 eval $setvar
11283
11284 : see if umask exists
11285 set umask d_umask
11286 eval $inlibc
11287
11288 : see if ustat exists
11289 set ustat d_ustat
11290 eval $inlibc
11291
11292 : backward compatibility for d_hvfork
11293 if test X$d_hvfork != X; then
11294         d_vfork="$d_hvfork"
11295         d_hvfork=''
11296 fi
11297 : see if there is a vfork
11298 val=''
11299 set vfork val
11300 eval $inlibc
11301
11302 : Ok, but do we want to use it. vfork is reportedly unreliable in 
11303 : perl on Solaris 2.x, and probably elsewhere.
11304 case "$val" in
11305 $define)
11306         echo " "
11307         case "$usevfork" in
11308         false) dflt='n';;
11309         *) dflt='y';;
11310         esac
11311         cat <<'EOM'
11312  
11313 Perl can only use a vfork() that doesn't suffer from strict
11314 restrictions on calling functions or modifying global data in
11315 the child.  For example, glibc-2.1 contains such a vfork()
11316 that is unsuitable.  If your system provides a proper fork()
11317 call, chances are that you do NOT want perl to use vfork().
11318
11319 EOM
11320         rp="Do you still want to use vfork()?"
11321         . ./myread
11322         case "$ans" in
11323         y|Y) ;;
11324         *)
11325                 echo "Ok, we won't use vfork()."
11326                 val="$undef"
11327                 ;;
11328         esac
11329         ;;
11330 esac
11331 set d_vfork
11332 eval $setvar
11333 case "$d_vfork" in
11334 $define) usevfork='true';;
11335 *) usevfork='false';;
11336 esac
11337
11338 : see if this is an sysdir system
11339 set sys/dir.h i_sysdir
11340 eval $inhdr
11341
11342 : see if this is an sysndir system
11343 set sys/ndir.h i_sysndir
11344 eval $inhdr
11345
11346 : see if closedir exists
11347 set closedir d_closedir
11348 eval $inlibc
11349
11350 case "$d_closedir" in
11351 "$define")
11352         echo " "
11353         echo "Checking whether closedir() returns a status..." >&4
11354         cat > closedir.c <<EOM
11355 #$i_dirent I_DIRENT             /**/
11356 #$i_sysdir I_SYS_DIR            /**/
11357 #$i_sysndir I_SYS_NDIR          /**/
11358 #$i_systypes I_SYS_TYPES        /**/
11359
11360 #if defined(I_SYS_TYPES)
11361 #include <sys/types.h>
11362 #endif
11363 #if defined(I_DIRENT)
11364 #include <dirent.h>
11365 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11366 #include <sys/dir.h>
11367 #endif
11368 #else
11369 #ifdef I_SYS_NDIR
11370 #include <sys/ndir.h>
11371 #else
11372 #ifdef I_SYS_DIR
11373 #ifdef hp9000s500
11374 #include <ndir.h>       /* may be wrong in the future */
11375 #else
11376 #include <sys/dir.h>
11377 #endif
11378 #endif
11379 #endif
11380 #endif 
11381 int main() { return closedir(opendir(".")); }
11382 EOM
11383         set closedir
11384         if eval $compile_ok; then
11385                 if ./closedir > /dev/null 2>&1 ; then
11386                         echo "Yes, it does."
11387                         val="$undef"
11388                 else
11389                         echo "No, it doesn't."
11390                         val="$define"
11391                 fi
11392         else
11393                 echo "(I can't seem to compile the test program--assuming it doesn't)"
11394                 val="$define"
11395         fi
11396         ;;
11397 *)
11398         val="$undef";
11399         ;;
11400 esac
11401 set d_void_closedir
11402 eval $setvar
11403 $rm -f closedir*
11404 : check for volatile keyword
11405 echo " "
11406 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11407 $cat >try.c <<'EOCP'
11408 int main()
11409 {
11410         typedef struct _goo_struct goo_struct;
11411         goo_struct * volatile goo = ((goo_struct *)0);
11412         struct _goo_struct {
11413                 long long_int;
11414                 int reg_int;
11415                 char char_var;
11416         };
11417         typedef unsigned short foo_t;
11418         char *volatile foo;
11419         volatile int bar;
11420         volatile foo_t blech;
11421         foo = foo;
11422 }
11423 EOCP
11424 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11425         val="$define"
11426         echo "Yup, it does."
11427 else
11428         val="$undef"
11429         echo "Nope, it doesn't."
11430 fi
11431 set d_volatile
11432 eval $setvar
11433 $rm -f try.*
11434
11435 : see if there is a wait4
11436 set wait4 d_wait4
11437 eval $inlibc
11438
11439 : see if waitpid exists
11440 set waitpid d_waitpid
11441 eval $inlibc
11442
11443 : see if wcstombs exists
11444 set wcstombs d_wcstombs
11445 eval $inlibc
11446
11447 : see if wctomb exists
11448 set wctomb d_wctomb
11449 eval $inlibc
11450
11451 : preserve RCS keywords in files with variable substitution, grrr
11452 Date='$Date'
11453 Id='$Id'
11454 Log='$Log'
11455 RCSfile='$RCSfile'
11456 Revision='$Revision'
11457
11458 case "$crosscompile" in
11459 ''|[nN]*) crosscompile="$undef" ;;
11460 esac
11461
11462 case "$osname" in
11463 next|rhapsody) multiarch="$define" ;;
11464 esac
11465 case "$multiarch" in
11466 ''|[nN]*) multiarch="$undef" ;;
11467 esac
11468
11469 : check for alignment requirements
11470 echo " "
11471 case "$crosscompile$multiarch" in
11472 *$define*)
11473         $cat <<EOM
11474 You seem to be either cross-compiling or doing a multiarchitecture build,
11475 skipping the memory alignment check.
11476
11477 EOM
11478         case "$alignbytes" in
11479         '') alignbytes=8 ;;
11480         esac
11481         ;;
11482 *)
11483         case "$alignbytes" in
11484         '') echo "Checking alignment constraints..." >&4
11485                 $cat >try.c <<'EOCP'
11486 #include <stdio.h>
11487 struct foobar {
11488         char foo;
11489         double bar;
11490 } try_algn;
11491 int main()
11492 {
11493     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
11494     return(0);
11495 }
11496 EOCP
11497                 set try
11498                 if eval $compile_ok; then
11499                         dflt=`./try`
11500                 else
11501                         dflt='8'
11502                         echo "(I can't seem to compile the test program...)"
11503                 fi
11504                 ;;
11505         *) dflt="$alignbytes"
11506                 ;;
11507         esac
11508         rp="Doubles must be aligned on a how-many-byte boundary?"
11509         . ./myread
11510         alignbytes="$ans"
11511         $rm -f try.c try
11512         ;;
11513 esac
11514
11515
11516 : check for ordering of bytes in a long
11517 echo " "
11518 case "$crosscompile$multiarch" in
11519 *$define*)
11520         $cat <<EOM
11521 You seem to be either cross-compiling or doing a multiarchitecture build,
11522 skipping the byteorder check.
11523
11524 EOM
11525         byteorder='0xffff'
11526         ;;
11527 *)
11528         case "$byteorder" in
11529         '')
11530                 $cat <<'EOM'
11531 In the following, larger digits indicate more significance.  A big-endian
11532 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
11533 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
11534 machines may have weird orders like 3412.  A Cray will report 87654321,
11535 an Alpha will report 12345678. If the test program works the default is
11536 probably right.
11537 I'm now running the test program...
11538 EOM
11539                 $cat >try.c <<'EOCP'
11540 #include <stdio.h>
11541 int main()
11542 {
11543         int i;
11544         union {
11545                 unsigned long l;
11546                 char c[sizeof(long)];
11547         } u;
11548
11549         if (sizeof(long) > 4)
11550                 u.l = (0x08070605L << 32) | 0x04030201L;
11551         else
11552                 u.l = 0x04030201L;
11553         for (i = 0; i < sizeof(long); i++)
11554                 printf("%c", u.c[i]+'0');
11555         printf("\n");
11556         exit(0);
11557 }
11558 EOCP
11559                 xxx_prompt=y
11560                 set try
11561                 if eval $compile && ./try > /dev/null; then
11562                         dflt=`./try`
11563                         case "$dflt" in
11564                         [1-4][1-4][1-4][1-4]|12345678|87654321)
11565                                 echo "(The test program ran ok.)"
11566                                 echo "byteorder=$dflt"
11567                                 xxx_prompt=n
11568                         ;;
11569                         ????|????????) echo "(The test program ran ok.)" ;;
11570                         *) echo "(The test program didn't run right for some reason.)" ;;
11571                         esac
11572                 else
11573                         dflt='4321'
11574                         cat <<'EOM'
11575 (I can't seem to compile the test program.  Guessing big-endian...)
11576 EOM
11577                 fi
11578                 case "$xxx_prompt" in
11579                 y)
11580                         rp="What is the order of bytes in a long?"
11581                         . ./myread
11582                         byteorder="$ans"
11583                         ;;
11584                 *)      byteorder=$dflt
11585                         ;;
11586                 esac
11587                 ;;
11588         esac
11589         $rm -f try.c try
11590         ;;
11591 esac
11592
11593
11594 : how do we catenate cpp tokens here?
11595 echo " "
11596 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11597 $cat >cpp_stuff.c <<'EOCP'
11598 #define RCAT(a,b)a/**/b
11599 #define ACAT(a,b)a ## b
11600 RCAT(Rei,ser)
11601 ACAT(Cir,cus)
11602 EOCP
11603 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11604 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11605         echo "Oh!  Smells like ANSI's been here." >&4
11606         echo "We can catify or stringify, separately or together!"
11607         cpp_stuff=42
11608 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11609         echo "Ah, yes!  The good old days!" >&4
11610         echo "However, in the good old days we don't know how to stringify and"
11611         echo "catify at the same time."
11612         cpp_stuff=1
11613 else
11614         $cat >&4 <<EOM
11615 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11616 to have to edit the values of CAT[2-5] in config.h...
11617 EOM
11618         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11619 fi
11620 $rm -f cpp_stuff.*
11621
11622 : see if this is a db.h system
11623 set db.h i_db
11624 eval $inhdr
11625
11626 case "$i_db" in
11627 $define)
11628         : Check db version.
11629         echo " "
11630         echo "Checking Berkeley DB version ..." >&4
11631         $cat >try.c <<EOCP
11632 #$d_const HASCONST
11633 #ifndef HASCONST
11634 #define const
11635 #endif
11636 #include <sys/types.h>
11637 #include <stdio.h>
11638 #include <db.h>
11639 int main()
11640 {
11641 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11642     int Major, Minor, Patch ;
11643     unsigned long Version ;
11644     (void)db_version(&Major, &Minor, &Patch) ;
11645     printf("You have Berkeley DB Version 2 or greater\n");
11646
11647     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11648                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11649     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11650                 Major, Minor, Patch) ;
11651
11652     /* check that db.h & libdb are compatible */
11653     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11654         printf("db.h and libdb are incompatible\n") ;
11655         exit(3);        
11656     }
11657
11658     printf("db.h and libdb are compatible\n") ;
11659
11660     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11661                 + DB_VERSION_PATCH ;
11662
11663     /* needs to be >= 2.3.4 */
11664     if (Version < 2003004) {
11665     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11666         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11667         exit(2);        
11668     }
11669
11670     exit(0);
11671 #else
11672 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11673     printf("You have Berkeley DB Version 1\n");
11674     exit(0);    /* DB version < 2: the coast is clear. */
11675 #else
11676     exit(1);    /* <db.h> not Berkeley DB? */
11677 #endif
11678 #endif
11679 }
11680 EOCP
11681         set try
11682         if eval $compile_ok && ./try; then
11683                 echo 'Looks OK.' >&4
11684         else
11685                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11686                 i_db=$undef
11687                 case " $libs " in
11688                 *"-ldb "*)
11689                         : Remove db from list of libraries to use
11690                         echo "Removing unusable -ldb from library list" >&4
11691                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11692                         shift
11693                         libs="$*"
11694                         echo "libs = $libs" >&4
11695                         ;;
11696                 esac
11697         fi
11698         $rm -f try.*
11699         ;;
11700 esac
11701
11702 case "$i_db" in
11703 define)
11704         : Check the return type needed for hash 
11705         echo " "
11706         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11707         $cat >try.c <<EOCP
11708 #$d_const HASCONST
11709 #ifndef HASCONST
11710 #define const
11711 #endif
11712 #include <sys/types.h>
11713 #include <db.h>
11714
11715 #ifndef DB_VERSION_MAJOR
11716 u_int32_t hash_cb (ptr, size)
11717 const void *ptr;
11718 size_t size;
11719 {
11720 }
11721 HASHINFO info;
11722 int main()
11723 {
11724         info.hash = hash_cb;
11725 }
11726 #endif
11727 EOCP
11728         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11729                 if $contains warning try.out >>/dev/null 2>&1 ; then
11730                         db_hashtype='int'
11731                 else
11732                         db_hashtype='u_int32_t'
11733                 fi
11734         else
11735                 : XXX Maybe we should just give up here.
11736                 db_hashtype=u_int32_t
11737                 $cat try.out >&4
11738                 echo "Help:  I can't seem to compile the db test program." >&4
11739                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11740         fi
11741         $rm -f try.*
11742         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11743         ;;
11744 *)      db_hashtype=u_int32_t
11745         ;;
11746 esac
11747 case "$i_db" in
11748 define)
11749         : Check the return type needed for prefix 
11750         echo " "
11751         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11752         cat >try.c <<EOCP
11753 #$d_const HASCONST
11754 #ifndef HASCONST
11755 #define const
11756 #endif
11757 #include <sys/types.h>
11758 #include <db.h>
11759
11760 #ifndef DB_VERSION_MAJOR
11761 size_t prefix_cb (key1, key2)
11762 const DBT *key1;
11763 const DBT *key2;
11764 {
11765 }
11766 BTREEINFO info;
11767 int main()
11768 {
11769         info.prefix = prefix_cb;
11770 }
11771 #endif
11772 EOCP
11773         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11774                 if $contains warning try.out >>/dev/null 2>&1 ; then
11775                         db_prefixtype='int'
11776                 else
11777                         db_prefixtype='size_t'
11778                 fi
11779         else
11780                 db_prefixtype='size_t'
11781                 : XXX Maybe we should just give up here.
11782                 $cat try.out >&4
11783                 echo "Help:  I can't seem to compile the db test program." >&4
11784                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11785         fi
11786         $rm -f try.*
11787         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11788         ;;
11789 *)      db_prefixtype='size_t'
11790         ;;
11791 esac
11792
11793 : check for void type
11794 echo " "
11795 echo "Checking to see how well your C compiler groks the void type..." >&4
11796 case "$voidflags" in
11797 '')
11798         $cat >try.c <<'EOCP'
11799 #if TRY & 1
11800 void sub() {
11801 #else
11802 sub() {
11803 #endif
11804         extern void moo();      /* function returning void */
11805         void (*goo)();          /* ptr to func returning void */
11806 #if TRY & 8
11807         void *hue;              /* generic ptr */
11808 #endif
11809 #if TRY & 2
11810         void (*foo[10])();
11811 #endif
11812
11813 #if TRY & 4
11814         if(goo == moo) {
11815                 exit(0);
11816         }
11817 #endif
11818         exit(0);
11819 }
11820 int main() { sub(); }
11821 EOCP
11822         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11823                 voidflags=$defvoidused
11824         echo "Good.  It appears to support void to the level $package wants.">&4
11825                 if $contains warning .out >/dev/null 2>&1; then
11826                         echo "However, you might get some warnings that look like this:"
11827                         $cat .out
11828                 fi
11829         else
11830 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11831                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11832                         echo "It supports 1..."
11833                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11834                                 echo "It also supports 2..."
11835                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11836                                         voidflags=7
11837                                         echo "And it supports 4 but not 8 definitely."
11838                                 else
11839                                         echo "It doesn't support 4..."
11840                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11841                                                 voidflags=11
11842                                                 echo "But it supports 8."
11843                                         else
11844                                                 voidflags=3
11845                                                 echo "Neither does it support 8."
11846                                         fi
11847                                 fi
11848                         else
11849                                 echo "It does not support 2..."
11850                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11851                                         voidflags=13
11852                                         echo "But it supports 4 and 8."
11853                                 else
11854                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11855                                                 voidflags=5
11856                                                 echo "And it supports 4 but has not heard about 8."
11857                                         else
11858                                                 echo "However it supports 8 but not 4."
11859                                         fi
11860                                 fi
11861                         fi
11862                 else
11863                         echo "There is no support at all for void."
11864                         voidflags=0
11865                 fi
11866         fi
11867 esac
11868 case "$voidflags" in
11869 "$defvoidused") ;;
11870 *)      $cat >&4 <<'EOM'
11871   Support flag bits are:
11872     1: basic void declarations.
11873     2: arrays of pointers to functions returning void.
11874     4: operations between pointers to and addresses of void functions.
11875     8: generic void pointers.
11876 EOM
11877         dflt="$voidflags";
11878         rp="Your void support flags add up to what?"
11879         . ./myread
11880         voidflags="$ans"
11881         ;;
11882 esac
11883 $rm -f try.* .out
11884
11885
11886 : How can we generate normalized random numbers ?
11887 echo " "
11888 echo "Looking for a random number function..." >&4
11889 case "$randfunc" in
11890 '')
11891         if set drand48 val -f; eval $csym; $val; then
11892                 dflt="drand48"
11893                 echo "Good, found drand48()." >&4
11894         elif set random val -f; eval $csym; $val; then
11895                 dflt="random"
11896                 echo "OK, found random()." >&4
11897         else
11898                 dflt="rand"
11899                 echo "Yick, looks like I have to use rand()." >&4
11900         fi
11901         echo " "
11902         ;;
11903 *)
11904         dflt="$randfunc"
11905         ;;
11906 esac
11907 cont=true
11908
11909 case "$ccflags" in
11910 *-Dmy_rand=*|*-Dmy_srand=*)
11911         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11912         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11913         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11914         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11915         ;;
11916 esac
11917
11918 while $test "$cont"; do
11919         rp="Use which function to generate random numbers?"
11920         . ./myread
11921         if $test "$ans" = "$dflt"; then
11922                 : null
11923         else
11924                 randbits=''
11925         fi
11926         randfunc="$ans"
11927         if set $ans val -f; eval $csym; $val; then
11928                 cont=''
11929         else
11930                 dflt=y
11931                 rp="I cannot find function $ans. Use that name anyway?"
11932                 . ./myread
11933                 dflt=rand
11934                 case "$ans" in
11935                         [yY]*) cont='';;
11936                 esac
11937         fi
11938         case "$cont" in
11939         '')
11940                 case "$randfunc" in
11941                 drand48)
11942                         drand01="drand48()"
11943                         seedfunc="srand48"
11944                         randbits=48
11945                         randseedtype=long
11946                         ;;
11947                 rand|random)
11948                         case "$randbits" in
11949                         '')
11950 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11951                                 $cat >try.c <<EOCP
11952 #$i_unistd I_UNISTD
11953 #$i_stdlib I_STDLIB
11954 #include <stdio.h>
11955 #ifdef I_UNISTD
11956 #  include <unistd.h>
11957 #endif
11958 #ifdef I_STDLIB
11959 #  include <stdlib.h>
11960 #endif
11961 int main()
11962 {
11963         register int i;
11964         register unsigned long tmp;
11965         register unsigned long max = 0L;
11966
11967         for (i = 1000; i; i--) {
11968                 tmp = (unsigned long) $randfunc();
11969                 if (tmp > max) max = tmp;
11970         }
11971         for (i = 0; max; i++)
11972                 max /= 2;
11973         printf("%d\n",i);
11974 }
11975 EOCP
11976                                 set try
11977                                 if eval $compile_ok; then
11978                                         dflt=`try`
11979                                 else
11980                                         dflt='?'
11981                                         echo "(I can't seem to compile the test program...)"
11982                                 fi
11983                                 ;;
11984                         *)
11985                                 dflt="$randbits"
11986                                 ;;
11987                         esac
11988                         rp="How many bits does your $randfunc() function produce?"
11989                         . ./myread
11990                         randbits="$ans"
11991                         $rm -f try.c try
11992                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11993                         seedfunc="s$randfunc"
11994                         randseedtype=unsigned
11995                         ;;
11996                 *)
11997                         dflt="31"
11998                         rp="How many bits does your $randfunc() function produce?"
11999                         . ./myread
12000                         randbits="$ans"
12001                         seedfunc="s$randfunc"
12002                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12003                         if set $seedfunc val -f; eval $csym; $val; then
12004                                 echo "(Using $seedfunc() to seed random generator)"
12005                         else
12006                                 echo "(Warning: no $seedfunc() to seed random generator)"
12007                                 seedfunc=rand
12008                         fi
12009                         randseedtype=unsigned
12010                         ;;
12011                 esac
12012                 ;;
12013         esac
12014 done
12015
12016 echo " "
12017 echo "Determining whether or not we are on an EBCDIC system..." >&4
12018 $cat >tebcdic.c <<'EOM'
12019 int main()
12020 {
12021   if ('M'==0xd4) return 0;
12022   return 1;
12023 }
12024 EOM
12025
12026 val=$undef
12027 set tebcdic
12028 if eval $compile_ok; then
12029         if ./tebcdic; then
12030                 echo "You have EBCDIC." >&4
12031                 val="$define"
12032         else
12033                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin." >&4
12034         fi
12035 else
12036         echo "I'm unable to compile the test program." >&4
12037         echo "I'll assume ASCII or some ISO Latin." >&4
12038 fi
12039 $rm -f tebcdic.c tebcdic
12040 set ebcdic
12041 eval $setvar
12042
12043 echo " "
12044 $cat >&4 <<EOM
12045 Checking how to flush all pending stdio output...
12046 EOM
12047 # I only know how to find the first 32 possibly open files on SunOS.
12048 # See also hints/sunos_4_1.sh and util.c  --AD
12049 case "$osname" in
12050 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
12051 esac
12052 $cat >>try.c <<EOCP
12053 #include <stdio.h>
12054 #$i_unistd I_UNISTD
12055 #ifdef I_UNISTD
12056 # include <unistd.h>
12057 #endif
12058 #$d_sysconf HAS_SYSCONF
12059 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
12060 #ifdef HAS_STDIO_STREAM_ARRAY
12061 # define STDIO_STREAM_ARRAY $stdio_stream_array
12062 #endif
12063 int main() {
12064   FILE* p = fopen("try.out", "w");
12065 #ifdef TRY_FPUTC
12066   fputc('x', p);
12067 #else
12068 # ifdef TRY_FPRINTF
12069   fprintf(p, "x");
12070 # endif
12071 #endif
12072 #ifdef TRY_FFLUSH_NULL
12073   fflush(NULL);
12074 #endif
12075 #ifdef TRY_FFLUSH_ALL
12076   {
12077     long open_max = -1;
12078 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
12079     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
12080 # else
12081 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
12082     open_max = sysconf(_SC_OPEN_MAX);
12083 #  else
12084 #   ifdef FOPEN_MAX
12085     open_max = FOPEN_MAX;
12086 #   else
12087 #    ifdef OPEN_MAX
12088     open_max = OPEN_MAX;
12089 #    else
12090 #     ifdef _NFILE
12091     open_max = _NFILE;
12092 #     endif
12093 #    endif
12094 #   endif
12095 #  endif
12096 # endif 
12097 # ifdef HAS_STDIO_STREAM_ARRAY
12098     if (open_max > 0) {
12099       long i;
12100       for (i = 0; i < open_max; i++)
12101             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
12102                 STDIO_STREAM_ARRAY[i]._file < open_max &&
12103                 STDIO_STREAM_ARRAY[i]._flag)
12104                 fflush(&STDIO_STREAM_ARRAY[i]);
12105     }   
12106   }
12107 # endif
12108 #endif
12109   _exit(42);
12110 }
12111 EOCP
12112 : first we have to find out how _not_ to flush
12113 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
12114     output=''
12115     set try -DTRY_FPUTC
12116     if eval $compile; then
12117             $rm -f try.out
12118             ./try$exe_ext 2>/dev/null
12119             if $test ! -s try.out -a "X$?" = X42; then
12120                 output=-DTRY_FPUTC
12121             fi
12122     fi
12123     case "$output" in
12124     '')
12125             set try -DTRY_FPRINTF
12126             $rm -f try.out
12127             if eval $compile; then
12128                     $rm -f try.out
12129                     ./try$exe_ext 2>/dev/null
12130                     if $test ! -s try.out -a "X$?" = X42; then
12131                         output=-DTRY_FPRINTF
12132                     fi
12133             fi
12134         ;;
12135     esac
12136 fi
12137 : check for fflush NULL behaviour
12138 case "$fflushNULL" in
12139 '')     set try -DTRY_FFLUSH_NULL $output
12140         if eval $compile; then
12141                 $rm -f try.out
12142                 ./try$exe_ext 2>/dev/null
12143                 code="$?"
12144                 if $test -s try.out -a "X$code" = X42; then
12145                         fflushNULL="`$cat try.out`"
12146                 else
12147                         if $test "X$code" != X42; then
12148                                 $cat >&4 <<EOM
12149 (If this test failed, don't worry, we'll try another method shortly.)
12150 EOM
12151                         fi
12152                 fi
12153         fi
12154         $rm -f core try.core core.try.*
12155         case "$fflushNULL" in
12156         x)      $cat >&4 <<EOM
12157 Your fflush(NULL) works okay.
12158 EOM
12159                 fflushNULL="$define"
12160                 ;;
12161         '')     $cat >&4 <<EOM
12162 Your fflush(NULL) isn't working (contrary to ANSI C).
12163 EOM
12164                 fflushNULL="$undef"
12165                 ;;
12166         *)      $cat >&4 <<EOM
12167 Cannot figure out whether your fflush(NULL) works or not.
12168 I'm assuming it doesn't (contrary to ANSI C).
12169 EOM
12170                 fflushNULL="$undef"
12171                 ;;
12172         esac
12173         ;;
12174 $define|true|[yY]*)
12175         fflushNULL="$define"
12176         ;;
12177 *)
12178         fflushNULL="$undef"
12179         ;;
12180 esac
12181 : check explicit looping only if NULL did not work
12182 case "$fflushNULL" in
12183 "$undef")
12184         : check for fflush all behaviour
12185         case "$fflushall" in
12186         '')     set try -DTRY_FFLUSH_ALL $output
12187                 if eval $compile; then
12188                         $cat >&4 <<EOM
12189 (Now testing the other method--but note that also this may fail.)
12190 EOM
12191                         $rm -f try.out
12192                         ./try$exe_ext 2>/dev/null
12193                         if $test -s try.out -a "X$?" = X42; then
12194                                 fflushall="`$cat try.out`"
12195                         fi
12196                 fi
12197                 $rm -f core try.core core.try.*
12198                 case "$fflushall" in
12199                 x)      $cat >&4 <<EOM
12200 Whew. Flushing explicitly all the stdio streams works.
12201 EOM
12202                         fflushall="$define"
12203                         ;;
12204                 '')     $cat >&4 <<EOM
12205 Sigh. Flushing explicitly all the stdio streams doesn't work.
12206 EOM
12207                         fflushall="$undef"
12208                         ;;
12209                 *)      $cat >&4 <<EOM
12210 Cannot figure out whether flushing stdio streams explicitly works or not.
12211 I'm assuming it doesn't.
12212 EOM
12213                         fflushall="$undef"
12214                         ;;
12215                 esac
12216                 ;;
12217         "$define"|true|[yY]*)
12218                 fflushall="$define"
12219                 ;;
12220         *)
12221                 fflushall="$undef"
12222                 ;;
12223         esac
12224         ;;
12225 *)      fflushall="$undef"      
12226         ;;
12227 esac
12228 case "$fflushNULL$fflushall" in
12229 undefundef)
12230         $cat <<EOM
12231 I cannot figure out how to flush pending stdio output.
12232 EOM
12233         ;;
12234 esac
12235 $rm -f try.* try$exe_ext
12236
12237 : Store the full pathname to the ar program for use in the C program
12238 : Respect a hint or command line value for full_ar.
12239 case "$full_ar" in
12240 '') full_ar=$ar ;;
12241 esac
12242
12243 : Store the full pathname to the sed program for use in the C program
12244 full_sed=$sed
12245
12246 : see what type gids are declared as in the kernel
12247 echo " "
12248 echo "Looking for the type for group ids returned by getgid()."
12249 set gid_t gidtype xxx stdio.h sys/types.h
12250 eval $typedef
12251 case "$gidtype" in
12252 xxx)
12253         xxx=`./findhdr sys/user.h`
12254         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
12255         case $1 in
12256         unsigned) dflt="$1 $2" ;;
12257         *) dflt="$1" ;;
12258         esac
12259         ;;
12260 *) dflt="$gidtype";;
12261 esac
12262 case "$gidtype" in
12263 gid_t) echo "gid_t found." ;;
12264 *)      rp="What is the type for group ids returned by getgid()?"
12265         . ./myread
12266         gidtype="$ans"
12267         ;;
12268 esac
12269
12270 echo " "
12271 case "$gidtype" in
12272 *_t) zzz="$gidtype"     ;;
12273 *)   zzz="gid"          ;;
12274 esac
12275 echo "Checking the size of $zzz..." >&4 
12276 cat > try.c <<EOCP
12277 #include <sys/types.h>
12278 #include <stdio.h>
12279 int main() {
12280     printf("%d\n", (int)sizeof($gidtype));
12281     exit(0);
12282 }
12283 EOCP
12284 set try
12285 if eval $compile_ok; then
12286         yyy=`./try`
12287         case "$yyy" in
12288         '')     gidsize=4
12289                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
12290                 ;;
12291         *)      gidsize=$yyy
12292                 echo "Your $zzz size is $gidsize bytes."
12293                 ;;
12294         esac
12295 else
12296         gidsize=4
12297         echo "(I can't compile the test program--guessing $gidsize.)" >&4
12298 fi
12299
12300
12301 echo " "
12302 case "$gidtype" in
12303 *_t) zzz="$gidtype"     ;;
12304 *)   zzz="gid"          ;;
12305 esac
12306 echo "Checking the sign of $zzz..." >&4 
12307 cat > try.c <<EOCP
12308 #include <sys/types.h>
12309 #include <stdio.h>
12310 int main() {
12311         $gidtype foo = -1;
12312         if (foo < 0)
12313                 printf("-1\n");
12314         else
12315                 printf("1\n");
12316 }
12317 EOCP
12318 set try
12319 if eval $compile; then
12320         yyy=`./try`
12321         case "$yyy" in
12322         '')     gidsign=1
12323                 echo "(I can't execute the test program--guessing unsigned.)" >&4
12324                 ;;
12325         *)      gidsign=$yyy
12326                 case "$gidsign" in
12327                  1) echo "Your $zzz is unsigned." ;;
12328                 -1) echo "Your $zzz is signed."   ;;
12329                 esac
12330                 ;;
12331         esac
12332 else
12333         gidsign=1
12334         echo "(I can't compile the test program--guessing unsigned.)" >&4
12335 fi
12336
12337
12338 echo " "
12339
12340 if $test X"$quadtype" != X; then
12341
12342 echo "Checking how to print 64-bit integers..." >&4
12343
12344 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
12345         $cat >try.c <<'EOCP'
12346 #include <sys/types.h>
12347 #include <stdio.h>
12348 int main() {
12349   int q = 12345678901;
12350   printf("%ld\n", q);
12351 }
12352 EOCP
12353         set try
12354         if eval $compile; then
12355                 yyy=`./try$exe_ext`
12356                 case "$yyy" in
12357                 12345678901)
12358                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
12359                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
12360                         echo "We will use %d."
12361                         ;;
12362                 esac
12363         fi
12364 fi
12365
12366 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
12367         $cat >try.c <<'EOCP'
12368 #include <sys/types.h>
12369 #include <stdio.h>
12370 int main() {
12371   long q = 12345678901;
12372   printf("%ld\n", q);
12373 }
12374 EOCP
12375         set try
12376         if eval $compile; then
12377                 yyy=`./try$exe_ext`
12378                 case "$yyy" in
12379                 12345678901)
12380                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
12381                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
12382                         echo "We will use %ld."
12383                         ;;
12384                 esac
12385         fi
12386 fi
12387
12388 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
12389         $cat >try.c <<'EOCP'
12390 #include <sys/types.h>
12391 #include <inttypes.h>
12392 #include <stdio.h>
12393 int main() {
12394   int64_t q = 12345678901;
12395   printf("%" PRId64 "\n", q);
12396 }
12397 EOCP
12398         set try
12399         if eval $compile; then
12400                 yyy=`./try$exe_ext`
12401                 case "$yyy" in
12402                 12345678901)
12403                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
12404                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
12405                         echo "We will use the C9X style."
12406                         ;;
12407                 esac
12408         fi
12409 fi
12410
12411 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
12412         $cat >try.c <<'EOCP'
12413 #include <sys/types.h>
12414 #include <stdio.h>
12415 int main() {
12416   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
12417   printf("%lld\n", q);
12418 }
12419 EOCP
12420         set try
12421         if eval $compile; then
12422                 yyy=`./try$exe_ext`
12423                 case "$yyy" in
12424                 12345678901)
12425                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
12426                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
12427                         echo "We will use the %lld style."
12428                         ;;
12429                 esac
12430         fi
12431 fi
12432
12433 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12434         $cat >try.c <<EOCP
12435 #include <sys/types.h>
12436 #include <stdio.h>
12437 int main() {
12438   $quadtype q = 12345678901;
12439   printf("%Ld\n", q);
12440 }
12441 EOCP
12442         set try
12443         if eval $compile; then
12444                 yyy=`./try$exe_ext`
12445                 case "$yyy" in
12446                 12345678901)
12447                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
12448                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
12449                         echo "We will use %Ld."
12450                         ;;
12451                 esac
12452         fi
12453 fi
12454
12455 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
12456         $cat >try.c <<EOCP
12457 #include <sys/types.h>
12458 #include <stdio.h>
12459 int main() {
12460   $quadtype q = 12345678901;
12461   printf("%qd\n", q);
12462 }
12463 EOCP
12464         set try
12465         if eval $compile; then
12466                 yyy=`./try$exe_ext`
12467                 case "$yyy" in
12468                 12345678901)
12469                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
12470                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
12471                         echo "We will use %qd."
12472                         ;;
12473                 esac
12474         fi
12475 fi
12476
12477 if $test X"$sPRId64" = X; then
12478         echo "Cannot figure out how to print 64-bit integers." >&4
12479 fi
12480
12481 $rm -f try try.*
12482
12483 fi
12484
12485 case "$sPRId64" in
12486 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
12487         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
12488         ;;
12489 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
12490         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
12491         ;;
12492 esac
12493
12494
12495 echo " "
12496 $echo "Checking the format strings to be used for Perl's internal types..." >&4
12497
12498 if $test X"$ivsize" = X8; then
12499         ivdformat="$sPRId64"
12500         uvuformat="$sPRIu64"
12501         uvoformat="$sPRIo64"
12502         uvxformat="$sPRIx64"
12503 else
12504         if $test X"$ivsize" = X"$longsize"; then
12505                 ivdformat='"ld"'
12506                 uvuformat='"lu"'
12507                 uvoformat='"lo"'
12508                 uvxformat='"lx"'
12509         else
12510                 if $test X"$ivsize" = X"$intsize"; then
12511                         ivdformat='"d"'
12512                         uvuformat='"u"'
12513                         uvoformat='"o"'
12514                         uvxformat='"x"'
12515                 else
12516                         : far out
12517                         if $test X"$ivsize" = X"$shortsize"; then
12518                                 ivdformat='"hd"'
12519                                 uvuformat='"hu"'
12520                                 uvoformat='"ho"'
12521                                 uvxformat='"hx"'
12522                         fi
12523                 fi
12524         fi
12525 fi
12526
12527 case "$ivdformat" in
12528 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
12529     exit 1
12530     ;;
12531 esac
12532
12533
12534 echo " "
12535 $echo "Checking the format string to be used for gids..." >&4
12536
12537 case "$gidsign" in
12538 -1)     if $test X"$gidsize" = X"$ivsize"; then
12539                 gidformat="$ivdformat"
12540         else
12541                 if $test X"$gidsize" = X"$longsize"; then
12542                         gidformat='"ld"'
12543                 else
12544                         if $test X"$gidsize" = X"$intsize"; then
12545                                 gidformat='"d"'
12546                         else
12547                                 if $test X"$gidsize" = X"$shortsize"; then
12548                                         gidformat='"hd"'
12549                                 fi
12550                         fi
12551                 fi
12552         fi
12553         ;;
12554 *)      if $test X"$gidsize" = X"$uvsize"; then
12555                 gidformat="$uvuformat"
12556         else
12557                 if $test X"$gidsize" = X"$longsize"; then
12558                         gidformat='"lu"'
12559                 else
12560                         if $test X"$gidsize" = X"$intsize"; then
12561                                 gidformat='"u"'
12562                         else
12563                                 if $test X"$gidsize" = X"$shortsize"; then
12564                                         gidformat='"hu"'
12565                                 fi
12566                         fi
12567                 fi
12568         fi
12569         ;;
12570 esac
12571
12572 : see if getgroups exists
12573 set getgroups d_getgrps
12574 eval $inlibc
12575
12576 : see if setgroups exists
12577 set setgroups d_setgrps
12578 eval $inlibc
12579
12580
12581 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
12582 echo " "
12583 case "$d_getgrps$d_setgrps" in
12584 *define*)
12585         case "$groupstype" in
12586         '') dflt="$gidtype" ;;
12587         *)  dflt="$groupstype" ;;
12588         esac
12589         $cat <<EOM
12590 What type of pointer is the second argument to getgroups() and setgroups()?
12591 Usually this is the same as group ids, $gidtype, but not always.
12592
12593 EOM
12594         rp='What type pointer is the second argument to getgroups() and setgroups()?'
12595         . ./myread
12596         groupstype="$ans"
12597         ;;
12598 *)  groupstype="$gidtype";;
12599 esac
12600
12601 echo " "
12602 echo "Checking if your $make program sets \$(MAKE)..." >&4
12603 case "$make_set_make" in
12604 '')
12605         $sed 's/^X //' > testmake.mak << 'EOF'
12606 Xall:
12607 X       @echo 'maketemp="$(MAKE)"'
12608 EOF
12609         case "`$make -f testmake.mak 2>/dev/null`" in
12610         *maketemp=*) make_set_make='#' ;;
12611         *)      make_set_make="MAKE=$make" ;;
12612         esac
12613         $rm -f testmake.mak
12614         ;;
12615 esac
12616 case "$make_set_make" in
12617 '#') echo "Yup, it does.";;
12618 *) echo "Nope, it doesn't.";;
12619 esac
12620
12621 : see what type is used for mode_t
12622 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
12623 set mode_t modetype int stdio.h sys/types.h
12624 eval $typedef_ask
12625
12626 : define a fucntion to check prototypes
12627 $cat > protochk <<EOSH
12628 $startsh
12629 cc="$cc"
12630 optimize="$optimize"
12631 ccflags="$ccflags"
12632 prototype="$prototype"
12633 define="$define"
12634 rm=$rm
12635 EOSH
12636
12637 $cat >> protochk <<'EOSH'
12638
12639 $rm -f try.c
12640 foo="$1"
12641 shift
12642 while test $# -ge 2; do
12643         case "$1" in
12644                 $define) echo "#include <$2>" >> try.c ;;
12645                 literal) echo "$2" >> try.c ;;
12646         esac
12647     shift 2
12648 done
12649 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
12650 cat >> try.c <<'EOCP'
12651 #ifdef CAN_PROTOTYPE
12652 #define _(args) args
12653 #else
12654 #define _(args) ()
12655 #endif
12656 EOCP
12657 echo "$foo" >> try.c
12658 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
12659 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
12660 status=$?
12661 $rm -f try.[co]
12662 exit $status
12663 EOSH
12664 chmod +x protochk
12665 $eunicefix protochk
12666
12667 : see what type is used for size_t
12668 rp="What is the type used for the length parameter for string functions?"
12669 set size_t sizetype 'unsigned int' stdio.h sys/types.h
12670 eval $typedef_ask
12671
12672 : check for type of arguments to gethostbyaddr. 
12673 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
12674         case "$d_gethbyaddr" in
12675         $define)
12676                 $cat <<EOM
12677
12678 Checking to see what type of arguments are accepted by gethostbyaddr().
12679 EOM
12680                 hdrs="$define sys/types.h
12681                         $d_socket sys/socket.h 
12682                         $i_niin netinet/in.h 
12683                         $i_netdb netdb.h
12684                         $i_unistd unistd.h"
12685                 : The first arg can 'char *' or 'void *'
12686                 : The second arg is some of integral type
12687                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
12688                         for yyy in size_t long int; do
12689                                 case "$netdb_host_type" in
12690                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
12691                                         if ./protochk "$try" $hdrs; then
12692                                                 echo "Your system accepts $xxx for the first arg."
12693                                                 echo "...and $yyy for the second arg."
12694                                                 netdb_host_type="$xxx"
12695                                                 netdb_hlen_type="$yyy"
12696                                         fi
12697                                         ;;
12698                                 esac
12699                         done
12700                 done
12701                 : In case none of those worked, prompt the user.
12702                 case "$netdb_host_type" in
12703                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
12704                         dflt='char *'
12705                         . ./myread
12706                         netdb_host_type=$ans
12707                         rp='What is the type for the 2nd argument to gethostbyaddr?'
12708                         dflt="$sizetype"
12709                         . ./myread
12710                         netdb_hlen_type=$ans
12711                         ;;
12712                 esac
12713                 ;;
12714         *)      : no gethostbyaddr, so pick harmless defaults
12715                 netdb_host_type='char *'
12716                 netdb_hlen_type="$sizetype"
12717                 ;;
12718         esac
12719         # Remove the "const" if needed. -- but then we'll have a 
12720         # prototype clash!
12721         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
12722 fi
12723
12724 : check for type of argument to gethostbyname. 
12725 if test "X$netdb_name_type" = X ; then
12726         case "$d_gethbyname" in
12727         $define)
12728                 $cat <<EOM
12729
12730 Checking to see what type of argument is accepted by gethostbyname().
12731 EOM
12732                 hdrs="$define sys/types.h
12733                         $d_socket sys/socket.h 
12734                         $i_niin netinet/in.h 
12735                         $i_netdb netdb.h
12736                         $i_unistd unistd.h"
12737                 for xxx in "const char *" "char *"; do
12738                         case "$netdb_name_type" in
12739                         '')     try="extern struct hostent *gethostbyname($xxx);"
12740                                 if ./protochk "$try" $hdrs; then
12741                                         echo "Your system accepts $xxx."
12742                                         netdb_name_type="$xxx"
12743                                 fi
12744                                 ;;
12745                         esac
12746                 done
12747                 : In case none of those worked, prompt the user.
12748                 case "$netdb_name_type" in
12749                 '')     rp='What is the type for the 1st argument to gethostbyname?'
12750                         dflt='char *'
12751                         . ./myread
12752                         netdb_name_type=$ans
12753                         ;;
12754                 esac
12755                 ;;
12756         *)      : no gethostbyname, so pick harmless default
12757                 netdb_name_type='char *'
12758                 ;;
12759         esac
12760 fi
12761
12762 : check for type of 1st argument to getnetbyaddr. 
12763 if test "X$netdb_net_type" = X ; then
12764         case "$d_getnbyaddr" in
12765         $define)
12766                 $cat <<EOM
12767
12768 Checking to see what type of 1st argument is accepted by getnetbyaddr().
12769 EOM
12770                 hdrs="$define sys/types.h
12771                         $d_socket sys/socket.h 
12772                         $i_niin netinet/in.h 
12773                         $i_netdb netdb.h
12774                         $i_unistd unistd.h"
12775                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
12776                         case "$netdb_net_type" in
12777                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
12778                                 if ./protochk "$try" $hdrs; then
12779                                         echo "Your system accepts $xxx."
12780                                         netdb_net_type="$xxx"
12781                                 fi
12782                                 ;;
12783                         esac
12784                 done
12785                 : In case none of those worked, prompt the user.
12786                 case "$netdb_net_type" in
12787                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
12788                         dflt='long'
12789                         . ./myread
12790                         netdb_net_type=$ans
12791                         ;;
12792                 esac
12793                 ;;
12794         *)      : no getnetbyaddr, so pick harmless default
12795                 netdb_net_type='long'
12796                 ;;
12797         esac
12798 fi
12799 : locate the preferred pager for this system
12800 case "$pager" in
12801 '')
12802         dflt=''
12803         case "$pg" in
12804         /*) dflt=$pg;;
12805         esac
12806         case "$more" in
12807         /*) dflt=$more;;
12808         esac
12809         case "$less" in
12810         /*) dflt=$less;;
12811         esac
12812         case "$dflt" in
12813         '') dflt=/usr/ucb/more;;
12814         esac
12815         ;;
12816 *) dflt="$pager";;
12817 esac
12818 echo " "
12819 fn=f/
12820 rp='What pager is used on your system?'
12821 . ./getfile
12822 pager="$ans"
12823
12824 : see what type pids are declared as in the kernel
12825 rp="What is the type of process ids on this system?"
12826 set pid_t pidtype int stdio.h sys/types.h
12827 eval $typedef_ask
12828
12829 : check for length of pointer
12830 echo " "
12831 case "$ptrsize" in
12832 '')
12833         $echo $n "Checking to see how big your pointers are...$c" >&4
12834         if test "$voidflags" -gt 7; then
12835                 echo '#define VOID_PTR char *' > try.c
12836         else
12837                 echo '#define VOID_PTR void *' > try.c
12838         fi
12839         $cat >>try.c <<'EOCP'
12840 #include <stdio.h>
12841 int main()
12842 {
12843     printf("%d\n", (int)sizeof(VOID_PTR));
12844     exit(0);
12845 }
12846 EOCP
12847         set try
12848         if eval $compile_ok; then
12849                 ptrsize=`./try`
12850                 $echo " $ptrsize bytes." >&4
12851         else
12852                 dflt='4'
12853                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12854                 rp="What is the size of a pointer (in bytes)?"
12855                 . ./myread
12856                 ptrsize="$ans"
12857         fi
12858         ;;
12859 esac
12860 $rm -f try.c try
12861
12862 : see if ar generates random libraries by itself
12863 echo " "
12864 echo "Checking how to generate random libraries on your machine..." >&4
12865 echo 'int bar1() { return bar2(); }' > bar1.c
12866 echo 'int bar2() { return 2; }' > bar2.c
12867 $cat > foo.c <<'EOP'
12868 int main() { printf("%d\n", bar1()); exit(0); }
12869 EOP
12870 $cc $ccflags -c bar1.c >/dev/null 2>&1
12871 $cc $ccflags -c bar2.c >/dev/null 2>&1
12872 $cc $ccflags -c foo.c >/dev/null 2>&1
12873 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12874 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12875         ./foobar >/dev/null 2>&1; then
12876         echo "$ar appears to generate random libraries itself."
12877         orderlib=false
12878         ranlib=":"
12879 elif $ar ts bar$_a >/dev/null 2>&1 &&
12880         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12881         ./foobar >/dev/null 2>&1; then
12882                 echo "a table of contents needs to be added with '$ar ts'."
12883                 orderlib=false
12884                 ranlib="$ar ts"
12885 else
12886         case "$ranlib" in
12887         :) ranlib='';;
12888         '')
12889                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12890                 $test -f $ranlib || ranlib=''
12891                 ;;
12892         esac
12893         if $test -n "$ranlib"; then
12894                 echo "your system has '$ranlib'; we'll use that."
12895                 orderlib=false
12896         else
12897                 echo "your system doesn't seem to support random libraries"
12898                 echo "so we'll use lorder and tsort to order the libraries."
12899                 orderlib=true
12900                 ranlib=":"
12901         fi
12902 fi
12903 $rm -f foo* bar* 
12904
12905 : check for type of arguments to select. 
12906 case "$selecttype" in
12907 '') case "$d_select" in
12908         $define)
12909                 echo " "
12910                 $cat <<EOM
12911 Checking to see what type of arguments are accepted by select().
12912 EOM
12913                 hdrs="$define sys/types.h
12914                         $i_systime sys/time.h 
12915                         $i_sysselct sys/select.h
12916                         $d_socket sys/socket.h"
12917                 : The first arg can be int, unsigned, or size_t
12918                 : The last arg may or may not be 'const'
12919                 val=''
12920                 : void pointer has been seen but using that
12921                 : breaks the selectminbits test
12922                 for xxx in 'fd_set *' 'int *'; do
12923                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12924                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12925                                         case "$val" in
12926                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12927                                                 if ./protochk "$try" $hdrs; then
12928                                                         echo "Your system accepts $xxx."
12929                                                         val="$xxx"
12930                                                 fi
12931                                                 ;;
12932                                         esac
12933                                 done
12934                         done
12935                 done
12936                 case "$val" in
12937                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12938                         case "$d_fd_set" in
12939                                 $define) dflt="fd_set *" ;;
12940                                 *)              dflt="int *" ;;
12941                         esac
12942                         . ./myread
12943                         val=$ans
12944                         ;;
12945                 esac
12946                 selecttype="$val"
12947                 ;;
12948         *)      : no select, so pick a harmless default
12949                 selecttype='int *'
12950                 ;;
12951         esac
12952         ;;
12953 esac
12954
12955 : check for the select 'width'
12956 case "$selectminbits" in
12957 '') case "$d_select" in
12958         $define)
12959                 $cat <<EOM
12960
12961 Checking to see on how many bits at a time your select() operates...
12962 EOM
12963                 $cat >try.c <<EOCP
12964 #include <sys/types.h>
12965 #$i_time I_TIME
12966 #$i_systime I_SYS_TIME
12967 #$i_systimek I_SYS_TIME_KERNEL
12968 #ifdef I_TIME
12969 #   include <time.h>
12970 #endif
12971 #ifdef I_SYS_TIME
12972 #   ifdef I_SYS_TIME_KERNEL
12973 #       define KERNEL
12974 #   endif
12975 #   include <sys/time.h>
12976 #   ifdef I_SYS_TIME_KERNEL
12977 #       undef KERNEL
12978 #   endif
12979 #endif
12980 #$i_sysselct I_SYS_SELECT
12981 #ifdef I_SYS_SELECT
12982 #include <sys/select.h>
12983 #endif
12984 #$d_socket HAS_SOCKET
12985 #ifdef HAS_SOCKET
12986 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12987 #endif
12988 #include <stdio.h>
12989 $selecttype b;
12990 #define S sizeof(*(b))
12991 #define MINBITS 64
12992 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12993 #define NBITS  (NBYTES * 8)
12994 int main() {
12995     char s[NBYTES];
12996     struct timeval t;
12997     int i;
12998     FILE* fp;
12999     int fd;
13000
13001     fclose(stdin);
13002     fp = fopen("try.c", "r");
13003     if (fp == 0)
13004       exit(1);
13005     fd = fileno(fp);
13006     if (fd < 0)
13007       exit(2);
13008     b = ($selecttype)s;
13009     for (i = 0; i < NBITS; i++)
13010         FD_SET(i, b);
13011     t.tv_sec  = 0;
13012     t.tv_usec = 0;
13013     select(fd + 1, b, 0, 0, &t);
13014     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
13015     printf("%d\n", i + 1);
13016     return 0;
13017 }
13018 EOCP
13019                 set try
13020                 if eval $compile_ok; then
13021                         selectminbits=`./try`
13022                         case "$selectminbits" in
13023                         '')     cat >&4 <<EOM
13024 Cannot figure out on how many bits at a time your select() operates.
13025 I'll play safe and guess it is 32 bits.
13026 EOM
13027                                 selectminbits=32
13028                                 bits="32 bits"
13029                                 ;;
13030                         1)      bits="1 bit" ;;
13031                         *)      bits="$selectminbits bits" ;;
13032                         esac
13033                         echo "Your select() operates on $bits at a time." >&4
13034                 else
13035                         rp='What is the minimum number of bits your select() operates on?'
13036                         case "$byteorder" in
13037                         1234|12345678)  dflt=32 ;;
13038                         *)              dflt=1  ;;
13039                         esac
13040                         . ./myread
13041                         val=$ans
13042                         selectminbits="$val"
13043                 fi
13044                 $rm -f try.* try
13045                 ;;
13046         *)      : no select, so pick a harmless default
13047                 selectminbits='32'
13048                 ;;
13049         esac
13050         ;;
13051 esac
13052
13053 : Trace out the files included by signal.h, then look for SIGxxx names.
13054 : Remove SIGARRAYSIZE used by HPUX.
13055 : Remove SIGSTKSIZE used by Linux.
13056 : Remove SIGSTKSZ used by Posix.
13057 : Remove SIGTYP void lines used by OS2.
13058 : Some cpps, like os390, dont give the file name anywhere
13059 if [ "X$fieldn" = X ]; then
13060         : Just make some guesses.  We check them later.
13061         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
13062 else
13063         xxx=`echo '#include <signal.h>' |
13064         $cppstdin $cppminus $cppflags 2>/dev/null |
13065         $grep '^[       ]*#.*include' | 
13066         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
13067 fi
13068 : Check this list of files to be sure we have parsed the cpp output ok.
13069 : This will also avoid potentially non-existent files, such 
13070 : as ../foo/bar.h
13071 xxxfiles=''
13072 for xx in $xxx /dev/null ; do
13073         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
13074 done
13075 : If we have found no files, at least try signal.h
13076 case "$xxxfiles" in
13077 '')     xxxfiles=`./findhdr signal.h` ;;
13078 esac
13079 xxx=`awk '
13080 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
13081         print substr($2, 4, 20)
13082 }
13083 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
13084         print substr($3, 4, 20)
13085 }' $xxxfiles`
13086 : Append some common names just in case the awk scan failed.
13087 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
13088 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
13089 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
13090 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
13091 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
13092
13093 : generate a few handy files for later
13094 $cat > signal.c <<'EOCP'
13095 #include <sys/types.h>
13096 #include <signal.h>
13097 #include <stdio.h>
13098 int main() {
13099
13100 /* Strange style to avoid deeply-nested #if/#else/#endif */
13101 #ifndef NSIG
13102 #  ifdef _NSIG
13103 #    define NSIG (_NSIG)
13104 #  endif
13105 #endif
13106
13107 #ifndef NSIG
13108 #  ifdef SIGMAX
13109 #    define NSIG (SIGMAX+1)
13110 #  endif
13111 #endif
13112
13113 #ifndef NSIG
13114 #  ifdef SIG_MAX
13115 #    define NSIG (SIG_MAX+1)
13116 #  endif
13117 #endif
13118
13119 #ifndef NSIG
13120 #  ifdef MAXSIG
13121 #    define NSIG (MAXSIG+1)
13122 #  endif
13123 #endif
13124
13125 #ifndef NSIG
13126 #  ifdef MAX_SIG
13127 #    define NSIG (MAX_SIG+1)
13128 #  endif
13129 #endif
13130
13131 #ifndef NSIG
13132 #  ifdef SIGARRAYSIZE
13133 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
13134 #  endif
13135 #endif
13136
13137 #ifndef NSIG
13138 #  ifdef _sys_nsig
13139 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
13140 #  endif
13141 #endif
13142
13143 /* Default to some arbitrary number that's big enough to get most
13144    of the common signals.
13145 */
13146 #ifndef NSIG
13147 #    define NSIG 50
13148 #endif
13149
13150 printf("NSIG %d\n", NSIG);
13151
13152 #ifndef JUST_NSIG
13153
13154 EOCP
13155
13156 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
13157 {
13158         printf "#ifdef SIG"; printf $1; printf "\n"
13159         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
13160         printf $1; printf ");\n"
13161         printf "#endif\n"
13162 }
13163 END {
13164         printf "#endif /* JUST_NSIG */\n";
13165         printf "exit(0);\n}\n";
13166 }
13167 ' >>signal.c
13168 $cat >signal.awk <<'EOP'
13169 BEGIN { ndups = 0 }
13170 $1 ~ /^NSIG$/ { nsig = $2 }
13171 ($1 !~ /^NSIG$/) && (NF == 2) {
13172     if ($2 > maxsig) { maxsig = $2 }
13173     if (sig_name[$2]) {
13174         dup_name[ndups] = $1
13175         dup_num[ndups] = $2
13176         ndups++ 
13177     }
13178     else {
13179         sig_name[$2] = $1
13180         sig_num[$2] = $2
13181     }
13182 }
13183 END { 
13184     if (nsig == 0) {
13185         nsig = maxsig + 1
13186     }
13187     printf("NSIG %d\n", nsig);
13188     for (n = 1; n < nsig; n++) {
13189         if (sig_name[n]) {
13190             printf("%s %d\n", sig_name[n], sig_num[n])
13191         }
13192         else {
13193             printf("NUM%d %d\n", n, n) 
13194         }
13195     }
13196     for (n = 0; n < ndups; n++) {
13197         printf("%s %d\n", dup_name[n], dup_num[n])
13198     }
13199 }
13200 EOP
13201 $cat >signal_cmd <<EOS
13202 $startsh
13203 if $test -s signal.lst; then
13204     echo "Using your existing signal.lst file"
13205         exit 0
13206 fi
13207 xxx="$xxx"
13208 EOS
13209 $cat >>signal_cmd <<'EOS'
13210
13211 set signal
13212 if eval $compile_ok; then
13213         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13214 else
13215         echo "(I can't seem be able to compile the whole test program)" >&4
13216         echo "(I'll try it in little pieces.)" >&4
13217         set signal -DJUST_NSIG
13218         if eval $compile_ok; then
13219                 ./signal$_exe > signal.nsg
13220                 $cat signal.nsg
13221         else
13222                 echo "I can't seem to figure out how many signals you have." >&4
13223                 echo "Guessing 50." >&4
13224                 echo 'NSIG 50' > signal.nsg
13225         fi
13226         : Now look at all the signal names, one at a time.
13227         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
13228                 $cat > signal.c <<EOCP
13229 #include <sys/types.h>
13230 #include <signal.h>
13231 #include <stdio.h>
13232 int main() {
13233 printf("$xx %d\n", SIG${xx});
13234 return 0;
13235 }
13236 EOCP
13237                 set signal
13238                 if eval $compile; then
13239                         echo "SIG${xx} found."
13240                         ./signal$_exe  >> signal.ls1
13241                 else
13242                         echo "SIG${xx} NOT found."
13243                 fi
13244         done
13245         if $test -s signal.ls1; then
13246                 $cat signal.nsg signal.ls1 |
13247                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
13248         fi
13249
13250 fi
13251 if $test -s signal.lst; then
13252         :
13253 else
13254         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
13255         echo 'kill -l' >signal
13256         set X `csh -f <signal`
13257         $rm -f signal
13258         shift
13259         case $# in
13260         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
13261         esac
13262         echo $@ | $tr ' ' $trnl | \
13263             $awk '{ printf "%s %d\n", $1, ++s; }
13264                   END { printf "NSIG %d\n", ++s }' >signal.lst
13265 fi
13266 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
13267 EOS
13268 chmod a+x signal_cmd
13269 $eunicefix signal_cmd
13270
13271 : generate list of signal names
13272 echo " "
13273 case "$sig_name_init" in
13274 '') doinit=yes ;;
13275 *)  case "$sig_num_init" in
13276     ''|*,*) doinit=yes ;;
13277     esac ;;
13278 esac
13279 case "$doinit" in
13280 yes)
13281         echo "Generating a list of signal names and numbers..." >&4
13282         . ./signal_cmd
13283         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
13284         sig_name=`$awk 'BEGIN { printf "ZERO " }
13285                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
13286         sig_num=`$awk  'BEGIN { printf "0 " }
13287                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
13288         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
13289                              !/^NSIG/   { printf "\"%s\", ", $1 }
13290                              END        { printf "0\n" }' signal.lst`
13291         sig_num_init=`$awk  'BEGIN      { printf "0, " }
13292                              !/^NSIG/   { printf "%d, ", $2}
13293                              END        { printf "0\n"}' signal.lst`
13294         ;;
13295 esac
13296 echo "The following $sig_count signals are available:"
13297 echo " "
13298 echo $sig_name | $awk \
13299 'BEGIN { linelen = 0 }
13300 {
13301         for (i = 1; i <= NF; i++) {
13302                 name = "SIG" $i " "
13303                 linelen = linelen + length(name)
13304                 if (linelen > 70) {
13305                         printf "\n"
13306                         linelen = length(name)
13307                 }
13308                 printf "%s", name
13309         }
13310         printf "\n"
13311 }'
13312 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
13313
13314 : see what type is used for signed size_t
13315 set ssize_t ssizetype int stdio.h sys/types.h
13316 eval $typedef
13317 dflt="$ssizetype"
13318 $cat > ssize.c <<EOM
13319 #include <stdio.h>
13320 #include <sys/types.h>
13321 #define Size_t $sizetype
13322 #define SSize_t $dflt
13323 int main()
13324 {
13325         if (sizeof(Size_t) == sizeof(SSize_t))
13326                 printf("$dflt\n");
13327         else if (sizeof(Size_t) == sizeof(int))
13328                 printf("int\n");
13329         else 
13330                 printf("long\n");
13331         exit(0);
13332 }
13333 EOM
13334 echo " "
13335 set ssize
13336 if eval $compile_ok && ./ssize > /dev/null; then
13337         ssizetype=`./ssize`
13338         echo "I'll be using $ssizetype for functions returning a byte count." >&4
13339 else
13340         $cat >&4 <<EOM
13341 Help! I can't compile and run the ssize_t test program: please enlighten me!
13342 (This is probably a misconfiguration in your system or libraries, and
13343 you really ought to fix it.  Still, I'll try anyway.)
13344
13345 I need a type that is the same size as $sizetype, but is guaranteed to
13346 be signed.  Common values are ssize_t, int and long.
13347
13348 EOM
13349         rp="What signed type is the same size as $sizetype?"
13350         . ./myread
13351         ssizetype="$ans"
13352 fi
13353 $rm -f ssize ssize.*
13354
13355 : see what type of char stdio uses.
13356 echo " "
13357 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13358         echo "Your stdio uses unsigned chars." >&4
13359         stdchar="unsigned char"
13360 else
13361         echo "Your stdio uses signed chars." >&4
13362         stdchar="char"
13363 fi
13364
13365 : see if time exists
13366 echo " "
13367 if test "X$d_time" = X -o X"$timetype" = X; then
13368     if set time val -f d_time; eval $csym; $val; then
13369                 echo 'time() found.' >&4
13370                 val="$define"
13371                 rp="What is the type returned by time() on this system?"
13372                 set time_t timetype long stdio.h sys/types.h
13373                 eval $typedef_ask
13374     else
13375                 echo 'time() not found, hope that will do.' >&4
13376                 val="$undef"
13377                 timetype='int';
13378     fi
13379     set d_time
13380     eval $setvar
13381 fi
13382
13383 : see what type uids are declared as in the kernel
13384 echo " "
13385 echo "Looking for the type for user ids returned by getuid()."
13386 set uid_t uidtype xxx stdio.h sys/types.h
13387 eval $typedef
13388 case "$uidtype" in
13389 xxx)
13390         xxx=`./findhdr sys/user.h`
13391         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
13392         case $1 in
13393         unsigned) dflt="$1 $2" ;;
13394         *) dflt="$1" ;;
13395         esac
13396         ;;
13397 *) dflt="$uidtype";;
13398 esac
13399 case "$uidtype" in
13400 uid_t)  echo "uid_t found." ;;
13401 *)      rp="What is the type for user ids returned by getuid()?"
13402         . ./myread
13403         uidtype="$ans"
13404         ;;
13405 esac
13406
13407 echo " "
13408 case "$uidtype" in
13409 *_t) zzz="$uidtype"     ;;
13410 *)   zzz="uid"          ;;
13411 esac
13412 echo "Checking the size of $zzz..." >&4 
13413 cat > try.c <<EOCP
13414 #include <sys/types.h>
13415 #include <stdio.h>
13416 int main() {
13417     printf("%d\n", (int)sizeof($uidtype));
13418     exit(0);
13419 }
13420 EOCP
13421 set try
13422 if eval $compile_ok; then
13423         yyy=`./try`
13424         case "$yyy" in
13425         '')     uidsize=4
13426                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
13427                 ;;
13428         *)      uidsize=$yyy
13429                 echo "Your $zzz size is $uidsize bytes."
13430                 ;;
13431         esac
13432 else
13433         uidsize=4
13434         echo "(I can't compile the test program--guessing $uidsize.)" >&4
13435 fi
13436
13437 echo " "
13438 case "$uidtype" in
13439 *_t) zzz="$uidtype"     ;;
13440 *)   zzz="uid"          ;;
13441 esac
13442 echo "Checking the sign of $zzz..." >&4
13443 cat > try.c <<EOCP
13444 #include <sys/types.h>
13445 #include <stdio.h>
13446 int main() {
13447         $uidtype foo = -1;
13448         if (foo < 0)
13449                 printf("-1\n");
13450         else
13451                 printf("1\n");
13452 }
13453 EOCP
13454 set try
13455 if eval $compile; then
13456         yyy=`./try`
13457         case "$yyy" in
13458         '')     uidsign=1
13459                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13460                 ;;
13461         *)      uidsign=$yyy
13462                 case "$uidsign" in
13463                  1) echo "Your $zzz is unsigned." ;;
13464                 -1) echo "Your $zzz is signed."   ;;
13465                 esac
13466                 ;;
13467         esac
13468 else
13469         uidsign=1
13470         echo "(I can't compile the test program--guessing unsigned.)" >&4
13471 fi
13472
13473
13474
13475 echo " "
13476 $echo "Checking the format string to be used for uids..." >&4
13477
13478 case "$uidsign" in
13479 -1)     if $test X"$uidsize" = X"$ivsize"; then
13480                 uidformat="$ivdformat"
13481         else
13482                 if $test X"$uidsize" = X"$longsize"; then
13483                         uidformat='"ld"'
13484                 else
13485                         if $test X"$uidsize" = X"$intsize"; then
13486                                 uidformat='"d"'
13487                         else
13488                                 if $test X"$uidsize" = X"$shortsize"; then
13489                                         uidformat='"hd"'
13490                                 fi
13491                         fi
13492                 fi
13493         fi
13494         ;;
13495 *)      if $test X"$uidsize" = X"$uvsize"; then
13496                 uidformat="$uvuformat"
13497         else
13498                 if $test X"$uidsize" = X"$longsize"; then
13499                         uidformat='"lu"'
13500                 else
13501                         if $test X"$uidsize" = X"$intsize"; then
13502                                 uidformat='"u"'
13503                         else
13504                                 if $test X"$uidsize" = X"$shortsize"; then
13505                                         uidformat='"hu"'
13506                                 fi
13507                         fi
13508                 fi
13509         fi
13510         ;;
13511 esac
13512
13513 : see if dbm.h is available
13514 : see if dbmclose exists
13515 set dbmclose d_dbmclose
13516 eval $inlibc
13517
13518 case "$d_dbmclose" in
13519 $define)
13520         set dbm.h i_dbm
13521         eval $inhdr
13522         case "$i_dbm" in
13523         $define)
13524                 val="$undef"
13525                 set i_rpcsvcdbm
13526                 eval $setvar
13527                 ;;
13528         *)      set rpcsvc/dbm.h i_rpcsvcdbm
13529                 eval $inhdr
13530                 ;;
13531         esac
13532         ;;
13533 *)      echo "We won't be including <dbm.h>"
13534         val="$undef"
13535         set i_dbm
13536         eval $setvar
13537         val="$undef"
13538         set i_rpcsvcdbm
13539         eval $setvar
13540         ;;
13541 esac
13542
13543 : see if this is a sys/file.h system
13544 val=''
13545 set sys/file.h val
13546 eval $inhdr
13547
13548 : do we need to include sys/file.h ?
13549 case "$val" in
13550 "$define")
13551         echo " "
13552         if $h_sysfile; then
13553                 val="$define"
13554                 echo "We'll be including <sys/file.h>." >&4
13555         else
13556                 val="$undef"
13557                 echo "We won't be including <sys/file.h>." >&4
13558         fi
13559         ;;
13560 *)
13561         h_sysfile=false
13562         ;;
13563 esac
13564 set i_sysfile
13565 eval $setvar
13566
13567 : see if fcntl.h is there
13568 val=''
13569 set fcntl.h val
13570 eval $inhdr
13571
13572 : see if we can include fcntl.h
13573 case "$val" in
13574 "$define")
13575         echo " "
13576         if $h_fcntl; then
13577                 val="$define"
13578                 echo "We'll be including <fcntl.h>." >&4
13579         else
13580                 val="$undef"
13581                 if $h_sysfile; then
13582         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13583                 else
13584                         echo "We won't be including <fcntl.h>." >&4
13585                 fi
13586         fi
13587         ;;
13588 *)
13589         h_fcntl=false
13590         val="$undef"
13591         ;;
13592 esac
13593 set i_fcntl
13594 eval $setvar
13595
13596 : see if this is a iconv.h system
13597 set iconv.h i_iconv
13598 eval $inhdr
13599
13600 : see if locale.h is available
13601 set locale.h i_locale
13602 eval $inhdr
13603
13604 : see if mach cthreads are available
13605 if test "X$usethreads" = "X$define"; then
13606         set mach/cthreads.h i_machcthr
13607         eval $inhdr
13608 else
13609         i_machcthr="$undef"
13610 fi
13611
13612
13613
13614 : see if this is a math.h system
13615 set math.h i_math
13616 eval $inhdr
13617
13618 : see if this is a mntent.h system
13619 set mntent.h i_mntent
13620 eval $inhdr
13621
13622 : see if ndbm.h is available
13623 set ndbm.h t_ndbm
13624 eval $inhdr
13625 case "$t_ndbm" in
13626 $define)
13627         : see if dbm_open exists
13628         set dbm_open d_dbm_open
13629         eval $inlibc
13630         case "$d_dbm_open" in
13631         $undef)
13632                 t_ndbm="$undef"
13633                 echo "We won't be including <ndbm.h>"
13634                 ;;
13635         esac
13636         ;;
13637 esac
13638 val="$t_ndbm"
13639 set i_ndbm
13640 eval $setvar
13641
13642 : see if net/errno.h is available
13643 val=''
13644 set net/errno.h val
13645 eval $inhdr
13646
13647 : Unfortunately, it causes problems on some systems.  Arrgh.
13648 case "$val" in
13649 $define)
13650         cat > try.c <<'EOM'
13651 #include <stdio.h>
13652 #include <errno.h>
13653 #include <net/errno.h>
13654 int func()
13655 {
13656         return ENOTSOCK;
13657 }
13658 EOM
13659         if $cc $ccflags -c try.c >/dev/null 2>&1; then
13660                 echo "We'll be including <net/errno.h>." >&4
13661         else
13662                 echo "We won't be including <net/errno.h>." >&4
13663                 val="$undef"
13664         fi
13665         $rm -f try.* try
13666         ;;
13667 esac
13668 set i_neterrno
13669 eval $setvar
13670
13671 : see if netinet/tcp.h is available
13672 set netinet/tcp.h i_netinettcp
13673 eval $inhdr
13674
13675 : see if this is a poll.h system
13676 set poll.h i_poll
13677 eval $inhdr
13678
13679 echo " "
13680 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
13681 $cat <<'EOSH' > Cppsym.know
13682 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
13683 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
13684 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
13685 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
13686 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
13687 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
13688 bull c cadmus clipper CMU COFF COMPILER_VERSION
13689 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
13690 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
13691 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
13692 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
13693 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
13694 H3050R H3050RX hbullx20 hcx host_mips
13695 hp200 hp300 hp700 HP700 hp800 hp9000
13696 hp9000s200 hp9000s300 hp9000s400 hp9000s500
13697 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
13698 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
13699 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
13700 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
13701 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
13702 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
13703 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
13704 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
13705 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
13706 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
13707 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
13708 MATH_HAS_NO_SIDE_EFFECTS
13709 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
13710 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
13711 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
13712 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
13713 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
13714 NetBSD news1500 news1700 news1800 news1900 news3700
13715 news700 news800 news900 NeXT NLS ns16000 ns32000
13716 ns32016 ns32332 ns32k nsc32000
13717 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
13718 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
13719 pc532 pdp11 PGC PIC plexus PORTAR posix
13720 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
13721 POSIX_C_SOURCE POSIX_SOURCE POWER
13722 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
13723 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
13724 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
13725 sony sony_news sonyrisc sparc sparclite spectrum
13726 stardent stdc STDC_EXT stratos sun sun3 sun386
13727 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
13728 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
13729 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
13730 sysV68 sysV88 Tek4132 Tek4300 titan
13731 tower tower32 tower32_200 tower32_600 tower32_700
13732 tower32_800 tower32_850 tss
13733 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
13734 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
13735 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
13736 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
13737 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
13738 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
13739 z8000
13740 EOSH
13741 # Maybe put other stuff here too.
13742 cat <<EOSH >>Cppsym.know
13743 $osname
13744 EOSH
13745 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
13746 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
13747 $cat Cppsym.a Cppsym.b | $tr ' ' $trnl | sort | uniq > Cppsym.know
13748 $rm -f Cppsym.a Cppsym.b
13749 cat <<EOSH > Cppsym
13750 $startsh
13751 if $test \$# -gt 0; then
13752     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
13753     if $test -s Cppsym.got; then
13754         $rm -f Cppsym.got
13755         exit 0
13756     fi
13757     $rm -f Cppsym.got
13758     exit 1
13759 else
13760     $tr " " "$trnl" | ./Cppsym.try
13761     exit 0
13762 fi
13763 EOSH
13764 chmod +x Cppsym
13765 $eunicefix Cppsym
13766 cat <<EOSH > Cppsym.try
13767 $startsh
13768 cat <<'EOCP' > try.c
13769 #include <stdio.h>
13770 int main() {
13771 EOCP
13772 $awk \\
13773 EOSH
13774 cat <<'EOSH' >> Cppsym.try
13775 'length($1) > 0 {
13776     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
13777     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
13778     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
13779     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
13780 }'       >> try.c
13781 echo '}' >> try.c
13782 EOSH
13783 cat <<EOSH >> Cppsym.try
13784 cc="$cc"
13785 optimize="$optimize"
13786 ccflags="$ccflags"
13787 ldflags="$ldflags"
13788 libs="$libs"
13789 exe_ext="$exe_ext"
13790 $cc $optimize $ccflags $ldflags -o try$exe_ext try.c $libs && ./try$exe_ext
13791 EOSH
13792 chmod +x Cppsym.try
13793 $eunicefix Cppsym.try
13794 ./Cppsym < Cppsym.know > Cppsym.true
13795 : now check the C compiler for additional symbols
13796 postprocess_cc_v=''
13797 case "$osname" in
13798 aix) postprocess_cc_v="|$tr , ' '" ;;
13799 esac
13800 $cat >ccsym <<EOS
13801 $startsh
13802 $cat >tmp.c <<EOF
13803 extern int foo;
13804 EOF
13805 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
13806 do
13807         case "\$i" in
13808         -D*) echo "\$i" | $sed 's/^-D//';;
13809         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
13810         esac
13811 done
13812 $rm -f try.c
13813 EOS
13814 postprocess_cc_v=''
13815 chmod +x ccsym
13816 $eunicefix ccsym
13817 ./ccsym > ccsym1.raw
13818 if $test -s ccsym1.raw; then
13819        $sort ccsym1.raw | $uniq >ccsym.raw
13820 else
13821        mv ccsym1.raw ccsym.raw
13822 fi
13823
13824 $awk '/\=/ { print $0; next }
13825         { print $0"=1" }' ccsym.raw >ccsym.list
13826 $awk '/\=/ { print $0; next }
13827         { print $0"=1" }' Cppsym.true >ccsym.true
13828 $comm -13 ccsym.true ccsym.list >ccsym.own
13829 $comm -12 ccsym.true ccsym.list >ccsym.com
13830 $comm -23 ccsym.true ccsym.list >ccsym.cpp
13831 also=''
13832 if $test -z ccsym.raw; then
13833         echo "Your C compiler doesn't seem to define any symbols!" >&4
13834         echo " "
13835         echo "However, your C preprocessor defines the following symbols:"
13836         $cat Cppsym.true
13837         ccsymbols=''
13838         cppsymbols=`$cat Cppsym.true`
13839         cppsymbols=`echo $cppsymbols`
13840         cppccsymbols="$cppsymbols"
13841 else
13842         if $test -s ccsym.com; then
13843                 echo "Your C compiler and pre-processor define these symbols:"
13844                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
13845                 also='also '
13846                 symbols='ones'
13847                 cppccsymbols=`$cat ccsym.com`
13848                 cppccsymbols=`echo $cppccsymbols`
13849                 $test "$silent" || sleep 1
13850         fi
13851         if $test -s ccsym.cpp; then
13852                 $test "$also" && echo " "
13853                 echo "Your C pre-processor ${also}defines the following symbols:"
13854                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
13855                 also='further '
13856                 cppsymbols=`$cat ccsym.cpp`
13857                 cppsymbols=`echo $cppsymbols`
13858                 $test "$silent" || sleep 1
13859         fi
13860         if $test -s ccsym.own; then
13861                 $test "$also" && echo " "
13862                 echo "Your C compiler ${also}defines the following cpp symbols:"
13863                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
13864                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
13865                 ccsymbols=`$cat ccsym.own`
13866                 ccsymbols=`echo $ccsymbols`
13867                 $test "$silent" || sleep 1
13868         fi
13869 fi
13870 $rm -f ccsym*
13871
13872 : see if this is a termio system
13873 val="$undef"
13874 val2="$undef"
13875 val3="$undef"
13876 if $test `./findhdr termios.h`; then
13877         set tcsetattr i_termios
13878         eval $inlibc
13879         val3="$i_termios"
13880 fi
13881 echo " "
13882 case "$val3" in
13883 "$define") echo "You have POSIX termios.h... good!" >&4;;
13884 *) if ./Cppsym pyr; then
13885                 case "`/bin/universe`" in
13886                 ucb) if $test `./findhdr sgtty.h`; then
13887                                 val2="$define"
13888                                 echo "<sgtty.h> found." >&4
13889                         else
13890                                 echo "System is pyramid with BSD universe."
13891                                 echo "<sgtty.h> not found--you could have problems." >&4
13892                         fi;;
13893                 *) if $test `./findhdr termio.h`; then
13894                                 val="$define"
13895                                 echo "<termio.h> found." >&4
13896                         else
13897                                 echo "System is pyramid with USG universe."
13898                                 echo "<termio.h> not found--you could have problems." >&4
13899                         fi;;
13900                 esac
13901         elif ./usg; then
13902                 if $test `./findhdr termio.h`; then
13903                         echo "<termio.h> found." >&4
13904                         val="$define"
13905                 elif $test `./findhdr sgtty.h`; then
13906                         echo "<sgtty.h> found." >&4
13907                         val2="$define"
13908                 else
13909 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
13910                 fi
13911         else
13912                 if $test `./findhdr sgtty.h`; then
13913                         echo "<sgtty.h> found." >&4
13914                         val2="$define"
13915                 elif $test `./findhdr termio.h`; then
13916                         echo "<termio.h> found." >&4
13917                         val="$define"
13918                 else
13919 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
13920                 fi
13921         fi;;
13922 esac
13923 set i_termio; eval $setvar
13924 val=$val2; set i_sgtty; eval $setvar
13925 val=$val3; set i_termios; eval $setvar
13926
13927 : see if this is a shadow.h system
13928 set shadow.h i_shadow
13929 eval $inhdr
13930
13931 : see if this is a socks.h system
13932 set socks.h i_socks
13933 eval $inhdr
13934
13935 : see if stdarg is available
13936 echo " "
13937 if $test `./findhdr stdarg.h`; then
13938         echo "<stdarg.h> found." >&4
13939         valstd="$define"
13940 else
13941         echo "<stdarg.h> NOT found." >&4
13942         valstd="$undef"
13943 fi
13944
13945 : see if varags is available
13946 echo " "
13947 if $test `./findhdr varargs.h`; then
13948         echo "<varargs.h> found." >&4
13949 else
13950         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13951 fi
13952
13953 : set up the varargs testing programs
13954 $cat > varargs.c <<EOP
13955 #ifdef I_STDARG
13956 #include <stdarg.h>
13957 #endif
13958 #ifdef I_VARARGS
13959 #include <varargs.h>
13960 #endif
13961
13962 #ifdef I_STDARG
13963 int f(char *p, ...)
13964 #else
13965 int f(va_alist)
13966 va_dcl
13967 #endif
13968 {
13969         va_list ap;
13970 #ifndef I_STDARG
13971         char *p;
13972 #endif
13973 #ifdef I_STDARG
13974         va_start(ap,p);
13975 #else
13976         va_start(ap);
13977         p = va_arg(ap, char *);
13978 #endif
13979         va_end(ap);
13980 }
13981 EOP
13982 $cat > varargs <<EOP
13983 $startsh
13984 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13985         echo "true"
13986 else
13987         echo "false"
13988 fi
13989 $rm -f varargs$_o
13990 EOP
13991 chmod +x varargs
13992
13993 : now check which varargs header should be included
13994 echo " "
13995 i_varhdr=''
13996 case "$valstd" in
13997 "$define")
13998         if `./varargs I_STDARG`; then
13999                 val='stdarg.h'
14000         elif `./varargs I_VARARGS`; then
14001                 val='varargs.h'
14002         fi
14003         ;;
14004 *)
14005         if `./varargs I_VARARGS`; then
14006                 val='varargs.h'
14007         fi
14008         ;;
14009 esac
14010 case "$val" in
14011 '')
14012 echo "I could not find the definition for va_dcl... You have problems..." >&4
14013         val="$undef"; set i_stdarg; eval $setvar
14014         val="$undef"; set i_varargs; eval $setvar
14015         ;;
14016 *) 
14017         set i_varhdr
14018         eval $setvar
14019         case "$i_varhdr" in
14020         stdarg.h)
14021                 val="$define"; set i_stdarg; eval $setvar
14022                 val="$undef"; set i_varargs; eval $setvar
14023                 ;;
14024         varargs.h)
14025                 val="$undef"; set i_stdarg; eval $setvar
14026                 val="$define"; set i_varargs; eval $setvar
14027                 ;;
14028         esac
14029         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14030 esac
14031 $rm -f varargs*
14032
14033 : see if stddef is available
14034 set stddef.h i_stddef
14035 eval $inhdr
14036
14037 : see if sys/access.h is available
14038 set sys/access.h i_sysaccess
14039 eval $inhdr
14040
14041 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
14042 set sys/filio.h i_sysfilio
14043 eval $inhdr
14044 echo " "
14045 if $test `./findhdr sys/ioctl.h`; then
14046         val="$define"
14047         echo '<sys/ioctl.h> found.' >&4
14048 else
14049         val="$undef"
14050         if $test $i_sysfilio = "$define"; then
14051             echo '<sys/ioctl.h> NOT found.' >&4
14052         else
14053                 $test $i_sgtty = "$define" && xxx="sgtty.h"
14054                 $test $i_termio = "$define" && xxx="termio.h"
14055                 $test $i_termios = "$define" && xxx="termios.h"
14056 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
14057         fi
14058 fi
14059 set i_sysioctl
14060 eval $setvar
14061
14062 : see if sys/resource.h has to be included
14063 set sys/resource.h i_sysresrc
14064 eval $inhdr
14065
14066 : see if sys/security.h is available
14067 set sys/security.h i_syssecrt
14068 eval $inhdr
14069
14070 : see if this is a sys/statvfs.h system
14071 set sys/statvfs.h i_sysstatvfs
14072 eval $inhdr
14073
14074 : see if this is a sys/uio.h system
14075 set sys/uio.h i_sysuio
14076 eval $inhdr
14077
14078 : see if this is a sys/un.h system
14079 set sys/un.h i_sysun
14080 eval $inhdr
14081
14082 : see if this is a syswait system
14083 set sys/wait.h i_syswait
14084 eval $inhdr
14085
14086 : see if this is a ustat.h system
14087 set ustat.h i_ustat
14088 eval $inhdr
14089
14090 : see if this is an utime system
14091 set utime.h i_utime
14092 eval $inhdr
14093
14094 : see if this is a values.h system
14095 set values.h i_values
14096 eval $inhdr
14097
14098 : see if this is a vfork system
14099 case "$d_vfork" in
14100 "$define")
14101         set vfork.h i_vfork
14102         eval $inhdr
14103         ;;
14104 *)
14105         i_vfork="$undef"
14106         ;;
14107 esac
14108
14109 : see if gdbm.h is available
14110 set gdbm.h t_gdbm
14111 eval $inhdr
14112 case "$t_gdbm" in
14113 $define)
14114         : see if gdbm_open exists
14115         set gdbm_open d_gdbm_open
14116         eval $inlibc
14117         case "$d_gdbm_open" in
14118         $undef)
14119                 t_gdbm="$undef"
14120                 echo "We won't be including <gdbm.h>"
14121                 ;;
14122         esac
14123         ;;
14124 esac
14125 val="$t_gdbm"
14126 set i_gdbm
14127 eval $setvar
14128
14129 echo " "
14130 echo "Looking for extensions..." >&4
14131 : If we are using the old config.sh, known_extensions may contain
14132 : old or inaccurate or duplicate values.
14133 known_extensions=''
14134 nonxs_extensions=''
14135 : We do not use find because it might not be available.
14136 : We do not just use MANIFEST because the user may have dropped
14137 : some additional extensions into the source tree and expect them
14138 : to be built.
14139
14140 : Function to recursively find available extensions, ignoring DynaLoader
14141 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
14142 find_extensions='
14143     for xxx in *; do
14144        case "$xxx" in
14145            DynaLoader|dynaload) ;;
14146            *)
14147            if $test -f $xxx/$xxx.xs; then
14148                known_extensions="$known_extensions $1$xxx";
14149            elif $test -f $xxx/Makefile.PL; then
14150                nonxs_extensions="$nonxs_extensions $1$xxx";
14151            else
14152                if $test -d $xxx -a $# -lt 10; then
14153                    set $1$xxx/ $*;
14154                    cd $xxx;
14155                    eval $find_extensions;
14156                    cd ..;
14157                    shift;
14158                fi;
14159            fi
14160            ;;
14161        esac;
14162     done'
14163 tdir=`pwd`
14164 cd $rsrc/ext
14165 set X
14166 shift
14167 eval $find_extensions
14168 set X $nonxs_extensions
14169 shift
14170 nonxs_extensions="$*"
14171 set X $known_extensions
14172 shift
14173 known_extensions="$*"
14174 cd $tdir
14175
14176 : Now see which are supported on this system.
14177 avail_ext=''
14178 for xxx in $known_extensions ; do
14179         case "$xxx" in
14180         DB_File|db_file)
14181                 case "$i_db" in
14182                 $define) avail_ext="$avail_ext $xxx" ;;
14183                 esac
14184                 ;;
14185         GDBM_File|gdbm_fil)
14186                 case "$i_gdbm" in 
14187                 $define) avail_ext="$avail_ext $xxx" ;;
14188                 esac
14189                 ;;
14190         NDBM_File|ndbm_fil)
14191                 case "$i_ndbm" in
14192                 $define) avail_ext="$avail_ext $xxx" ;;
14193                 esac
14194                 ;;
14195         ODBM_File|odbm_fil) 
14196                 case "${i_dbm}${i_rpcsvcdbm}" in
14197                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14198                 esac
14199                 ;;
14200         POSIX|posix)
14201                 case "$useposix" in
14202                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14203                 esac
14204                 ;;
14205         Opcode|opcode)
14206                 case "$useopcode" in
14207                 true|define|y) avail_ext="$avail_ext $xxx" ;;
14208                 esac
14209                 ;;
14210         Socket|socket)
14211                 case "$d_socket" in 
14212                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14213                 esac
14214                 ;;
14215         Thread|thread)
14216                 case "$usethreads" in 
14217                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
14218                 esac
14219                 ;;
14220         IPC/SysV|ipc/sysv)
14221                 : XXX Do we need a useipcsysv variable here
14222                 case "${d_msg}${d_sem}${d_shm}" in 
14223                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
14224                 esac
14225                 ;;
14226         *)      avail_ext="$avail_ext $xxx"
14227                 ;;
14228         esac
14229 done
14230
14231 set X $avail_ext
14232 shift
14233 avail_ext="$*"
14234
14235 : Now see which nonxs extensions are supported on this system.
14236 : For now assume all are.
14237 nonxs_ext=''
14238 for xxx in $nonxs_extensions ; do
14239         case "$xxx" in
14240         *)      nonxs_ext="$nonxs_ext $xxx"
14241                 ;;
14242         esac
14243 done
14244
14245 set X $nonxs_ext
14246 shift
14247 nonxs_ext="$*"
14248
14249 case $usedl in
14250 $define)
14251         $cat <<EOM
14252 A number of extensions are supplied with $package.  You may choose to
14253 compile these extensions for dynamic loading (the default), compile
14254 them into the $package executable (static loading), or not include
14255 them at all.  Answer "none" to include no extensions.
14256 Note that DynaLoader is always built and need not be mentioned here.
14257
14258 EOM
14259         case "$dynamic_ext" in
14260         '') dflt="$avail_ext" ;;
14261         *)      dflt="$dynamic_ext"
14262                 # Perhaps we are reusing an old out-of-date config.sh.
14263                 case "$hint" in
14264                 previous)
14265                         if test X"$dynamic_ext" != X"$avail_ext"; then
14266                                 $cat <<EOM
14267 NOTICE:  Your previous config.sh list may be incorrect. 
14268 The extensions now available to you are 
14269         ${avail_ext}
14270 but the default list from your previous config.sh is
14271         ${dynamic_ext} 
14272
14273 EOM
14274                         fi
14275                         ;;
14276                 esac
14277                 ;;
14278         esac
14279         case "$dflt" in
14280         '')     dflt=none;;
14281         esac
14282         rp="What extensions do you wish to load dynamically?"
14283         . ./myread
14284         case "$ans" in
14285         none) dynamic_ext=' ' ;;
14286         *) dynamic_ext="$ans" ;;
14287         esac
14288
14289         case "$static_ext" in
14290         '')
14291                 : Exclude those already listed in dynamic linking
14292                 dflt=''
14293                 for xxx in $avail_ext; do
14294                         case " $dynamic_ext " in
14295                         *" $xxx "*) ;;
14296                         *) dflt="$dflt $xxx" ;;
14297                         esac
14298                 done
14299                 set X $dflt
14300                 shift
14301                 dflt="$*"
14302                 ;;
14303         *)  dflt="$static_ext" 
14304                 ;;
14305         esac
14306
14307         case "$dflt" in
14308         '')     dflt=none;;
14309         esac
14310         rp="What extensions do you wish to load statically?"
14311         . ./myread
14312         case "$ans" in
14313         none) static_ext=' ' ;;
14314         *) static_ext="$ans" ;;
14315         esac
14316         ;;
14317 *)
14318         $cat <<EOM
14319 A number of extensions are supplied with $package.  Answer "none" 
14320 to include no extensions. 
14321 Note that DynaLoader is always built and need not be mentioned here.
14322
14323 EOM
14324         case "$static_ext" in
14325         '') dflt="$avail_ext" ;;
14326         *)      dflt="$static_ext"
14327                 # Perhaps we are reusing an old out-of-date config.sh.
14328                 case "$hint" in
14329                 previous)
14330                         if test X"$static_ext" != X"$avail_ext"; then
14331                                 $cat <<EOM
14332 NOTICE:  Your previous config.sh list may be incorrect. 
14333 The extensions now available to you are 
14334         ${avail_ext}
14335 but the default list from your previous config.sh is
14336         ${static_ext} 
14337
14338 EOM
14339                         fi
14340                         ;;
14341                 esac
14342                 ;;
14343         esac
14344         : Exclude those that are not xs extensions
14345         case "$dflt" in
14346         '')     dflt=none;;
14347         esac
14348         rp="What extensions do you wish to include?"
14349         . ./myread
14350         case "$ans" in
14351         none) static_ext=' ' ;;
14352         *) static_ext="$ans" ;;
14353         esac
14354         ;;
14355 esac
14356
14357 set X $dynamic_ext $static_ext $nonxs_ext
14358 shift
14359 extensions="$*"
14360
14361 : Remove build directory name from cppstdin so it can be used from
14362 : either the present location or the final installed location.
14363 echo " "
14364 : Get out of the UU directory to get correct path name.
14365 cd ..
14366 case "$cppstdin" in
14367 `pwd`/cppstdin)
14368         echo "Stripping down cppstdin path name"
14369         cppstdin=cppstdin
14370         ;;
14371 esac
14372 cd UU
14373
14374 : end of configuration questions
14375 echo " "
14376 echo "End of configuration questions."
14377 echo " "
14378
14379 : back to where it started
14380 if test -d ../UU; then
14381         cd ..
14382 fi
14383
14384 : configuration may be patched via a 'config.over' file
14385 if $test -f config.over; then
14386         echo " "
14387         dflt=y
14388         rp='I see a config.over file.  Do you wish to load it?'
14389         . UU/myread
14390         case "$ans" in
14391         n*) echo "OK, I'll ignore it.";;
14392         *)      . ./config.over
14393                 echo "Configuration override changes have been loaded."
14394                 ;;
14395         esac
14396 fi
14397
14398 : in case they want portability, strip down executable paths
14399 case "$d_portable" in
14400 "$define")
14401         echo " "
14402         echo "Stripping down executable paths..." >&4
14403         for file in $loclist $trylist; do
14404                 eval temp=\$$file
14405                 eval $file=`basename $temp`
14406         done
14407         ;;
14408 esac
14409
14410 : create config.sh file
14411 echo " "
14412 echo "Creating config.sh..." >&4
14413 $spitshell <<EOT >config.sh
14414 $startsh
14415 #
14416 # This file was produced by running the Configure script. It holds all the
14417 # definitions figured out by Configure. Should you modify one of these values,
14418 # do not forget to propagate your changes by running "Configure -der". You may
14419 # instead choose to run each of the .SH files by yourself, or "Configure -S".
14420 #
14421
14422 # Package name      : $package
14423 # Source directory  : $src
14424 # Configuration time: $cf_time
14425 # Configured by     : $cf_by
14426 # Target system     : $myuname
14427
14428 Author='$Author'
14429 Date='$Date'
14430 Header='$Header'
14431 Id='$Id'
14432 Locker='$Locker'
14433 Log='$Log'
14434 Mcc='$Mcc'
14435 RCSfile='$RCSfile'
14436 Revision='$Revision'
14437 Source='$Source'
14438 State='$State'
14439 _a='$_a'
14440 _exe='$_exe'
14441 _o='$_o'
14442 afs='$afs'
14443 alignbytes='$alignbytes'
14444 ansi2knr='$ansi2knr'
14445 aphostname='$aphostname'
14446 api_revision='$api_revision'
14447 api_subversion='$api_subversion'
14448 api_version='$api_version'
14449 api_versionstring='$api_versionstring'
14450 ar='$ar'
14451 archlib='$archlib'
14452 archlibexp='$archlibexp'
14453 archname64='$archname64'
14454 archname='$archname'
14455 archobjs='$archobjs'
14456 awk='$awk'
14457 baserev='$baserev'
14458 bash='$bash'
14459 bin='$bin'
14460 bincompat5005='$bincompat5005'
14461 binexp='$binexp'
14462 bison='$bison'
14463 byacc='$byacc'
14464 byteorder='$byteorder'
14465 c='$c'
14466 castflags='$castflags'
14467 cat='$cat'
14468 cc='$cc'
14469 cccdlflags='$cccdlflags'
14470 ccdlflags='$ccdlflags'
14471 ccflags='$ccflags'
14472 ccsymbols='$ccsymbols'
14473 cf_by='$cf_by'
14474 cf_email='$cf_email'
14475 cf_time='$cf_time'
14476 charsize='$charsize'
14477 chgrp='$chgrp'
14478 chmod='$chmod'
14479 chown='$chown'
14480 clocktype='$clocktype'
14481 comm='$comm'
14482 compress='$compress'
14483 contains='$contains'
14484 cp='$cp'
14485 cpio='$cpio'
14486 cpp='$cpp'
14487 cpp_stuff='$cpp_stuff'
14488 cppccsymbols='$cppccsymbols'
14489 cppflags='$cppflags'
14490 cpplast='$cpplast'
14491 cppminus='$cppminus'
14492 cpprun='$cpprun'
14493 cppstdin='$cppstdin'
14494 cppsymbols='$cppsymbols'
14495 crosscompile='$crosscompile'
14496 cryptlib='$cryptlib'
14497 csh='$csh'
14498 d_Gconvert='$d_Gconvert'
14499 d_PRIEldbl='$d_PRIEldbl'
14500 d_PRIFldbl='$d_PRIFldbl'
14501 d_PRIGldbl='$d_PRIGldbl'
14502 d_PRIX64='$d_PRIX64'
14503 d_PRId64='$d_PRId64'
14504 d_PRIeldbl='$d_PRIeldbl'
14505 d_PRIfldbl='$d_PRIfldbl'
14506 d_PRIgldbl='$d_PRIgldbl'
14507 d_PRIi64='$d_PRIi64'
14508 d_PRIo64='$d_PRIo64'
14509 d_PRIu64='$d_PRIu64'
14510 d_PRIx64='$d_PRIx64'
14511 d_access='$d_access'
14512 d_accessx='$d_accessx'
14513 d_alarm='$d_alarm'
14514 d_archlib='$d_archlib'
14515 d_atolf='$d_atolf'
14516 d_atoll='$d_atoll'
14517 d_attribut='$d_attribut'
14518 d_bcmp='$d_bcmp'
14519 d_bcopy='$d_bcopy'
14520 d_bincompat5005='$d_bincompat5005'
14521 d_bsd='$d_bsd'
14522 d_bsdgetpgrp='$d_bsdgetpgrp'
14523 d_bsdsetpgrp='$d_bsdsetpgrp'
14524 d_bzero='$d_bzero'
14525 d_casti32='$d_casti32'
14526 d_castneg='$d_castneg'
14527 d_charvspr='$d_charvspr'
14528 d_chown='$d_chown'
14529 d_chroot='$d_chroot'
14530 d_chsize='$d_chsize'
14531 d_closedir='$d_closedir'
14532 d_const='$d_const'
14533 d_crypt='$d_crypt'
14534 d_csh='$d_csh'
14535 d_cuserid='$d_cuserid'
14536 d_dbl_dig='$d_dbl_dig'
14537 d_difftime='$d_difftime'
14538 d_dirnamlen='$d_dirnamlen'
14539 d_dlerror='$d_dlerror'
14540 d_dlopen='$d_dlopen'
14541 d_dlsymun='$d_dlsymun'
14542 d_dosuid='$d_dosuid'
14543 d_drand48proto='$d_drand48proto'
14544 d_dup2='$d_dup2'
14545 d_eaccess='$d_eaccess'
14546 d_endgrent='$d_endgrent'
14547 d_endhent='$d_endhent'
14548 d_endnent='$d_endnent'
14549 d_endpent='$d_endpent'
14550 d_endpwent='$d_endpwent'
14551 d_endsent='$d_endsent'
14552 d_endspent='$d_endspent'
14553 d_eofnblk='$d_eofnblk'
14554 d_eunice='$d_eunice'
14555 d_fchmod='$d_fchmod'
14556 d_fchown='$d_fchown'
14557 d_fcntl='$d_fcntl'
14558 d_fd_macros='$d_fd_macros'
14559 d_fd_set='$d_fd_set'
14560 d_fds_bits='$d_fds_bits'
14561 d_fgetpos='$d_fgetpos'
14562 d_flexfnam='$d_flexfnam'
14563 d_flock='$d_flock'
14564 d_fork='$d_fork'
14565 d_fpathconf='$d_fpathconf'
14566 d_fpos64_t='$d_fpos64_t'
14567 d_fs_data_s='$d_fs_data_s'
14568 d_fseeko='$d_fseeko'
14569 d_fsetpos='$d_fsetpos'
14570 d_fstatfs='$d_fstatfs'
14571 d_fstatvfs='$d_fstatvfs'
14572 d_ftello='$d_ftello'
14573 d_ftime='$d_ftime'
14574 d_getgrent='$d_getgrent'
14575 d_getgrps='$d_getgrps'
14576 d_gethbyaddr='$d_gethbyaddr'
14577 d_gethbyname='$d_gethbyname'
14578 d_gethent='$d_gethent'
14579 d_gethname='$d_gethname'
14580 d_gethostprotos='$d_gethostprotos'
14581 d_getlogin='$d_getlogin'
14582 d_getmnt='$d_getmnt'
14583 d_getmntent='$d_getmntent'
14584 d_getnbyaddr='$d_getnbyaddr'
14585 d_getnbyname='$d_getnbyname'
14586 d_getnent='$d_getnent'
14587 d_getnetprotos='$d_getnetprotos'
14588 d_getpbyname='$d_getpbyname'
14589 d_getpbynumber='$d_getpbynumber'
14590 d_getpent='$d_getpent'
14591 d_getpgid='$d_getpgid'
14592 d_getpgrp2='$d_getpgrp2'
14593 d_getpgrp='$d_getpgrp'
14594 d_getppid='$d_getppid'
14595 d_getprior='$d_getprior'
14596 d_getprotoprotos='$d_getprotoprotos'
14597 d_getpwent='$d_getpwent'
14598 d_getsbyname='$d_getsbyname'
14599 d_getsbyport='$d_getsbyport'
14600 d_getsent='$d_getsent'
14601 d_getservprotos='$d_getservprotos'
14602 d_getspent='$d_getspent'
14603 d_getspnam='$d_getspnam'
14604 d_gettimeod='$d_gettimeod'
14605 d_gnulibc='$d_gnulibc'
14606 d_grpasswd='$d_grpasswd'
14607 d_hasmntopt='$d_hasmntopt'
14608 d_htonl='$d_htonl'
14609 d_iconv='$d_iconv'
14610 d_index='$d_index'
14611 d_inetaton='$d_inetaton'
14612 d_int64t='$d_int64t'
14613 d_isascii='$d_isascii'
14614 d_killpg='$d_killpg'
14615 d_lchown='$d_lchown'
14616 d_ldbl_dig='$d_ldbl_dig'
14617 d_link='$d_link'
14618 d_locconv='$d_locconv'
14619 d_lockf='$d_lockf'
14620 d_longdbl='$d_longdbl'
14621 d_longlong='$d_longlong'
14622 d_lstat='$d_lstat'
14623 d_mblen='$d_mblen'
14624 d_mbstowcs='$d_mbstowcs'
14625 d_mbtowc='$d_mbtowc'
14626 d_memchr='$d_memchr'
14627 d_memcmp='$d_memcmp'
14628 d_memcpy='$d_memcpy'
14629 d_memmove='$d_memmove'
14630 d_memset='$d_memset'
14631 d_mkdir='$d_mkdir'
14632 d_mkfifo='$d_mkfifo'
14633 d_mktime='$d_mktime'
14634 d_msg='$d_msg'
14635 d_msg_ctrunc='$d_msg_ctrunc'
14636 d_msg_dontroute='$d_msg_dontroute'
14637 d_msg_oob='$d_msg_oob'
14638 d_msg_peek='$d_msg_peek'
14639 d_msg_proxy='$d_msg_proxy'
14640 d_msgctl='$d_msgctl'
14641 d_msgget='$d_msgget'
14642 d_msgrcv='$d_msgrcv'
14643 d_msgsnd='$d_msgsnd'
14644 d_mymalloc='$d_mymalloc'
14645 d_nice='$d_nice'
14646 d_nv_preserves_uv='$d_nv_preserves_uv'
14647 d_off64_t='$d_off64_t'
14648 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
14649 d_oldpthreads='$d_oldpthreads'
14650 d_oldsock='$d_oldsock'
14651 d_open3='$d_open3'
14652 d_pathconf='$d_pathconf'
14653 d_pause='$d_pause'
14654 d_phostname='$d_phostname'
14655 d_pipe='$d_pipe'
14656 d_poll='$d_poll'
14657 d_portable='$d_portable'
14658 d_pthread_yield='$d_pthread_yield'
14659 d_pwage='$d_pwage'
14660 d_pwchange='$d_pwchange'
14661 d_pwclass='$d_pwclass'
14662 d_pwcomment='$d_pwcomment'
14663 d_pwexpire='$d_pwexpire'
14664 d_pwgecos='$d_pwgecos'
14665 d_pwpasswd='$d_pwpasswd'
14666 d_pwquota='$d_pwquota'
14667 d_quad='$d_quad'
14668 d_readdir='$d_readdir'
14669 d_readlink='$d_readlink'
14670 d_rename='$d_rename'
14671 d_rewinddir='$d_rewinddir'
14672 d_rmdir='$d_rmdir'
14673 d_safebcpy='$d_safebcpy'
14674 d_safemcpy='$d_safemcpy'
14675 d_sanemcmp='$d_sanemcmp'
14676 d_sched_yield='$d_sched_yield'
14677 d_scm_rights='$d_scm_rights'
14678 d_seekdir='$d_seekdir'
14679 d_select='$d_select'
14680 d_sem='$d_sem'
14681 d_semctl='$d_semctl'
14682 d_semctl_semid_ds='$d_semctl_semid_ds'
14683 d_semctl_semun='$d_semctl_semun'
14684 d_semget='$d_semget'
14685 d_semop='$d_semop'
14686 d_setegid='$d_setegid'
14687 d_seteuid='$d_seteuid'
14688 d_setgrent='$d_setgrent'
14689 d_setgrps='$d_setgrps'
14690 d_sethent='$d_sethent'
14691 d_setlinebuf='$d_setlinebuf'
14692 d_setlocale='$d_setlocale'
14693 d_setnent='$d_setnent'
14694 d_setpent='$d_setpent'
14695 d_setpgid='$d_setpgid'
14696 d_setpgrp2='$d_setpgrp2'
14697 d_setpgrp='$d_setpgrp'
14698 d_setprior='$d_setprior'
14699 d_setpwent='$d_setpwent'
14700 d_setregid='$d_setregid'
14701 d_setresgid='$d_setresgid'
14702 d_setresuid='$d_setresuid'
14703 d_setreuid='$d_setreuid'
14704 d_setrgid='$d_setrgid'
14705 d_setruid='$d_setruid'
14706 d_setsent='$d_setsent'
14707 d_setsid='$d_setsid'
14708 d_setspent='$d_setspent'
14709 d_setvbuf='$d_setvbuf'
14710 d_sfio='$d_sfio'
14711 d_shm='$d_shm'
14712 d_shmat='$d_shmat'
14713 d_shmatprototype='$d_shmatprototype'
14714 d_shmctl='$d_shmctl'
14715 d_shmdt='$d_shmdt'
14716 d_shmget='$d_shmget'
14717 d_sigaction='$d_sigaction'
14718 d_sigsetjmp='$d_sigsetjmp'
14719 d_socket='$d_socket'
14720 d_sockpair='$d_sockpair'
14721 d_sqrtl='$d_sqrtl'
14722 d_statblks='$d_statblks'
14723 d_statfs_f_flags='$d_statfs_f_flags'
14724 d_statfs_s='$d_statfs_s'
14725 d_statvfs='$d_statvfs'
14726 d_stdio_cnt_lval='$d_stdio_cnt_lval'
14727 d_stdio_ptr_lval='$d_stdio_ptr_lval'
14728 d_stdio_stream_array='$d_stdio_stream_array'
14729 d_stdiobase='$d_stdiobase'
14730 d_stdstdio='$d_stdstdio'
14731 d_strchr='$d_strchr'
14732 d_strcoll='$d_strcoll'
14733 d_strctcpy='$d_strctcpy'
14734 d_strerrm='$d_strerrm'
14735 d_strerror='$d_strerror'
14736 d_strtod='$d_strtod'
14737 d_strtol='$d_strtol'
14738 d_strtold='$d_strtold'
14739 d_strtoll='$d_strtoll'
14740 d_strtoul='$d_strtoul'
14741 d_strtoull='$d_strtoull'
14742 d_strtouq='$d_strtouq'
14743 d_strxfrm='$d_strxfrm'
14744 d_suidsafe='$d_suidsafe'
14745 d_symlink='$d_symlink'
14746 d_syscall='$d_syscall'
14747 d_sysconf='$d_sysconf'
14748 d_sysernlst='$d_sysernlst'
14749 d_syserrlst='$d_syserrlst'
14750 d_system='$d_system'
14751 d_tcgetpgrp='$d_tcgetpgrp'
14752 d_tcsetpgrp='$d_tcsetpgrp'
14753 d_telldir='$d_telldir'
14754 d_telldirproto='$d_telldirproto'
14755 d_time='$d_time'
14756 d_times='$d_times'
14757 d_truncate='$d_truncate'
14758 d_tzname='$d_tzname'
14759 d_umask='$d_umask'
14760 d_uname='$d_uname'
14761 d_union_semun='$d_union_semun'
14762 d_ustat='$d_ustat'
14763 d_vendorbin='$d_vendorbin'
14764 d_vendorlib='$d_vendorlib'
14765 d_vfork='$d_vfork'
14766 d_void_closedir='$d_void_closedir'
14767 d_voidsig='$d_voidsig'
14768 d_voidtty='$d_voidtty'
14769 d_volatile='$d_volatile'
14770 d_vprintf='$d_vprintf'
14771 d_wait4='$d_wait4'
14772 d_waitpid='$d_waitpid'
14773 d_wcstombs='$d_wcstombs'
14774 d_wctomb='$d_wctomb'
14775 d_xenix='$d_xenix'
14776 date='$date'
14777 db_hashtype='$db_hashtype'
14778 db_prefixtype='$db_prefixtype'
14779 defvoidused='$defvoidused'
14780 direntrytype='$direntrytype'
14781 dlext='$dlext'
14782 dlsrc='$dlsrc'
14783 doublesize='$doublesize'
14784 drand01='$drand01'
14785 dynamic_ext='$dynamic_ext'
14786 eagain='$eagain'
14787 ebcdic='$ebcdic'
14788 echo='$echo'
14789 egrep='$egrep'
14790 emacs='$emacs'
14791 eunicefix='$eunicefix'
14792 exe_ext='$exe_ext'
14793 expr='$expr'
14794 extensions='$extensions'
14795 fflushNULL='$fflushNULL'
14796 fflushall='$fflushall'
14797 find='$find'
14798 firstmakefile='$firstmakefile'
14799 flex='$flex'
14800 fpossize='$fpossize'
14801 fpostype='$fpostype'
14802 freetype='$freetype'
14803 full_ar='$full_ar'
14804 full_csh='$full_csh'
14805 full_sed='$full_sed'
14806 gccversion='$gccversion'
14807 gidformat='$gidformat'
14808 gidsign='$gidsign'
14809 gidsize='$gidsize'
14810 gidtype='$gidtype'
14811 glibpth='$glibpth'
14812 grep='$grep'
14813 groupcat='$groupcat'
14814 groupstype='$groupstype'
14815 gzip='$gzip'
14816 h_fcntl='$h_fcntl'
14817 h_sysfile='$h_sysfile'
14818 hint='$hint'
14819 hostcat='$hostcat'
14820 huge='$huge'
14821 i16size='$i16size'
14822 i16type='$i16type'
14823 i32size='$i32size'
14824 i32type='$i32type'
14825 i64size='$i64size'
14826 i64type='$i64type'
14827 i8size='$i8size'
14828 i8type='$i8type'
14829 i_arpainet='$i_arpainet'
14830 i_bsdioctl='$i_bsdioctl'
14831 i_db='$i_db'
14832 i_dbm='$i_dbm'
14833 i_dirent='$i_dirent'
14834 i_dld='$i_dld'
14835 i_dlfcn='$i_dlfcn'
14836 i_fcntl='$i_fcntl'
14837 i_float='$i_float'
14838 i_gdbm='$i_gdbm'
14839 i_grp='$i_grp'
14840 i_iconv='$i_iconv'
14841 i_inttypes='$i_inttypes'
14842 i_limits='$i_limits'
14843 i_locale='$i_locale'
14844 i_machcthr='$i_machcthr'
14845 i_malloc='$i_malloc'
14846 i_math='$i_math'
14847 i_memory='$i_memory'
14848 i_mntent='$i_mntent'
14849 i_ndbm='$i_ndbm'
14850 i_netdb='$i_netdb'
14851 i_neterrno='$i_neterrno'
14852 i_netinettcp='$i_netinettcp'
14853 i_niin='$i_niin'
14854 i_poll='$i_poll'
14855 i_pthread='$i_pthread'
14856 i_pwd='$i_pwd'
14857 i_rpcsvcdbm='$i_rpcsvcdbm'
14858 i_sfio='$i_sfio'
14859 i_sgtty='$i_sgtty'
14860 i_shadow='$i_shadow'
14861 i_socks='$i_socks'
14862 i_stdarg='$i_stdarg'
14863 i_stddef='$i_stddef'
14864 i_stdlib='$i_stdlib'
14865 i_string='$i_string'
14866 i_sysaccess='$i_sysaccess'
14867 i_sysdir='$i_sysdir'
14868 i_sysfile='$i_sysfile'
14869 i_sysfilio='$i_sysfilio'
14870 i_sysin='$i_sysin'
14871 i_sysioctl='$i_sysioctl'
14872 i_sysmount='$i_sysmount'
14873 i_sysndir='$i_sysndir'
14874 i_sysparam='$i_sysparam'
14875 i_sysresrc='$i_sysresrc'
14876 i_syssecrt='$i_syssecrt'
14877 i_sysselct='$i_sysselct'
14878 i_syssockio='$i_syssockio'
14879 i_sysstat='$i_sysstat'
14880 i_sysstatfs='$i_sysstatfs'
14881 i_sysstatvfs='$i_sysstatvfs'
14882 i_systime='$i_systime'
14883 i_systimek='$i_systimek'
14884 i_systimes='$i_systimes'
14885 i_systypes='$i_systypes'
14886 i_sysuio='$i_sysuio'
14887 i_sysun='$i_sysun'
14888 i_sysvfs='$i_sysvfs'
14889 i_syswait='$i_syswait'
14890 i_termio='$i_termio'
14891 i_termios='$i_termios'
14892 i_time='$i_time'
14893 i_unistd='$i_unistd'
14894 i_ustat='$i_ustat'
14895 i_utime='$i_utime'
14896 i_values='$i_values'
14897 i_varargs='$i_varargs'
14898 i_varhdr='$i_varhdr'
14899 i_vfork='$i_vfork'
14900 ignore_versioned_solibs='$ignore_versioned_solibs'
14901 inc_version_list='$inc_version_list'
14902 inc_version_list_init='$inc_version_list_init'
14903 incpath='$incpath'
14904 inews='$inews'
14905 installarchlib='$installarchlib'
14906 installbin='$installbin'
14907 installman1dir='$installman1dir'
14908 installman3dir='$installman3dir'
14909 installprefix='$installprefix'
14910 installprefixexp='$installprefixexp'
14911 installprivlib='$installprivlib'
14912 installscript='$installscript'
14913 installsitearch='$installsitearch'
14914 installsitebin='$installsitebin'
14915 installsitelib='$installsitelib'
14916 installstyle='$installstyle'
14917 installusrbinperl='$installusrbinperl'
14918 installvendorbin='$installvendorbin'
14919 installvendorlib='$installvendorlib'
14920 intsize='$intsize'
14921 ivdformat='$ivdformat'
14922 ivsize='$ivsize'
14923 ivtype='$ivtype'
14924 known_extensions='$known_extensions'
14925 ksh='$ksh'
14926 large='$large'
14927 ld='$ld'
14928 lddlflags='$lddlflags'
14929 ldflags='$ldflags'
14930 ldlibpthname='$ldlibpthname'
14931 less='$less'
14932 lib_ext='$lib_ext'
14933 libc='$libc'
14934 libperl='$libperl'
14935 libpth='$libpth'
14936 libs='$libs'
14937 libsdirs='$libsdirs'
14938 libsfiles='$libsfiles'
14939 libsfound='$libsfound'
14940 libswanted='$libswanted'
14941 line='$line'
14942 lint='$lint'
14943 lkflags='$lkflags'
14944 ln='$ln'
14945 lns='$lns'
14946 locincpth='$locincpth'
14947 loclibpth='$loclibpth'
14948 longdblsize='$longdblsize'
14949 longlongsize='$longlongsize'
14950 longsize='$longsize'
14951 lp='$lp'
14952 lpr='$lpr'
14953 ls='$ls'
14954 lseeksize='$lseeksize'
14955 lseektype='$lseektype'
14956 mail='$mail'
14957 mailx='$mailx'
14958 make='$make'
14959 make_set_make='$make_set_make'
14960 mallocobj='$mallocobj'
14961 mallocsrc='$mallocsrc'
14962 malloctype='$malloctype'
14963 man1dir='$man1dir'
14964 man1direxp='$man1direxp'
14965 man1ext='$man1ext'
14966 man3dir='$man3dir'
14967 man3direxp='$man3direxp'
14968 man3ext='$man3ext'
14969 medium='$medium'
14970 mips_type='$mips_type'
14971 mkdir='$mkdir'
14972 models='$models'
14973 modetype='$modetype'
14974 more='$more'
14975 multiarch='$multiarch'
14976 mv='$mv'
14977 myarchname='$myarchname'
14978 mydomain='$mydomain'
14979 myhostname='$myhostname'
14980 myuname='$myuname'
14981 n='$n'
14982 netdb_hlen_type='$netdb_hlen_type'
14983 netdb_host_type='$netdb_host_type'
14984 netdb_name_type='$netdb_name_type'
14985 netdb_net_type='$netdb_net_type'
14986 nm='$nm'
14987 nm_opt='$nm_opt'
14988 nm_so_opt='$nm_so_opt'
14989 nonxs_ext='$nonxs_ext'
14990 nroff='$nroff'
14991 nvsize='$nvsize'
14992 nvtype='$nvtype'
14993 o_nonblock='$o_nonblock'
14994 obj_ext='$obj_ext'
14995 old_pthread_create_joinable='$old_pthread_create_joinable'
14996 optimize='$optimize'
14997 orderlib='$orderlib'
14998 osname='$osname'
14999 osvers='$osvers'
15000 package='$package'
15001 pager='$pager'
15002 passcat='$passcat'
15003 patchlevel='$patchlevel'
15004 path_sep='$path_sep'
15005 perl='$perl'
15006 perladmin='$perladmin'
15007 perlpath='$perlpath'
15008 pg='$pg'
15009 phostname='$phostname'
15010 pidtype='$pidtype'
15011 plibpth='$plibpth'
15012 pmake='$pmake'
15013 pr='$pr'
15014 prefix='$prefix'
15015 prefixexp='$prefixexp'
15016 privlib='$privlib'
15017 privlibexp='$privlibexp'
15018 prototype='$prototype'
15019 ptrsize='$ptrsize'
15020 quadkind='$quadkind'
15021 quadtype='$quadtype'
15022 randbits='$randbits'
15023 randfunc='$randfunc'
15024 randseedtype='$randseedtype'
15025 ranlib='$ranlib'
15026 rd_nodata='$rd_nodata'
15027 rm='$rm'
15028 rmail='$rmail'
15029 runnm='$runnm'
15030 sPRIEldbl='$sPRIEldbl'
15031 sPRIFldbl='$sPRIFldbl'
15032 sPRIGldbl='$sPRIGldbl'
15033 sPRIX64='$sPRIX64'
15034 sPRId64='$sPRId64'
15035 sPRIeldbl='$sPRIeldbl'
15036 sPRIfldbl='$sPRIfldbl'
15037 sPRIgldbl='$sPRIgldbl'
15038 sPRIi64='$sPRIi64'
15039 sPRIo64='$sPRIo64'
15040 sPRIu64='$sPRIu64'
15041 sPRIx64='$sPRIx64'
15042 sched_yield='$sched_yield'
15043 scriptdir='$scriptdir'
15044 scriptdirexp='$scriptdirexp'
15045 sed='$sed'
15046 seedfunc='$seedfunc'
15047 selectminbits='$selectminbits'
15048 selecttype='$selecttype'
15049 sendmail='$sendmail'
15050 sh='$sh'
15051 shar='$shar'
15052 sharpbang='$sharpbang'
15053 shmattype='$shmattype'
15054 shortsize='$shortsize'
15055 shrpenv='$shrpenv'
15056 shsharp='$shsharp'
15057 sig_count='$sig_count'
15058 sig_name='$sig_name'
15059 sig_name_init='$sig_name_init'
15060 sig_num='$sig_num'
15061 sig_num_init='$sig_num_init'
15062 signal_t='$signal_t'
15063 sitearch='$sitearch'
15064 sitearchexp='$sitearchexp'
15065 sitebin='$sitebin'
15066 sitebinexp='$sitebinexp'
15067 sitelib='$sitelib'
15068 sitelibexp='$sitelibexp'
15069 siteprefix='$siteprefix'
15070 siteprefixexp='$siteprefixexp'
15071 sizetype='$sizetype'
15072 sleep='$sleep'
15073 smail='$smail'
15074 small='$small'
15075 so='$so'
15076 sockethdr='$sockethdr'
15077 socketlib='$socketlib'
15078 sort='$sort'
15079 spackage='$spackage'
15080 spitshell='$spitshell'
15081 split='$split'
15082 src='$src'
15083 ssizetype='$ssizetype'
15084 startperl='$startperl'
15085 startsh='$startsh'
15086 static_ext='$static_ext'
15087 stdchar='$stdchar'
15088 stdio_base='$stdio_base'
15089 stdio_bufsiz='$stdio_bufsiz'
15090 stdio_cnt='$stdio_cnt'
15091 stdio_filbuf='$stdio_filbuf'
15092 stdio_ptr='$stdio_ptr'
15093 stdio_stream_array='$stdio_stream_array'
15094 strings='$strings'
15095 submit='$submit'
15096 subversion='$subversion'
15097 sysman='$sysman'
15098 tail='$tail'
15099 tar='$tar'
15100 tbl='$tbl'
15101 tee='$tee'
15102 test='$test'
15103 timeincl='$timeincl'
15104 timetype='$timetype'
15105 touch='$touch'
15106 tr='$tr'
15107 trnl='$trnl'
15108 troff='$troff'
15109 u16size='$u16size'
15110 u16type='$u16type'
15111 u32size='$u32size'
15112 u32type='$u32type'
15113 u64size='$u64size'
15114 u64type='$u64type'
15115 u8size='$u8size'
15116 u8type='$u8type'
15117 uidformat='$uidformat'
15118 uidsign='$uidsign'
15119 uidsize='$uidsize'
15120 uidtype='$uidtype'
15121 uname='$uname'
15122 uniq='$uniq'
15123 uquadtype='$uquadtype'
15124 use5005threads='$use5005threads'
15125 use64bits='$use64bits'
15126 usedl='$usedl'
15127 useithreads='$useithreads'
15128 uselargefiles='$uselargefiles'
15129 uselongdouble='$uselongdouble'
15130 uselonglong='$uselonglong'
15131 usemorebits='$usemorebits'
15132 usemultiplicity='$usemultiplicity'
15133 usemymalloc='$usemymalloc'
15134 usenm='$usenm'
15135 useopcode='$useopcode'
15136 useperlio='$useperlio'
15137 useposix='$useposix'
15138 usesfio='$usesfio'
15139 useshrplib='$useshrplib'
15140 usesocks='$usesocks'
15141 usethreads='$usethreads'
15142 usevendorprefix='$usevendorprefix'
15143 usevfork='$usevfork'
15144 usrinc='$usrinc'
15145 uuname='$uuname'
15146 uvoformat='$uvoformat'
15147 uvsize='$uvsize'
15148 uvtype='$uvtype'
15149 uvuformat='$uvuformat'
15150 uvxformat='$uvxformat'
15151 vendorbin='$vendorbin'
15152 vendorbinexp='$vendorbinexp'
15153 vendorlib='$vendorlib'
15154 vendorlibexp='$vendorlibexp'
15155 vendorprefix='$vendorprefix'
15156 vendorprefixexp='$vendorprefixexp'
15157 version='$version'
15158 vi='$vi'
15159 voidflags='$voidflags'
15160 xlibpth='$xlibpth'
15161 zcat='$zcat'
15162 zip='$zip'
15163 EOT
15164
15165 : Add in command line options if available
15166 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
15167
15168 : add special variables
15169 $test -f $src/patchlevel.h && \
15170 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
15171 echo "CONFIGDOTSH=true" >>config.sh
15172
15173 : propagate old symbols
15174 if $test -f UU/config.sh; then
15175         <UU/config.sh sort | uniq >UU/oldconfig.sh
15176         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
15177         sort | uniq -u >UU/oldsyms
15178         set X `cat UU/oldsyms`
15179         shift
15180         case $# in
15181         0) ;;
15182         *)
15183                 cat <<EOM
15184 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
15185 EOM
15186                 echo "# Variables propagated from previous config.sh file." >>config.sh
15187                 for sym in `cat UU/oldsyms`; do
15188                         echo "    Propagating $hint variable "'$'"$sym..."
15189                         eval 'tmp="$'"${sym}"'"'
15190                         echo "$tmp" | \
15191                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
15192                 done
15193                 ;;
15194         esac
15195 fi
15196
15197 : Finish up by extracting the .SH files
15198 case "$alldone" in
15199 exit)
15200         $rm -rf UU
15201         echo "Done."
15202         exit 0
15203         ;;
15204 cont)
15205         ;;
15206 '')
15207         dflt=''
15208         nostick=true
15209         $cat <<EOM
15210
15211 If you'd like to make any changes to the config.sh file before I begin
15212 to configure things, do it as a shell escape now (e.g. !vi config.sh).
15213
15214 EOM
15215         rp="Press return or use a shell escape to edit config.sh:"
15216         . UU/myread
15217         nostick=''
15218         case "$ans" in
15219         '') ;;
15220         *) : in case they cannot read
15221                 sh 1>&4 -c "$ans";;
15222         esac
15223         ;;
15224 esac
15225
15226 : if this fails, just run all the .SH files by hand
15227 . ./config.sh
15228
15229 echo " "
15230 exec 1>&4
15231 . ./UU/extract
15232
15233 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
15234         dflt=y
15235         case "$silent" in
15236         true) ;;
15237         *)
15238                 $cat <<EOM
15239
15240 Now you need to generate make dependencies by running "$make depend".
15241 You might prefer to run it in background: "$make depend > makedepend.out &"
15242 It can take a while, so you might not want to run it right now.
15243
15244 EOM
15245                 ;;
15246         esac
15247         rp="Run $make depend now?"
15248         . UU/myread
15249         case "$ans" in
15250         y*)
15251                 $make depend && echo "Now you must run a $make."
15252                 ;;
15253         *)
15254                 echo "You must run '$make depend' then '$make'."
15255                 ;;
15256         esac
15257 elif test -f [Mm]akefile; then
15258         echo " "
15259         echo "Now you must run a $make."
15260 else
15261         echo "Done."
15262 fi
15263
15264 if $test -f Policy.sh; then
15265     $cat <<EOM
15266
15267 If you compile $package on a different machine or from a different object
15268 directory, copy the Policy.sh file from this object directory to the
15269 new one before you run Configure -- this will help you with most of
15270 the policy defaults.
15271
15272 EOM
15273 fi
15274 if $test -f config.msg; then
15275     echo "Hmm.  I also noted the following information while running:"
15276     echo " "
15277     $cat config.msg >&4
15278     $rm -f config.msg
15279 fi
15280 $rm -f kit*isdone ark*isdone
15281 $rm -rf UU
15282
15283 : End of Configure
15284