Fix typo
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Oct 30 18:24:58 METDST 2004 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >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 >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 c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
51         cat >&4 <<EOF
52 ***
53 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
55 *** Please read the README.plan9 for further instructions.
56 *** Cannot continue, aborting.
57 ***
58 EOF
59         exit 1
60 fi
61
62 : compute my invocation name
63 me=$0
64 case "$0" in
65 */*)
66         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67         test "$me" || me=$0
68         ;;
69 esac
70
71 : Proper separator for the PATH environment variable
72 p_=:
73 : On OS/2 this directory should exist if this is not floppy only system :-]
74 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
75     if test -n "$OS2_SHELL"; then
76                 p_=\;
77                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
79                 is_os2=yes
80         elif test -n "$DJGPP"; then
81                 case "X${MACHTYPE:-nonesuchmach}" in
82                 *cygwin) ;;
83                 *) p_=\; ;;
84                 esac
85         fi
86 fi
87
88 : Proper PATH setting
89 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
90 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
91 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
92 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
93 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
94 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
95 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
96 paths="$paths /sbin /usr/sbin /usr/libexec"
97 paths="$paths /system/gnu_library/bin"
98
99 for p in $paths
100 do
101         case "$p_$PATH$p_" in
102         *$p_$p$p_*) ;;
103         *) test -d $p && PATH=$PATH$p_$p ;;
104         esac
105 done
106
107 PATH=.$p_$PATH
108 export PATH
109
110 : shall we be using ksh?
111 inksh=''
112 needksh=''
113 avoidksh=''
114 newsh=/bin/ksh
115 changesh=''
116 if (PATH=.; alias -x) >/dev/null 2>&1; then
117                 inksh=true
118 fi
119 if test -f /hp-ux -a -f /bin/ksh; then
120         needksh='to avoid sh bug in "here document" expansion'
121 fi
122 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
123         if test X`/usr/bin/uname -v` = X4; then
124                 avoidksh="to avoid AIX 4's /bin/sh"
125                 newsh=/usr/bin/bsh
126         fi
127 fi
128 if test -f /osf_boot -a -f /usr/sbin/setld; then
129         if test X`/usr/bin/uname -s` = XOSF1; then
130                 avoidksh="to avoid Digital UNIX' ksh"
131                 newsh=/bin/sh
132                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
133         fi
134 fi
135 case "$inksh/$needksh" in
136 /[a-z]*)
137                 ENV=''
138                 changesh=true
139                 reason="$needksh"
140         ;;
141 esac
142 case "$inksh/$avoidksh" in
143 true/[a-z]*)
144         changesh=true
145         reason="$avoidksh"
146         ;;
147 esac
148 case "$inksh/$needksh-$avoidksh-" in
149 true/--)
150                 cat <<EOM
151 (I see you are using the Korn shell.  Some ksh's blow up on $me,
152 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
153 EOM
154         ;;
155 esac
156 case "$changesh" in
157 true)
158         export newsh
159         echo "(Feeding myself to $newsh $reason.)"
160         case "$0" in
161         Configure|*/Configure) exec $newsh $0 "$@";;
162         *) exec $newsh Configure "$@";;
163         esac
164         ;;
165 esac
166
167 : if needed set CDPATH to a harmless value that is not chatty
168 : avoid bash 2.02 problems with empty CDPATH.
169 case "$CDPATH" in
170 '')     ;;
171 *)      case "$SHELL" in
172         *bash*) CDPATH='.' ;;
173         *)              CDPATH='' ;;
174         esac
175         ;;
176 esac
177 : Configure runs within the UU subdirectory
178 test -d UU || mkdir UU
179 cd UU && rm -f ./*
180
181 ccname=''
182 ccversion=''
183 ccsymbols=''
184 cppccsymbols=''
185 cppsymbols=''
186 from=''
187 run=''
188 targetarch=''
189 to=''
190 usecrosscompile=''
191 mistrustnm=''
192 perllibs=''
193 dynamic_ext=''
194 extensions=''
195 known_extensions=''
196 nonxs_ext=''
197 static_ext=''
198 useopcode=''
199 useposix=''
200 extras=''
201 d_bsd=''
202 d_eunice=''
203 d_xenix=''
204 eunicefix=''
205 Mcc=''
206 ar=''
207 awk=''
208 bash=''
209 bison=''
210 byacc=''
211 cat=''
212 chgrp=''
213 chmod=''
214 chown=''
215 comm=''
216 compress=''
217 cp=''
218 cpio=''
219 cpp=''
220 csh=''
221 date=''
222 echo=''
223 egrep=''
224 emacs=''
225 expr=''
226 find=''
227 flex=''
228 gmake=''
229 grep=''
230 gzip=''
231 inews=''
232 ksh=''
233 less=''
234 line=''
235 lint=''
236 ln=''
237 lp=''
238 lpr=''
239 ls=''
240 mail=''
241 mailx=''
242 make=''
243 mkdir=''
244 more=''
245 mv=''
246 nm=''
247 nroff=''
248 perl=''
249 pg=''
250 pmake=''
251 pr=''
252 rm=''
253 rmail=''
254 sed=''
255 sendmail=''
256 shar=''
257 sleep=''
258 smail=''
259 sort=''
260 submit=''
261 tail=''
262 tar=''
263 tbl=''
264 tee=''
265 test=''
266 touch=''
267 tr=''
268 troff=''
269 uname=''
270 uniq=''
271 uuname=''
272 vi=''
273 zcat=''
274 zip=''
275 full_ar=''
276 full_sed=''
277 libswanted=''
278 hint=''
279 myuname=''
280 osname=''
281 osvers=''
282 Author=''
283 Date=''
284 Header=''
285 Id=''
286 Locker=''
287 Log=''
288 RCSfile=''
289 Revision=''
290 Source=''
291 State=''
292 _a=''
293 _exe=''
294 _o=''
295 archobjs=''
296 exe_ext=''
297 firstmakefile=''
298 lib_ext=''
299 obj_ext=''
300 path_sep=''
301 afs=''
302 afsroot=''
303 alignbytes=''
304 ansi2knr=''
305 archlib=''
306 archlibexp=''
307 d_archlib=''
308 installarchlib=''
309 archname=''
310 myarchname=''
311 d_atolf=''
312 d_atoll=''
313 baserev=''
314 bin=''
315 binexp=''
316 installbin=''
317 byteorder=''
318 cc=''
319 ccflags=''
320 cppflags=''
321 ldflags=''
322 lkflags=''
323 locincpth=''
324 optimize=''
325 cf_email=''
326 cf_by=''
327 cf_time=''
328 charsize=''
329 contains=''
330 cpp_stuff=''
331 cpplast=''
332 cppminus=''
333 cpprun=''
334 cppstdin=''
335 d__fwalk=''
336 d_access=''
337 d_accessx=''
338 d_aintl=''
339 d_alarm=''
340 asctime_r_proto=''
341 d_asctime_r=''
342 d_attribut=''
343 d_bcmp=''
344 d_bcopy=''
345 d_bzero=''
346 d_casti32=''
347 castflags=''
348 d_castneg=''
349 d_chown=''
350 d_chroot=''
351 d_chsize=''
352 d_class=''
353 d_closedir=''
354 d_void_closedir=''
355 d_cmsghdr_s=''
356 d_const=''
357 d_copysignl=''
358 cryptlib=''
359 d_crypt=''
360 crypt_r_proto=''
361 d_crypt_r=''
362 d_csh=''
363 full_csh=''
364 ctermid_r_proto=''
365 d_ctermid_r=''
366 ctime_r_proto=''
367 d_ctime_r=''
368 d_cuserid=''
369 d_dbl_dig=''
370 d_dbminitproto=''
371 d_difftime=''
372 d_dirfd=''
373 d_dlerror=''
374 d_dlopen=''
375 d_dlsymun=''
376 d_dosuid=''
377 d_suidsafe=''
378 d_drand48_r=''
379 drand48_r_proto=''
380 d_drand48proto=''
381 d_dup2=''
382 d_eaccess=''
383 d_endgrent=''
384 d_endgrent_r=''
385 endgrent_r_proto=''
386 d_endhent=''
387 d_endhostent_r=''
388 endhostent_r_proto=''
389 d_endnent=''
390 d_endnetent_r=''
391 endnetent_r_proto=''
392 d_endpent=''
393 d_endprotoent_r=''
394 endprotoent_r_proto=''
395 d_endpwent=''
396 d_endpwent_r=''
397 endpwent_r_proto=''
398 d_endsent=''
399 d_endservent_r=''
400 endservent_r_proto=''
401 d_faststdio=''
402 d_fchdir=''
403 d_fchmod=''
404 d_fchown=''
405 d_fcntl=''
406 d_fcntl_can_lock=''
407 d_fd_macros=''
408 d_fd_set=''
409 d_fds_bits=''
410 d_fgetpos=''
411 d_finite=''
412 d_finitel=''
413 d_flexfnam=''
414 d_flock=''
415 d_flockproto=''
416 d_fork=''
417 d_fp_class=''
418 d_fpclass=''
419 d_fpclassify=''
420 d_fpclassl=''
421 d_fpos64_t=''
422 d_frexpl=''
423 d_fs_data_s=''
424 d_fseeko=''
425 d_fsetpos=''
426 d_fstatfs=''
427 d_fsync=''
428 d_ftello=''
429 d_ftime=''
430 d_gettimeod=''
431 d_Gconvert=''
432 d_getcwd=''
433 d_getespwnam=''
434 d_getfsstat=''
435 d_getgrent=''
436 d_getgrent_r=''
437 getgrent_r_proto=''
438 d_getgrgid_r=''
439 getgrgid_r_proto=''
440 d_getgrnam_r=''
441 getgrnam_r_proto=''
442 d_getgrps=''
443 d_gethbyaddr=''
444 d_gethbyname=''
445 d_gethent=''
446 aphostname=''
447 d_gethname=''
448 d_phostname=''
449 d_uname=''
450 d_gethostbyaddr_r=''
451 gethostbyaddr_r_proto=''
452 d_gethostbyname_r=''
453 gethostbyname_r_proto=''
454 d_gethostent_r=''
455 gethostent_r_proto=''
456 d_gethostprotos=''
457 d_getitimer=''
458 d_getlogin=''
459 d_getlogin_r=''
460 getlogin_r_proto=''
461 d_getmnt=''
462 d_getmntent=''
463 d_getnbyaddr=''
464 d_getnbyname=''
465 d_getnent=''
466 d_getnetbyaddr_r=''
467 getnetbyaddr_r_proto=''
468 d_getnetbyname_r=''
469 getnetbyname_r_proto=''
470 d_getnetent_r=''
471 getnetent_r_proto=''
472 d_getnetprotos=''
473 d_getpagsz=''
474 d_getpent=''
475 d_getpgid=''
476 d_getpgrp2=''
477 d_bsdgetpgrp=''
478 d_getpgrp=''
479 d_getppid=''
480 d_getprior=''
481 d_getpbyname=''
482 d_getpbynumber=''
483 d_getprotobyname_r=''
484 getprotobyname_r_proto=''
485 d_getprotobynumber_r=''
486 getprotobynumber_r_proto=''
487 d_getprotoent_r=''
488 getprotoent_r_proto=''
489 d_getprotoprotos=''
490 d_getprpwnam=''
491 d_getpwent=''
492 d_getpwent_r=''
493 getpwent_r_proto=''
494 d_getpwnam_r=''
495 getpwnam_r_proto=''
496 d_getpwuid_r=''
497 getpwuid_r_proto=''
498 d_getsent=''
499 d_getservbyname_r=''
500 getservbyname_r_proto=''
501 d_getservbyport_r=''
502 getservbyport_r_proto=''
503 d_getservent_r=''
504 getservent_r_proto=''
505 d_getservprotos=''
506 d_getspnam=''
507 d_getspnam_r=''
508 getspnam_r_proto=''
509 d_getsbyname=''
510 d_getsbyport=''
511 d_gmtime_r=''
512 gmtime_r_proto=''
513 d_gnulibc=''
514 gnulibc_version=''
515 d_hasmntopt=''
516 d_htonl=''
517 d_ilogbl=''
518 d_inetaton=''
519 d_int64_t=''
520 d_isascii=''
521 d_isfinite=''
522 d_isinf=''
523 d_isnan=''
524 d_isnanl=''
525 d_killpg=''
526 d_lchown=''
527 d_ldbl_dig=''
528 d_link=''
529 d_localtime_r=''
530 localtime_r_proto=''
531 d_locconv=''
532 d_lockf=''
533 d_longdbl=''
534 longdblsize=''
535 d_longlong=''
536 longlongsize=''
537 d_lseekproto=''
538 d_lstat=''
539 d_madvise=''
540 d_mblen=''
541 d_mbstowcs=''
542 d_mbtowc=''
543 d_memchr=''
544 d_memcmp=''
545 d_memcpy=''
546 d_memmove=''
547 d_memset=''
548 d_mkdir=''
549 d_mkdtemp=''
550 d_mkfifo=''
551 d_mkstemp=''
552 d_mkstemps=''
553 d_mktime=''
554 d_mmap=''
555 mmaptype=''
556 d_modfl=''
557 d_modfl_pow32_bug=''
558 d_modflproto=''
559 d_mprotect=''
560 d_msg=''
561 d_msgctl=''
562 d_msgget=''
563 d_msghdr_s=''
564 d_msgrcv=''
565 d_msgsnd=''
566 d_msync=''
567 d_munmap=''
568 d_nice=''
569 d_nl_langinfo=''
570 d_off64_t=''
571 d_open3=''
572 d_fpathconf=''
573 d_pathconf=''
574 d_pause=''
575 d_pipe=''
576 d_poll=''
577 d_portable=''
578 d_procselfexe=''
579 procselfexe=''
580 d_old_pthread_create_joinable=''
581 old_pthread_create_joinable=''
582 d_pthread_atfork=''
583 d_pthread_attr_setscope=''
584 d_pthread_yield=''
585 d_sched_yield=''
586 sched_yield=''
587 d_qgcvt=''
588 d_random_r=''
589 random_r_proto=''
590 d_readdir64_r=''
591 readdir64_r_proto=''
592 d_readdir=''
593 d_rewinddir=''
594 d_seekdir=''
595 d_telldir=''
596 d_readdir_r=''
597 readdir_r_proto=''
598 d_readlink=''
599 d_readv=''
600 d_recvmsg=''
601 d_rename=''
602 d_rmdir=''
603 d_safebcpy=''
604 d_safemcpy=''
605 d_sanemcmp=''
606 d_sbrkproto=''
607 d_scalbnl=''
608 d_select=''
609 d_sem=''
610 d_semctl=''
611 d_semget=''
612 d_semop=''
613 d_sendmsg=''
614 d_setegid=''
615 d_seteuid=''
616 d_setgrent=''
617 d_setgrent_r=''
618 setgrent_r_proto=''
619 d_setgrps=''
620 d_sethent=''
621 d_sethostent_r=''
622 sethostent_r_proto=''
623 d_setitimer=''
624 d_setlinebuf=''
625 d_setlocale=''
626 d_setlocale_r=''
627 setlocale_r_proto=''
628 d_setnent=''
629 d_setnetent_r=''
630 setnetent_r_proto=''
631 d_setpent=''
632 d_setpgid=''
633 d_setpgrp2=''
634 d_bsdsetpgrp=''
635 d_setpgrp=''
636 d_setprior=''
637 d_setproctitle=''
638 d_setprotoent_r=''
639 setprotoent_r_proto=''
640 d_setpwent=''
641 d_setpwent_r=''
642 setpwent_r_proto=''
643 d_setregid=''
644 d_setresgid=''
645 d_setresuid=''
646 d_setreuid=''
647 d_setrgid=''
648 d_setruid=''
649 d_setsent=''
650 d_setservent_r=''
651 setservent_r_proto=''
652 d_setsid=''
653 d_setvbuf=''
654 d_sfio=''
655 usesfio=''
656 d_shm=''
657 d_shmat=''
658 d_shmatprototype=''
659 shmattype=''
660 d_shmctl=''
661 d_shmdt=''
662 d_shmget=''
663 d_sigaction=''
664 d_sigprocmask=''
665 d_sigsetjmp=''
666 d_sockatmark=''
667 d_sockatmarkproto=''
668 d_msg_ctrunc=''
669 d_msg_dontroute=''
670 d_msg_oob=''
671 d_msg_peek=''
672 d_msg_proxy=''
673 d_oldsock=''
674 d_scm_rights=''
675 d_socket=''
676 d_sockpair=''
677 sockethdr=''
678 socketlib=''
679 d_socklen_t=''
680 d_socks5_init=''
681 d_sqrtl=''
682 d_srand48_r=''
683 srand48_r_proto=''
684 d_srandom_r=''
685 srandom_r_proto=''
686 d_sresgproto=''
687 d_sresuproto=''
688 d_statblks=''
689 d_statfs_f_flags=''
690 d_statfs_s=''
691 d_fstatvfs=''
692 d_statvfs=''
693 d_stdio_cnt_lval=''
694 d_stdio_ptr_lval=''
695 d_stdio_ptr_lval_nochange_cnt=''
696 d_stdio_ptr_lval_sets_cnt=''
697 d_stdiobase=''
698 d_stdstdio=''
699 stdio_base=''
700 stdio_bufsiz=''
701 stdio_cnt=''
702 stdio_filbuf=''
703 stdio_ptr=''
704 d_index=''
705 d_strchr=''
706 d_strcoll=''
707 d_strctcpy=''
708 d_strerrm=''
709 d_strerror=''
710 d_sysernlst=''
711 d_syserrlst=''
712 d_strerror_r=''
713 strerror_r_proto=''
714 d_strftime=''
715 d_strlcat=''
716 d_strlcpy=''
717 d_strtod=''
718 d_strtol=''
719 d_strtold=''
720 d_strtoll=''
721 d_strtoq=''
722 d_strtoul=''
723 d_strtoull=''
724 d_strtouq=''
725 d_strxfrm=''
726 d_symlink=''
727 d_syscall=''
728 d_syscallproto=''
729 d_sysconf=''
730 d_system=''
731 d_tcgetpgrp=''
732 d_tcsetpgrp=''
733 d_telldirproto=''
734 d_time=''
735 timetype=''
736 clocktype=''
737 d_times=''
738 d_tmpnam_r=''
739 tmpnam_r_proto=''
740 d_truncate=''
741 d_ttyname_r=''
742 ttyname_r_proto=''
743 d_tzname=''
744 d_u32align=''
745 d_ualarm=''
746 d_umask=''
747 d_semctl_semid_ds=''
748 d_semctl_semun=''
749 d_union_semun=''
750 d_unordered=''
751 d_usleep=''
752 d_usleepproto=''
753 d_ustat=''
754 d_vfork=''
755 usevfork=''
756 d_voidsig=''
757 signal_t=''
758 d_volatile=''
759 d_charvspr=''
760 d_vprintf=''
761 d_wait4=''
762 d_waitpid=''
763 d_wcstombs=''
764 d_wctomb=''
765 d_writev=''
766 dlext=''
767 cccdlflags=''
768 ccdlflags=''
769 dlsrc=''
770 ld=''
771 lddlflags=''
772 usedl=''
773 doublesize=''
774 ebcdic=''
775 fflushNULL=''
776 fflushall=''
777 fpossize=''
778 fpostype=''
779 gccansipedantic=''
780 gccosandvers=''
781 gccversion=''
782 gidformat=''
783 gidsign=''
784 gidsize=''
785 gidtype=''
786 groupstype=''
787 h_fcntl=''
788 h_sysfile=''
789 html1dir=''
790 html1direxp=''
791 installhtml1dir=''
792 html3dir=''
793 html3direxp=''
794 installhtml3dir=''
795 i_arpainet=''
796 i_crypt=''
797 db_hashtype=''
798 db_prefixtype=''
799 db_version_major=''
800 db_version_minor=''
801 db_version_patch=''
802 i_db=''
803 i_dbm=''
804 i_rpcsvcdbm=''
805 d_dirnamlen=''
806 direntrytype=''
807 i_dirent=''
808 i_dld=''
809 i_dlfcn=''
810 i_fcntl=''
811 i_float=''
812 i_fp=''
813 i_fp_class=''
814 i_gdbm=''
815 d_grpasswd=''
816 i_grp=''
817 i_ieeefp=''
818 i_inttypes=''
819 i_langinfo=''
820 i_libutil=''
821 i_limits=''
822 i_locale=''
823 i_machcthr=''
824 i_malloc=''
825 i_math=''
826 i_memory=''
827 i_mntent=''
828 i_ndbm=''
829 i_netdb=''
830 i_neterrno=''
831 i_netinettcp=''
832 i_niin=''
833 i_sysin=''
834 i_poll=''
835 i_prot=''
836 i_pthread=''
837 d_pwage=''
838 d_pwchange=''
839 d_pwclass=''
840 d_pwcomment=''
841 d_pwexpire=''
842 d_pwgecos=''
843 d_pwpasswd=''
844 d_pwquota=''
845 i_pwd=''
846 i_sfio=''
847 i_shadow=''
848 i_socks=''
849 i_stddef=''
850 i_stdlib=''
851 i_string=''
852 strings=''
853 i_sunmath=''
854 i_sysaccess=''
855 i_sysdir=''
856 i_sysfile=''
857 d_voidtty=''
858 i_bsdioctl=''
859 i_sysfilio=''
860 i_sysioctl=''
861 i_syssockio=''
862 i_syslog=''
863 i_sysmman=''
864 i_sysmode=''
865 i_sysmount=''
866 i_sysndir=''
867 i_sysparam=''
868 i_sysresrc=''
869 i_syssecrt=''
870 i_sysselct=''
871 i_sysstat=''
872 i_sysstatfs=''
873 i_sysstatvfs=''
874 i_systimes=''
875 i_systypes=''
876 i_sysuio=''
877 i_sysun=''
878 i_sysutsname=''
879 i_sysvfs=''
880 i_syswait=''
881 i_sgtty=''
882 i_termio=''
883 i_termios=''
884 d_tm_tm_gmtoff=''
885 d_tm_tm_zone=''
886 i_systime=''
887 i_systimek=''
888 i_time=''
889 timeincl=''
890 i_unistd=''
891 i_ustat=''
892 i_utime=''
893 i_values=''
894 i_stdarg=''
895 i_varargs=''
896 i_varhdr=''
897 i_vfork=''
898 inc_version_list=''
899 inc_version_list_init=''
900 installprefix=''
901 installprefixexp=''
902 installstyle=''
903 installusrbinperl=''
904 intsize=''
905 longsize=''
906 shortsize=''
907 issymlink=''
908 libc=''
909 ldlibpthname=''
910 libperl=''
911 shrpenv=''
912 useshrplib=''
913 glibpth=''
914 libpth=''
915 loclibpth=''
916 plibpth=''
917 xlibpth=''
918 ignore_versioned_solibs=''
919 libs=''
920 libsdirs=''
921 libsfiles=''
922 libsfound=''
923 libspath=''
924 lns=''
925 d_PRIEUldbl=''
926 d_PRIFUldbl=''
927 d_PRIGUldbl=''
928 d_PRIeldbl=''
929 d_PRIfldbl=''
930 d_PRIgldbl=''
931 d_SCNfldbl=''
932 sPRIEUldbl=''
933 sPRIFUldbl=''
934 sPRIGUldbl=''
935 sPRIeldbl=''
936 sPRIfldbl=''
937 sPRIgldbl=''
938 sSCNfldbl=''
939 lseeksize=''
940 lseektype=''
941 make_set_make=''
942 d_mymalloc=''
943 freetype=''
944 mallocobj=''
945 mallocsrc=''
946 malloctype=''
947 usemallocwrap=''
948 usemymalloc=''
949 installman1dir=''
950 man1dir=''
951 man1direxp=''
952 man1ext=''
953 installman3dir=''
954 man3dir=''
955 man3direxp=''
956 man3ext=''
957 modetype=''
958 multiarch=''
959 mydomain=''
960 myhostname=''
961 phostname=''
962 c=''
963 n=''
964 d_eofnblk=''
965 eagain=''
966 o_nonblock=''
967 rd_nodata=''
968 need_va_copy=''
969 netdb_hlen_type=''
970 netdb_host_type=''
971 netdb_name_type=''
972 netdb_net_type=''
973 groupcat=''
974 hostcat=''
975 passcat=''
976 orderlib=''
977 ranlib=''
978 d_perl_otherlibdirs=''
979 otherlibdirs=''
980 package=''
981 spackage=''
982 pager=''
983 api_revision=''
984 api_subversion=''
985 api_version=''
986 api_versionstring=''
987 patchlevel=''
988 perl_patchlevel=''
989 revision=''
990 subversion=''
991 version=''
992 version_patchlevel_string=''
993 perl5=''
994 perladmin=''
995 perlpath=''
996 d_nv_preserves_uv=''
997 i16size=''
998 i16type=''
999 i32size=''
1000 i32type=''
1001 i64size=''
1002 i64type=''
1003 i8size=''
1004 i8type=''
1005 ivsize=''
1006 ivtype=''
1007 nv_preserves_uv_bits=''
1008 nvsize=''
1009 nvtype=''
1010 u16size=''
1011 u16type=''
1012 u32size=''
1013 u32type=''
1014 u64size=''
1015 u64type=''
1016 u8size=''
1017 u8type=''
1018 uvsize=''
1019 uvtype=''
1020 ivdformat=''
1021 nvEUformat=''
1022 nvFUformat=''
1023 nvGUformat=''
1024 nveformat=''
1025 nvfformat=''
1026 nvgformat=''
1027 uvXUformat=''
1028 uvoformat=''
1029 uvuformat=''
1030 uvxformat=''
1031 pidtype=''
1032 prefix=''
1033 prefixexp=''
1034 installprivlib=''
1035 privlib=''
1036 privlibexp=''
1037 prototype=''
1038 ptrsize=''
1039 d_PRIXU64=''
1040 d_PRId64=''
1041 d_PRIi64=''
1042 d_PRIo64=''
1043 d_PRIu64=''
1044 d_PRIx64=''
1045 sPRIXU64=''
1046 sPRId64=''
1047 sPRIi64=''
1048 sPRIo64=''
1049 sPRIu64=''
1050 sPRIx64=''
1051 d_quad=''
1052 quadkind=''
1053 quadtype=''
1054 uquadtype=''
1055 drand01=''
1056 randbits=''
1057 randfunc=''
1058 randseedtype=''
1059 seedfunc=''
1060 installscript=''
1061 scriptdir=''
1062 scriptdirexp=''
1063 selectminbits=''
1064 selecttype=''
1065 sh=''
1066 sig_count=''
1067 sig_name=''
1068 sig_name_init=''
1069 sig_num=''
1070 sig_num_init=''
1071 sig_size=''
1072 installsitearch=''
1073 sitearch=''
1074 sitearchexp=''
1075 installsitebin=''
1076 sitebin=''
1077 sitebinexp=''
1078 installsitehtml1dir=''
1079 sitehtml1dir=''
1080 sitehtml1direxp=''
1081 installsitehtml3dir=''
1082 sitehtml3dir=''
1083 sitehtml3direxp=''
1084 installsitelib=''
1085 sitelib=''
1086 sitelib_stem=''
1087 sitelibexp=''
1088 installsiteman1dir=''
1089 siteman1dir=''
1090 siteman1direxp=''
1091 installsiteman3dir=''
1092 siteman3dir=''
1093 siteman3direxp=''
1094 siteprefix=''
1095 siteprefixexp=''
1096 installsitescript=''
1097 sitescript=''
1098 sitescriptexp=''
1099 sizesize=''
1100 sizetype=''
1101 so=''
1102 socksizetype=''
1103 sharpbang=''
1104 shsharp=''
1105 spitshell=''
1106 src=''
1107 ssizetype=''
1108 startperl=''
1109 startsh=''
1110 stdchar=''
1111 d_stdio_stream_array=''
1112 stdio_stream_array=''
1113 sysman=''
1114 trnl=''
1115 uidformat=''
1116 uidsign=''
1117 uidsize=''
1118 uidtype=''
1119 archname64=''
1120 use64bitall=''
1121 use64bitint=''
1122 usefaststdio=''
1123 ccflags_uselargefiles=''
1124 ldflags_uselargefiles=''
1125 libswanted_uselargefiles=''
1126 uselargefiles=''
1127 uselongdouble=''
1128 usemorebits=''
1129 usemultiplicity=''
1130 nm_opt=''
1131 nm_so_opt=''
1132 runnm=''
1133 usenm=''
1134 useperlio=''
1135 usesocks=''
1136 d_oldpthreads=''
1137 use5005threads=''
1138 useithreads=''
1139 usereentrant=''
1140 usethreads=''
1141 incpath=''
1142 mips_type=''
1143 usrinc=''
1144 d_vendorarch=''
1145 installvendorarch=''
1146 vendorarch=''
1147 vendorarchexp=''
1148 d_vendorbin=''
1149 installvendorbin=''
1150 vendorbin=''
1151 vendorbinexp=''
1152 installvendorhtml1dir=''
1153 vendorhtml1dir=''
1154 vendorhtml1direxp=''
1155 installvendorhtml3dir=''
1156 vendorhtml3dir=''
1157 vendorhtml3direxp=''
1158 d_vendorlib=''
1159 installvendorlib=''
1160 vendorlib=''
1161 vendorlib_stem=''
1162 vendorlibexp=''
1163 installvendorman1dir=''
1164 vendorman1dir=''
1165 vendorman1direxp=''
1166 installvendorman3dir=''
1167 vendorman3dir=''
1168 vendorman3direxp=''
1169 usevendorprefix=''
1170 vendorprefix=''
1171 vendorprefixexp=''
1172 d_vendorscript=''
1173 installvendorscript=''
1174 vendorscript=''
1175 vendorscriptexp=''
1176 versiononly=''
1177 defvoidused=''
1178 voidflags=''
1179 yacc=''
1180 yaccflags=''
1181 CONFIG=''
1182
1183 define='define'
1184 undef='undef'
1185 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1186 rmlist=''
1187
1188 : We must find out about Eunice early
1189 eunicefix=':'
1190 if test -f /etc/unixtovms; then
1191         eunicefix=/etc/unixtovms
1192 fi
1193 if test -f /etc/unixtovms.exe; then
1194         eunicefix=/etc/unixtovms.exe
1195 fi
1196
1197 : Set executable suffix now -- needed before hints available
1198 if test -f "/libs/version.library"; then
1199 : Amiga OS
1200     _exe=""
1201 elif test -f "/system/gnu_library/bin/ar.pm"; then
1202 : Stratus VOS
1203     _exe=".pm"
1204 elif test -n "$DJGPP"; then
1205 : DOS DJGPP
1206     _exe=".exe"
1207 elif test -d c:/. -o -n "$is_os2" ; then
1208 : OS/2 or cygwin
1209     _exe=".exe"
1210 fi
1211
1212 i_whoami=''
1213 ccname=''
1214 ccversion=''
1215 perllibs=''
1216 : set useposix=false in your hint file to disable the POSIX extension.
1217 useposix=true
1218 : set useopcode=false in your hint file to disable the Opcode extension.
1219 useopcode=true
1220 : Trailing extension.  Override this in a hint file, if needed.
1221 : Extra object files, if any, needed on this platform.
1222 archobjs=''
1223 archname=''
1224 : Possible local include directories to search.
1225 : Set locincpth to "" in a hint file to defeat local include searches.
1226 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1227 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1228 :
1229 : no include file wanted by default
1230 inclwanted=''
1231
1232 groupstype=''
1233 libnames=''
1234 : change the next line if compiling for Xenix/286 on Xenix/386
1235 xlibpth='/usr/lib/386 /lib/386'
1236 : Possible local library directories to search.
1237 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1238 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1239
1240 : general looking path for locating libraries
1241 glibpth="/lib /usr/lib $xlibpth"
1242 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1243 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1244 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1245
1246 : Private path used by Configure to find libraries.  Its value
1247 : is prepended to libpth. This variable takes care of special
1248 : machines, like the mips.  Usually, it should be empty.
1249 plibpth=''
1250
1251 : default library list
1252 libswanted=''
1253 : some systems want to use only the non-versioned libso:s
1254 ignore_versioned_solibs=''
1255 siteman1dir=''
1256 siteman3dir=''
1257 sitescript=''
1258 archname64=''
1259 ccflags_uselargefiles=''
1260 ldflags_uselargefiles=''
1261 libswanted_uselargefiles=''
1262 : set usemultiplicity on the Configure command line to enable multiplicity.
1263 : set usesocks on the Configure command line to enable socks.
1264 : set usethreads on the Configure command line to enable threads.
1265 usereentrant='undef'
1266 : full support for void wanted by default
1267 defvoidused=15
1268
1269 : List of libraries we want.
1270 : If anyone needs extra -lxxx, put those in a hint file.
1271 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1272 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1273 : We probably want to search /usr/shlib before most other libraries.
1274 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1275 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1276 glibpth="/usr/shlib $glibpth"
1277 : Do not use vfork unless overridden by a hint file.
1278 usevfork=false
1279
1280 : Find the basic shell for Bourne shell scripts
1281 case "$sh" in
1282 '')
1283         case "$SYSTYPE" in
1284         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1285         *) xxx='/bin/sh';;
1286         esac
1287         if test -f "$xxx"; then
1288                 sh="$xxx"
1289         else
1290                 : Build up a list and do a single loop so we can 'break' out.
1291                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1292                 for xxx in sh bash ksh pdksh ash; do
1293                         for p in $pth; do
1294                                 try="$try ${p}/${xxx}"
1295                         done
1296                 done
1297                 for xxx in $try; do
1298                         if test -f "$xxx"; then
1299                                 sh="$xxx";
1300                                 break
1301                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1302                                 sh="$xxx";
1303                                 break
1304                         elif test -f "$xxx.exe"; then
1305                                 sh="$xxx";
1306                                 break
1307                         fi
1308                 done
1309         fi
1310         ;;
1311 esac
1312
1313 case "$sh" in
1314 '')     cat >&2 <<EOM
1315 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1316
1317 Usually it's in /bin/sh.  How did you even get this far?
1318 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1319 we'll try to straighten this all out.
1320 EOM
1321         exit 1
1322         ;;
1323 esac
1324
1325 : see if sh knows # comments
1326 if `$sh -c '#' >/dev/null 2>&1`; then
1327         shsharp=true
1328         spitshell=cat
1329         xcat=/bin/cat
1330         test -f $xcat$_exe || xcat=/usr/bin/cat
1331         if test ! -f $xcat$_exe; then
1332                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1333                         if test -f $p/cat$_exe; then
1334                                 xcat=$p/cat
1335                                 break
1336                         fi
1337                 done
1338                 if test ! -f $xcat$_exe; then
1339                         echo "Can't find cat anywhere!"
1340                         exit 1
1341                 fi
1342         fi
1343         echo "#!$xcat" >sharp
1344         $eunicefix sharp
1345         chmod +x sharp
1346         ./sharp > today
1347         if test -s today; then
1348                 sharpbang='#!'
1349         else
1350                 echo "#! $xcat" > sharp
1351                 $eunicefix sharp
1352                 chmod +x sharp
1353                 ./sharp > today
1354                 if test -s today; then
1355                         sharpbang='#! '
1356                 else
1357                         sharpbang=': use '
1358                 fi
1359         fi
1360 else
1361         echo " "
1362         echo "Your $sh doesn't grok # comments--I will strip them later on."
1363         shsharp=false
1364         cd ..
1365         echo "exec grep -v '^[  ]*#'" >spitshell
1366         chmod +x spitshell
1367         $eunicefix spitshell
1368         spitshell=`pwd`/spitshell
1369         cd UU
1370         echo "I presume that if # doesn't work, #! won't work either!"
1371         sharpbang=': use '
1372 fi
1373 rm -f sharp today
1374
1375 : figure out how to guarantee sh startup
1376 case "$startsh" in
1377 '') startsh=${sharpbang}${sh} ;;
1378 *)
1379 esac
1380 cat >sharp <<EOSS
1381 $startsh
1382 set abc
1383 test "$?abc" != 1
1384 EOSS
1385
1386 chmod +x sharp
1387 $eunicefix sharp
1388 if ./sharp; then
1389         : echo "Yup, it does."
1390 else
1391         echo "Hmm... '$startsh' does not guarantee sh startup..."
1392         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1393 fi
1394 rm -f sharp
1395
1396
1397 : Save command line options in file UU/cmdline.opt for later use in
1398 : generating config.sh.
1399 cat > cmdline.opt <<EOSH
1400 # Configure command line arguments.
1401 config_arg0='$0'
1402 config_args='$*'
1403 config_argc=$#
1404 EOSH
1405 argn=1
1406 args_exp=''
1407 args_sep=''
1408 for arg in "$@"; do
1409         cat >>cmdline.opt <<EOSH
1410 config_arg$argn='$arg'
1411 EOSH
1412         # Extreme backslashitis: replace each ' by '"'"'
1413         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1414 $arg
1415 EOC
1416         arg_exp=`cat cmdl.opt`
1417         args_exp="$args_exp$args_sep'$arg_exp'"
1418         argn=`expr $argn + 1`
1419         args_sep=' '
1420 done
1421 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1422 # used by ./hints/os2.sh
1423 rm -f cmdl.opt
1424
1425 : produce awk script to parse command line options
1426 cat >options.awk <<'EOF'
1427 BEGIN {
1428         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1429
1430         len = length(optstr);
1431         for (i = 1; i <= len; i++) {
1432                 c = substr(optstr, i, 1);
1433                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1434                 if (a == ":") {
1435                         arg[c] = 1;
1436                         i++;
1437                 }
1438                 opt[c] = 1;
1439         }
1440 }
1441 {
1442         expect = 0;
1443         str = $0;
1444         if (substr(str, 1, 1) != "-") {
1445                 printf("'%s'\n", str);
1446                 next;
1447         }
1448         len = length($0);
1449         for (i = 2; i <= len; i++) {
1450                 c = substr(str, i, 1);
1451                 if (!opt[c]) {
1452                         printf("-%s\n", substr(str, i));
1453                         next;
1454                 }
1455                 printf("-%s\n", c);
1456                 if (arg[c]) {
1457                         if (i < len)
1458                                 printf("'%s'\n", substr(str, i + 1));
1459                         else
1460                                 expect = 1;
1461                         next;
1462                 }
1463         }
1464 }
1465 END {
1466         if (expect)
1467                 print "?";
1468 }
1469 EOF
1470
1471 : process the command line options
1472 set X `for arg in "$@"; do echo "X$arg"; done |
1473         sed -e s/X// | awk -f options.awk`
1474 eval "set $*"
1475 shift
1476 rm -f options.awk
1477
1478 : set up default values
1479 fastread=''
1480 reuseval=false
1481 config_sh=''
1482 alldone=''
1483 error=''
1484 silent=''
1485 extractsh=''
1486 override=''
1487 knowitall=''
1488 rm -f optdef.sh posthint.sh
1489 cat >optdef.sh <<EOS
1490 $startsh
1491 EOS
1492
1493
1494 : option parsing
1495 while test $# -gt 0; do
1496         case "$1" in
1497         -d) shift; fastread=yes;;
1498         -e) shift; alldone=cont;;
1499         -f)
1500                 shift
1501                 cd ..
1502                 if test -r "$1"; then
1503                         config_sh="$1"
1504                 else
1505                         echo "$me: cannot read config file $1." >&2
1506                         error=true
1507                 fi
1508                 cd UU
1509                 shift;;
1510         -h) shift; error=true;;
1511         -r) shift; reuseval=true;;
1512         -s) shift; silent=true; realsilent=true;;
1513         -E) shift; alldone=exit;;
1514         -K) shift; knowitall=true;;
1515         -O) shift; override=true;;
1516         -S) shift; silent=true; extractsh=true;;
1517         -D)
1518                 shift
1519                 case "$1" in
1520                 *=)
1521                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1522                         echo "$me: ignoring -D $1" >&2
1523                         ;;
1524                 *=*) echo "$1" | \
1525                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1526                 *) echo "$1='define'" >> optdef.sh;;
1527                 esac
1528                 shift
1529                 ;;
1530         -U)
1531                 shift
1532                 case "$1" in
1533                 *=) echo "$1" >> optdef.sh;;
1534                 *=*)
1535                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1536                         echo "$me: ignoring -U $1" >&2
1537                         ;;
1538                 *) echo "$1='undef'" >> optdef.sh;;
1539                 esac
1540                 shift
1541                 ;;
1542         -A)
1543             shift
1544             xxx=''
1545             yyy="$1"
1546             zzz=''
1547             uuu=undef
1548             case "$yyy" in
1549             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1550                  case "$zzz" in
1551                  *:*) zzz='' ;;
1552                  *)   xxx=append
1553                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1554                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1555                  esac
1556                  ;;
1557             esac
1558             case "$xxx" in
1559             '')  case "$yyy" in
1560                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1561                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1562                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1563                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1564                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1565                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1566                  esac
1567                  ;;       
1568             esac
1569             case "$xxx" in
1570             append)
1571                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1572             clear)
1573                 echo "$yyy=''"                  >> posthint.sh ;;
1574             define)
1575                 case "$zzz" in
1576                 '') zzz=define ;;
1577                 esac
1578                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1579             eval)
1580                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1581             prepend)
1582                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1583             undef)
1584                 case "$zzz" in
1585                 '') zzz="$uuu" ;;
1586                 esac
1587                 echo "$yyy=$zzz"                >> posthint.sh ;;
1588             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1589             esac
1590             shift
1591             ;;
1592         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1593             exit 0;;
1594         --) break;;
1595         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1596         *) break;;
1597         esac
1598 done
1599
1600 case "$error" in
1601 true)
1602         cat >&2 <<EOM
1603 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1604                  [-U symbol] [-U symbol=] [-A command:symbol...]
1605   -d : use defaults for all answers.
1606   -e : go on without questioning past the production of config.sh.
1607   -f : specify an alternate default configuration file.
1608   -h : print this help message and exit (with an error status).
1609   -r : reuse C symbols value if possible (skips costly nm extraction).
1610   -s : silent mode, only echoes questions and essential information.
1611   -D : define symbol to have some value:
1612          -D symbol         symbol gets the value 'define'
1613          -D symbol=value   symbol gets the value 'value'
1614   -E : stop at the end of questions, after having produced config.sh.
1615   -K : do not use unless you know what you are doing.
1616   -O : let -D and -U override definitions from loaded configuration file.
1617   -S : perform variable substitutions on all .SH files (can mix with -f)
1618   -U : undefine symbol:
1619          -U symbol    symbol gets the value 'undef'
1620          -U symbol=   symbol gets completely empty
1621   -A : manipulate symbol after the platform specific hints have been applied:
1622          -A symbol=value                append " "value to symbol
1623          -A append:symbol=value         append value to symbol
1624          -A define:symbol=value         define symbol to have value
1625          -A clear:symbol                define symbol to be ''
1626          -A define:symbol               define symbol to be 'define'
1627          -A eval:symbol=value           define symbol to be eval of value
1628          -A prepend:symbol=value        prepend value to symbol
1629          -A undef:symbol                define symbol to be 'undef'
1630          -A undef:symbol=               define symbol to be ''
1631   -V : print version number and exit (with a zero status).
1632 EOM
1633         exit 1
1634         ;;
1635 esac
1636
1637 : Sanity checks
1638 case "$fastread$alldone" in
1639 yescont|yesexit) ;;
1640 *)
1641         case "$extractsh" in
1642         true) ;;
1643         *)
1644                 if test ! -t 0; then
1645                         echo "Say 'sh Configure', not 'sh <Configure'"
1646                         exit 1
1647                 fi
1648                 ;;
1649         esac
1650         ;;
1651 esac
1652
1653 exec 4>&1
1654 case "$silent" in
1655 true) exec 1>/dev/null;;
1656 esac
1657
1658 : run the defines and the undefines, if any, but leave the file out there...
1659 touch optdef.sh
1660 . ./optdef.sh
1661 : create the posthint manipulation script and leave the file out there...
1662 touch posthint.sh
1663
1664 : set package name
1665 package=perl5
1666 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1667 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1668 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1669 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1670 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1671 esac
1672
1673 : Some greps do not return status, grrr.
1674 echo "grimblepritz" >grimble
1675 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1676         contains=contains
1677 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1678         contains=grep
1679 else
1680         contains=contains
1681 fi
1682 rm -f grimble
1683 : the following should work in any shell
1684 case "$contains" in
1685 contains*)
1686         echo " "
1687         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1688         cat >contains <<'EOSS'
1689 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1690 EOSS
1691 chmod +x contains
1692 esac
1693
1694 : Find the path to the source tree
1695 case "$src" in
1696 '') case "$0" in
1697     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1698          case "$src" in
1699          /*)    ;;
1700          .)     ;;
1701          *)     src=`cd ../$src && pwd` ;;
1702          esac
1703          ;;
1704     *)   src='.';;
1705     esac;;
1706 esac
1707 case "$src" in
1708 '')     src=/
1709         rsrc=/
1710         ;;
1711 /*) rsrc="$src";;
1712 *) rsrc="../$src";;
1713 esac
1714 if test -f $rsrc/Configure && \
1715         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1716 then
1717    : found it, so we are ok.
1718 else
1719         rsrc=''
1720         for src in . .. ../.. ../../.. ../../../..; do
1721                 if test -f ../$src/Configure && \
1722                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1723                 then
1724                         rsrc=../$src
1725                         break
1726                 fi
1727         done
1728 fi
1729 case "$rsrc" in
1730 '')
1731         cat <<EOM >&4
1732
1733 Sorry, I can't seem to locate the source dir for $package.  Please start
1734 Configure with an explicit path -- i.e. /some/path/Configure.
1735
1736 EOM
1737         exit 1
1738         ;;
1739 ../.)   rsrc='..';;
1740 *)
1741         echo " "
1742         echo "Sources for $package found in \"$src\"." >&4
1743         ;;
1744 esac
1745
1746 : script used to extract .SH files with variable substitutions
1747 cat >extract <<'EOS'
1748 PERL_CONFIG_SH=true
1749 echo "Doing variable substitutions on .SH files..."
1750 if test -f MANIFEST; then
1751         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1752 else
1753         echo "(Looking for .SH files under the source directory.)"
1754         set x `(cd "$src"; find . -name "*.SH" -print)`
1755 fi
1756 shift
1757 case $# in
1758 0) set x `(cd "$src"; echo *.SH)`; shift;;
1759 esac
1760 if test ! -f "$src/$1"; then
1761         shift
1762 fi
1763 mkdir_p='
1764 name=$1;
1765 create="";
1766 while test $name; do
1767         if test ! -d "$name"; then
1768                 create="$name $create";
1769                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1770                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1771         else
1772                 name="";
1773         fi;
1774 done;
1775 for file in $create; do
1776         mkdir $file;
1777 done
1778 '
1779 for file in $*; do
1780         case "$src" in
1781         ".")
1782                 case "$file" in
1783                 */*)
1784                         dir=`expr X$file : 'X\(.*\)/'`
1785                         file=`expr X$file : 'X.*/\(.*\)'`
1786                         (cd "$dir" && . ./$file)
1787                         ;;
1788                 *)
1789                         . ./$file
1790                         ;;
1791                 esac
1792                 ;;
1793         *)
1794                 case "$file" in
1795                 */*)
1796                         dir=`expr X$file : 'X\(.*\)/'`
1797                         file=`expr X$file : 'X.*/\(.*\)'`
1798                         (set x $dir; shift; eval $mkdir_p)
1799                         sh <"$src/$dir/$file"
1800                         ;;
1801                 *)
1802                         sh <"$src/$file"
1803                         ;;
1804                 esac
1805                 ;;
1806         esac
1807 done
1808 if test -f "$src/config_h.SH"; then
1809         if test ! -f config.h; then
1810         : oops, they left it out of MANIFEST, probably, so do it anyway.
1811         . "$src/config_h.SH"
1812         fi
1813 fi
1814 EOS
1815
1816 : extract files and exit if asked to do so
1817 case "$extractsh" in
1818 true)
1819         case "$realsilent" in
1820         true) ;;
1821         *) exec 1>&4;;
1822         esac
1823         case "$config_sh" in
1824         '') config_sh='config.sh';;
1825         esac
1826         echo " "
1827         echo "Fetching answers from $config_sh..."
1828         cd ..
1829         . $config_sh
1830         test "$override" && . ./optdef.sh
1831         echo " "
1832         . UU/extract
1833         rm -rf UU
1834         echo "Extraction done."
1835         exit 0
1836         ;;
1837 esac
1838
1839 : Eunice requires " " instead of "", can you believe it
1840 echo " "
1841 : Here we go...
1842 echo "Beginning of configuration questions for $package."
1843
1844 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1845
1846 : first determine how to suppress newline on echo command
1847 echo " "
1848 echo "Checking echo to see how to suppress newlines..."
1849 (echo "hi there\c" ; echo " ") >.echotmp
1850 if $contains c .echotmp >/dev/null 2>&1 ; then
1851         echo "...using -n."
1852         n='-n'
1853         c=''
1854 else
1855         cat <<'EOM'
1856 ...using \c
1857 EOM
1858         n=''
1859         c='\c'
1860 fi
1861 echo $n "The star should be here-->$c"
1862 echo '*'
1863 rm -f .echotmp
1864
1865 : Now test for existence of everything in MANIFEST
1866 echo " "
1867 if test -f "$rsrc/MANIFEST"; then
1868         echo "First let's make sure your kit is complete.  Checking..." >&4
1869         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1870         rm -f missing
1871         tmppwd=`pwd`
1872         for filelist in x??; do
1873                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1874         done
1875         if test -s missing; then
1876                 cat missing >&4
1877                 cat >&4 <<'EOM'
1878
1879 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1880
1881 You have the option of continuing the configuration process, despite the
1882 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1883 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1884 and contact the author (perlbug@perl.org).
1885
1886 EOM
1887                 echo $n "Continue? [n] $c" >&4
1888                 read ans
1889                 case "$ans" in
1890                 y*)
1891                         echo "Continuing..." >&4
1892                         rm -f missing
1893                         ;;
1894                 *)
1895                         echo "ABORTING..." >&4
1896                         kill $$
1897                         ;;
1898                 esac
1899         else
1900                 echo "Looks good..."
1901         fi
1902 else
1903         echo "There is no MANIFEST file.  I hope your kit is complete !"
1904 fi
1905 rm -f missing x??
1906
1907 echo " "
1908 : Find the appropriate value for a newline for tr
1909 if test -n "$DJGPP"; then
1910        trnl='\012'
1911 fi
1912 if test X"$trnl" = X; then
1913         case "`echo foo|tr '\n' x 2>/dev/null`" in
1914         foox) trnl='\n' ;;
1915         esac
1916 fi
1917 if test X"$trnl" = X; then
1918         case "`echo foo|tr '\012' x 2>/dev/null`" in
1919         foox) trnl='\012' ;;
1920         esac
1921 fi
1922 if test X"$trnl" = X; then
1923        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1924        fooxy) trnl='\n\r' ;;
1925        esac
1926 fi
1927 if test X"$trnl" = X; then
1928         cat <<EOM >&2
1929
1930 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1931
1932 EOM
1933         exit 1
1934 fi
1935
1936 : compute the number of columns on the terminal for proper question formatting
1937 case "$COLUMNS" in
1938 '') COLUMNS='80';;
1939 esac
1940
1941 : set up the echo used in my read
1942 myecho="case \"\$xxxm\" in
1943 '') echo $n \"\$rp $c\" >&4;;
1944 *) case \"\$rp\" in
1945         '') echo $n \"[\$xxxm] $c\";;
1946         *)
1947                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1948                         echo \"\$rp\" >&4
1949                         echo $n \"[\$xxxm] $c\" >&4
1950                 else
1951                         echo $n \"\$rp [\$xxxm] $c\" >&4
1952                 fi
1953                 ;;
1954         esac;;
1955 esac"
1956
1957 : now set up to do reads with possible shell escape and default assignment
1958 cat <<EOSC >myread
1959 $startsh
1960 xxxm=\$dflt
1961 $myecho
1962 ans='!'
1963 case "\$fastread" in
1964 yes) case "\$dflt" in
1965         '') ;;
1966         *) ans='';
1967                 case "\$silent-\$rp" in
1968                 true-) ;;
1969                 *) echo " " >&4;;
1970                 esac;;
1971         esac;;
1972 *) case "\$silent" in
1973         true) case "\$rp" in
1974                 '') ans='';;
1975                 esac;;
1976         esac;;
1977 esac
1978 while expr "X\$ans" : "X!" >/dev/null; do
1979         read answ
1980         set x \$xxxm
1981         shift
1982         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1983         case  "\$answ" in
1984         "!")
1985                 sh 1>&4
1986                 echo " "
1987                 $myecho
1988                 ;;
1989         !*)
1990                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1991                 shift
1992                 sh 1>&4 -c "\$*"
1993                 echo " "
1994                 $myecho
1995                 ;;
1996         "\$ans")
1997                 case "\$ans" in
1998                 \\&*)
1999                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2000                         shift
2001                         case "\$1" in
2002                         -d)
2003                                 fastread=yes
2004                                 echo "(OK, I'll run with -d after this question.)" >&4
2005                                 ;;
2006                         -*)
2007                                 echo "*** Sorry, \$1 not supported yet." >&4
2008                                 ;;
2009                         esac
2010                         $myecho
2011                         ans=!
2012                         ;;
2013                 esac;;
2014         *)
2015                 case "\$aok" in
2016                 y)
2017                         echo "*** Substitution done -- please confirm."
2018                         xxxm="\$ans"
2019                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2020                         xxxm="\$ans"
2021                         ans=!
2022                         ;;
2023                 *)
2024                         echo "*** Error -- try again."
2025                         ans=!
2026                         ;;
2027                 esac
2028                 $myecho
2029                 ;;
2030         esac
2031         case "\$ans\$xxxm\$nostick" in
2032         '')
2033                 ans=!
2034                 $myecho
2035                 ;;
2036         esac
2037 done
2038 case "\$ans" in
2039 '') ans="\$xxxm";;
2040 esac
2041 EOSC
2042
2043 : create .config dir to save info across Configure sessions
2044 test -d ../.config || mkdir ../.config
2045 cat >../.config/README <<EOF
2046 This directory created by Configure to save information that should
2047 persist across sessions for $package.
2048
2049 You may safely delete it if you wish.
2050 EOF
2051
2052 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2053 case "$usedevel" in
2054 $define|true|[yY]*) ;;
2055 *) case "$xversion" in
2056    *[13579])
2057         cat >&4 <<EOH
2058 *** WHOA THERE!!! ***
2059
2060     This is an UNSTABLE DEVELOPMENT release.
2061     The version of this $package distribution is $xversion, that is, odd,
2062     (as opposed to even) and that signifies a development release.
2063     If you want a maintenance release, you want an even-numbered version.
2064
2065     Do ***NOT*** install this into production use.
2066     Data corruption and crashes are possible.
2067
2068     It is most seriously suggested that you do not continue any further
2069     unless you want to help in developing and debugging Perl.
2070
2071     If you *still* want to build perl, you can answer 'y' now,
2072     or pass -Dusedevel to Configure.
2073
2074 EOH
2075         rp='Do you really want to continue?'
2076         dflt='n'
2077         . ./myread
2078         case "$ans" in
2079         [yY]) echo >&4 "Okay, continuing."
2080               usedevel="$define" ;;
2081         *) echo >&4 "Okay, bye."
2082            exit 1
2083            ;;
2084         esac
2085         ;;
2086     esac
2087     ;;
2088 esac
2089 case "$usedevel" in
2090 $define|true|[yY]*)
2091         case "$versiononly" in
2092         '') versiononly="$define" ;;
2093         esac
2094         case "$installusrbinperl" in
2095         '') installusrbinperl="$undef" ;;
2096         esac
2097         ;;
2098 esac
2099
2100 : general instructions
2101 needman=true
2102 firsttime=true
2103 user=`(logname) 2>/dev/null`
2104 case "$user" in
2105 '') user=`whoami 2>&1`;;
2106 esac
2107 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2108         firsttime=false
2109         echo " "
2110         rp='Would you like to see the instructions?'
2111         dflt=n
2112         . ./myread
2113         case "$ans" in
2114         [yY]*) ;;
2115         *) needman=false;;
2116         esac
2117 fi
2118 if $needman; then
2119         cat <<EOH
2120
2121 This installation shell script will examine your system and ask you questions
2122 to determine how the perl5 package should be installed. If you get
2123 stuck on a question, you may use a ! shell escape to start a subshell or
2124 execute a command.  Many of the questions will have default answers in square
2125 brackets; typing carriage return will give you the default.
2126
2127 On some of the questions which ask for file or directory names you are allowed
2128 to use the ~name construct to specify the login directory belonging to "name",
2129 even if you don't have a shell which knows about that.  Questions where this is
2130 allowed will be marked "(~name ok)".
2131
2132 EOH
2133         rp=''
2134         dflt='Type carriage return to continue'
2135         . ./myread
2136         cat <<'EOH'
2137
2138 The prompter used in this script allows you to use shell variables and
2139 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2140 in the default answer, as if the default line was a set of arguments given to a
2141 script shell.  This means you may also use $* to repeat the whole default line,
2142 so you do not have to re-type everything to add something to the default.
2143
2144 Everytime there is a substitution, you will have to confirm.  If there is an
2145 error (e.g. an unmatched backtick), the default answer will remain unchanged
2146 and you will be prompted again.
2147
2148 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2149 the questions and use the computed defaults (or the previous answers if there
2150 was already a config.sh file). Type 'Configure -h' for a list of options.
2151 You may also start interactively and then answer '& -d' at any prompt to turn
2152 on the non-interactive behaviour for the remainder of the execution.
2153
2154 EOH
2155         . ./myread
2156         cat <<EOH
2157
2158 Much effort has been expended to ensure that this shell script will run on any
2159 Unix system.  If despite that it blows up on yours, your best bet is to edit
2160 Configure and run it again.  If you can't run Configure for some reason,
2161 you'll have to generate a config.sh file by hand.  Whatever problems you
2162 have, let me (perlbug@perl.org) know how I blew it.
2163
2164 This installation script affects things in two ways:
2165
2166 1) it may do direct variable substitutions on some of the files included
2167    in this kit.
2168 2) it builds a config.h file for inclusion in C programs.  You may edit
2169    any of these files as the need arises after running this script.
2170
2171 If you make a mistake on a question, there is no easy way to back up to it
2172 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2173 files.  Configure will offer to let you do this before it runs the SH files.
2174
2175 EOH
2176         dflt='Type carriage return to continue'
2177         . ./myread
2178         case "$firsttime" in
2179         true) echo $user >>../.config/instruct;;
2180         esac
2181 fi
2182
2183 : find out where common programs are
2184 echo " "
2185 echo "Locating common programs..." >&4
2186 cat <<EOSC >loc
2187 $startsh
2188 case \$# in
2189 0) exit 1;;
2190 esac
2191 thing=\$1
2192 shift
2193 dflt=\$1
2194 shift
2195 for dir in \$*; do
2196         case "\$thing" in
2197         .)
2198         if test -d \$dir/\$thing; then
2199                 echo \$dir
2200                 exit 0
2201         fi
2202         ;;
2203         *)
2204         for thisthing in \$dir/\$thing; do
2205                 : just loop through to pick last item
2206         done
2207         if test -f \$thisthing; then
2208                 echo \$thisthing
2209                 exit 0
2210         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2211                 echo \$thisthing
2212                 exit 0
2213         elif test -f \$dir/\$thing.exe; then
2214                 if test -n "$DJGPP"; then
2215                         echo \$dir/\$thing.exe
2216                 elif test "$eunicefix" != ":"; then
2217                         : on Eunice apparently
2218                         echo \$dir/\$thing
2219                         exit 0
2220                 fi
2221                 exit 0
2222         fi
2223         ;;
2224         esac
2225 done
2226 echo \$dflt
2227 exit 1
2228 EOSC
2229 chmod +x loc
2230 $eunicefix loc
2231 loclist="
2232 awk
2233 cat
2234 chmod
2235 comm
2236 cp
2237 echo
2238 expr
2239 grep
2240 ls
2241 mkdir
2242 rm
2243 sed
2244 sort
2245 touch
2246 tr
2247 uniq
2248 "
2249 trylist="
2250 Mcc
2251 ar
2252 bison
2253 byacc
2254 cpp
2255 csh
2256 date
2257 egrep
2258 gmake
2259 gzip
2260 less
2261 ln
2262 make
2263 more
2264 nm
2265 nroff
2266 pg
2267 test
2268 uname
2269 zip
2270 "
2271 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2272 pth="$pth /lib /usr/lib"
2273 for file in $loclist; do
2274         eval xxx=\$$file
2275         case "$xxx" in
2276         /*|?:[\\/]*)
2277                 if test -f "$xxx"; then
2278                         : ok
2279                 else
2280                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2281                         xxx=`./loc $file $file $pth`
2282                 fi
2283                 ;;
2284         '') xxx=`./loc $file $file $pth`;;
2285         *) xxx=`./loc $xxx $xxx $pth`;;
2286         esac
2287         eval $file=$xxx$_exe
2288         eval _$file=$xxx
2289         case "$xxx" in
2290         /*)
2291                 echo $file is in $xxx.
2292                 ;;
2293         ?:[\\/]*)
2294                 echo $file is in $xxx.
2295                 ;;
2296         *)
2297                 echo "I don't know where '$file' is, and my life depends on it." >&4
2298                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2299                 exit 1
2300                 ;;
2301         esac
2302 done
2303 echo " "
2304 echo "Don't worry if any of the following aren't found..."
2305 say=offhand
2306 for file in $trylist; do
2307         eval xxx=\$$file
2308         case "$xxx" in
2309         /*|?:[\\/]*)
2310                 if test -f "$xxx"; then
2311                         : ok
2312                 else
2313                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2314                         xxx=`./loc $file $file $pth`
2315                 fi
2316                 ;;
2317         '') xxx=`./loc $file $file $pth`;;
2318         *) xxx=`./loc $xxx $xxx $pth`;;
2319         esac
2320         eval $file=$xxx$_exe
2321         eval _$file=$xxx
2322         case "$xxx" in
2323         /*)
2324                 echo $file is in $xxx.
2325                 ;;
2326         ?:[\\/]*)
2327                 echo $file is in $xxx.
2328                 ;;
2329         *)
2330                 echo "I don't see $file out there, $say."
2331                 say=either
2332                 ;;
2333         esac
2334 done
2335 case "$egrep" in
2336 egrep)
2337         echo "Substituting grep for egrep."
2338         egrep=$grep
2339         _egrep=$grep
2340         ;;
2341 esac
2342 case "$ln" in
2343 ln)
2344         echo "Substituting cp for ln."
2345         ln=$cp
2346         _ln=$cp
2347         ;;
2348 esac
2349 case "$make" in
2350 make)   
2351         case "$gmake" in
2352         gmake)
2353         echo "I can't find make or gmake, and my life depends on it." >&4
2354         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2355         exit 1
2356         ;;
2357         esac
2358         ;;
2359 esac    
2360 case "$gmake" in
2361 gmake)  ;;
2362 *)      # We can't have osname yet.
2363         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2364                 # Assume that gmake, if found, is definitely GNU make
2365                 # and prefer it over the system make.
2366                 echo "Substituting gmake for make."
2367                 make=$gmake
2368                 _make=$gmake
2369         fi
2370         ;;
2371 esac
2372 case "$test" in
2373 test)
2374         echo "Hopefully test is built into your sh."
2375         ;;
2376 *)
2377         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2378                 echo "Using the test built into your sh."
2379                 test=test
2380                 _test=test
2381         fi
2382         ;;
2383 esac
2384 case "$echo" in
2385 echo)
2386         echo "Hopefully echo is built into your sh."
2387         ;;
2388 '') ;;
2389 *)
2390         echo " "
2391 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2392         $echo $n "hi there$c" >foo1
2393         echo $n "hi there$c" >foo2
2394         if cmp foo1 foo2 >/dev/null 2>&1; then
2395                 echo "They are compatible.  In fact, they may be identical."
2396         else
2397                 case "$n" in
2398                 '-n') n='' c='\c';;
2399                 *) n='-n' c='';;
2400                 esac
2401                 cat <<FOO
2402 They are not compatible!  You are probably running ksh on a non-USG system.
2403 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2404 have echo built in and we may have to run some Bourne shell scripts.  That
2405 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2406
2407 FOO
2408                 $echo $n "The star should be here-->$c"
2409                 $echo "*"
2410         fi
2411         $rm -f foo1 foo2
2412         ;;
2413 esac
2414
2415 cat <<EOS >trygcc
2416 $startsh
2417 EOS
2418 cat <<'EOSC' >>trygcc
2419 case "$cc" in
2420 '') ;;
2421 *)  $rm -f try try.*
2422     $cat >try.c <<EOM
2423 int main(int argc, char *argv[]) {
2424   return 0;
2425 }
2426 EOM
2427     if $cc -o try $ccflags $ldflags try.c; then
2428        :
2429     else
2430         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2431         despair=yes
2432         trygcc=yes
2433         case "$cc" in
2434         *gcc*) trygcc=no ;;
2435         esac
2436         case "`$cc -v -c try.c 2>&1`" in
2437         *gcc*) trygcc=no ;;
2438         esac
2439         if $test X"$trygcc" = Xyes; then
2440             if gcc -o try -c try.c; then
2441                 echo " "
2442                 echo "You seem to have a working gcc, though." >&4
2443                 rp="Would you like to use it?"
2444                 dflt=y
2445                 if $test -f myread; then
2446                     . ./myread
2447                 else
2448                     if $test -f UU/myread; then
2449                         . ./UU/myread
2450                     else
2451                         echo "Cannot find myread, sorry.  Aborting." >&2
2452                         exit 1
2453                     fi
2454                 fi  
2455                 case "$ans" in
2456                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2457                        if $test -f usethreads.cbu; then
2458                            $cat >&4 <<EOM 
2459
2460 *** However, any setting of the C compiler flags (e.g. for thread support)
2461 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2462 *** (together with e.g. -Dusethreads).
2463
2464 EOM
2465                        fi;;
2466                 esac
2467             fi
2468         fi
2469     fi
2470     $rm -f try try.*
2471     ;;
2472 esac
2473 EOSC
2474
2475 cat <<EOS >checkcc
2476 $startsh
2477 EOS
2478 cat <<'EOSC' >>checkcc
2479 case "$cc" in        
2480 '') ;;
2481 *)  $rm -f try try.*              
2482     $cat >try.c <<EOM
2483 int main(int argc, char *argv[]) {
2484   return 0;
2485 }
2486 EOM
2487     if $cc -o try $ccflags $ldflags try.c; then
2488        :
2489     else
2490         if $test X"$despair" = Xyes; then
2491            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2492         fi
2493         $cat >&4 <<EOM         
2494 You need to find a working C compiler.
2495 Either (purchase and) install the C compiler supplied by your OS vendor,
2496 or for a free C compiler try http://gcc.gnu.org/
2497 I cannot continue any further, aborting.
2498 EOM
2499         exit 1
2500     fi
2501     $rm -f try try.*
2502     ;;
2503 esac
2504 EOSC
2505
2506 : determine whether symbolic links are supported
2507 echo " "
2508 $touch blurfl
2509 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2510         echo "Symbolic links are supported." >&4
2511         lns="$ln -s"
2512 else
2513         echo "Symbolic links are NOT supported." >&4
2514         lns="$ln"
2515 fi
2516 $rm -f blurfl sym
2517
2518 : determine whether symbolic links are supported
2519 echo " "
2520 case "$lns" in
2521 *"ln"*" -s")
2522         echo "Checking how to test for symbolic links..." >&4
2523         $lns blurfl sym
2524         if $test "X$issymlink" = X; then
2525                 case "$newsh" in
2526                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2527                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2528                 esac
2529                 if test $? = 0; then
2530                         issymlink="test -h"
2531                 else
2532                         echo "Your builtin 'test -h' may be broken." >&4
2533                         case "$test" in
2534                         /*)     ;;
2535                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2536                                 for p in $pth
2537                                 do
2538                                         if test -f "$p/$test"; then
2539                                                 test="$p/$test"
2540                                                 break
2541                                         fi
2542                                 done
2543                                 ;;
2544                         esac
2545                         case "$test" in
2546                         /*)
2547                                 echo "Trying external '$test -h'." >&4
2548                                 issymlink="$test -h"
2549                                 if $test ! -h sym >/dev/null 2>&1; then
2550                                         echo "External '$test -h' is broken, too." >&4
2551                                         issymlink=''
2552                                 fi
2553                                 ;;
2554                         *)      issymlink='' ;;
2555                         esac
2556                 fi              
2557         fi
2558         if $test "X$issymlink" = X; then
2559                 if $test -L sym 2>/dev/null; then
2560                         issymlink="$test -L"
2561                         echo "The builtin '$test -L' worked." >&4
2562                 fi
2563         fi
2564         if $test "X$issymlink" != X; then
2565                 echo "You can test for symbolic links with '$issymlink'." >&4
2566         else
2567                 echo "I do not know how you can test for symbolic links." >&4
2568         fi
2569         $rm -f blurfl sym
2570         ;;
2571 *)      echo "No symbolic links, so not testing for their testing..." >&4
2572         ;;
2573 esac
2574 echo " "
2575
2576
2577 case "$mksymlinks" in
2578 $define|true|[yY]*)
2579         case "$src" in
2580         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2581                 exit 1
2582                 ;;
2583         *)      case "$lns:$issymlink" in
2584                 *"ln"*" -s:"*"test -"?)
2585                         echo "Creating the symbolic links..." >&4
2586                         echo "(First creating the subdirectories...)" >&4
2587                         cd ..
2588                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2589                                 read directory
2590                                 test -z "$directory" && break
2591                                 mkdir -p $directory
2592                         done
2593                         # Sanity check 1.
2594                         if test ! -d t/base; then
2595                                 echo "Failed to create the subdirectories.  Aborting." >&4
2596                                 exit 1
2597                         fi
2598                         echo "(Then creating the symlinks...)" >&4
2599                         awk '{print $1}' $src/MANIFEST | while true; do
2600                                 read filename
2601                                 test -z "$filename" && break
2602                                 if test -f $filename; then
2603                                         if $issymlink $filename; then
2604                                                 rm -f $filename
2605                                         fi
2606                                 fi
2607                                 if test -f $filename; then
2608                                         echo "$filename already exists, not symlinking."
2609                                 else
2610                                         ln -s $src/$filename $filename
2611                                 fi
2612                         done
2613                         # Sanity check 2.
2614                         if test ! -f t/base/lex.t; then
2615                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2616                                 exit 1
2617                         fi
2618                         cd UU
2619                         ;;
2620                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2621                         ;;
2622                 esac
2623                 ;;
2624         esac
2625         ;;
2626 esac
2627
2628
2629 case "$usecrosscompile" in
2630 $define|true|[yY]*)
2631         $echo "Cross-compiling..."
2632         croak=''
2633         case "$cc" in
2634         *-*-gcc) # A cross-compiling gcc, probably.
2635             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2636             ar=$targetarch-ar
2637             # leave out ld, choosing it is more complex
2638             nm=$targetarch-nm
2639             ranlib=$targetarch-ranlib
2640             $echo 'extern int foo;' > try.c
2641             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2642             shift
2643             if $test $# -gt 0; then
2644                 incpth="$incpth $*"
2645                 incpth="`$echo $incpth|$sed 's/^ //'`"
2646                 echo "Guessing incpth '$incpth'." >&4
2647                 for i in $*; do
2648                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2649                     if $test -d $j; then
2650                         libpth="$libpth $j"
2651                     fi
2652                 done   
2653                 libpth="`$echo $libpth|$sed 's/^ //'`"
2654                 echo "Guessing libpth '$libpth'." >&4
2655             fi
2656             $rm -f try.c
2657             ;;
2658         esac
2659         case "$targetarch" in
2660         '') echo "Targetarch not defined." >&4; croak=y ;;
2661         *)  echo "Using targetarch $targetarch." >&4 ;;
2662         esac
2663         case "$incpth" in
2664         '') echo "Incpth not defined." >&4; croak=y ;;
2665         *)  echo "Using incpth '$incpth'." >&4 ;;
2666         esac
2667         case "$libpth" in
2668         '') echo "Libpth not defined." >&4; croak=y ;;
2669         *)  echo "Using libpth '$libpth'." >&4 ;;
2670         esac
2671         case "$usrinc" in
2672         '') for i in $incpth; do
2673                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2674                     usrinc=$i
2675                     echo "Guessing usrinc $usrinc." >&4
2676                     break
2677                 fi
2678             done
2679             case "$usrinc" in
2680             '') echo "Usrinc not defined." >&4; croak=y ;;
2681             esac
2682             ;;
2683         *)  echo "Using usrinc $usrinc." >&4 ;;
2684         esac
2685         case "$targethost" in
2686         '') echo "Targethost not defined." >&4; croak=y ;;
2687         *)  echo "Using targethost $targethost." >&4
2688         esac
2689         locincpth=' '
2690         loclibpth=' '
2691         case "$croak" in
2692         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2693         esac
2694         case "$src" in
2695         /*) run=$src/Cross/run
2696             targetmkdir=$src/Cross/mkdir
2697             to=$src/Cross/to
2698             from=$src/Cross/from
2699             ;;
2700         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2701             run=$pwd/Cross/run
2702             targetmkdir=$pwd/Cross/mkdir
2703             to=$pwd/Cross/to
2704             from=$pwd/Cross/from
2705             ;;
2706         esac
2707         case "$targetrun" in
2708         '') targetrun=ssh ;;
2709         esac
2710         case "$targetto" in
2711         '') targetto=scp ;;
2712         esac
2713         case "$targetfrom" in
2714         '') targetfrom=scp ;;
2715         esac
2716         run=$run-$targetrun
2717         to=$to-$targetto
2718         from=$from-$targetfrom
2719         case "$targetdir" in
2720         '')  targetdir=/tmp
2721              echo "Guessing targetdir $targetdir." >&4
2722              ;;
2723         esac
2724         case "$targetuser" in
2725         '')  targetuser=root
2726              echo "Guessing targetuser $targetuser." >&4
2727              ;;
2728         esac
2729         case "$targetfrom" in
2730         scp)    q=-q ;;
2731         *)      q='' ;;
2732         esac
2733         case "$targetrun" in
2734         ssh|rsh)
2735             cat >$run <<EOF
2736 #!/bin/sh
2737 case "\$1" in
2738 -cwd)
2739   shift
2740   cwd=\$1
2741   shift
2742   ;;
2743 esac
2744 case "\$cwd" in
2745 '') cwd=$targetdir ;;
2746 esac
2747 exe=\$1
2748 shift
2749 if $test ! -f \$exe.xok; then
2750   $to \$exe
2751   $touch \$exe.xok
2752 fi
2753 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2754 EOF
2755             ;;
2756         *)  echo "Unknown targetrun '$targetrun'" >&4
2757             exit 1
2758             ;;
2759         esac
2760         case "$targetmkdir" in
2761         */Cross/mkdir)
2762             cat >$targetmkdir <<EOF
2763 #!/bin/sh
2764 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2765 EOF
2766             $chmod a+rx $targetmkdir
2767             ;;
2768         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2769             exit 1
2770             ;;
2771         esac
2772         case "$targetto" in
2773         scp|rcp)
2774             cat >$to <<EOF
2775 #!/bin/sh
2776 for f in \$@
2777 do
2778   case "\$f" in
2779   /*)
2780     $targetmkdir \`dirname \$f\`
2781     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2782     ;;
2783   *)
2784     $targetmkdir $targetdir/\`dirname \$f\`
2785     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2786     ;;
2787   esac
2788 done
2789 exit 0
2790 EOF
2791             ;;
2792         cp) cat >$to <<EOF
2793 #!/bin/sh
2794 for f in \$@
2795 do
2796   case "\$f" in
2797   /*)
2798     $mkdir -p $targetdir/\`dirname \$f\`
2799     $cp \$f $targetdir/\$f || exit 1
2800     ;;
2801   *)
2802     $targetmkdir $targetdir/\`dirname \$f\`
2803     $cp \$f $targetdir/\$f || exit 1
2804     ;;
2805   esac
2806 done
2807 exit 0
2808 EOF
2809             ;;
2810         *)  echo "Unknown targetto '$targetto'" >&4
2811             exit 1
2812             ;;
2813         esac
2814         case "$targetfrom" in
2815         scp|rcp)
2816           cat >$from <<EOF
2817 #!/bin/sh
2818 for f in \$@
2819 do
2820   $rm -f \$f
2821   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2822 done
2823 exit 0
2824 EOF
2825             ;;
2826         cp) cat >$from <<EOF
2827 #!/bin/sh
2828 for f in \$@
2829 do
2830   $rm -f \$f
2831   cp $targetdir/\$f . || exit 1
2832 done
2833 exit 0
2834 EOF
2835             ;;
2836         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2837             exit 1
2838             ;;
2839         esac
2840         if $test ! -f $run; then
2841             echo "Target 'run' script '$run' not found." >&4
2842         else
2843             $chmod a+rx $run
2844         fi
2845         if $test ! -f $to; then
2846             echo "Target 'to' script '$to' not found." >&4
2847         else
2848             $chmod a+rx $to
2849         fi
2850         if $test ! -f $from; then
2851             echo "Target 'from' script '$from' not found." >&4
2852         else
2853             $chmod a+rx $from
2854         fi
2855         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2856             exit 1
2857         fi
2858         cat >&4 <<EOF
2859 Using '$run' for remote execution,
2860 and '$from' and '$to'
2861 for remote file transfer.
2862 EOF
2863         ;;
2864 *)      run=''
2865         to=:
2866         from=:
2867         usecrosscompile='undef'
2868         targetarch=''
2869         ;;
2870 esac
2871
2872 : see whether [:lower:] and [:upper:] are supported character classes
2873 echo " "
2874 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2875 ABYZ)
2876         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2877         up='[:upper:]'
2878         low='[:lower:]'
2879         ;;
2880 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2881         # (0xd9 and 0xe2), therefore that is a nice testing point.
2882         if test "X$up" = X -o "X$low" = X; then
2883             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2884             rs) up='[A-Z]'
2885                 low='[a-z]'
2886                 ;;
2887             esac
2888         fi
2889         if test "X$up" = X -o "X$low" = X; then
2890             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2891             rs) up='A-Z'
2892                 low='a-z'
2893                 ;;
2894             esac
2895         fi
2896         if test "X$up" = X -o "X$low" = X; then
2897             case "`echo RS | od -x 2>/dev/null`" in
2898             *D9E2*|*d9e2*)
2899                 echo "Hey, this might be EBCDIC." >&4
2900                 if test "X$up" = X -o "X$low" = X; then
2901                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2902                     rs) up='[A-IJ-RS-Z]'
2903                         low='[a-ij-rs-z]'
2904                         ;;
2905                     esac
2906                 fi
2907                 if test "X$up" = X -o "X$low" = X; then
2908                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2909                     rs) up='A-IJ-RS-Z'
2910                         low='a-ij-rs-z'
2911                         ;;
2912                     esac
2913                 fi
2914                 ;;
2915             esac
2916         fi
2917 esac
2918 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2919 rs)
2920     echo "Using $up and $low to convert case." >&4
2921     ;;
2922 *)
2923     echo "I don't know how to translate letters from upper to lower case." >&4
2924     echo "Your tr is not acting any way I know of." >&4
2925     exit 1
2926     ;;
2927 esac
2928 : set up the translation script tr, must be called with ./tr of course
2929 cat >tr <<EOSC
2930 $startsh
2931 case "\$1\$2" in
2932 '[A-Z][a-z]') exec $tr '$up' '$low';;
2933 '[a-z][A-Z]') exec $tr '$low' '$up';;
2934 esac
2935 exec $tr "\$@"
2936 EOSC
2937 chmod +x tr
2938 $eunicefix tr
2939
2940 : Try to determine whether config.sh was made on this system
2941 case "$config_sh" in
2942 '')
2943 myuname=`$uname -a 2>/dev/null`
2944 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2945 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2946 # because the A-Z/a-z are not consecutive.
2947 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2948         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2949 newmyuname="$myuname"
2950 dflt=n
2951 case "$knowitall" in
2952 '')
2953         if test -f ../config.sh; then
2954                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2955                         eval "`grep myuname= ../config.sh`"
2956                 fi
2957                 if test "X$myuname" = "X$newmyuname"; then
2958                         dflt=y
2959                 fi
2960         fi
2961         ;;
2962 *) dflt=y;;
2963 esac
2964
2965 : Get old answers from old config file if Configure was run on the
2966 : same system, otherwise use the hints.
2967 hint=default
2968 cd ..
2969 if test -f config.sh; then
2970         echo " "
2971         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2972         . UU/myread
2973         case "$ans" in
2974         n*|N*) echo "OK, I'll ignore it."
2975                 mv config.sh config.sh.old
2976                 myuname="$newmyuname"
2977                 ;;
2978         *)  echo "Fetching default answers from your old config.sh file..." >&4
2979                 tmp_n="$n"
2980                 tmp_c="$c"
2981                 tmp_sh="$sh"
2982                 . ./config.sh
2983                 cp config.sh UU
2984                 n="$tmp_n"
2985                 c="$tmp_c"
2986                 : Older versions did not always set $sh.  Catch re-use of such
2987                 : an old config.sh.
2988                 case "$sh" in
2989                 '') sh="$tmp_sh" ;;
2990                 esac
2991                 hint=previous
2992                 ;;
2993         esac
2994 fi
2995 . ./UU/checkcc
2996 if test ! -f config.sh; then
2997         $cat <<EOM
2998
2999 First time through, eh?  I have some defaults handy for some systems
3000 that need some extra help getting the Configure answers right:
3001
3002 EOM
3003         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3004         dflt=''
3005         : Half the following guesses are probably wrong... If you have better
3006         : tests or hints, please send them to perlbug@perl.org
3007         : The metaconfig authors would also appreciate a copy...
3008         $test -f /irix && osname=irix
3009         $test -f /xenix && osname=sco_xenix
3010         $test -f /dynix && osname=dynix
3011         $test -f /dnix && osname=dnix
3012         $test -f /lynx.os && osname=lynxos
3013         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3014         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3015         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3016         $test -f /bin/mips && /bin/mips && osname=mips
3017         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3018                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3019         $test -d /usr/apollo/bin && osname=apollo
3020         $test -f /etc/saf/_sactab && osname=svr4
3021         $test -d /usr/include/minix && osname=minix
3022         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3023         if $test -d /MachTen -o -d /MachTen_Folder; then
3024                 osname=machten
3025                 if $test -x /sbin/version; then
3026                         osvers=`/sbin/version | $awk '{print $2}' |
3027                         $sed -e 's/[A-Za-z]$//'`
3028                 elif $test -x /usr/etc/version; then
3029                         osvers=`/usr/etc/version | $awk '{print $2}' |
3030                         $sed -e 's/[A-Za-z]$//'`
3031                 else
3032                         osvers="$2.$3"
3033                 fi
3034         fi
3035
3036         $test -f /sys/posix.dll &&
3037                 $test -f /usr/bin/what &&
3038                 set X `/usr/bin/what /sys/posix.dll` &&
3039                 $test "$3" = UWIN &&
3040                 osname=uwin &&
3041                 osvers="$5"
3042
3043         if $test -f $uname; then
3044                 set X $myuname
3045                 shift
3046
3047                 case "$5" in
3048                 fps*) osname=fps ;;
3049                 mips*)
3050                         case "$4" in
3051                         umips) osname=umips ;;
3052                         *) osname=mips ;;
3053                         esac;;
3054                 [23]100) osname=mips ;;
3055                 next*) osname=next ;;
3056                 i386*)
3057                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3058                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3059                                 osname='sco'
3060                                 osvers=$tmp
3061                         elif $test -f /etc/kconfig; then
3062                                 osname=isc
3063                                 if test "$lns" = "$ln -s"; then
3064                                         osvers=4
3065                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3066                                         osvers=3
3067                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3068                                         osvers=2
3069                                 fi
3070                         fi
3071                         tmp=''
3072                         ;;
3073                 pc*)
3074                         if test -n "$DJGPP"; then
3075                                 osname=dos
3076                                 osvers=djgpp
3077                         fi
3078                         ;;
3079                 esac
3080
3081                 case "$1" in
3082                 aix) osname=aix
3083                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3084                         case "$tmp" in
3085                         # oslevel can fail with:
3086                         # oslevel: Unable to acquire lock.
3087                         *not\ found) osvers="$4"."$3" ;;
3088                         '<3240'|'<>3240') osvers=3.2.0 ;;
3089                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3090                         '=3250'|'>3250') osvers=3.2.5 ;;
3091                         *) osvers=$tmp;;
3092                         esac
3093                         ;;
3094                 bsd386) osname=bsd386
3095                         osvers=`$uname -r`
3096                         ;;
3097                 cygwin*) osname=cygwin
3098                         osvers="$3"
3099                         ;;
3100                 *dc.osx) osname=dcosx
3101                         osvers="$3"
3102                         ;;
3103                 dnix) osname=dnix
3104                         osvers="$3"
3105                         ;;
3106                 domainos) osname=apollo
3107                         osvers="$3"
3108                         ;;
3109                 dgux)   osname=dgux 
3110                         osvers="$3"
3111                         ;;
3112                 dynixptx*) osname=dynixptx
3113                         osvers=`echo "$4"|sed 's/^v//'`
3114                         ;;
3115                 freebsd) osname=freebsd 
3116                         osvers="$3" ;;
3117                 genix)  osname=genix ;;
3118                 gnu)    osname=gnu
3119                         osvers="$3" ;;
3120                 hp*)    osname=hpux 
3121                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3122                         ;;
3123                 irix*)  osname=irix
3124                         case "$3" in
3125                         4*) osvers=4 ;;
3126                         5*) osvers=5 ;;
3127                         *)      osvers="$3" ;;
3128                         esac
3129                         ;;
3130                 linux)  osname=linux
3131                         case "$3" in
3132                         *)      osvers="$3" ;;
3133                         esac
3134                         ;;
3135                 MiNT)   osname=mint
3136                         ;;
3137                 netbsd*) osname=netbsd
3138                         osvers="$3"
3139                         ;;
3140                 news-os) osvers="$3"
3141                         case "$3" in
3142                         4*) osname=newsos4 ;;
3143                         *) osname=newsos ;;
3144                         esac
3145                         ;;
3146                 next*) osname=next ;;
3147                 nonstop-ux) osname=nonstopux ;;
3148                 openbsd) osname=openbsd
3149                         osvers="$3"
3150                         ;;
3151                 os2)    osname=os2
3152                         osvers="$4"
3153                         ;;
3154                 POSIX-BC | posix-bc ) osname=posix-bc
3155                         osvers="$3"
3156                         ;;
3157                 powerux | power_ux | powermax_os | powermaxos | \
3158                 powerunix | power_unix) osname=powerux
3159                         osvers="$3"
3160                         ;;
3161                 qnx) osname=qnx
3162                         osvers="$4"
3163                         ;;
3164                 solaris) osname=solaris
3165                         case "$3" in
3166                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3167                         *)      osvers="$3" ;;
3168                         esac
3169                         ;;
3170                 sunos) osname=sunos
3171                         case "$3" in
3172                         5*) osname=solaris
3173                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3174                         *)      osvers="$3" ;;
3175                         esac
3176                         ;;
3177                 titanos) osname=titanos
3178                         case "$3" in
3179                         1*) osvers=1 ;;
3180                         2*) osvers=2 ;;
3181                         3*) osvers=3 ;;
3182                         4*) osvers=4 ;;
3183                         *)      osvers="$3" ;;
3184                         esac
3185                         ;;
3186                 ultrix) osname=ultrix
3187                         osvers="$3"
3188                         ;;
3189                 osf1|mls+)      case "$5" in
3190                                 alpha)
3191                                         osname=dec_osf
3192                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3193                                         case "$osvers" in
3194                                         [1-9].[0-9]*) ;;
3195                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3196                                         esac
3197                                         ;;
3198                         hp*)    osname=hp_osf1  ;;
3199                         mips)   osname=mips_osf1 ;;
3200                         esac
3201                         ;;
3202                 # UnixWare 7.1.2 is known as Open UNIX 8
3203                 openunix|unixware) osname=svr5
3204                         osvers="$4"
3205                         ;;
3206                 uts)    osname=uts
3207                         osvers="$3"
3208                         ;;
3209                 vos) osvers="$3"
3210                         ;;
3211                 $2) case "$osname" in
3212                         *isc*) ;;
3213                         *freebsd*) ;;
3214                         svr*)
3215                                 : svr4.x or possibly later
3216                                 case "svr$3" in 
3217                                 ${osname}*)
3218                                         osname=svr$3
3219                                         osvers=$4
3220                                         ;;
3221                                 esac
3222                                 case "$osname" in
3223                                 svr4.0)
3224                                         : Check for ESIX
3225                                         if test -f /stand/boot ; then
3226                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3227                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3228                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3229                                                         if test -n "$isesix"; then
3230                                                                 osname=esix4
3231                                                         fi
3232                                                 fi
3233                                         fi
3234                                         ;;
3235                                 esac
3236                                 ;;
3237                         *)      if test -f /etc/systemid; then
3238                                         osname=sco
3239                                         set `echo $3 | $sed 's/\./ /g'` $4
3240                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3241                                                 osvers=$1.$2.$3
3242                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3243                                                 osvers=$1.$2
3244                                         elif $test -f $src/hints/sco_$1.sh; then
3245                                                 osvers=$1
3246                                         fi
3247                                 else
3248                                         case "$osname" in
3249                                         '') : Still unknown.  Probably a generic Sys V.
3250                                                 osname="sysv"
3251                                                 osvers="$3"
3252                                                 ;;
3253                                         esac
3254                                 fi
3255                                 ;;
3256                         esac
3257                         ;;
3258                 *)      case "$osname" in
3259                         '') : Still unknown.  Probably a generic BSD.
3260                                 osname="$1"
3261                                 osvers="$3"
3262                                 ;;
3263                         esac
3264                         ;;
3265                 esac
3266         else
3267                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3268                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3269                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3270                                 osname=news_os
3271                         fi
3272                         $rm -f UU/kernel.what
3273                 elif test -d c:/. -o -n "$is_os2" ; then
3274                         set X $myuname
3275                         osname=os2
3276                         osvers="$5"
3277                 fi
3278         fi
3279         
3280         case "$targetarch" in
3281         '') ;;
3282         *)  hostarch=$osname
3283             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3284             osvers=''
3285             ;;
3286         esac
3287
3288         : Now look for a hint file osname_osvers, unless one has been
3289         : specified already.
3290         case "$hintfile" in
3291         ''|' ')
3292                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3293                 : Also try without trailing minor version numbers.
3294                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3295                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3296                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3297                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3298                 case "$file" in
3299                 '') dflt=none ;;
3300                 *)  case "$osvers" in
3301                         '') dflt=$file
3302                                 ;;
3303                         *)  if $test -f $src/hints/$file.sh ; then
3304                                         dflt=$file
3305                                 elif $test -f $src/hints/$xfile.sh ; then
3306                                         dflt=$xfile
3307                                 elif $test -f $src/hints/$xxfile.sh ; then
3308                                         dflt=$xxfile
3309                                 elif $test -f $src/hints/$xxxfile.sh ; then
3310                                         dflt=$xxxfile
3311                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3312                                         dflt=$xxxxfile
3313                                 elif $test -f "$src/hints/${osname}.sh" ; then
3314                                         dflt="${osname}"
3315                                 else
3316                                         dflt=none
3317                                 fi
3318                                 ;;
3319                         esac
3320                         ;;
3321                 esac
3322                 if $test -f Policy.sh ; then
3323                         case "$dflt" in
3324                         *Policy*) ;;
3325                         none) dflt="Policy" ;;
3326                         *) dflt="Policy $dflt" ;;
3327                         esac
3328                 fi
3329                 ;;
3330         *)
3331                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3332                 ;;
3333         esac
3334
3335         if $test -f Policy.sh ; then
3336                 $cat <<EOM
3337
3338 There's also a Policy hint file available, which should make the
3339 site-specific (policy) questions easier to answer.
3340 EOM
3341
3342         fi
3343
3344         $cat <<EOM
3345
3346 You may give one or more space-separated answers, or "none" if appropriate.
3347 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3348 is a good thing.  DO NOT give a wrong version or a wrong OS.
3349
3350 EOM
3351
3352         rp="Which of these apply, if any?"
3353         . UU/myread
3354         tans=$ans
3355         for file in $tans; do
3356                 if $test X$file = XPolicy -a -f Policy.sh; then
3357                         . Policy.sh
3358                         $cat Policy.sh >> UU/config.sh
3359                 elif $test -f $src/hints/$file.sh; then
3360                         . $src/hints/$file.sh
3361                         $cat $src/hints/$file.sh >> UU/config.sh
3362                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3363                         : nothing
3364                 else
3365                         : Give one chance to correct a possible typo.
3366                         echo "$file.sh does not exist"
3367                         dflt=$file
3368                         rp="hint to use instead?"
3369                         . UU/myread
3370                         for file in $ans; do
3371                                 if $test -f "$src/hints/$file.sh"; then
3372                                         . $src/hints/$file.sh
3373                                         $cat $src/hints/$file.sh >> UU/config.sh
3374                                 elif $test X$ans = X -o X$ans = Xnone ; then
3375                                         : nothing
3376                                 else
3377                                         echo "$file.sh does not exist -- ignored."
3378                                 fi
3379                         done
3380                 fi
3381         done
3382
3383         hint=recommended
3384         : Remember our hint file for later.
3385         if $test -f "$src/hints/$file.sh" ; then
3386                 hintfile="$file"
3387         else
3388                 hintfile=''
3389         fi
3390 fi
3391 cd UU
3392 ;;
3393 *)
3394         echo " "
3395         echo "Fetching default answers from $config_sh..." >&4
3396         tmp_n="$n"
3397         tmp_c="$c"
3398         cd ..
3399         cp $config_sh config.sh 2>/dev/null
3400         chmod +w config.sh
3401         . ./config.sh
3402         cd UU
3403         cp ../config.sh .
3404         n="$tmp_n"
3405         c="$tmp_c"
3406         hint=previous
3407         ;;
3408 esac
3409 test "$override" && . ./optdef.sh
3410
3411 : Restore computed paths
3412 for file in $loclist $trylist; do
3413         eval $file="\$_$file"
3414 done
3415
3416 cat << EOM
3417
3418 Configure uses the operating system name and version to set some defaults.
3419 The default value is probably right if the name rings a bell. Otherwise,
3420 since spelling matters for me, either accept the default or answer "none"
3421 to leave it blank.
3422
3423 EOM
3424 case "$osname" in
3425         ''|' ')
3426                 case "$hintfile" in
3427                 ''|' '|none) dflt=none ;;
3428                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3429                 esac
3430                 ;;
3431         *) dflt="$osname" ;;
3432 esac
3433 rp="Operating system name?"
3434 . ./myread
3435 case "$ans" in
3436 none)  osname='' ;;
3437 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3438 esac
3439 echo " "
3440 case "$osvers" in
3441         ''|' ')
3442                 case "$hintfile" in
3443                 ''|' '|none) dflt=none ;;
3444                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3445                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3446                         case "$dflt" in
3447                         ''|' ') dflt=none ;;
3448                         esac
3449                         ;;
3450                 esac
3451                 ;;
3452         *) dflt="$osvers" ;;
3453 esac
3454 rp="Operating system version?"
3455 . ./myread
3456 case "$ans" in
3457 none)  osvers='' ;;
3458 *) osvers="$ans" ;;
3459 esac
3460
3461
3462 . ./posthint.sh
3463
3464 : who configured the system
3465 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3466 case "$cf_by" in
3467 "")
3468         cf_by=`(logname) 2>/dev/null`
3469         case "$cf_by" in
3470         "")
3471                 cf_by=`(whoami) 2>/dev/null`
3472                 case "$cf_by" in
3473                 "") cf_by=unknown ;;
3474                 esac ;;
3475         esac ;;
3476 esac
3477
3478 : set up the script used to warn in case of inconsistency
3479 cat <<EOS >whoa
3480 $startsh
3481 EOS
3482 cat <<'EOSC' >>whoa
3483 dflt=y
3484 echo " "
3485 echo "*** WHOA THERE!!! ***" >&4
3486 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3487 rp="    Keep the $hint value?"
3488 . ./myread
3489 case "$ans" in
3490 y) td=$was; tu=$was;;
3491 esac
3492 EOSC
3493
3494 : function used to set $1 to $val
3495 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3496 case "$val$was" in
3497 $define$undef) . ./whoa; eval "$var=\$td";;
3498 $undef$define) . ./whoa; eval "$var=\$tu";;
3499 *) eval "$var=$val";;
3500 esac'
3501
3502 case "$usesocks" in
3503 $define|true|[yY]*)     dflt='y';;
3504 *) dflt='n';;
3505 esac
3506 cat <<EOM
3507
3508 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3509 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3510 to use the PerlIO abstraction layer, this will be implicitly selected.
3511
3512 If this doesn't make any sense to you, just accept the default '$dflt'.
3513 EOM
3514 rp='Build Perl for SOCKS?'
3515 . ./myread
3516 case "$ans" in
3517 y|Y)    val="$define" ;;     
3518 *)      val="$undef" ;;
3519 esac
3520 set usesocks
3521 eval $setvar
3522
3523 case "$usesocks" in
3524 $define|true|[yY]*) useperlio="$define";;
3525 esac
3526
3527 case "$useperlio" in
3528 $define|true|[yY]*|'')  dflt='y';;
3529 *) dflt='n';;
3530 esac
3531 cat <<EOM
3532
3533 Previous version of $package used the standard IO mechanisms as
3534 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3535 alternate IO mechanisms via the PerlIO abstraction layer, but the
3536 stdio mechanism is still available if needed.  The abstraction layer
3537 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3538 Using PerlIO with sfio may cause problems with some extension modules.
3539
3540 If this doesn't make any sense to you, just accept the default '$dflt'.
3541 EOM
3542 rp='Use the PerlIO abstraction layer?'
3543 . ./myread
3544 case "$ans" in
3545 y|Y) 
3546         val="$define"
3547         ;;
3548 *)      
3549         echo "Ok, doing things the stdio way."
3550         val="$undef"
3551         ;;
3552 esac
3553 set useperlio
3554 eval $setvar 
3555
3556 case "$usesocks" in
3557 $define|true|[yY]*)
3558         case "$useperlio" in
3559         $define|true|[yY]*) ;;
3560         *)      cat >&4 <<EOM
3561
3562 You are using the SOCKS proxy protocol library which means that you
3563 should also use the PerlIO layer.  You may be headed for trouble.
3564
3565 EOM
3566                 ;;
3567         esac
3568         ;;
3569 esac
3570
3571         
3572 case "$usethreads" in
3573 $define|true|[yY]*)     dflt='y';;
3574 *)     # Catch case where user specified ithreads or 5005threads but
3575        # forgot -Dusethreads (A.D. 4/2002)
3576        case "$useithreads$use5005threads" in
3577        *$define*)      
3578                 case "$useperlio" in
3579                 "$define")      dflt='y' ;;
3580                 *)              dflt='n' ;;
3581                 esac
3582                 ;;
3583        *)       dflt='n';;
3584        esac
3585        ;;
3586 esac
3587 cat <<EOM
3588
3589 Perl can be built to take advantage of threads on some systems.
3590 To do so, Configure can be run with -Dusethreads.
3591
3592 Note that Perl built with threading support runs slightly slower
3593 and uses more memory than plain Perl. The current implementation
3594 is believed to be stable, but it is fairly new, and so should be
3595 treated with caution.
3596
3597 If this doesn't make any sense to you, just accept the default '$dflt'.
3598 EOM
3599 rp='Build a threading Perl?'
3600 . ./myread
3601 case "$ans" in
3602 y|Y)    val="$define" ;;
3603 *)      val="$undef" ;;
3604 esac
3605 set usethreads
3606 eval $setvar
3607
3608 case "$usethreads" in
3609 $define)
3610         $cat <<EOM
3611
3612 Since release 5.6, Perl has had two different threading implementations,
3613 the newer interpreter-based version (ithreads) with one interpreter per
3614 thread, and the older 5.005 version (5005threads).
3615 The 5005threads version is effectively unmaintained and will probably be
3616 removed in Perl 5.10, so there should be no need to build a Perl using it
3617 unless needed for backwards compatibility with some existing 5.005threads
3618 code.
3619
3620 EOM
3621         : Default to ithreads unless overridden on command line or with
3622         : old config.sh
3623         dflt='y'
3624         case "$use5005threads" in
3625                 $define|true|[yY]*) dflt='n';;
3626         esac
3627         case "$useithreads" in
3628                 $undef|false|[nN]*) dflt='n';;
3629         esac
3630         rp='Use the newer interpreter-based ithreads?'
3631         . ./myread
3632         case "$ans" in
3633         y|Y)    val="$define" ;;
3634         *)      val="$undef" ;;
3635         esac
3636         set useithreads
3637         eval $setvar
3638         : Now set use5005threads to the opposite value.
3639         case "$useithreads" in
3640         $define) val="$undef" ;;
3641         *) val="$define" ;;
3642         esac
3643         set use5005threads
3644         eval $setvar
3645         ;;
3646 *)
3647         useithreads="$undef"
3648         use5005threads="$undef"
3649         ;;
3650 esac
3651
3652 case "$useithreads$use5005threads" in
3653 "$define$define")
3654         $cat >&4 <<EOM
3655
3656 You cannot have both the ithreads and the 5.005 threads enabled
3657 at the same time.  Disabling the 5.005 threads since they are
3658 much less stable than the ithreads.
3659
3660 EOM
3661         use5005threads="$undef"
3662         ;;
3663 esac
3664
3665 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3666         cat >&4 <<EOF
3667 ***
3668 *** To build with ithreads you must also use the PerlIO layer.
3669 *** Cannot continue, aborting.
3670 ***
3671 EOF
3672         exit 1
3673 fi
3674
3675 case "$d_oldpthreads" in
3676 '')     : Configure tests would be welcome here.  For now, assume undef.
3677         val="$undef" ;;
3678 *)      val="$d_oldpthreads" ;;
3679 esac
3680 set d_oldpthreads
3681 eval $setvar
3682
3683
3684 : Look for a hint-file generated 'call-back-unit'.  If the
3685 : user has specified that a threading perl is to be built,
3686 : we may need to set or change some other defaults.
3687 if $test -f usethreads.cbu; then
3688     echo "Your platform has some specific hints regarding threaded builds, using them..."
3689     . ./usethreads.cbu
3690 else
3691     case "$usethreads" in
3692         "$define"|true|[yY]*)
3693                 $cat <<EOM
3694 (Your platform does not have any specific hints for threaded builds.
3695  Assuming POSIX threads, then.)
3696 EOM
3697         ;;
3698     esac
3699 fi
3700
3701 cat <<EOM
3702
3703 Perl can be built so that multiple Perl interpreters can coexist
3704 within the same Perl executable.
3705 EOM
3706
3707 case "$useithreads" in
3708 $define)
3709         cat <<EOM
3710 This multiple interpreter support is required for interpreter-based threads.
3711 EOM
3712         val="$define"
3713         ;;
3714 *)      case "$usemultiplicity" in
3715         $define|true|[yY]*)     dflt='y';;
3716         *) dflt='n';;
3717         esac
3718         echo " "
3719         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3720         rp='Build Perl for multiplicity?'
3721         . ./myread
3722         case "$ans" in
3723         y|Y)    val="$define" ;;
3724         *)      val="$undef" ;;
3725         esac
3726         ;;
3727 esac
3728 set usemultiplicity
3729 eval $setvar
3730
3731
3732 case "$usemorebits" in
3733 "$define"|true|[yY]*)
3734         use64bitint="$define"
3735         uselongdouble="$define"
3736         usemorebits="$define"
3737         ;;
3738 *)      usemorebits="$undef"
3739         ;;
3740 esac
3741
3742 : make some quick guesses about what we are up against
3743 echo " "
3744 $echo $n "Hmm...  $c"
3745 echo exit 1 >bsd
3746 echo exit 1 >usg
3747 echo exit 1 >v7
3748 echo exit 1 >osf1
3749 echo exit 1 >eunice
3750 echo exit 1 >xenix
3751 echo exit 1 >venix
3752 echo exit 1 >os2
3753 d_bsd="$undef"
3754 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3755 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3756 then
3757         echo "Looks kind of like an OSF/1 system, but we'll see..."
3758         echo exit 0 >osf1
3759 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3760         xxx=`./loc addbib blurfl $pth`
3761         if $test -f $xxx; then
3762         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3763                 echo exit 0 >bsd
3764                 echo exit 0 >usg
3765         else
3766                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3767                         echo "Looks kind of like an extended USG system, but we'll see..."
3768                 else
3769                         echo "Looks kind of like a USG system, but we'll see..."
3770                 fi
3771                 echo exit 0 >usg
3772         fi
3773 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3774         echo "Looks kind of like a BSD system, but we'll see..."
3775         d_bsd="$define"
3776         echo exit 0 >bsd
3777 else
3778         echo "Looks kind of like a Version 7 system, but we'll see..."
3779         echo exit 0 >v7
3780 fi
3781 case "$eunicefix" in
3782 *unixtovms*)
3783         $cat <<'EOI'
3784 There is, however, a strange, musty smell in the air that reminds me of
3785 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3786 EOI
3787         echo exit 0 >eunice
3788         d_eunice="$define"
3789 : it so happens the Eunice I know will not run shell scripts in Unix format
3790         ;;
3791 *)
3792         echo " "
3793         echo "Congratulations.  You aren't running Eunice."
3794         d_eunice="$undef"
3795         ;;
3796 esac
3797 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3798 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3799 : semicolon as a patch separator
3800 case "$p_" in
3801 :) ;;
3802 *)
3803         $cat <<'EOI'
3804 I have the feeling something is not exactly right, however...don't tell me...
3805 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3806 (Or you may be running DOS with DJGPP.)
3807 EOI
3808         echo exit 0 >os2
3809         ;;
3810 esac
3811 if test -f /xenix; then
3812         echo "Actually, this looks more like a XENIX system..."
3813         echo exit 0 >xenix
3814         d_xenix="$define"
3815 else
3816         echo " "
3817         echo "It's not Xenix..."
3818         d_xenix="$undef"
3819 fi
3820 chmod +x xenix
3821 $eunicefix xenix
3822 if test -f /venix; then
3823         echo "Actually, this looks more like a VENIX system..."
3824         echo exit 0 >venix
3825 else
3826         echo " "
3827         if ./xenix; then
3828                 : null
3829         else
3830                 echo "Nor is it Venix..."
3831         fi
3832 fi
3833 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3834 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3835 $rm -f foo
3836
3837 case "$cc" in
3838 '') dflt=cc;;
3839 *) dflt="$cc";;
3840 esac
3841 rp="Use which C compiler?"
3842 . ./myread
3843 cc="$ans"
3844
3845 : See if they have not cc but they do have gcc
3846 . ./trygcc
3847 : Look for a hint-file generated 'call-back-unit'.  Now that the
3848 : user has specified the compiler, we may need to set or change some
3849 : other defaults.
3850 if $test -f cc.cbu; then
3851     . ./cc.cbu
3852 fi
3853 . ./checkcc
3854
3855 echo " "
3856 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3857 $cat >try.c <<EOM
3858 #include <stdio.h>
3859 int main() {
3860 #ifdef __GNUC__
3861 #ifdef __VERSION__
3862         printf("%s\n", __VERSION__);
3863 #else
3864         printf("%s\n", "1");
3865 #endif
3866 #endif
3867         return(0);
3868 }
3869 EOM
3870 if $cc -o try $ccflags $ldflags try.c; then
3871         gccversion=`$run ./try`
3872         case "$gccversion" in
3873         '') echo "You are not using GNU cc." ;;
3874         *)  echo "You are using GNU cc $gccversion."
3875             ccname=gcc
3876             ;;
3877         esac
3878 else
3879         echo " "
3880         echo "*** WHOA THERE!!! ***" >&4
3881         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3882         case "$knowitall" in
3883         '')
3884         echo "    You'd better start hunting for one and let me know about it." >&4
3885                 exit 1
3886                 ;;
3887         esac
3888 fi
3889 $rm -f try try.*
3890 case "$gccversion" in
3891 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3892 esac
3893 case "$gccversion" in
3894 '') gccosandvers='' ;;
3895 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3896    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3897    gccshortvers=''
3898    case "$gccosandvers" in
3899    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3900    $osname$osvers) ;; # looking good
3901    $osname*) cat <<EOM >&4
3902
3903 *** WHOA THERE!!! ***
3904
3905     Your gcc has not been compiled for the exact release of
3906     your operating system ($gccosandvers versus $osname$osvers).
3907
3908     In general it is a good idea to keep gcc synchronized with
3909     the operating system because otherwise serious problems
3910     may ensue when trying to compile software, like Perl.
3911
3912     I'm trying to be optimistic here, though, and will continue.
3913     If later during the configuration and build icky compilation
3914     problems appear (headerfile conflicts being the most common
3915     manifestation), I suggest reinstalling the gcc to match
3916     your operating system release.
3917
3918 EOM
3919       ;;
3920    *) gccosandvers='' ;; # failed to parse, better be silent
3921    esac
3922    ;;
3923 esac
3924 case "$ccname" in
3925 '') ccname="$cc" ;;
3926 esac
3927
3928 # gcc 3.* complain about adding -Idirectories that they already know about,
3929 # so we will take those off from locincpth.
3930 case "$gccversion" in
3931 3*)
3932     echo "main(){}">try.c
3933     for incdir in $locincpth; do
3934        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3935              grep '^c[cp]p*[01]: warning: changing search order '`
3936        if test "X$warn" != X; then
3937            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3938        fi
3939     done
3940     $rm -f try try.*
3941 esac
3942
3943 : decide how portable to be.  Allow command line overrides.
3944 case "$d_portable" in
3945 "$undef") ;;
3946 *)      d_portable="$define" ;;
3947 esac
3948
3949 : set up shell script to do ~ expansion
3950 cat >filexp <<EOSS
3951 $startsh
3952 : expand filename
3953 case "\$1" in
3954  ~/*|~)
3955         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3956         ;;
3957  ~*)
3958         if $test -f /bin/csh; then
3959                 /bin/csh -f -c "glob \$1"
3960                 failed=\$?
3961                 echo ""
3962                 exit \$failed
3963         else
3964                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3965                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3966                 if $test ! -d "\$dir"; then
3967                         me=\`basename \$0\`
3968                         echo "\$me: can't locate home directory for: \$name" >&2
3969                         exit 1
3970                 fi
3971                 case "\$1" in
3972                 */*)
3973                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3974                         ;;
3975                 *)
3976                         echo \$dir
3977                         ;;
3978                 esac
3979         fi
3980         ;;
3981 *)
3982         echo \$1
3983         ;;
3984 esac
3985 EOSS
3986 chmod +x filexp
3987 $eunicefix filexp
3988
3989 : now set up to get a file name
3990 cat <<EOS >getfile
3991 $startsh
3992 EOS
3993 cat <<'EOSC' >>getfile
3994 tilde=''
3995 fullpath=''
3996 already=''
3997 skip=''
3998 none_ok=''
3999 exp_file=''
4000 nopath_ok=''
4001 orig_rp="$rp"
4002 orig_dflt="$dflt"
4003 case "$gfpth" in
4004 '') gfpth='.' ;;
4005 esac
4006
4007 case "$fn" in
4008 *\(*)
4009         : getfile will accept an answer from the comma-separated list
4010         : enclosed in parentheses even if it does not meet other criteria.
4011         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4012         fn=`echo $fn | sed 's/(.*)//'`
4013         ;;
4014 esac
4015
4016 case "$fn" in
4017 *:*)
4018         loc_file=`expr $fn : '.*:\(.*\)'`
4019         fn=`expr $fn : '\(.*\):.*'`
4020         ;;
4021 esac
4022
4023 case "$fn" in
4024 *~*) tilde=true;;
4025 esac
4026 case "$fn" in
4027 */*) fullpath=true;;
4028 esac
4029 case "$fn" in
4030 *+*) skip=true;;
4031 esac
4032 case "$fn" in
4033 *n*) none_ok=true;;
4034 esac
4035 case "$fn" in
4036 *e*) exp_file=true;;
4037 esac
4038 case "$fn" in
4039 *p*) nopath_ok=true;;
4040 esac
4041
4042 case "$fn" in
4043 *f*) type='File';;
4044 *d*) type='Directory';;
4045 *l*) type='Locate';;
4046 esac
4047
4048 what="$type"
4049 case "$what" in
4050 Locate) what='File';;
4051 esac
4052
4053 case "$exp_file" in
4054 '')
4055         case "$d_portable" in
4056         "$define") ;;
4057         *) exp_file=true;;
4058         esac
4059         ;;
4060 esac
4061
4062 cd ..
4063 while test "$type"; do
4064         redo=''
4065         rp="$orig_rp"
4066         dflt="$orig_dflt"
4067         case "$tilde" in
4068         true) rp="$rp (~name ok)";;
4069         esac
4070         . UU/myread
4071         if test -f UU/getfile.ok && \
4072                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4073         then
4074                 value="$ans"
4075                 ansexp="$ans"
4076                 break
4077         fi
4078         case "$ans" in
4079         none)
4080                 value=''
4081                 ansexp=''
4082                 case "$none_ok" in
4083                 true) type='';;
4084                 esac
4085                 ;;
4086         *)
4087                 case "$tilde" in
4088                 '') value="$ans"
4089                         ansexp="$ans";;
4090                 *)
4091                         value=`UU/filexp $ans`
4092                         case $? in
4093                         0)
4094                                 if test "$ans" != "$value"; then
4095                                         echo "(That expands to $value on this system.)"
4096                                 fi
4097                                 ;;
4098                         *) value="$ans";;
4099                         esac
4100                         ansexp="$value"
4101                         case "$exp_file" in
4102                         '') value="$ans";;
4103                         esac
4104                         ;;
4105                 esac
4106                 case "$fullpath" in
4107                 true)
4108                         case "$ansexp" in
4109                         /*) value="$ansexp" ;;
4110                         [a-zA-Z]:/*) value="$ansexp" ;;
4111                         *)
4112                                 redo=true
4113                                 case "$already" in
4114                                 true)
4115                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4116                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4117                                         ;;
4118                                 *)
4119                                 echo "Please give a full path name, starting with slash." >&4
4120                                         case "$tilde" in
4121                                         true)
4122                                 echo "Note that using ~name is ok provided it expands well." >&4
4123                                                 already=true
4124                                                 ;;
4125                                         esac
4126                                 esac
4127                                 ;;
4128                         esac
4129                         ;;
4130                 esac
4131                 case "$redo" in
4132                 '')
4133                         case "$type" in
4134                         File)
4135                                 for fp in $gfpth; do
4136                                         if test "X$fp" = X.; then
4137                                             pf="$ansexp"
4138                                         else    
4139                                             pf="$fp/$ansexp"
4140                                         fi
4141                                         if test -f "$pf"; then
4142                                                 type=''
4143                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4144                                         then
4145                                                 echo "($value is not a plain file, but that's ok.)"
4146                                                 type=''
4147                                         fi
4148                                         if test X"$type" = X; then
4149                                             value="$pf"
4150                                             break
4151                                         fi
4152                                 done
4153                                 ;;
4154                         Directory)
4155                                 for fp in $gfpth; do
4156                                         if test "X$fp" = X.; then
4157                                             dir="$ans"
4158                                             direxp="$ansexp"
4159                                         else    
4160                                             dir="$fp/$ansexp"
4161                                             direxp="$fp/$ansexp"
4162                                         fi
4163                                         if test -d "$direxp"; then
4164                                                 type=''
4165                                                 value="$dir"
4166                                                 break
4167                                         fi
4168                                 done
4169                                 ;;
4170                         Locate)
4171                                 if test -d "$ansexp"; then
4172                                         echo "(Looking for $loc_file in directory $value.)"
4173                                         value="$value/$loc_file"
4174                                         ansexp="$ansexp/$loc_file"
4175                                 fi
4176                                 if test -f "$ansexp"; then
4177                                         type=''
4178                                 fi
4179                                 case "$nopath_ok" in
4180                                 true)   case "$value" in
4181                                         */*) ;;
4182                                         *)      echo "Assuming $value will be in people's path."
4183                                                 type=''
4184                                                 ;;
4185                                         esac
4186                                         ;;
4187                                 esac
4188                                 ;;
4189                         esac
4190
4191                         case "$skip" in
4192                         true) type='';
4193                         esac
4194
4195                         case "$type" in
4196                         '') ;;
4197                         *)
4198                                 if test "$fastread" = yes; then
4199                                         dflt=y
4200                                 else
4201                                         dflt=n
4202                                 fi
4203                                 rp="$what $value doesn't exist.  Use that name anyway?"
4204                                 . UU/myread
4205                                 dflt=''
4206                                 case "$ans" in
4207                                 y*) type='';;
4208                                 *) echo " ";;
4209                                 esac
4210                                 ;;
4211                         esac
4212                         ;;
4213                 esac
4214                 ;;
4215         esac
4216 done
4217 cd UU
4218 ans="$value"
4219 rp="$orig_rp"
4220 dflt="$orig_dflt"
4221 rm -f getfile.ok
4222 test "X$gfpthkeep" != Xy && gfpth=""
4223 EOSC
4224
4225 : What should the include directory be ?
4226 echo " "
4227 $echo $n "Hmm...  $c"
4228 dflt='/usr/include'
4229 incpath=''
4230 mips_type=''
4231 if $test -f /bin/mips && /bin/mips; then
4232         echo "Looks like a MIPS system..."
4233         $cat >usr.c <<'EOCP'
4234 #ifdef SYSTYPE_BSD43
4235 /bsd43
4236 #endif
4237 EOCP
4238         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4239                 dflt='/bsd43/usr/include'
4240                 incpath='/bsd43'
4241                 mips_type='BSD 4.3'
4242         else
4243                 mips_type='System V'
4244         fi
4245         $rm -f usr.c usr.out
4246         echo "and you're compiling with the $mips_type compiler and libraries."
4247         xxx_prompt=y
4248         echo "exit 0" >mips
4249 else
4250         echo "Doesn't look like a MIPS system."
4251         xxx_prompt=n
4252         echo "exit 1" >mips
4253 fi
4254 chmod +x mips
4255 $eunicefix mips
4256 case "$usrinc" in
4257 '') ;;
4258 *) dflt="$usrinc";;
4259 esac
4260 case "$xxx_prompt" in
4261 y)      fn=d/
4262         echo " "
4263         rp='Where are the include files you want to use?'
4264         . ./getfile
4265         usrinc="$ans"
4266         ;;
4267 *)      usrinc="$dflt"
4268         ;;
4269 esac
4270
4271 : see how we invoke the C preprocessor
4272 echo " "
4273 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4274 cat <<'EOT' >testcpp.c
4275 #define ABC abc
4276 #define XYZ xyz
4277 ABC.XYZ
4278 EOT
4279 cd ..
4280 if test ! -f cppstdin; then
4281         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4282                 # AIX cc -E doesn't show the absolute headerfile
4283                 # locations but we'll cheat by using the -M flag.
4284                 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
4285         else
4286                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4287         fi
4288 else
4289         echo "Keeping your $hint cppstdin wrapper."
4290 fi
4291 chmod 755 cppstdin
4292 wrapper=`pwd`/cppstdin
4293 ok='false'
4294 cd UU
4295
4296 if $test "X$cppstdin" != "X" && \
4297         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4298         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4299 then
4300         echo "You used to use $cppstdin $cppminus so we'll use that again."
4301         case "$cpprun" in
4302         '') echo "But let's see if we can live without a wrapper..." ;;
4303         *)
4304                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4305                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4306                 then
4307                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4308                         ok='true'
4309                 else
4310                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4311                 fi
4312                 ;;
4313         esac
4314 else
4315         case "$cppstdin" in
4316         '') ;;
4317         *)
4318                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4319                 ;;
4320         esac
4321 fi
4322
4323 if $ok; then
4324         : nothing
4325 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4326         $cc -E <testcpp.c >testcpp.out 2>&1; \
4327         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4328         echo "Yup, it does."
4329         x_cpp="$cc -E"
4330         x_minus='';
4331 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4332         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4333         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4334         echo "Yup, it does."
4335         x_cpp="$cc -E"
4336         x_minus='-';
4337 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4338         $cc -P <testcpp.c >testcpp.out 2>&1; \
4339         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4340         echo "Yipee, that works!"
4341         x_cpp="$cc -P"
4342         x_minus='';
4343 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4344         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4345         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346         echo "At long last!"
4347         x_cpp="$cc -P"
4348         x_minus='-';
4349 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4350         $cpp <testcpp.c >testcpp.out 2>&1; \
4351         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4352         echo "It works!"
4353         x_cpp="$cpp"
4354         x_minus='';
4355 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4356         $cpp - <testcpp.c >testcpp.out 2>&1; \
4357         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4358         echo "Hooray, it works!  I was beginning to wonder."
4359         x_cpp="$cpp"
4360         x_minus='-';
4361 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4362         $wrapper <testcpp.c >testcpp.out 2>&1; \
4363         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4364         x_cpp="$wrapper"
4365         x_minus=''
4366         echo "Eureka!"
4367 else
4368         dflt=''
4369         rp="No dice.  I can't find a C preprocessor.  Name one:"
4370         . ./myread
4371         x_cpp="$ans"
4372         x_minus=''
4373         $x_cpp <testcpp.c >testcpp.out 2>&1
4374         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4375                 echo "OK, that will do." >&4
4376         else
4377 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4378                 exit 1
4379         fi
4380 fi
4381
4382 case "$ok" in
4383 false)
4384         cppstdin="$x_cpp"
4385         cppminus="$x_minus"
4386         cpprun="$x_cpp"
4387         cpplast="$x_minus"
4388         set X $x_cpp
4389         shift
4390         case "$1" in
4391         "$cpp")
4392                 echo "Perhaps can we force $cc -E using a wrapper..."
4393                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4394                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4395                 then
4396                         echo "Yup, we can."
4397                         cppstdin="$wrapper"
4398                         cppminus='';
4399                 else
4400                         echo "Nope, we'll have to live without it..."
4401                 fi
4402                 ;;
4403         esac
4404         case "$cpprun" in
4405         "$wrapper")
4406                 cpprun=''
4407                 cpplast=''
4408                 ;;
4409         esac
4410         ;;
4411 esac
4412
4413 case "$cppstdin" in
4414 "$wrapper"|'cppstdin') ;;
4415 *) $rm -f $wrapper;;
4416 esac
4417 $rm -f testcpp.c testcpp.out
4418
4419 : Set private lib path
4420 case "$plibpth" in
4421 '') if ./mips; then
4422                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4423         fi;;
4424 esac
4425 case "$libpth" in
4426 ' ') dlist='';;
4427 '') dlist="$loclibpth $plibpth $glibpth";;
4428 *) dlist="$libpth";;
4429 esac
4430
4431 : Now check and see which directories actually exist, avoiding duplicates
4432 libpth=''
4433 for xxx in $dlist
4434 do
4435     if $test -d $xxx; then
4436                 case " $libpth " in
4437                 *" $xxx "*) ;;
4438                 *) libpth="$libpth $xxx";;
4439                 esac
4440     fi
4441 done
4442 $cat <<'EOM'
4443
4444 Some systems have incompatible or broken versions of libraries.  Among
4445 the directories listed in the question below, please remove any you
4446 know not to be holding relevant libraries, and add any that are needed.
4447 Say "none" for none.
4448
4449 EOM
4450 case "$libpth" in
4451 '') dflt='none';;
4452 *)
4453         set X $libpth
4454         shift
4455         dflt=${1+"$@"}
4456         ;;
4457 esac
4458 rp="Directories to use for library searches?"
4459 . ./myread
4460 case "$ans" in
4461 none) libpth=' ';;
4462 *) libpth="$ans";;
4463 esac
4464
4465 : compute shared library extension
4466 case "$so" in
4467 '')
4468         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4469                 dflt='sl'
4470         else
4471                 dflt='so'
4472         fi
4473         ;;
4474 *) dflt="$so";;
4475 esac
4476 $cat <<EOM
4477
4478 On some systems, shared libraries may be available.  Answer 'none' if
4479 you want to suppress searching of shared libraries for the remainder
4480 of this configuration.
4481
4482 EOM
4483 rp='What is the file extension used for shared libraries?'
4484 . ./myread
4485 so="$ans"
4486
4487 : Define several unixisms.
4488 : Hints files or command line option can be used to override them.
4489 : The convoluted testing is in case hints files set either the old
4490 : or the new name.
4491 case "$_exe" in
4492 '')     case "$exe_ext" in
4493         '')     ;;
4494         *)      _exe="$exe_ext" ;;
4495         esac
4496         ;;
4497 esac
4498 case "$_a" in
4499 '')     case "$lib_ext" in
4500     '') _a='.a';;
4501         *)      _a="$lib_ext" ;;
4502         esac
4503         ;;
4504 esac
4505 case "$_o" in
4506 '') case "$obj_ext" in
4507         '')     _o='.o';;
4508         *)      _o="$obj_ext";;
4509         esac
4510         ;;
4511 esac
4512 case "$p_" in
4513 '') case "$path_sep" in
4514         '')     p_=':';;
4515         *)      p_="$path_sep";;
4516         esac
4517         ;;
4518 esac
4519 exe_ext=$_exe
4520 lib_ext=$_a
4521 obj_ext=$_o
4522 path_sep=$p_
4523
4524 : Which makefile gets called first.  This is used by make depend.
4525 case "$firstmakefile" in
4526 '') firstmakefile='makefile';;
4527 esac
4528
4529 case "$ccflags" in
4530 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4531 esac
4532
4533 case "$uselongdouble" in
4534 $define|true|[yY]*)     dflt='y';;
4535 *) dflt='n';;
4536 esac
4537 cat <<EOM
4538
4539 Perl can be built to take advantage of long doubles which
4540 (if available) may give more accuracy and range for floating point numbers.
4541
4542 If this doesn't make any sense to you, just accept the default '$dflt'.
4543 EOM
4544 rp='Try to use long doubles if available?'
4545 . ./myread
4546 case "$ans" in
4547 y|Y)    val="$define"   ;;
4548 *)      val="$undef"    ;;
4549 esac
4550 set uselongdouble
4551 eval $setvar
4552
4553 case "$uselongdouble" in
4554 true|[yY]*) uselongdouble="$define" ;;
4555 esac
4556
4557 : Look for a hint-file generated 'call-back-unit'.  If the
4558 : user has specified that long doubles should be used,
4559 : we may need to set or change some other defaults.
4560 if $test -f uselongdouble.cbu; then
4561     echo "Your platform has some specific hints regarding long doubles, using them..."
4562     . ./uselongdouble.cbu
4563 else
4564     case "$uselongdouble" in
4565         $define)
4566                 $cat <<EOM
4567 (Your platform does not have any specific hints for long doubles.)
4568 EOM
4569         ;;
4570     esac
4571 fi
4572
4573 : Looking for optional libraries
4574 echo " "
4575 echo "Checking for optional libraries..." >&4
4576 case "$libs" in
4577 ' '|'') dflt='';;
4578 *) dflt="$libs";;
4579 esac
4580 case "$libswanted" in
4581 '') libswanted='c_s';;
4582 esac
4583 case "$usesocks" in
4584 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4585 esac
4586 libsfound=''
4587 libsfiles=''
4588 libsdirs=''
4589 libspath=''
4590 for thisdir in $libpth $xlibpth; do
4591   test -d $thisdir && libspath="$libspath $thisdir"
4592 done
4593 for thislib in $libswanted; do
4594         for thisdir in $libspath; do
4595             xxx=''
4596             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4597                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4598                 $test -f "$xxx" && eval $libscheck
4599                 $test -f "$xxx" && libstyle=shared
4600             fi
4601             if test ! -f "$xxx"; then
4602                 xxx=$thisdir/lib$thislib.$so
4603                 $test -f "$xxx" && eval $libscheck
4604                 $test -f "$xxx" && libstyle=shared
4605             fi  
4606             if test ! -f "$xxx"; then
4607                 xxx=$thisdir/lib$thislib$_a
4608                 $test -f "$xxx" && eval $libscheck
4609                 $test -f "$xxx" && libstyle=static
4610             fi
4611             if test ! -f "$xxx"; then
4612                 xxx=$thisdir/$thislib$_a
4613                 $test -f "$xxx" && eval $libscheck
4614                 $test -f "$xxx" && libstyle=static
4615             fi
4616             if test ! -f "$xxx"; then
4617                 xxx=$thisdir/lib${thislib}_s$_a
4618                 $test -f "$xxx" && eval $libscheck
4619                 $test -f "$xxx" && libstyle=static
4620                 $test -f "$xxx" && thislib=${thislib}_s
4621             fi
4622             if test ! -f "$xxx"; then
4623                 xxx=$thisdir/Slib$thislib$_a
4624                 $test -f "$xxx" && eval $libscheck
4625                 $test -f "$xxx" && libstyle=static
4626             fi
4627             if $test -f "$xxx"; then
4628                 case "$libstyle" in
4629                 shared) echo "Found -l$thislib (shared)." ;;
4630                 static) echo "Found -l$thislib." ;;
4631                 *)      echo "Found -l$thislib ($libstyle)." ;;
4632                 esac
4633                 case " $dflt " in
4634                 *"-l$thislib "*);;
4635                 *) dflt="$dflt -l$thislib"
4636                    libsfound="$libsfound $xxx"
4637                    yyy=`basename $xxx`
4638                    libsfiles="$libsfiles $yyy"
4639                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4640                    case " $libsdirs " in
4641                    *" $yyy "*) ;;
4642                    *) libsdirs="$libsdirs $yyy" ;;
4643                    esac
4644                    ;;
4645                 esac
4646                 break
4647             fi  
4648         done
4649         if $test ! -f "$xxx"; then
4650             echo "No -l$thislib."
4651         fi
4652 done
4653 set X $dflt
4654 shift
4655 dflt="$*"
4656 case "$libs" in
4657 '') dflt="$dflt";;
4658 *) dflt="$libs";;
4659 esac
4660 case "$dflt" in
4661 ' '|'') dflt='none';;
4662 esac
4663
4664 $cat <<EOM
4665
4666 In order to compile $package on your machine, a number of libraries
4667 are usually needed.  Include any other special libraries here as well.
4668 Say "none" for none.  The default list is almost always right.
4669 EOM
4670
4671 echo " "
4672 rp="What libraries to use?"
4673 . ./myread
4674 case "$ans" in
4675 none) libs=' ';;
4676 *) libs="$ans";;
4677 esac
4678
4679 : determine optimization, if desired, or use for debug flag also
4680 case "$optimize" in
4681 ' '|$undef) dflt='none';;
4682 '') dflt='-O';;
4683 *) dflt="$optimize";;
4684 esac
4685 $cat <<EOH
4686
4687 By default, $package compiles with the -O flag to use the optimizer.
4688 Alternately, you might want to use the symbolic debugger, which uses
4689 the -g flag (on traditional Unix systems).  Either flag can be
4690 specified here.  To use neither flag, specify the word "none".
4691
4692 EOH
4693 rp="What optimizer/debugger flag should be used?"
4694 . ./myread
4695 optimize="$ans"
4696 case "$optimize" in
4697 'none') optimize=" ";;
4698 esac
4699
4700 dflt=''
4701 : We will not override a previous value, but we might want to
4702 : augment a hint file
4703 case "$hint" in
4704 default|recommended)
4705         case "$gccversion" in
4706         1*) dflt='-fpcc-struct-return' ;;
4707         esac
4708         case "$optimize" in
4709         *-g*) dflt="$dflt -DDEBUGGING";;
4710         esac
4711         case "$gccversion" in
4712         2*) if test -d /etc/conf/kconfig.d &&
4713                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4714                 then
4715                         # Interactive Systems (ISC) POSIX mode.
4716                         dflt="$dflt -posix"
4717                 fi
4718                 ;;
4719         esac
4720         case "$gccversion" in
4721         1*) ;;
4722         2.[0-8]*) ;;
4723         ?*)     echo " "
4724                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4725                 echo 'int main(void) { return 0; }' > gcctest.c
4726                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4727                         echo "Yes, it does." 2>&1
4728                         case "$ccflags" in
4729                         *strict-aliasing*)
4730                                 echo "Leaving current flags $ccflags alone." 2>&1
4731                                 ;;
4732                         *) dflt="$dflt -fno-strict-aliasing" ;;
4733                         esac
4734                 else
4735                         echo "Nope, it doesn't, but that's ok." 2>&1
4736                 fi
4737                 ;;
4738         esac
4739         # For gcc, adding -pipe speeds up compilations for some, but apparently
4740         # some assemblers can't read from stdin.  (It also slows down compilations
4741         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4742         case "$gccversion" in
4743         ?*)     echo " "
4744                 echo "Checking if your compiler accepts -pipe" 2>&1
4745                 echo 'int main(void) { return 0; }' > gcctest.c
4746                 if $cc -O2 -pipe -o gcctest gcctest.c; then
4747                         echo "Yes, it does." 2>&1
4748                         case "$ccflags" in
4749                         *-pipe*)
4750                                 echo "Leaving current flags $ccflags alone." 2>&1
4751                                 ;;
4752                         *) dflt="$dflt -pipe" ;;
4753                         esac
4754                 else
4755                         echo "Nope, it doesn't, but that's ok." 2>&1
4756                 fi
4757                 ;;
4758         esac
4759         ;;
4760 esac
4761
4762 case "$mips_type" in
4763 *BSD*|'') inclwanted="$locincpth $usrinc";;
4764 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4765 esac
4766 for thisincl in $inclwanted; do
4767         if $test -d $thisincl; then
4768                 if $test x$thisincl != x$usrinc; then
4769                         case "$dflt" in
4770                         *" -I$thisincl "*);;
4771                         *) dflt="$dflt -I$thisincl ";;
4772                         esac
4773                 fi
4774         fi
4775 done
4776
4777 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4778         xxx=true;
4779 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4780         xxx=true;
4781 else
4782         xxx=false;
4783 fi;
4784 if $xxx; then
4785         case "$dflt" in
4786         *$2*);;
4787         *) dflt="$dflt -D$2";;
4788         esac;
4789 fi'
4790
4791 set signal.h LANGUAGE_C; eval $inctest
4792
4793 case "$usesocks" in
4794 $define)
4795         ccflags="$ccflags -DSOCKS"
4796         ;;
4797 esac
4798
4799 case "$hint" in
4800 default|recommended) dflt="$ccflags $dflt" ;;
4801 *) dflt="$ccflags";;
4802 esac
4803
4804 case "$dflt" in
4805 ''|' ') dflt=none;;
4806 esac
4807
4808 $cat <<EOH
4809
4810 Your C compiler may want other flags.  For this question you should include
4811 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4812 but you should NOT include libraries or ld flags like -lwhatever.  If you
4813 want $package to honor its debug switch, you should include -DDEBUGGING here.
4814 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4815
4816 To use no flags, specify the word "none".
4817
4818 EOH
4819 set X $dflt
4820 shift
4821 dflt=${1+"$@"}
4822 rp="Any additional cc flags?"
4823 . ./myread
4824 case "$ans" in
4825 none) ccflags='';;
4826 *) ccflags="$ans";;
4827 esac
4828
4829 : the following weeds options from ccflags that are of no interest to cpp
4830 case "$cppflags" in
4831 '') cppflags="$ccflags" ;;
4832 *)  cppflags="$cppflags $ccflags" ;;
4833 esac
4834 case "$gccversion" in
4835 1*) cppflags="$cppflags -D__GNUC__"
4836 esac
4837 case "$mips_type" in
4838 '');;
4839 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4840 esac
4841 case "$cppflags" in
4842 '');;
4843 *)
4844         echo " "
4845         echo "Let me guess what the preprocessor flags are..." >&4
4846         set X $cppflags
4847         shift
4848         cppflags=''
4849         $cat >cpp.c <<'EOM'
4850 #define BLURFL foo
4851
4852 BLURFL xx LFRULB
4853 EOM
4854         previous=''
4855         for flag in $*
4856         do
4857                 case "$flag" in
4858                 -*) ftry="$flag";;
4859                 *) ftry="$previous $flag";;
4860                 esac
4861                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4862                         >cpp1.out 2>/dev/null && \
4863                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4864                         >cpp2.out 2>/dev/null && \
4865                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4866                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4867                 then
4868                         cppflags="$cppflags $ftry"
4869                         previous=''
4870                 else
4871                         previous="$flag"
4872                 fi
4873         done
4874         set X $cppflags
4875         shift
4876         cppflags=${1+"$@"}
4877         case "$cppflags" in
4878         *-*)  echo "They appear to be: $cppflags";;
4879         esac
4880         $rm -f cpp.c cpp?.out
4881         ;;
4882 esac
4883
4884 : flags used in final linking phase
4885 case "$ldflags" in
4886 '') if ./venix; then
4887                 dflt='-i -z'
4888         else
4889                 dflt=''
4890         fi
4891         case "$ccflags" in
4892         *-posix*) dflt="$dflt -posix" ;;
4893         esac
4894         ;;
4895 *) dflt="$ldflags";;
4896 esac
4897
4898 : Try to guess additional flags to pick up local libraries.
4899 for thislibdir in $libpth; do
4900         case " $loclibpth " in
4901         *" $thislibdir "*)
4902                 case "$dflt " in
4903                 *"-L$thislibdir "*) ;;
4904                 *)  dflt="$dflt -L$thislibdir" ;;
4905                 esac
4906                 ;;
4907         esac
4908 done
4909
4910 case "$dflt" in
4911 '') dflt='none' ;;
4912 esac
4913
4914 $cat <<EOH
4915
4916 Your C linker may need flags.  For this question you should
4917 include -L/whatever and any other flags used by the C linker, but you
4918 should NOT include libraries like -lwhatever.
4919
4920 Make sure you include the appropriate -L/path flags if your C linker
4921 does not normally search all of the directories you specified above,
4922 namely
4923         $libpth
4924 To use no flags, specify the word "none".
4925
4926 EOH
4927
4928 rp="Any additional ld flags (NOT including libraries)?"
4929 . ./myread
4930 case "$ans" in
4931 none) ldflags='';;
4932 *) ldflags="$ans";;
4933 esac
4934 rmlist="$rmlist pdp11"
4935
4936 : coherency check
4937 echo " "
4938 echo "Checking your choice of C compiler and flags for coherency..." >&4
4939 $cat > try.c <<'EOF'
4940 #include <stdio.h>
4941 int main() { printf("Ok\n"); return(0); }
4942 EOF
4943 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4944 shift
4945 $cat >try.msg <<'EOM'
4946 I've tried to compile and run the following simple program:
4947
4948 EOM
4949 $cat try.c >> try.msg
4950
4951 $cat >> try.msg <<EOM
4952
4953 I used the command:
4954
4955         $*
4956         $run ./try
4957
4958 and I got the following output:
4959
4960 EOM
4961 dflt=y
4962 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4963         if $sh -c "$run ./try" >>try.msg 2>&1; then
4964                 xxx=`$run ./try`
4965                 case "$xxx" in
4966                 "Ok") dflt=n ;;
4967                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4968                         case " $libs " in
4969                         *" -lsfio "*)
4970                                 cat >> try.msg <<'EOQS'
4971 If $libs contains -lsfio, and sfio is mis-configured, then it
4972 sometimes (apparently) runs and exits with a 0 status, but with no
4973 output!  It may have to do with sfio's use of _exit vs. exit.
4974
4975 EOQS
4976                                 rp="You have a big problem.  Shall I abort Configure"
4977                                 dflt=y
4978                                 ;;
4979                         esac
4980                         ;;
4981                 esac
4982         else
4983                 echo "The program compiled OK, but exited with status $?." >>try.msg
4984                 rp="You have a problem.  Shall I abort Configure"
4985                 dflt=y
4986         fi
4987 else
4988         echo "I can't compile the test program." >>try.msg
4989         rp="You have a BIG problem.  Shall I abort Configure"
4990         dflt=y
4991 fi
4992 case "$dflt" in
4993 y)
4994         $cat try.msg >&4
4995         case "$knowitall" in
4996         '')
4997                 echo "(The supplied flags or libraries might be incorrect.)"
4998                 ;;
4999         *) dflt=n;;
5000         esac
5001         echo " "
5002         . ./myread
5003         case "$ans" in
5004         n*|N*) ;;
5005         *)      echo "Ok.  Stopping Configure." >&4
5006                 exit 1
5007                 ;;
5008         esac
5009         ;;
5010 n) echo "OK, that should do.";;
5011 esac
5012 $rm -f try try.* core
5013
5014 : define a shorthand compile call
5015 compile='
5016 mc_file=$1;
5017 shift;
5018 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5019 : define a shorthand compile call for compilations that should be ok.
5020 compile_ok='
5021 mc_file=$1;
5022 shift;
5023 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5024
5025 : determine filename position in cpp output
5026 echo " "
5027 echo "Computing filename position in cpp output for #include directives..." >&4
5028 case "$osname" in
5029 vos) testaccess=-e ;;
5030 *)   testaccess=-r ;;
5031 esac
5032 echo '#include <stdio.h>' > foo.c
5033 $cat >fieldn <<EOF
5034 $startsh
5035 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5036 $grep '^[       ]*#.*stdio\.h' | \
5037 while read cline; do
5038         pos=1
5039         set \$cline
5040         while $test \$# -gt 0; do
5041                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5042                         echo "\$pos"
5043                         exit 0
5044                 fi
5045                 shift
5046                 pos=\`expr \$pos + 1\`
5047         done
5048 done
5049 EOF
5050 chmod +x fieldn
5051 fieldn=`./fieldn`
5052 $rm -f foo.c fieldn
5053 case $fieldn in
5054 '') pos='???';;
5055 1) pos=first;;
5056 2) pos=second;;
5057 3) pos=third;;
5058 *) pos="${fieldn}th";;
5059 esac
5060 echo "Your cpp writes the filename in the $pos field of the line."
5061
5062 case "$osname" in
5063 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5064 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5065 *)   cppfilter='' ;;
5066 esac
5067 : locate header file
5068 $cat >findhdr <<EOF
5069 $startsh
5070 wanted=\$1
5071 name=''
5072 for usrincdir in $usrinc
5073 do
5074         if test -f \$usrincdir/\$wanted; then
5075                 echo "\$usrincdir/\$wanted"
5076                 exit 0
5077         fi
5078 done
5079 awkprg='{ print \$$fieldn }'
5080 echo "#include <\$wanted>" > foo\$\$.c
5081 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5082 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5083 while read cline; do
5084         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5085         case "\$name" in
5086         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5087         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5088         *) exit 2;;
5089         esac;
5090 done;
5091 #
5092 # status = 0: grep returned 0 lines, case statement not executed
5093 # status = 1: headerfile found
5094 # status = 2: while loop executed, no headerfile found
5095 #
5096 status=\$?
5097 $rm -f foo\$\$.c;
5098 if test \$status -eq 1; then
5099         exit 0;
5100 fi
5101 exit 1
5102 EOF
5103 chmod +x findhdr
5104
5105 : define an alternate in-header-list? function
5106 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5107 cont=true; xxf="echo \"<\$1> found.\" >&4";
5108 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5109 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5110 esac;
5111 case $# in 4) instead=instead;; *) instead="at last";; esac;
5112 while $test "$cont"; do
5113         xxx=`./findhdr $1`
5114         var=$2; eval "was=\$$2";
5115         if $test "$xxx" && $test -r "$xxx";
5116         then eval $xxf;
5117         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5118                 cont="";
5119         else eval $xxnf;
5120         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5121         set $yyy; shift; shift; yyy=$@;
5122         case $# in 0) cont="";;
5123         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5124                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5125         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5126                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5127         esac;
5128 done;
5129 while $test "$yyy";
5130 do set $yyy; var=$2; eval "was=\$$2";
5131         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5132         set $yyy; shift; shift; yyy=$@;
5133 done'
5134
5135 : see if stdlib is available
5136 set stdlib.h i_stdlib
5137 eval $inhdr
5138
5139 : check for lengths of integral types
5140 echo " "
5141 case "$intsize" in
5142 '')
5143         echo "Checking to see how big your integers are..." >&4
5144         $cat >try.c <<EOCP
5145 #include <stdio.h>
5146 #$i_stdlib I_STDLIB
5147 #ifdef I_STDLIB
5148 #include <stdlib.h>
5149 #endif
5150 int main()
5151 {
5152         printf("intsize=%d;\n", (int)sizeof(int));
5153         printf("longsize=%d;\n", (int)sizeof(long));
5154         printf("shortsize=%d;\n", (int)sizeof(short));
5155         exit(0);
5156 }
5157 EOCP
5158         set try
5159         if eval $compile_ok && $run ./try > /dev/null; then
5160                 eval `$run ./try`
5161                 echo "Your integers are $intsize bytes long."
5162                 echo "Your long integers are $longsize bytes long."
5163                 echo "Your short integers are $shortsize bytes long."
5164         else
5165                 $cat >&4 <<EOM
5166 !
5167 Help! I can't compile and run the intsize test program: please enlighten me!
5168 (This is probably a misconfiguration in your system or libraries, and
5169 you really ought to fix it.  Still, I'll try anyway.)
5170 !
5171 EOM
5172                 dflt=4
5173                 rp="What is the size of an integer (in bytes)?"
5174                 . ./myread
5175                 intsize="$ans"
5176                 dflt=$intsize
5177                 rp="What is the size of a long integer (in bytes)?"
5178                 . ./myread
5179                 longsize="$ans"
5180                 dflt=2
5181                 rp="What is the size of a short integer (in bytes)?"
5182                 . ./myread
5183                 shortsize="$ans"
5184         fi
5185         ;;
5186 esac
5187 $rm -f try try.*
5188
5189 : check for long long
5190 echo " "
5191 echo "Checking to see if you have long long..." >&4
5192 echo 'int main() { long long x = 7; return 0; }' > try.c
5193 set try
5194 if eval $compile; then
5195         val="$define"
5196         echo "You have long long."
5197 else
5198         val="$undef"
5199         echo "You do not have long long."
5200 fi
5201 $rm try.*
5202 set d_longlong
5203 eval $setvar
5204
5205 : check for length of long long
5206 case "${d_longlong}${longlongsize}" in
5207 $define)
5208         echo " "
5209         echo "Checking to see how big your long longs are..." >&4
5210         $cat >try.c <<'EOCP'
5211 #include <stdio.h>
5212 int main()
5213 {
5214     printf("%d\n", (int)sizeof(long long));
5215     return(0);
5216 }
5217 EOCP
5218         set try
5219         if eval $compile_ok; then
5220                 longlongsize=`$run ./try`
5221                 echo "Your long longs are $longlongsize bytes long."
5222         else
5223                 dflt='8'
5224                 echo " "
5225                 echo "(I can't seem to compile the test program.  Guessing...)"
5226                 rp="What is the size of a long long (in bytes)?"
5227                 . ./myread
5228                 longlongsize="$ans"
5229         fi
5230         if $test "X$longsize" = "X$longlongsize"; then
5231                 echo "(That isn't any different from an ordinary long.)"
5232         fi      
5233         ;;
5234 esac
5235 $rm -f try.* try
5236
5237 : see if inttypes.h is available
5238 : we want a real compile instead of Inhdr because some systems
5239 : have an inttypes.h which includes non-existent headers
5240 echo " "
5241 $cat >try.c <<EOCP
5242 #include <inttypes.h>
5243 int main() {
5244         static int32_t foo32 = 0x12345678;
5245 }
5246 EOCP
5247 set try
5248 if eval $compile; then
5249         echo "<inttypes.h> found." >&4
5250         val="$define"
5251 else
5252         echo "<inttypes.h> NOT found." >&4
5253         val="$undef"
5254 fi
5255 $rm -f try.c try
5256 set i_inttypes
5257 eval $setvar
5258
5259 : check for int64_t
5260 echo " "
5261 echo "Checking to see if you have int64_t..." >&4
5262 $cat >try.c <<EOCP
5263 #include <sys/types.h>
5264 #$i_inttypes I_INTTYPES
5265 #ifdef I_INTTYPES
5266 #include <inttypes.h>
5267 #endif
5268 int main() { int64_t x = 7; }
5269 EOCP
5270 set try
5271 if eval $compile; then
5272         val="$define"
5273         echo "You have int64_t."
5274 else
5275         val="$undef"
5276         echo "You do not have int64_t."
5277 fi
5278 $rm -f try try.*
5279 set d_int64_t
5280 eval $setvar
5281
5282
5283 echo " "
5284 echo "Checking which 64-bit integer type we could use..." >&4
5285
5286 case "$intsize" in
5287 8) val=int
5288    set quadtype
5289    eval $setvar
5290    val='"unsigned int"'
5291    set uquadtype
5292    eval $setvar
5293    quadkind=1
5294    ;;
5295 *) case "$longsize" in
5296    8) val=long
5297       set quadtype
5298       eval $setvar
5299       val='"unsigned long"'
5300       set uquadtype
5301       eval $setvar
5302       quadkind=2
5303       ;;
5304    *) case "$d_longlong:$longlongsize" in
5305       define:8)
5306         val='"long long"'
5307         set quadtype
5308         eval $setvar
5309         val='"unsigned long long"'
5310         set uquadtype
5311         eval $setvar
5312         quadkind=3
5313         ;;
5314       *) case "$d_int64_t" in
5315          define)
5316            val=int64_t
5317            set quadtype
5318            eval $setvar
5319            val=uint64_t
5320            set uquadtype
5321            eval $setvar
5322            quadkind=4
5323            ;;
5324          esac
5325          ;;
5326       esac
5327       ;;
5328    esac
5329    ;;
5330 esac
5331
5332 case "$quadtype" in
5333 '')     echo "Alas, no 64-bit integer types in sight." >&4
5334         d_quad="$undef"
5335         ;;
5336 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5337         d_quad="$define"
5338         ;;
5339 esac
5340
5341
5342 case "$uselonglong" in
5343 "$define"|true|[yY]*)
5344         cat <<EOM >&4
5345
5346 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5347 EOM
5348         use64bitint="$define"
5349         ;;
5350 esac                          
5351 case "$use64bits" in
5352 "$define"|true|[yY]*)
5353         cat <<EOM >&4
5354
5355 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5356 EOM
5357         use64bitint="$define"
5358         ;;
5359 esac                          
5360 case "$use64bitints" in
5361 "$define"|true|[yY]*)
5362         cat <<EOM >&4
5363
5364 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5365 EOM
5366         use64bitint="$define"
5367         ;;
5368 esac                          
5369 case "$use64bitsint" in
5370 "$define"|true|[yY]*)
5371         cat <<EOM >&4
5372
5373 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5374 EOM
5375         use64bitint="$define"
5376         ;;
5377 esac                          
5378 case "$uselonglongs" in
5379 "$define"|true|[yY]*)
5380         cat <<EOM >&4
5381
5382 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5383 EOM
5384         use64bitint="$define"
5385         ;;
5386 esac                          
5387 case "$use64bitsall" in
5388 "$define"|true|[yY]*)
5389         cat <<EOM >&4
5390
5391 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5392 EOM
5393         use64bitall="$define"
5394         ;;
5395 esac                          
5396
5397 case "$ccflags" in
5398 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5399 esac
5400 case "$use64bitall" in
5401 "$define"|true|[yY]*) use64bitint="$define" ;;
5402 esac
5403
5404 case "$longsize" in
5405 8) cat <<EOM
5406
5407 You have natively 64-bit long integers.
5408 EOM
5409    val="$define"
5410    ;;
5411 *) case "$use64bitint" in
5412    "$define"|true|[yY]*) dflt='y';;
5413    *) dflt='n';;
5414    esac
5415    case "$d_quad" in
5416    "$define") ;;
5417    *) dflt='n' ;;
5418    esac
5419    cat <<EOM
5420
5421 Perl can be built to take advantage of 64-bit integer types
5422 on some systems.  To do so, Configure can be run with -Duse64bitint.
5423 Choosing this option will most probably introduce binary incompatibilities.
5424
5425 If this doesn't make any sense to you, just accept the default '$dflt'.
5426 (The default has been chosen based on your configuration.)
5427 EOM
5428    rp='Try to use 64-bit integers, if available?'
5429    . ./myread
5430    case "$ans" in
5431    [yY]*) val="$define" ;;
5432    *)     val="$undef"  ;;
5433    esac
5434    ;;
5435 esac
5436 set use64bitint
5437 eval $setvar
5438
5439 case "$use64bitall" in
5440 "$define"|true|[yY]*) dflt='y' ;;
5441 *) case "$longsize" in
5442    8) dflt='y' ;;
5443    *) dflt='n' ;;
5444    esac
5445    ;;
5446 esac    
5447 cat <<EOM
5448
5449 You may also choose to try maximal 64-bitness.  It means using as much
5450 64-bitness as possible on the platform.  This in turn means even more
5451 binary incompatibilities.  On the other hand, your platform may not
5452 have any more 64-bitness available than what you already have chosen.
5453
5454 If this doesn't make any sense to you, just accept the default '$dflt'.
5455 (The default has been chosen based on your configuration.)
5456 EOM
5457 rp='Try to use maximal 64-bit support, if available?'
5458 . ./myread
5459 case "$ans" in
5460 [yY]*) val="$define" ;;
5461 *)     val="$undef"  ;;
5462 esac
5463 set use64bitall
5464 eval $setvar
5465 case "$use64bitall" in
5466 "$define")
5467         case "$use64bitint" in
5468         "$undef")
5469                 cat <<EOM
5470
5471 Since you have chosen a maximally 64-bit build, I'm also turning on
5472 the use of 64-bit integers.
5473 EOM
5474                 use64bitint="$define" ;;
5475         esac
5476         ;;
5477 esac
5478
5479 : Look for a hint-file generated 'call-back-unit'.  If the
5480 : user has specified that a 64-bit perl is to be built,
5481 : we may need to set or change some other defaults.
5482 if $test -f use64bitint.cbu; then
5483         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5484         . ./use64bitint.cbu
5485 fi
5486 case "$use64bitint" in
5487 "$define"|true|[yY]*)
5488         case "$longsize" in
5489         4) case "$archname64" in
5490            '') archname64=64int ;;
5491            esac
5492            ;;
5493         esac
5494         ;;
5495 esac
5496
5497 : Look for a hint-file generated 'call-back-unit'.  If the
5498 : user has specified that a maximally 64-bit perl is to be built,
5499 : we may need to set or change some other defaults.
5500 if $test -f use64bitall.cbu; then
5501         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5502         . ./use64bitall.cbu
5503 fi
5504 case "$use64bitall" in
5505 "$define"|true|[yY]*)
5506         case "$longsize" in
5507         4) case "$archname64" in
5508            ''|64int) archname64=64all ;;
5509            esac
5510            ;;
5511         esac
5512         ;;
5513 esac
5514
5515 case "$d_quad:$use64bitint" in
5516 $undef:$define)
5517         cat >&4 <<EOF
5518
5519 *** You have chosen to use 64-bit integers,
5520 *** but none can be found.
5521 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5522 *** Cannot continue, aborting.
5523
5524 EOF
5525         exit 1
5526         ;;
5527 esac
5528
5529 : check for length of double
5530 echo " "
5531 case "$doublesize" in
5532 '')
5533         echo "Checking to see how big your double precision numbers are..." >&4
5534         $cat >try.c <<EOCP
5535 #include <stdio.h>
5536 #$i_stdlib I_STDLIB
5537 #ifdef I_STDLIB
5538 #include <stdlib.h>
5539 #endif
5540 int main()
5541 {
5542     printf("%d\n", (int)sizeof(double));
5543     exit(0);
5544 }
5545 EOCP
5546         set try
5547         if eval $compile_ok; then
5548                 doublesize=`$run ./try`
5549                 echo "Your double is $doublesize bytes long."
5550         else
5551                 dflt='8'
5552                 echo "(I can't seem to compile the test program.  Guessing...)"
5553                 rp="What is the size of a double precision number (in bytes)?"
5554                 . ./myread
5555                 doublesize="$ans"
5556         fi
5557         ;;
5558 esac
5559 $rm -f try.c try
5560
5561 : check for long doubles
5562 echo " "
5563 echo "Checking to see if you have long double..." >&4
5564 echo 'int main() { long double x = 7.0; }' > try.c
5565 set try
5566 if eval $compile; then
5567         val="$define"
5568         echo "You have long double."
5569 else
5570         val="$undef"
5571         echo "You do not have long double."
5572 fi
5573 $rm try.*
5574 set d_longdbl
5575 eval $setvar
5576
5577 : check for length of long double
5578 case "${d_longdbl}${longdblsize}" in
5579 $define)
5580         echo " "
5581         echo "Checking to see how big your long doubles are..." >&4
5582         $cat >try.c <<'EOCP'
5583 #include <stdio.h>
5584 int main()
5585 {
5586         printf("%d\n", sizeof(long double));
5587 }
5588 EOCP
5589         set try
5590         set try
5591         if eval $compile; then
5592                 longdblsize=`$run ./try`
5593                 echo "Your long doubles are $longdblsize bytes long."
5594         else
5595                 dflt='8'
5596                 echo " "
5597                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5598                 rp="What is the size of a long double (in bytes)?"
5599                 . ./myread
5600                 longdblsize="$ans"
5601         fi
5602         if $test "X$doublesize" = "X$longdblsize"; then
5603                 echo "That isn't any different from an ordinary double."
5604                 echo "I'll keep your setting anyway, but you may see some"
5605                 echo "harmless compilation warnings."
5606         fi      
5607         ;;
5608 esac
5609 $rm -f try.* try
5610
5611 : determine the architecture name
5612 echo " "
5613 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5614         tarch=`arch`"-$osname"
5615 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5616         if uname -m > tmparch 2>&1 ; then
5617                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5618                         -e 's/$/'"-$osname/" tmparch`
5619         else
5620                 tarch="$osname"
5621         fi
5622         $rm -f tmparch
5623 else
5624         tarch="$osname"
5625 fi
5626 case "$myarchname" in
5627 ''|"$tarch") ;;
5628 *)
5629         echo "(Your architecture name used to be $myarchname.)"
5630         archname=''
5631         ;;
5632 esac
5633 case "$targetarch" in
5634 '') ;;
5635 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5636 esac
5637 myarchname="$tarch"
5638 case "$archname" in
5639 '') dflt="$tarch";;
5640 *) dflt="$archname";;
5641 esac
5642 rp='What is your architecture name'
5643 . ./myread
5644 archname="$ans"
5645 case "$usethreads" in
5646 $define)
5647         echo "Threads selected." >&4
5648         case "$archname" in
5649         *-thread*) echo "...and architecture name already has -thread." >&4
5650                 ;;
5651         *)      archname="$archname-thread"
5652                 echo "...setting architecture name to $archname." >&4
5653                 ;;
5654         esac
5655         ;;
5656 esac
5657 case "$usemultiplicity" in
5658 $define)
5659         echo "Multiplicity selected." >&4
5660         case "$archname" in
5661         *-multi*) echo "...and architecture name already has -multi." >&4
5662                 ;;
5663         *)      archname="$archname-multi"
5664                 echo "...setting architecture name to $archname." >&4
5665                 ;;
5666         esac
5667         ;;
5668 esac
5669 case "$use64bitint$use64bitall" in
5670 *"$define"*)
5671         case "$archname64" in
5672         '')
5673                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5674                 ;;
5675         *)
5676                 case "$use64bitint" in
5677                 "$define") echo "64 bit integers selected." >&4 ;;
5678                 esac
5679                 case "$use64bitall" in
5680                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5681                 esac
5682                 case "$archname" in
5683                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5684                         ;;
5685                 *)      archname="$archname-$archname64"
5686                         echo "...setting architecture name to $archname." >&4
5687                         ;;
5688                 esac
5689                 ;;
5690         esac
5691 esac
5692 case "$uselongdouble" in
5693 $define)
5694         echo "Long doubles selected." >&4
5695         case "$longdblsize" in
5696         $doublesize)
5697                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5698                 ;;
5699         *)
5700                 case "$archname" in
5701                 *-ld*) echo "...and architecture name already has -ld." >&4
5702                         ;;
5703                 *)      archname="$archname-ld"
5704                         echo "...setting architecture name to $archname." >&4
5705                         ;;
5706                 esac
5707                 ;;
5708         esac
5709         ;;
5710 esac
5711 case "$useperlio" in
5712 $define)
5713         echo "Perlio selected." >&4
5714         ;;
5715 *)
5716         echo "Perlio not selected, using stdio." >&4
5717         case "$archname" in
5718         *-stdio*) echo "...and architecture name already has -stdio." >&4
5719                 ;;
5720         *)      archname="$archname-stdio"
5721                 echo "...setting architecture name to $archname." >&4
5722                 ;;
5723         esac
5724         ;;
5725 esac
5726 if $test -f archname.cbu; then
5727         echo "Your platform has some specific hints for architecture name, using them..."
5728         . ./archname.cbu
5729 fi
5730
5731 : determine root of directory hierarchy where package will be installed.
5732 case "$prefix" in
5733 '')
5734         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5735         ;;
5736 *?/)
5737         dflt=`echo "$prefix" | sed 's/.$//'`
5738         ;;
5739 *)
5740         dflt="$prefix"
5741         ;;
5742 esac
5743 $cat <<EOM
5744
5745 By default, $package will be installed in $dflt/bin, manual pages
5746 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5747 installation directories. Typically this is something like /usr/local.
5748 If you wish to have binaries under /usr/bin but other parts of the
5749 installation under /usr/local, that's ok: you will be prompted
5750 separately for each of the installation directories, the prefix being
5751 only used to set the defaults.
5752
5753 EOM
5754 fn=d~
5755 rp='Installation prefix to use?'
5756 . ./getfile
5757 oldprefix=''
5758 case "$prefix" in
5759 '') ;;
5760 *)
5761         case "$ans" in
5762         "$prefix") ;;
5763         *) oldprefix="$prefix";;
5764         esac
5765         ;;
5766 esac
5767 prefix="$ans"
5768 prefixexp="$ansexp"
5769
5770 case "$afsroot" in
5771 '')     afsroot=/afs ;;
5772 *)      afsroot=$afsroot ;;
5773 esac
5774
5775 : is AFS running?
5776 echo " "
5777 case "$afs" in
5778 $define|true)   afs=true ;;
5779 $undef|false)   afs=false ;;
5780 *)      if test -d $afsroot; then
5781                 afs=true
5782         else
5783                 afs=false
5784         fi
5785         ;;
5786 esac
5787 if $afs; then
5788         echo "AFS may be running... I'll be extra cautious then..." >&4
5789 else
5790         echo "AFS does not seem to be running..." >&4
5791 fi
5792
5793 : determine installation prefix for where package is to be installed.
5794 if $afs; then 
5795 $cat <<EOM
5796
5797 Since you are running AFS, I need to distinguish the directory in which
5798 files will reside from the directory in which they are installed (and from
5799 which they are presumably copied to the former directory by occult means).
5800
5801 EOM
5802         case "$installprefix" in
5803         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5804         *) dflt="$installprefix";;
5805         esac
5806 else
5807 $cat <<EOM
5808
5809 In some special cases, particularly when building $package for distribution,
5810 it is convenient to distinguish the directory in which files should be
5811 installed from the directory ($prefix) in which they will
5812 eventually reside.  For most users, these two directories are the same.
5813
5814 EOM
5815         case "$installprefix" in
5816         '') dflt=$prefix ;;
5817         *) dflt=$installprefix;;
5818         esac
5819 fi
5820 fn=d~
5821 rp='What installation prefix should I use for installing files?'
5822 . ./getfile
5823 installprefix="$ans"
5824 installprefixexp="$ansexp"
5825
5826 : set the prefixit variable, to compute a suitable default value
5827 prefixit='case "$3" in
5828 ""|none)
5829         case "$oldprefix" in
5830         "") eval "$1=\"\$$2\"";;
5831         *)
5832                 case "$3" in
5833                 "") eval "$1=";;
5834                 none)
5835                         eval "tp=\"\$$2\"";
5836                         case "$tp" in
5837                         ""|" ") eval "$1=\"\$$2\"";;
5838                         *) eval "$1=";;
5839                         esac;;
5840                 esac;;
5841         esac;;
5842 *)
5843         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5844         case "$tp" in
5845         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5846         /*-$oldprefix/*|\~*-$oldprefix/*)
5847                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5848         *) eval "$1=\"\$$2\"";;
5849         esac;;
5850 esac'
5851
5852 : get the patchlevel
5853 echo " "
5854 echo "Getting the current patchlevel..." >&4
5855 if $test -r $rsrc/patchlevel.h;then
5856         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5857         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5858         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5859         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5860         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5861         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5862        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5863 else
5864         revision=0
5865         patchlevel=0
5866         subversion=0
5867         api_revision=0
5868         api_version=0
5869         api_subversion=0
5870         perl_patchlevel=0
5871         $echo "(You do not have patchlevel.h.  Eek.)"
5872 fi
5873 if $test -r $rsrc/.patch ; then  
5874         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5875                 perl_patchlevel=`cat $rsrc/.patch`
5876         fi
5877 fi
5878 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5879 version_patchlevel_string="version $patchlevel subversion $subversion"
5880 case "$perl_patchlevel" in
5881 0|'') ;;
5882 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5883 esac
5884
5885 $echo "(You have $package $version_patchlevel_string.)"
5886
5887 case "$osname" in
5888 dos|vms)
5889         : XXX Should be a Configure test for double-dots in filenames.
5890         version=`echo $revision $patchlevel $subversion | \
5891                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5892         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5893                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5894         ;;
5895 *)
5896         version=`echo $revision $patchlevel $subversion | \
5897                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5898         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5899                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5900         ;;
5901 esac
5902 : Special case the 5.005_xx maintenance series, which used 5.005
5903 : without any subversion label as a subdirectory in $sitelib
5904 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5905         api_versionstring='5.005'
5906 fi
5907
5908 : determine installation style
5909 : For now, try to deduce it from prefix unless it is already set.
5910 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5911 case "$installstyle" in
5912 '')     case "$prefix" in
5913                 *perl*) dflt='lib';;
5914                 *) dflt='lib/perl5' ;;
5915         esac
5916         ;;
5917 *)      dflt="$installstyle" ;;
5918 esac
5919 : Probably not worth prompting for this since we prompt for all
5920 : the directories individually, and the prompt would be too long and
5921 : confusing anyway.
5922 installstyle=$dflt
5923
5924 : determine where private library files go
5925 : Usual default is /usr/local/lib/perl5/$version.
5926 : Also allow things like /opt/perl/lib/$version, since 
5927 : /opt/perl/lib/perl5... would be redundant.
5928 : The default "style" setting is made in installstyle.U
5929 case "$installstyle" in
5930 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5931 *)       set dflt privlib lib/$version ;;
5932 esac
5933 eval $prefixit
5934 $cat <<EOM
5935
5936 There are some auxiliary files for $package that need to be put into a
5937 private library directory that is accessible by everyone.
5938
5939 EOM
5940 fn=d~+
5941 rp='Pathname where the private library files will reside?'
5942 . ./getfile
5943 privlib="$ans"
5944 privlibexp="$ansexp"
5945 : Change installation prefix, if necessary.
5946 if $test X"$prefix" != X"$installprefix"; then
5947         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5948 else
5949         installprivlib="$privlibexp"
5950 fi
5951
5952 : set the prefixup variable, to restore leading tilda escape
5953 prefixup='case "$prefixexp" in
5954 "$prefix") ;;
5955 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5956 esac'
5957
5958 : determine where public architecture dependent libraries go
5959 set archlib archlib
5960 eval $prefixit
5961 : privlib default is /usr/local/lib/$package/$version
5962 : archlib default is /usr/local/lib/$package/$version/$archname
5963 : privlib may have an optional trailing /share.
5964 tdflt=`echo $privlib | $sed 's,/share$,,'`
5965 tdflt=$tdflt/$archname
5966 case "$archlib" in
5967 '')     dflt=$tdflt
5968         ;;
5969 *)      dflt="$archlib"
5970     ;;
5971 esac
5972 $cat <<EOM
5973
5974 $spackage contains architecture-dependent library files.  If you are
5975 sharing libraries in a heterogeneous environment, you might store
5976 these files in a separate location.  Otherwise, you can just include
5977 them with the rest of the public library files.
5978
5979 EOM
5980 fn=d+~
5981 rp='Where do you want to put the public architecture-dependent libraries?'
5982 . ./getfile
5983 archlib="$ans"
5984 archlibexp="$ansexp"
5985 if $test X"$archlib" = X"$privlib"; then
5986         d_archlib="$undef"
5987 else
5988         d_archlib="$define"
5989 fi
5990 : Change installation prefix, if necessary.
5991 if $test X"$prefix" != X"$installprefix"; then
5992         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5993 else
5994         installarchlib="$archlibexp"
5995 fi
5996
5997 : see if setuid scripts can be secure
5998 $cat <<EOM
5999
6000 Some kernels have a bug that prevents setuid #! scripts from being
6001 secure.  Some sites have disabled setuid #! scripts because of this.
6002
6003 First let's decide if your kernel supports secure setuid #! scripts.
6004 (If setuid #! scripts would be secure but have been disabled anyway,
6005 don't say that they are secure if asked.)
6006
6007 EOM
6008
6009 val="$undef"
6010 if $test -d /dev/fd; then
6011         echo "#!$ls" >reflect
6012         chmod +x,u+s reflect
6013         ./reflect >flect 2>&1
6014         if $contains "/dev/fd" flect >/dev/null; then
6015                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6016                 val="$define"
6017         else
6018                 $cat <<EOM
6019 If you are not sure if they are secure, I can check but I'll need a
6020 username and password different from the one you are using right now.
6021 If you don't have such a username or don't want me to test, simply
6022 enter 'none'.
6023
6024 EOM
6025                 rp='Other username to test security of setuid scripts with?'
6026                 dflt='none'
6027                 . ./myread
6028                 case "$ans" in
6029                 n|none)
6030                         case "$d_suidsafe" in
6031                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6032                                 dflt=n;;
6033                         "$undef")
6034                                 echo "Well, the $hint value is *not* secure." >&4
6035                                 dflt=n;;
6036                         *)      echo "Well, the $hint value *is* secure." >&4
6037                                 dflt=y;;
6038                         esac
6039                         ;;
6040                 *)
6041                         $rm -f reflect flect
6042                         echo "#!$ls" >reflect
6043                         chmod +x,u+s reflect
6044                         echo >flect
6045                         chmod a+w flect
6046                         echo '"su" will (probably) prompt you for '"$ans's password."
6047                         su $ans -c './reflect >flect'
6048                         if $contains "/dev/fd" flect >/dev/null; then
6049                                 echo "Okay, it looks like setuid scripts are secure." >&4
6050                                 dflt=y
6051                         else
6052                                 echo "I don't think setuid scripts are secure." >&4
6053                                 dflt=n
6054                         fi
6055                         ;;
6056                 esac
6057                 rp='Does your kernel have *secure* setuid scripts?'
6058                 . ./myread
6059                 case "$ans" in
6060                 [yY]*)  val="$define";;
6061                 *)      val="$undef";;
6062                 esac
6063         fi
6064 else
6065         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6066         echo "(That's for file descriptors, not floppy disks.)"
6067         val="$undef"
6068 fi
6069 set d_suidsafe
6070 eval $setvar
6071
6072 $rm -f reflect flect
6073
6074 : now see if they want to do setuid emulation
6075 echo " "
6076 val="$undef"
6077 case "$d_suidsafe" in
6078 "$define")
6079         val="$undef"
6080         echo "No need to emulate SUID scripts since they are secure here." >&4
6081         ;;
6082 *)
6083         $cat <<EOM
6084 Some systems have disabled setuid scripts, especially systems where
6085 setuid scripts cannot be secure.  On systems where setuid scripts have
6086 been disabled, the setuid/setgid bits on scripts are currently
6087 useless.  It is possible for $package to detect those bits and emulate
6088 setuid/setgid in a secure fashion.  This emulation will only work if
6089 setuid scripts have been disabled in your kernel.
6090
6091 EOM
6092         case "$d_dosuid" in
6093         "$define") dflt=y ;;
6094         *) dflt=n ;;
6095         esac
6096         rp="Do you want to do setuid/setgid emulation?"
6097         . ./myread
6098         case "$ans" in
6099         [yY]*)  val="$define";;
6100         *)      val="$undef";;
6101         esac
6102         ;;
6103 esac
6104 set d_dosuid
6105 eval $setvar
6106
6107 : see if this is a malloc.h system
6108 : we want a real compile instead of Inhdr because some systems have a
6109 : malloc.h that just gives a compile error saying to use stdlib.h instead
6110 echo " "
6111 $cat >try.c <<EOCP
6112 #include <stdlib.h>
6113 #include <malloc.h>
6114 int main () { return 0; }
6115 EOCP
6116 set try
6117 if eval $compile; then
6118     echo "<malloc.h> found." >&4
6119     val="$define"
6120 else
6121     echo "<malloc.h> NOT found." >&4
6122     val="$undef"
6123 fi
6124 $rm -f try.c try
6125 set i_malloc
6126 eval $setvar
6127
6128 : check for void type
6129 echo " "
6130 echo "Checking to see how well your C compiler groks the void type..." >&4
6131 case "$voidflags" in
6132 '')
6133         $cat >try.c <<EOCP
6134 #$i_stdlib I_STDLIB
6135 #ifdef I_STDLIB
6136 #include <stdlib.h>
6137 #endif
6138 #if TRY & 1
6139 void sub() {
6140 #else
6141 sub() {
6142 #endif
6143         extern void moo();      /* function returning void */
6144         void (*goo)();          /* ptr to func returning void */
6145 #if TRY & 8
6146         void *hue;              /* generic ptr */
6147 #endif
6148 #if TRY & 2
6149         void (*foo[10])();
6150 #endif
6151
6152 #if TRY & 4
6153         if(goo == moo) {
6154                 exit(0);
6155         }
6156 #endif
6157         exit(0);
6158 }
6159 int main() { sub(); }
6160 EOCP
6161         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6162                 voidflags=$defvoidused
6163         echo "Good.  It appears to support void to the level $package wants.">&4
6164                 if $contains warning .out >/dev/null 2>&1; then
6165                         echo "However, you might get some warnings that look like this:"
6166                         $cat .out
6167                 fi
6168         else
6169 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6170                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6171                         echo "It supports 1..."
6172                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6173                                 echo "It also supports 2..."
6174                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6175                                         voidflags=7
6176                                         echo "And it supports 4 but not 8 definitely."
6177                                 else
6178                                         echo "It doesn't support 4..."
6179                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6180                                                 voidflags=11
6181                                                 echo "But it supports 8."
6182                                         else
6183                                                 voidflags=3
6184                                                 echo "Neither does it support 8."
6185                                         fi
6186                                 fi
6187                         else
6188                                 echo "It does not support 2..."
6189                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6190                                         voidflags=13
6191                                         echo "But it supports 4 and 8."
6192                                 else
6193                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6194                                                 voidflags=5
6195                                                 echo "And it supports 4 but has not heard about 8."
6196                                         else
6197                                                 echo "However it supports 8 but not 4."
6198                                         fi
6199                                 fi
6200                         fi
6201                 else
6202                         echo "There is no support at all for void."
6203                         voidflags=0
6204                 fi
6205         fi
6206 esac
6207 case "$voidflags" in
6208 "$defvoidused") ;;
6209 *)      $cat >&4 <<'EOM'
6210   Support flag bits are:
6211     1: basic void declarations.
6212     2: arrays of pointers to functions returning void.
6213     4: operations between pointers to and addresses of void functions.
6214     8: generic void pointers.
6215 EOM
6216         dflt="$voidflags";
6217         rp="Your void support flags add up to what?"
6218         . ./myread
6219         voidflags="$ans"
6220         ;;
6221 esac
6222 $rm -f try.* .out
6223
6224 : check for length of pointer
6225 echo " "
6226 case "$ptrsize" in
6227 '')
6228         echo "Checking to see how big your pointers are..." >&4
6229         if test "$voidflags" -gt 7; then
6230                 echo '#define VOID_PTR char *' > try.c
6231         else
6232                 echo '#define VOID_PTR void *' > try.c
6233         fi
6234         $cat >>try.c <<EOCP
6235 #include <stdio.h>
6236 #$i_stdlib I_STDLIB
6237 #ifdef I_STDLIB
6238 #include <stdlib.h>
6239 #endif
6240 int main()
6241 {
6242     printf("%d\n", (int)sizeof(VOID_PTR));
6243     exit(0);
6244 }
6245 EOCP
6246         set try
6247         if eval $compile_ok; then
6248                 ptrsize=`$run ./try`
6249                 echo "Your pointers are $ptrsize bytes long."
6250         else
6251                 dflt='4'
6252                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6253                 rp="What is the size of a pointer (in bytes)?"
6254                 . ./myread
6255                 ptrsize="$ans"
6256         fi
6257         ;;
6258 esac
6259 $rm -f try.c try
6260 case "$use64bitall" in
6261 "$define"|true|[yY]*)
6262         case "$ptrsize" in
6263         4)      cat <<EOM >&4
6264
6265 *** You have chosen a maximally 64-bit build,
6266 *** but your pointers are only 4 bytes wide.
6267 *** Please rerun Configure without -Duse64bitall.
6268 EOM
6269                 case "$d_quad" in
6270                 define)
6271                         cat <<EOM >&4
6272 *** Since you have quads, you could possibly try with -Duse64bitint.
6273 EOM
6274                         ;;
6275                 esac
6276                 cat <<EOM >&4
6277 *** Cannot continue, aborting.
6278
6279 EOM
6280
6281                 exit 1
6282                 ;;
6283         esac
6284         ;;
6285 esac
6286
6287
6288 : determine whether to use malloc wrapping
6289 echo " "
6290 case "$usemallocwrap" in
6291 [yY]*|true|$define)     dflt='y' ;;
6292 [nN]*|false|$undef)     dflt='n' ;;
6293 *)      case "$usedevel" in
6294         [yY]*|true|$define)     dflt='y' ;;
6295         *) dflt='n' ;;
6296         esac
6297         ;;
6298 esac
6299 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6300 . ./myread
6301 usemallocwrap="$ans"
6302 case "$ans" in
6303 y*|true)
6304         usemallocwrap="$define" ;;
6305 *)
6306         usemallocwrap="$undef" ;;
6307 esac
6308
6309 : determine which malloc to compile in
6310 echo " "
6311 case "$usemymalloc" in
6312 [yY]*|true|$define)     dflt='y' ;;
6313 [nN]*|false|$undef)     dflt='n' ;;
6314 *)      case "$ptrsize" in
6315         4) dflt='y' ;;
6316         *) dflt='n' ;;
6317         esac
6318         ;;
6319 esac
6320 rp="Do you wish to attempt to use the malloc that comes with $package?"
6321 . ./myread
6322 usemymalloc="$ans"
6323 case "$ans" in
6324 y*|true)
6325         usemymalloc='y'
6326         mallocsrc='malloc.c'
6327         mallocobj="malloc$_o"
6328         d_mymalloc="$define"
6329         case "$libs" in
6330         *-lmalloc*)
6331                 : Remove malloc from list of libraries to use
6332                 echo "Removing unneeded -lmalloc from library list" >&4
6333                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6334                 shift
6335                 libs="$*"
6336                 echo "libs = $libs" >&4
6337                 ;;
6338         esac
6339         ;;
6340 *)
6341         usemymalloc='n'
6342         mallocsrc=''
6343         mallocobj=''
6344         d_mymalloc="$undef"
6345         ;;
6346 esac
6347
6348 : compute the return types of malloc and free
6349 echo " "
6350 $cat >malloc.c <<END
6351 #$i_malloc I_MALLOC
6352 #$i_stdlib I_STDLIB
6353 #include <stdio.h>
6354 #include <sys/types.h>
6355 #ifdef I_MALLOC
6356 #include <malloc.h>
6357 #endif
6358 #ifdef I_STDLIB
6359 #include <stdlib.h>
6360 #endif
6361 #ifdef TRY_MALLOC
6362 void *malloc();
6363 #endif
6364 #ifdef TRY_FREE
6365 void free();
6366 #endif
6367 END
6368 case "$malloctype" in
6369 '')
6370         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6371                 malloctype='void *'
6372         else
6373                 malloctype='char *'
6374         fi
6375         ;;
6376 esac
6377 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6378
6379 case "$freetype" in
6380 '')
6381         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6382                 freetype='void'
6383         else
6384                 freetype='int'
6385         fi
6386         ;;
6387 esac
6388 echo "Your system uses $freetype free(), it would seem." >&4
6389 $rm -f malloc.[co]
6390 $cat <<EOM
6391
6392 After $package is installed, you may wish to install various
6393 add-on modules and utilities.  Typically, these add-ons will
6394 be installed under $prefix with the rest
6395 of this package.  However, you may wish to install such add-ons
6396 elsewhere under a different prefix.
6397
6398 If you do not wish to put everything under a single prefix, that's
6399 ok.  You will be prompted for the individual locations; this siteprefix
6400 is only used to suggest the defaults.
6401
6402 The default should be fine for most people.
6403
6404 EOM
6405 fn=d~+
6406 rp='Installation prefix to use for add-on modules and utilities?'
6407 : XXX Here might be another good place for an installstyle setting.
6408 case "$siteprefix" in
6409 '') dflt=$prefix ;;
6410 *)  dflt=$siteprefix ;;
6411 esac
6412 . ./getfile
6413 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6414 oldsiteprefix=''
6415 case "$siteprefix" in
6416 '') ;;
6417 *)      case "$ans" in
6418         "$prefix") ;;
6419         *) oldsiteprefix="$prefix";;
6420         esac
6421         ;;
6422 esac
6423 siteprefix="$ans"
6424 siteprefixexp="$ansexp"
6425
6426 : determine where site specific libraries go.
6427 : Usual default is /usr/local/lib/perl5/site_perl/$version
6428 : The default "style" setting is made in installstyle.U
6429 : XXX No longer works with Prefixit stuff.
6430 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6431 case "$sitelib" in
6432 '') case "$installstyle" in
6433         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6434         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6435         esac
6436         ;;
6437 *)      dflt="$sitelib"
6438         ;;
6439 esac
6440 $cat <<EOM
6441
6442 The installation process will create a directory for
6443 site-specific extensions and modules.  Most users find it convenient
6444 to place all site-specific files in this directory rather than in the
6445 main distribution directory.
6446
6447 EOM
6448 fn=d~+
6449 rp='Pathname for the site-specific library files?'
6450 . ./getfile
6451 sitelib="$ans"
6452 sitelibexp="$ansexp"
6453 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6454 : Change installation prefix, if necessary.
6455 if $test X"$prefix" != X"$installprefix"; then
6456         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6457 else
6458         installsitelib="$sitelibexp"
6459 fi
6460
6461 : determine where site specific architecture-dependent libraries go.
6462 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6463 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6464 : sitelib may have an optional trailing /share.
6465 case "$sitearch" in
6466 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6467         dflt="$dflt/$archname"
6468         ;;
6469 *)      dflt="$sitearch"
6470         ;;
6471 esac
6472 set sitearch sitearch none
6473 eval $prefixit
6474 $cat <<EOM
6475
6476 The installation process will also create a directory for
6477 architecture-dependent site-specific extensions and modules.
6478
6479 EOM
6480 fn=d~+
6481 rp='Pathname for the site-specific architecture-dependent library files?'
6482 . ./getfile
6483 sitearch="$ans"
6484 sitearchexp="$ansexp"
6485 : Change installation prefix, if necessary.
6486 if $test X"$prefix" != X"$installprefix"; then
6487         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6488 else
6489         installsitearch="$sitearchexp"
6490 fi
6491
6492 $cat <<EOM
6493
6494 The installation process will also create a directory for
6495 vendor-supplied add-ons.  Vendors who supply perl with their system
6496 may find it convenient to place all vendor-supplied files in this
6497 directory rather than in the main distribution directory.  This will
6498 ease upgrades between binary-compatible maintenance versions of perl.
6499
6500 Of course you may also use these directories in whatever way you see
6501 fit.  For example, you might use them to access modules shared over a
6502 company-wide network.
6503
6504 The default answer should be fine for most people.
6505 This causes further questions about vendor add-ons to be skipped
6506 and no vendor-specific directories will be configured for perl.
6507
6508 EOM
6509 rp='Do you want to configure vendor-specific add-on directories?'
6510 case "$usevendorprefix" in
6511 define|true|[yY]*) dflt=y ;;
6512 *)      : User may have set vendorprefix directly on Configure command line.
6513         case "$vendorprefix" in
6514         ''|' ') dflt=n ;;
6515         *)      dflt=y ;;
6516         esac
6517         ;;
6518 esac
6519 . ./myread
6520 case "$ans" in
6521 [yY]*)  fn=d~+
6522         rp='Installation prefix to use for vendor-supplied add-ons?'
6523         case "$vendorprefix" in
6524         '') dflt='' ;;
6525         *)  dflt=$vendorprefix ;;
6526         esac
6527         . ./getfile
6528         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6529         oldvendorprefix=''
6530         case "$vendorprefix" in
6531         '') ;;
6532         *)      case "$ans" in
6533                 "$prefix") ;;
6534                 *) oldvendorprefix="$prefix";;
6535                 esac
6536                 ;;
6537         esac
6538         usevendorprefix="$define"
6539         vendorprefix="$ans"
6540         vendorprefixexp="$ansexp"
6541         ;;
6542 *)      usevendorprefix="$undef"
6543         vendorprefix=''
6544         vendorprefixexp=''
6545         ;;
6546 esac
6547
6548 case "$vendorprefix" in
6549 '')     d_vendorlib="$undef"
6550         vendorlib=''
6551         vendorlibexp=''
6552         ;;
6553 *)      d_vendorlib="$define"
6554         : determine where vendor-supplied modules go.
6555         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6556         case "$vendorlib" in
6557         '')
6558                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6559                 case "$installstyle" in
6560                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6561                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6562                 esac
6563                 ;;
6564         *)      dflt="$vendorlib"
6565                 ;;
6566         esac
6567         fn=d~+
6568         rp='Pathname for the vendor-supplied library files?'
6569         . ./getfile
6570         vendorlib="$ans"
6571         vendorlibexp="$ansexp"
6572         ;;
6573 esac
6574 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6575 : Change installation prefix, if necessary.
6576 if $test X"$prefix" != X"$installprefix"; then
6577         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6578 else
6579         installvendorlib="$vendorlibexp"
6580 fi
6581
6582 case "$vendorprefix" in
6583 '')     d_vendorarch="$undef"
6584         vendorarch=''
6585         vendorarchexp=''
6586         ;;
6587 *)      d_vendorarch="$define"
6588         : determine where vendor-supplied architecture-dependent libraries go.
6589         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6590         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6591         : vendorlib may have an optional trailing /share.
6592         case "$vendorarch" in
6593         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6594                 dflt="$dflt/$archname"
6595                 ;;
6596         *)      dflt="$vendorarch" ;;
6597         esac
6598         fn=d~+
6599         rp='Pathname for vendor-supplied architecture-dependent files?'
6600         . ./getfile
6601         vendorarch="$ans"
6602         vendorarchexp="$ansexp"
6603         ;;
6604 esac
6605 : Change installation prefix, if necessary.
6606 if $test X"$prefix" != X"$installprefix"; then
6607         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6608 else
6609         installvendorarch="$vendorarchexp"
6610 fi
6611
6612 : Final catch-all directories to search
6613 $cat <<EOM
6614
6615 Lastly, you can have perl look in other directories for extensions and
6616 modules in addition to those already specified.
6617 These directories will be searched after 
6618         $sitearch 
6619         $sitelib 
6620 EOM
6621 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6622 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6623 echo ' '
6624 case "$otherlibdirs" in
6625 ''|' ') dflt='none' ;;
6626 *)      dflt="$otherlibdirs" ;;
6627 esac
6628 $cat <<EOM
6629 Enter a colon-separated set of extra paths to include in perl's @INC
6630 search path, or enter 'none' for no extra paths.
6631
6632 EOM
6633
6634 rp='Colon-separated list of additional directories for perl to search?'
6635 . ./myread
6636 case "$ans" in
6637 ' '|''|none)    otherlibdirs=' ' ;;     
6638 *)      otherlibdirs="$ans" ;;
6639 esac
6640 case "$otherlibdirs" in
6641 ' ') val=$undef ;;
6642 *)      val=$define ;;
6643 esac
6644 set d_perl_otherlibdirs
6645 eval $setvar
6646
6647 : Cruising for prototypes
6648 echo " "
6649 echo "Checking out function prototypes..." >&4
6650 $cat >prototype.c <<EOCP
6651 #$i_stdlib I_STDLIB
6652 #ifdef I_STDLIB
6653 #include <stdlib.h>
6654 #endif
6655 int main(int argc, char *argv[]) {
6656         exit(0);}
6657 EOCP
6658 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6659         echo "Your C compiler appears to support function prototypes."
6660         val="$define"
6661 else
6662         echo "Your C compiler doesn't seem to understand function prototypes."
6663         val="$undef"
6664 fi
6665 set prototype
6666 eval $setvar
6667 $rm -f prototype*
6668
6669 case "$prototype" in
6670 "$define") ;;
6671 *)      ansi2knr='ansi2knr'
6672         echo " "
6673         cat <<EOM >&4
6674
6675 $me:  FATAL ERROR:
6676 This version of $package can only be compiled by a compiler that 
6677 understands function prototypes.  Unfortunately, your C compiler 
6678         $cc $ccflags
6679 doesn't seem to understand them.  Sorry about that.
6680
6681 If GNU cc is available for your system, perhaps you could try that instead.  
6682
6683 Eventually, we hope to support building Perl with pre-ANSI compilers.
6684 If you would like to help in that effort, please contact <perlbug@perl.org>.
6685
6686 Aborting Configure now.
6687 EOM
6688         exit 2
6689         ;;
6690 esac
6691
6692 : determine where public executables go
6693 echo " "
6694 set dflt bin bin
6695 eval $prefixit
6696 fn=d~
6697 rp='Pathname where the public executables will reside?'
6698 . ./getfile
6699 if $test "X$ansexp" != "X$binexp"; then
6700         installbin=''
6701 fi
6702 bin="$ans"
6703 binexp="$ansexp"
6704 : Change installation prefix, if necessary.
6705 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6706 if $test X"$prefix" != X"$installprefix"; then
6707         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6708 else
6709         installbin="$binexp"
6710 fi
6711
6712 echo " "
6713 case "$extras" in
6714 '') dflt='n';;
6715 *) dflt='y';;
6716 esac
6717 cat <<EOM
6718 Perl can be built with extra modules or bundles of modules which
6719 will be fetched from the CPAN and installed alongside Perl.
6720
6721 Notice that you will need access to the CPAN; either via the Internet,
6722 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6723 be asked later to configure the CPAN.pm module which will in turn do
6724 the installation of the rest of the extra modules or bundles.)
6725
6726 Notice also that if the modules require any external software such as
6727 libraries and headers (the libz library and the zlib.h header for the
6728 Compress::Zlib module, for example) you MUST have any such software
6729 already installed, this configuration process will NOT install such
6730 things for you.
6731
6732 If this doesn't make any sense to you, just accept the default '$dflt'.
6733 EOM
6734 rp='Install any extra modules (y or n)?'
6735 . ./myread
6736 case "$ans" in
6737 y|Y)
6738         cat <<EOM
6739
6740 Please list any extra modules or bundles to be installed from CPAN,
6741 with spaces between the names.  The names can be in any format the
6742 'install' command of CPAN.pm will understand.  (Answer 'none',
6743 without the quotes, to install no extra modules or bundles.)
6744 EOM
6745         rp='Extras?'
6746         dflt="$extras"
6747         . ./myread
6748         extras="$ans"
6749 esac
6750 case "$extras" in
6751 ''|'none')
6752         val=''
6753         $rm -f ../extras.lst
6754         ;;
6755 *)      echo "(Saving the list of extras for later...)"
6756         echo "$extras" > ../extras.lst
6757         val="'$extras'"
6758         ;;
6759 esac
6760 set extras
6761 eval $setvar
6762 echo " "
6763
6764 : determine where html pages for programs go
6765 set html1dir html1dir none
6766 eval $prefixit
6767 $cat <<EOM
6768
6769 If you wish to install html files for programs in $spackage, indicate 
6770 the appropriate directory here.  To skip installing html files,
6771 answer "none".
6772 EOM
6773 case "$html1dir" in
6774 ''|none|$undef|' ') dflt=none ;;
6775 *) dflt=$html1dir ;;
6776 esac
6777 fn=dn+~
6778 rp="Directory for the main $spackage html pages?"
6779 . ./getfile
6780 html1dir="$ans"
6781 html1direxp="$ansexp"
6782 : Use ' ' for none so value is preserved next time through Configure
6783 $test X"$html1dir" = "X" && html1dir=' '
6784 : Change installation prefix, if necessary.
6785 if $test X"$prefix" != X"$installprefix"; then
6786         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6787 else
6788         installhtml1dir="$html1direxp"
6789 fi
6790
6791 : determine where html pages for libraries and modules go
6792 set html3dir html3dir none
6793 eval $prefixit
6794 $cat <<EOM
6795
6796 If you wish to install html files for modules associated with $spackage,
6797 indicate the appropriate directory here.  To skip installing html files,
6798 answer "none".
6799 EOM
6800 : There is no obvious default.  If they have specified html1dir, then
6801 : try to key off that, possibly changing .../html1 into .../html3.
6802 case "$html3dir" in
6803 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6804 *) dflt=$html3dir ;;
6805 esac
6806 fn=dn+~
6807 rp="Directory for the $spackage module html pages?"
6808 . ./getfile
6809 html3dir="$ans"
6810 html3direxp="$ansexp"
6811 : Use ' ' for none so value is preserved next time through Configure
6812 $test X"$html3dir" = "X" && html3dir=' '
6813 : Change installation prefix, if necessary.
6814 if $test X"$prefix" != X"$installprefix"; then
6815         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6816 else
6817         installhtml3dir="$html3direxp"
6818 fi
6819
6820 : Find perl5.005 or later.
6821 echo "Looking for a previously installed perl5.005 or later... "
6822 case "$perl5" in
6823 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6824                 : Check if this perl is recent and can load a simple module
6825                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6826                         perl5=$tdir/perl
6827                         break;
6828                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6829                         perl5=$tdir/perl5
6830                         break;
6831                 fi
6832         done
6833         ;;
6834 *)      perl5="$perl5"
6835         ;;
6836 esac
6837 case "$perl5" in
6838 '')     echo "None found.  That's ok.";;
6839 *)      echo "Using $perl5." ;;
6840 esac
6841
6842 : Determine list of previous versions to include in @INC
6843 $cat > getverlist <<EOPL
6844 #!$perl5 -w
6845 use File::Basename;
6846 \$api_versionstring = "$api_versionstring";
6847 \$version = "$version";
6848 \$stem = "$sitelib_stem";
6849 \$archname = "$archname";
6850 EOPL
6851         $cat >> getverlist <<'EOPL'
6852 # Can't have leading @ because metaconfig interprets it as a command!
6853 ;@inc_version_list=();
6854 # XXX Redo to do opendir/readdir? 
6855 if (-d $stem) {
6856     chdir($stem);
6857     ;@candidates = glob("5.*");
6858 }
6859 else {
6860     ;@candidates = ();
6861 }
6862
6863 # XXX ToDo:  These comparisons must be reworked when two-digit
6864 # subversions come along, so that 5.7.10 compares as greater than
6865 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6866 # widespread that we can use the built-in version vectors rather
6867 # than reinventing them here.  For 5.6.0, however, we must
6868 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6869 foreach $d (@candidates) {
6870     if ($d lt $version) {
6871         if ($d ge $api_versionstring) {
6872             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6873         }
6874         elsif ($d ge "5.005") {
6875             unshift(@inc_version_list, grep { -d } $d);
6876         }
6877     }
6878     else {
6879         # Skip newer version.  I.e. don't look in
6880         # 5.7.0 if we're installing 5.6.1.
6881     }
6882 }
6883
6884 if (@inc_version_list) {
6885     print join(' ', @inc_version_list);
6886 }
6887 else {
6888     # Blank space to preserve value for next Configure run.
6889     print " ";
6890 }
6891 EOPL
6892 chmod +x getverlist
6893 case "$inc_version_list" in
6894 '')     if test -x "$perl5$exe_ext"; then
6895                 dflt=`$perl5 getverlist`
6896         else
6897                 dflt='none'
6898         fi
6899         ;;
6900 $undef) dflt='none' ;;
6901 *)  eval dflt=\"$inc_version_list\" ;;
6902 esac
6903 case "$dflt" in
6904 ''|' ') dflt=none ;;
6905 esac
6906 case "$dflt" in
6907 5.005) dflt=none ;;
6908 esac
6909 $cat <<EOM
6910
6911 In order to ease the process of upgrading, this version of perl 
6912 can be configured to use modules built and installed with earlier 
6913 versions of perl that were installed under $prefix.  Specify here
6914 the list of earlier versions that this version of perl should check.
6915 If Configure detected no earlier versions of perl installed under
6916 $prefix, then the list will be empty.  Answer 'none' to tell perl
6917 to not search earlier versions.
6918
6919 The default should almost always be sensible, so if you're not sure,
6920 just accept the default.
6921 EOM
6922
6923 rp='List of earlier versions to include in @INC?'
6924 . ./myread
6925 case "$ans" in
6926 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6927 *) inc_version_list="$ans" ;;
6928 esac
6929 case "$inc_version_list" in
6930 ''|' ') 
6931         inc_version_list_init='0';;
6932 *)      inc_version_list_init=`echo $inc_version_list |
6933                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6934         ;;
6935 esac
6936 $rm -f getverlist
6937
6938 : determine whether to install perl also as /usr/bin/perl
6939
6940 echo " "
6941 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6942         $cat <<EOM
6943 Many scripts expect perl to be installed as /usr/bin/perl.
6944
6945 If you want to, I can install the perl you are about to compile
6946 as /usr/bin/perl (in addition to $bin/perl).
6947 EOM
6948         if test -f /usr/bin/perl; then
6949             $cat <<EOM
6950
6951 However, please note that because you already have a /usr/bin/perl,
6952 overwriting that with a new Perl would very probably cause problems.
6953 Therefore I'm assuming you don't want to do that (unless you insist).
6954
6955 EOM
6956             case "$installusrbinperl" in
6957             "$define"|[yY]*)    dflt='y';;
6958             *)                  dflt='n';;
6959             esac
6960         else
6961             $cat <<EOM
6962
6963 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6964
6965 EOM
6966             case "$installusrbinperl" in
6967             "$undef"|[nN]*)     dflt='n';;
6968             *)                  dflt='y';;
6969             esac
6970         fi
6971         rp="Do you want to install perl as /usr/bin/perl?"
6972         . ./myread
6973         case "$ans" in
6974         [yY]*)  val="$define";;
6975         *)      val="$undef" ;;
6976         esac
6977 else
6978         val="$undef"
6979 fi
6980 set installusrbinperl
6981 eval $setvar
6982
6983 echo " "
6984 echo "Checking for GNU C Library..." >&4
6985 cat >try.c <<'EOCP'
6986 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6987    alone are insufficient to distinguish different versions, such as
6988    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6989    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6990 */
6991 #include <stdio.h>
6992 int main(void)
6993 {
6994 #ifdef __GLIBC__
6995 #   ifdef __GLIBC_MINOR__
6996 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
6997 #           include <gnu/libc-version.h>
6998             printf("%s\n",  gnu_get_libc_version());
6999 #       else
7000             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7001 #       endif
7002 #   else
7003         printf("%d\n",  __GLIBC__);
7004 #   endif
7005     return 0;
7006 #else
7007     return 1;
7008 #endif
7009 }
7010 EOCP
7011 set try
7012 if eval $compile_ok && $run ./try > glibc.ver; then
7013         val="$define"
7014         gnulibc_version=`$cat glibc.ver`
7015         echo "You are using the GNU C Library version $gnulibc_version"
7016 else
7017         val="$undef"
7018         gnulibc_version=''
7019         echo "You are not using the GNU C Library"
7020 fi
7021 $rm -f try try.* glibc.ver
7022 set d_gnulibc
7023 eval $setvar
7024
7025 : see if nm is to be used to determine whether a symbol is defined or not
7026 case "$usenm" in
7027 '')
7028         dflt=''
7029         case "$d_gnulibc" in
7030         "$define")
7031                 echo " "
7032                 echo "nm probably won't work on the GNU C Library." >&4
7033                 dflt=n
7034                 ;;
7035         esac
7036         case "$dflt" in
7037         '') 
7038                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7039                         echo " "
7040                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7041                         echo "'nm' won't be sufficient on this sytem." >&4
7042                         dflt=n
7043                 fi
7044                 ;;
7045         esac
7046         case "$dflt" in
7047         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7048                 if $test $dflt -gt 20; then
7049                         dflt=y
7050                 else
7051                         dflt=n
7052                 fi
7053                 ;;
7054         esac
7055         ;;
7056 *)
7057         case "$usenm" in
7058         true|$define) dflt=y;;
7059         *) dflt=n;;
7060         esac
7061         ;;
7062 esac
7063 $cat <<EOM
7064
7065 I can use $nm to extract the symbols from your C libraries. This
7066 is a time consuming task which may generate huge output on the disk (up
7067 to 3 megabytes) but that should make the symbols extraction faster. The
7068 alternative is to skip the 'nm' extraction part and to compile a small
7069 test program instead to determine whether each symbol is present. If
7070 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7071 this may be the best solution.
7072
7073 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7074
7075 EOM
7076 rp="Shall I use $nm to extract C symbols from the libraries?"
7077 . ./myread
7078 case "$ans" in
7079 [Nn]*) usenm=false;;
7080 *) usenm=true;;
7081 esac
7082
7083 runnm=$usenm
7084 case "$reuseval" in
7085 true) runnm=false;;
7086 esac
7087
7088 : nm options which may be necessary
7089 case "$nm_opt" in
7090 '') if $test -f /mach_boot; then
7091                 nm_opt=''       # Mach
7092         elif $test -d /usr/ccs/lib; then
7093                 nm_opt='-p'     # Solaris (and SunOS?)
7094         elif $test -f /dgux; then
7095                 nm_opt='-p'     # DG-UX
7096         elif $test -f /lib64/rld; then
7097                 nm_opt='-p'     # 64-bit Irix
7098         else
7099                 nm_opt=''
7100         fi;;
7101 esac
7102
7103 : nm options which may be necessary for shared libraries but illegal
7104 : for archive libraries.  Thank you, Linux.
7105 case "$nm_so_opt" in
7106 '')     case "$myuname" in
7107         *linux*)
7108                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7109                         nm_so_opt='--dynamic'
7110                 fi
7111                 ;;
7112         esac
7113         ;;
7114 esac
7115
7116 case "$runnm" in
7117 true)
7118 : get list of predefined functions in a handy place
7119 echo " "
7120 case "$libc" in
7121 '') libc=unknown
7122         case "$libs" in
7123         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7124         esac
7125         ;;
7126 esac
7127 case "$libs" in
7128 '') ;;
7129 *)  for thislib in $libs; do
7130         case "$thislib" in
7131         -lc|-lc_s)
7132                 : Handle C library specially below.
7133                 ;;
7134         -l*)
7135                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7136                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7137                         :
7138                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7139                         :
7140                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7141                         :
7142                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7143                         :
7144                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7145                         :
7146                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7147                         :
7148                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7149                         :
7150                 else
7151                         try=''
7152                 fi
7153                 libnames="$libnames $try"
7154                 ;;
7155         *) libnames="$libnames $thislib" ;;
7156         esac
7157         done
7158         ;;
7159 esac
7160 xxx=normal
7161 case "$libc" in
7162 unknown)
7163         set /lib/libc.$so
7164         for xxx in $libpth; do
7165                 $test -r $1 || set $xxx/libc.$so
7166                 : The messy sed command sorts on library version numbers.
7167                 $test -r $1 || \
7168                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7169                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7170                                 h
7171                                 s/[0-9][0-9]*/0000&/g
7172                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7173                                 G
7174                                 s/\n/ /' | \
7175                          $sort | $sed -e 's/^.* //'`
7176                 eval set \$$#
7177         done
7178         $test -r $1 || set /usr/ccs/lib/libc.$so
7179         $test -r $1 || set /lib/libsys_s$_a
7180         ;;
7181 *)
7182         set blurfl
7183         ;;
7184 esac
7185 if $test -r "$1"; then
7186         echo "Your (shared) C library seems to be in $1."
7187         libc="$1"
7188 elif $test -r /lib/libc && $test -r /lib/clib; then
7189         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7190         xxx=apollo
7191         libc='/lib/clib /lib/libc'
7192         if $test -r /lib/syslib; then
7193                 echo "(Your math library is in /lib/syslib.)"
7194                 libc="$libc /lib/syslib"
7195         fi
7196 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7197         echo "Your C library seems to be in $libc, as you said before."
7198 elif $test -r $incpath/usr/lib/libc$_a; then
7199         libc=$incpath/usr/lib/libc$_a;
7200         echo "Your C library seems to be in $libc.  That's fine."
7201 elif $test -r /lib/libc$_a; then
7202         libc=/lib/libc$_a;
7203         echo "Your C library seems to be in $libc.  You're normal."
7204 else
7205         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7206                 :
7207         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7208                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7209         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7210                 :
7211         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7212                 :
7213         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7214                 :
7215         else
7216                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7217         fi
7218         if $test -r "$tans"; then
7219                 echo "Your C library seems to be in $tans, of all places."
7220                 libc=$tans
7221         else
7222                 libc='blurfl'
7223         fi
7224 fi
7225 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7226         dflt="$libc"
7227         cat <<EOM
7228
7229 If the guess above is wrong (which it might be if you're using a strange
7230 compiler, or your machine supports multiple models), you can override it here.
7231
7232 EOM
7233 else
7234         dflt=''
7235         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7236         cat >&4 <<EOM
7237 I can't seem to find your C library.  I've looked in the following places:
7238
7239 EOM
7240         $sed 's/^/      /' libpath
7241         cat <<EOM
7242
7243 None of these seems to contain your C library. I need to get its name...
7244
7245 EOM
7246 fi
7247 fn=f
7248 rp='Where is your C library?'
7249 . ./getfile
7250 libc="$ans"
7251
7252 echo " "
7253 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7254 set X `cat libnames`
7255 shift
7256 xxx=files
7257 case $# in 1) xxx=file; esac
7258 echo "Extracting names from the following $xxx for later perusal:" >&4
7259 echo " "
7260 $sed 's/^/      /' libnames >&4
7261 echo " "
7262 $echo $n "This may take a while...$c" >&4
7263
7264 for file in $*; do
7265         case $file in
7266         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7267         *) $nm $nm_opt $file 2>/dev/null;;
7268         esac
7269 done >libc.tmp
7270
7271 $echo $n ".$c"
7272 $grep fprintf libc.tmp > libc.ptf
7273 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7274 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7275 xxx='[ADTSIW]'
7276 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7277         eval $xscan;\
7278         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7279                 eval $xrun
7280 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7281         eval $xscan;\
7282         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7283                 eval $xrun
7284 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7285         eval $xscan;\
7286         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7287                 eval $xrun
7288 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7289         eval $xscan;\
7290         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7291                 eval $xrun
7292 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7293         eval $xscan;\
7294         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7295                 eval $xrun
7296 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7297         eval $xscan;\
7298         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7299                 eval $xrun
7300 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7301                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7302         eval $xscan;\
7303         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7304                 eval $xrun
7305 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7306         eval $xscan;\
7307         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7308                 eval $xrun
7309 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7310         eval $xscan;\
7311         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7312                 eval $xrun
7313 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7314         eval $xscan;\
7315         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7316                 eval $xrun
7317 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7318         eval $xscan;\
7319         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7320                 eval $xrun
7321 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7322         eval $xscan;\
7323         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7324                 eval $xrun
7325 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7326         eval $xscan;\
7327         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7328                 eval $xrun
7329 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7330         eval $xscan;\
7331         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7332                 eval $xrun
7333 else
7334         $nm -p $* 2>/dev/null >libc.tmp
7335         $grep fprintf libc.tmp > libc.ptf
7336         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7337                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7338         then
7339                 nm_opt='-p'
7340                 eval $xrun
7341         else
7342                 echo " "
7343                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7344                 com=''
7345                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7346                         for thisname in $libnames $libc; do
7347                                 $ar t $thisname >>libc.tmp
7348                         done
7349                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7350                         echo "Ok." >&4
7351                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7352                         # Repeat libc to extract forwarders to DLL entries too
7353                         for thisname in $libnames $libc; do
7354                                 $ar tv $thisname >>libc.tmp
7355                                 # Revision 50 of EMX has bug in $ar.
7356                                 # it will not extract forwarders to DLL entries
7357                                 # Use emximp which will extract exactly them.
7358                                 emximp -o tmp.imp $thisname \
7359                                     2>/dev/null && \
7360                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7361                                     < tmp.imp >>libc.tmp
7362                                 $rm tmp.imp
7363                         done
7364                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7365                         echo "Ok." >&4
7366                 else
7367                         echo "$ar didn't seem to work right." >&4
7368                         echo "Maybe this is a Cray...trying bld instead..." >&4
7369                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7370                         then
7371                                 for thisname in $libnames; do
7372                                         bld t $libnames | \
7373                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7374                                         $ar t $thisname >>libc.tmp
7375                                 done
7376                                 echo "Ok." >&4
7377                         else
7378                                 echo "That didn't work either.  Giving up." >&4
7379                                 exit 1
7380                         fi
7381                 fi
7382         fi
7383 fi
7384 nm_extract="$com"
7385 case "$PASE" in
7386 define)
7387     echo " "
7388     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7389     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7390     ;;
7391 *)  if $test -f /lib/syscalls.exp; then
7392         echo " "
7393         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7394         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7395     fi
7396     ;;
7397 esac
7398 ;;
7399 esac
7400 $rm -f libnames libpath
7401
7402 : see if dld is available
7403 set dld.h i_dld
7404 eval $inhdr
7405
7406 : is a C symbol defined?
7407 csym='tlook=$1;
7408 case "$3" in
7409 -v) tf=libc.tmp; tdc="";;
7410 -a) tf=libc.tmp; tdc="[]";;
7411 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7412 esac;
7413 tx=yes;
7414 case "$reuseval-$4" in
7415 true-) ;;
7416 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7417 esac;
7418 case "$tx" in
7419 yes)
7420         tval=false;
7421         if $test "$runnm" = true; then
7422                 if $contains $tlook $tf >/dev/null 2>&1; then
7423                         tval=true;
7424                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7425                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7426                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7427                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7428                         $rm -f try$_exe try.c core core.* try.core;
7429                 fi;
7430         else
7431                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7432                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7433                 $rm -f try$_exe try.c;
7434         fi;
7435         ;;
7436 *)
7437         case "$tval" in
7438         $define) tval=true;;
7439         *) tval=false;;
7440         esac;
7441         ;;
7442 esac;
7443 eval "$2=$tval"'
7444
7445 : define an is-in-libc? function
7446 inlibc='echo " "; td=$define; tu=$undef;
7447 sym=$1; var=$2; eval "was=\$$2";
7448 tx=yes;
7449 case "$reuseval$was" in
7450 true) ;;
7451 true*) tx=no;;
7452 esac;
7453 case "$tx" in
7454 yes)
7455         set $sym tres -f;
7456         eval $csym;
7457         case "$tres" in
7458         true)
7459                 echo "$sym() found." >&4;
7460                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7461         *)
7462                 echo "$sym() NOT found." >&4;
7463                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7464         esac;;
7465 *)
7466         case "$was" in
7467         $define) echo "$sym() found." >&4;;
7468         *) echo "$sym() NOT found." >&4;;
7469         esac;;
7470 esac'
7471
7472 : see if dlopen exists
7473 xxx_runnm="$runnm"
7474 runnm=false
7475 set dlopen d_dlopen
7476 eval $inlibc
7477 runnm="$xxx_runnm"
7478
7479 : determine which dynamic loading, if any, to compile in
7480 echo " "
7481 dldir="ext/DynaLoader"
7482 case "$usedl" in
7483 $define|y|true)
7484         dflt='y'
7485         usedl="$define"
7486         ;;
7487 $undef|n|false)
7488         dflt='n'
7489         usedl="$undef"
7490         ;;
7491 *) 
7492         dflt='n'
7493         case "$d_dlopen" in
7494             $define) dflt='y' ;;
7495         esac
7496         case "$i_dld" in
7497             $define) dflt='y' ;;
7498         esac
7499         : Does a dl_xxx.xs file exist for this operating system
7500         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7501         ;;
7502 esac
7503 rp="Do you wish to use dynamic loading?"
7504 . ./myread
7505 usedl="$ans"
7506 case "$ans" in
7507 y*) usedl="$define"
7508         case "$dlsrc" in
7509         '')
7510                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7511                         dflt="$dldir/dl_${osname}.xs"
7512                 elif $test "$d_dlopen" = "$define" ; then
7513                         dflt="$dldir/dl_dlopen.xs"
7514                 elif $test "$i_dld" = "$define" ; then
7515                         dflt="$dldir/dl_dld.xs"
7516                 else
7517                         dflt=''
7518                 fi
7519                 ;;
7520         *)      dflt="$dldir/$dlsrc"
7521                 ;;
7522         esac
7523     echo "The following dynamic loading files are available:"
7524         : Can not go over to $dldir because getfile has path hard-coded in.
7525         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7526         rp="Source file to use for dynamic loading"
7527         fn="fne"
7528         gfpth="$src"
7529         . ./getfile
7530         usedl="$define"
7531         : emulate basename
7532         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7533
7534         $cat << EOM
7535
7536 Some systems may require passing special flags to $cc -c to
7537 compile modules that will be used to create a shared library.
7538 To use no flags, say "none".
7539
7540 EOM
7541     case "$cccdlflags" in
7542     '') case "$gccversion" in
7543                 '') case "$osname" in
7544                         hpux)   dflt='+z' ;;
7545                         next)   dflt='none' ;;
7546                         irix*)  dflt='-KPIC' ;;
7547                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7548                         sunos)  dflt='-pic' ;;
7549                         *)      dflt='none' ;;
7550                     esac
7551                         ;;
7552                 *)  case "$osname" in
7553                         darwin) dflt='none' ;;
7554                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7555                         *)      dflt='-fpic' ;;
7556                     esac ;;
7557             esac ;;
7558         ' ') dflt='none' ;;
7559     *)  dflt="$cccdlflags" ;;
7560     esac
7561     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7562     . ./myread
7563     case "$ans" in
7564     none) cccdlflags=' ' ;;
7565     *) cccdlflags="$ans" ;;
7566     esac
7567
7568     cat << EOM
7569
7570 Some systems use ld to create libraries that can be dynamically loaded,
7571 while other systems (such as those using ELF) use $cc.
7572
7573 EOM
7574         case "$ld" in
7575         '')     $cat >try.c <<EOM
7576 /* Test for whether ELF binaries are produced */
7577 #include <fcntl.h>
7578 #$i_stdlib I_STDLIB
7579 #ifdef I_STDLIB
7580 #include <stdlib.h>
7581 #endif
7582 int main() {
7583         char b[4];
7584         int i = open("a.out",O_RDONLY);
7585         if(i == -1) 
7586                 exit(1); /* fail */
7587         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7588                 exit(0); /* succeed (yes, it's ELF) */
7589         else
7590                 exit(1); /* fail */
7591 }
7592 EOM
7593                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7594                         cat <<EOM
7595 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7596 EOM
7597                         dflt="$cc"
7598                 else
7599                         echo "I'll use ld to build dynamic libraries."
7600                         dflt='ld'
7601                 fi
7602                 rm -f try.c a.out
7603                 ;;
7604         *)      dflt="$ld"
7605                 ;;
7606         esac
7607
7608     rp="What command should be used to create dynamic libraries?"
7609     . ./myread
7610         ld="$ans"
7611
7612     cat << EOM
7613
7614 Some systems may require passing special flags to $ld to create a
7615 library that can be dynamically loaded.  If your ld flags include
7616 -L/other/path options to locate libraries outside your loader's normal
7617 search path, you may need to specify those -L options here as well.  To
7618 use no flags, say "none".
7619
7620 EOM
7621     case "$lddlflags" in
7622     '') case "$osname" in
7623                         beos) dflt='-nostart' ;;
7624                         hpux) dflt='-b';
7625                               case "$gccversion" in
7626                               '') dflt="$dflt +vnocompatwarnings" ;;
7627                               esac
7628                               ;;        
7629                         linux|irix*)    dflt='-shared' ;;
7630                         next)  dflt='none' ;;
7631                         solaris) dflt='-G' ;;
7632                         sunos) dflt='-assert nodefinitions' ;;
7633                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7634                 *)     dflt='none' ;;
7635                         esac
7636                         ;;
7637     *) dflt="$lddlflags" ;;
7638     esac
7639
7640         : Try to guess additional flags to pick up local libraries.
7641         : Be careful not to append to a plain 'none'
7642         case "$dflt" in
7643         none) dflt='' ;;
7644         esac
7645         for thisflag in $ldflags; do
7646                 case "$thisflag" in
7647                 -L*|-R*|-Wl,-R*)
7648                         case " $dflt " in
7649                         *" $thisflag "*) ;;
7650                         *) dflt="$dflt $thisflag" ;;
7651                         esac
7652                         ;;
7653                 esac
7654         done
7655
7656         case "$dflt" in
7657         ''|' ') dflt='none' ;;
7658         esac
7659
7660     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7661     . ./myread
7662     case "$ans" in
7663     none) lddlflags=' ' ;;
7664     *) lddlflags="$ans" ;;
7665     esac
7666
7667         cat <<EOM
7668
7669 Some systems may require passing special flags to $cc to indicate that
7670 the resulting executable will use dynamic linking.  To use no flags,
7671 say "none".
7672
7673 EOM
7674     case "$ccdlflags" in
7675     '') case "$osname" in
7676             linux|hpux) dflt='-Wl,-E' ;;
7677             next|sunos) dflt='none' ;;
7678             *)          dflt='none' ;;
7679             esac ;;
7680     ' ')  dflt='none' ;;
7681     *)  dflt="$ccdlflags" ;;
7682     esac
7683     rp="Any special flags to pass to $cc to use dynamic linking?"
7684     . ./myread
7685     case "$ans" in
7686     none) ccdlflags=' ' ;;
7687     *) ccdlflags="$ans" ;;
7688     esac
7689     ;;
7690 *)  usedl="$undef"
7691         ld='ld'
7692     dlsrc='dl_none.xs'
7693     lddlflags=''
7694     ccdlflags=''
7695     ;;
7696 esac
7697
7698 also=''
7699 case "$usedl" in
7700 $undef)
7701         # No dynamic loading being used, so don't bother even to prompt.
7702         useshrplib='false'
7703         ;;
7704 *)      case "$useshrplib" in
7705         '')     case "$osname" in
7706                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7707                         dflt=y
7708                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7709                         ;;
7710                 next*)
7711                         case "$osvers" in
7712                         4*)     dflt=y
7713                                 also='Building a shared libperl is needed for MAB support.'
7714                                 ;;
7715                         *)      dflt=n
7716                                 ;;
7717                         esac
7718                         ;;
7719                 *)      dflt=n
7720                         ;;
7721                 esac
7722                 ;;
7723         $define|true|[Yy]*)
7724                 dflt=y
7725                 ;;
7726         *)      dflt=n
7727                 ;;
7728         esac
7729         $cat << EOM
7730
7731 The perl executable is normally obtained by linking perlmain.c with
7732 libperl${_a}, any static extensions (usually just DynaLoader), and
7733 any other libraries needed on this system (such as -lm, etc.).  Since
7734 your system supports dynamic loading, it is probably possible to build
7735 a shared libperl.$so.  If you will have more than one executable linked
7736 to libperl.$so, this will significantly reduce the size of each
7737 executable, but it may have a noticeable affect on performance.  The
7738 default is probably sensible for your system.
7739 $also
7740
7741 EOM
7742         rp="Build a shared libperl.$so (y/n)"
7743         . ./myread
7744         case "$ans" in
7745         true|$define|[Yy]*)
7746                 useshrplib='true'  ;;
7747         *)      useshrplib='false' ;;
7748         esac
7749         ;;
7750 esac
7751
7752 case "$useshrplib" in
7753 true)
7754         case "$libperl" in
7755         '')
7756                 # Figure out a good name for libperl.so.  Since it gets stored in
7757                 # a version-specific architecture-dependent library, the version
7758                 # number isn't really that important, except for making cc/ld happy.
7759                 #
7760                 # A name such as libperl.so.3.1
7761                 majmin="libperl.$so.$patchlevel.$subversion"
7762                 # A name such as libperl.so.301
7763                 majonly=`echo $patchlevel $subversion |
7764                         $awk '{printf "%d%02d", $1, $2}'`
7765                 majonly=libperl.$so.$majonly
7766                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7767                 # rely on figuring it out from the naming of libc.
7768                 case "${osname}${osvers}" in
7769                 next4*)
7770                         dflt=libperl.5.$so
7771                         # XXX How handle the --version stuff for MAB?
7772                         ;;
7773                 linux*)  # ld won't link with a bare -lperl otherwise.
7774                         dflt=libperl.$so
7775                         ;;
7776                 cygwin*) # ld links against an importlib
7777                         dflt=libperl$lib_ext
7778                         ;;
7779                 *)      # Try to guess based on whether libc has major.minor.
7780                         case "$libc" in
7781                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7782                         *libc.$so.[0-9]*) dflt=$majonly ;;
7783                         *)      dflt=libperl.$so ;;
7784                         esac
7785                         ;;
7786                 esac
7787                 ;;
7788         *)      dflt=$libperl
7789                 ;;
7790         esac
7791         cat << EOM
7792
7793 I need to select a good name for the shared libperl.  If your system uses
7794 library names with major and minor numbers, then you might want something
7795 like $majmin.  Alternatively, if your system uses a single version
7796 number for shared libraries, then you might want to use $majonly.
7797 Or, your system might be quite happy with a simple libperl.$so.
7798
7799 Since the shared libperl will get installed into a version-specific
7800 architecture-dependent directory, the version number of the shared perl
7801 library probably isn't important, so the default should be o.k.
7802
7803 EOM
7804         rp='What name do you want to give to the shared libperl?'
7805         . ./myread
7806         libperl=$ans
7807         echo "Ok, I'll use $libperl"
7808         ;;
7809 *)
7810         libperl="libperl${_a}"
7811         ;;
7812 esac
7813
7814 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7815 case "$shrpdir" in
7816 '') ;;
7817 *)      $cat >&4 <<EOM
7818 WARNING:  Use of the shrpdir variable for the installation location of
7819 the shared $libperl is not supported.  It was never documented and
7820 will not work in this version.  Let me (perlbug@perl.org)
7821 know of any problems this may cause.
7822
7823 EOM
7824         case "$shrpdir" in
7825         "$archlibexp/CORE")
7826                 $cat >&4 <<EOM
7827 But your current setting of $shrpdir is
7828 the default anyway, so it's harmless.
7829 EOM
7830                 ;;
7831         *)
7832                 $cat >&4 <<EOM
7833 Further, your current attempted setting of $shrpdir
7834 conflicts with the value of $archlibexp/CORE
7835 that installperl will use.
7836 EOM
7837                 ;;
7838         esac
7839         ;;
7840 esac
7841
7842 # How will the perl executable find the installed shared $libperl?
7843 # Add $xxx to ccdlflags.
7844 # If we can't figure out a command-line option, use $shrpenv to
7845 # set env LD_RUN_PATH.  The main perl makefile uses this.
7846 shrpdir=$archlibexp/CORE
7847 xxx=''
7848 tmp_shrpenv=''
7849 if "$useshrplib"; then
7850     case "$osname" in 
7851         aix)
7852                 # We'll set it in Makefile.SH...
7853                 ;;
7854         solaris)
7855                 xxx="-R $shrpdir"
7856                 ;;
7857         freebsd|netbsd|openbsd)
7858                 xxx="-Wl,-R$shrpdir"
7859                 ;;
7860         bsdos|linux|irix*|dec_osf)
7861                 xxx="-Wl,-rpath,$shrpdir"
7862                 ;;
7863         next)
7864                 # next doesn't like the default...
7865                 ;;
7866         beos)
7867                 # beos doesn't like the default, either.
7868                 ;;
7869         hpux*)
7870                 # hpux doesn't like the default, either.
7871                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7872                 ;;
7873         *)
7874                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7875                 ;;
7876         esac
7877         case "$xxx" in
7878         '') ;;
7879         *)      
7880                 # Only add $xxx if it isn't already in ccdlflags.
7881                 case " $ccdlflags " in
7882                 *" $xxx "*)     ;;
7883                 *)      ccdlflags="$ccdlflags $xxx"
7884                         cat <<EOM >&4
7885
7886 Adding $xxx to the flags
7887 passed to $ld so that the perl executable will find the 
7888 installed shared $libperl.
7889
7890 EOM
7891                         ;;
7892                 esac
7893                 ;;
7894         esac
7895 fi
7896 # Fix ccdlflags in AIX for building external extensions.
7897 # (For building Perl itself bare -bE:perl.exp is needed,
7898 #  Makefile.SH takes care of this.)
7899 case "$osname" in
7900 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7901 esac
7902 # Respect a hint or command-line value.
7903 case "$shrpenv" in
7904 '') shrpenv="$tmp_shrpenv" ;;
7905 esac
7906 case "$ldlibpthname" in
7907 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7908 none)   ldlibpthname='' ;;
7909 esac
7910
7911 : determine where manual pages are on this system
7912 echo " "
7913 case "$sysman" in
7914 '') 
7915         syspath='/usr/share/man/man1 /usr/man/man1'
7916         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7917         syspath="$syspath /usr/man/u_man/man1"
7918         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7919         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7920         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7921         sysman=`./loc . /usr/man/man1 $syspath`
7922         ;;
7923 esac
7924 if $test -d "$sysman"; then
7925         echo "System manual is in $sysman." >&4
7926 else
7927         echo "Could not find manual pages in source form." >&4
7928 fi
7929
7930 : determine where manual pages go
7931 set man1dir man1dir none
7932 eval $prefixit
7933 $cat <<EOM
7934
7935 $spackage has manual pages available in source form.
7936 EOM
7937 case "$nroff" in
7938 nroff)
7939         echo "However, you don't have nroff, so they're probably useless to you."
7940         case "$man1dir" in
7941         '') man1dir="none";;
7942         esac;;
7943 esac
7944 echo "If you don't want the manual sources installed, answer 'none'."
7945 case "$man1dir" in
7946 ' ') dflt=none
7947         ;;
7948 '')
7949         lookpath="$prefixexp/share/man/man1"
7950         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7951         lookpath="$lookpath $prefixexp/man/p_man/man1"
7952         lookpath="$lookpath $prefixexp/man/u_man/man1"
7953         lookpath="$lookpath $prefixexp/man/man.1"
7954         case "$sysman" in
7955         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7956         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7957         esac
7958         set dflt
7959         eval $prefixup
7960         ;;
7961 *)  dflt="$man1dir"
7962         ;;
7963 esac
7964 echo " "
7965 fn=dn+~
7966 rp="Where do the main $spackage manual pages (source) go?"
7967 . ./getfile
7968 if $test "X$man1direxp" != "X$ansexp"; then
7969         installman1dir=''
7970 fi
7971 man1dir="$ans"
7972 man1direxp="$ansexp"
7973 case "$man1dir" in
7974 '')     man1dir=' '
7975         installman1dir='';;
7976 esac
7977
7978 : Change installation prefix, if necessary.
7979 if $test X"$prefix" != X"$installprefix"; then
7980         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7981 else
7982         installman1dir="$man1direxp"
7983 fi
7984
7985 : What suffix to use on installed man pages
7986
7987 case "$man1dir" in
7988 ' ')
7989         man1ext='0'
7990         ;;
7991 *)
7992         rp="What suffix should be used for the main $spackage man pages?"
7993         case "$man1ext" in
7994         '')     case "$man1dir" in
7995                 *1)  dflt=1 ;;
7996                 *1p) dflt=1p ;;
7997                 *1pm) dflt=1pm ;;
7998                 *l) dflt=l;;
7999                 *n) dflt=n;;
8000                 *o) dflt=o;;
8001                 *p) dflt=p;;
8002                 *C) dflt=C;;
8003                 *L) dflt=L;;
8004                 *L1) dflt=L1;;
8005                 *) dflt=1;;
8006                 esac
8007                 ;;
8008         *)      dflt="$man1ext";;
8009         esac
8010         . ./myread
8011         man1ext="$ans"
8012         ;;
8013 esac
8014
8015 : see if we can have long filenames
8016 echo " "
8017 first=123456789abcdef
8018 $rm -f $first
8019 if (echo hi >$first) 2>/dev/null; then
8020         if $test -f 123456789abcde; then
8021                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8022                 val="$undef"
8023         else
8024                 echo 'You can have filenames longer than 14 characters.'>&4
8025                 val="$define"
8026         fi
8027 else
8028         $cat <<'EOM'
8029 You can't have filenames longer than 14 chars.
8030 You can't even think about them!
8031 EOM
8032         val="$undef"
8033 fi 
8034 set d_flexfnam
8035 eval $setvar
8036 $rm -rf 123456789abcde*
8037
8038 : determine where library module manual pages go
8039 set man3dir man3dir none
8040 eval $prefixit
8041 $cat <<EOM
8042
8043 $spackage has manual pages for many of the library modules.
8044 EOM
8045
8046 case "$nroff" in
8047 nroff)
8048         $cat <<'EOM'
8049 However, you don't have nroff, so they're probably useless to you.
8050 EOM
8051         case "$man3dir" in
8052         '') man3dir="none";;
8053         esac;;
8054 esac
8055
8056 case "$d_flexfnam" in
8057 undef)
8058         $cat <<'EOM'
8059 However, your system can't handle the long file names like File::Basename.3. 
8060 EOM
8061         case "$man3dir" in
8062         '') man3dir="none";;
8063         esac;;
8064 esac
8065
8066 echo "If you don't want the manual sources installed, answer 'none'."
8067 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8068 case "$man3dir" in
8069 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8070         if $test -d "$privlib/man/man3"; then
8071                 cat <<EOM >&4
8072
8073 WARNING:  Previous versions of perl installed man3 pages into
8074 $privlib/man/man3.  This version will suggest a 
8075 new default of $dflt.  
8076 EOM
8077                 tdflt=$dflt
8078                 dflt='n'
8079                 rp='Do you wish to preserve the old behavior?(y/n)'
8080                 . ./myread
8081                 case "$ans" in
8082                 y*) dflt="$privlib/man/man3" ;;
8083                 *)  dflt=$tdflt ;;
8084                 esac
8085     fi
8086         ;;
8087 *)      dflt="$man3dir" ;;
8088 esac
8089 case "$dflt" in
8090 ' ') dflt=none ;;
8091 esac
8092 echo " "
8093 fn=dn+~
8094 rp="Where do the $package library man pages (source) go?"
8095 . ./getfile
8096 man3dir="$ans"
8097 man3direxp="$ansexp"
8098 case "$man3dir" in
8099 '')     man3dir=' '
8100         installman3dir='';;
8101 esac
8102
8103 : Change installation prefix, if necessary.
8104 if $test X"$prefix" != X"$installprefix"; then
8105         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8106 else
8107         installman3dir="$man3direxp"
8108 fi
8109
8110 : What suffix to use on installed man pages
8111 case "$man3dir" in
8112 ' ')
8113         man3ext='0'
8114         ;;
8115 *)
8116         rp="What suffix should be used for the $package library man pages?"
8117         case "$man3ext" in
8118         '')     case "$man3dir" in
8119                 *3)  dflt=3 ;;
8120                 *3p) dflt=3p ;;
8121                 *3pm) dflt=3pm ;;
8122                 *l) dflt=l;;
8123                 *n) dflt=n;;
8124                 *o) dflt=o;;
8125                 *p) dflt=p;;
8126                 *C) dflt=C;;
8127                 *L) dflt=L;;
8128                 *L3) dflt=L3;;
8129                 *) dflt=3;;
8130                 esac
8131                 ;;
8132         *)      dflt="$man3ext";;
8133         esac
8134         . ./myread
8135         man3ext="$ans"
8136         ;;
8137 esac
8138
8139 : see if we have to deal with yellow pages, now NIS.
8140 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8141         if $test -f /usr/etc/nibindd; then
8142                 echo " "
8143                 echo "I'm fairly confident you're on a NeXT."
8144                 echo " "
8145                 rp='Do you get the hosts file via NetInfo?'
8146                 dflt=y
8147                 case "$hostcat" in
8148                 nidump*) ;;
8149                 '') ;;
8150                 *) dflt=n;;
8151                 esac
8152                 . ./myread
8153                 case "$ans" in
8154                 y*) hostcat='nidump hosts .';;
8155                 *)      case "$hostcat" in
8156                         nidump*) hostcat='';;
8157                         esac
8158                         ;;
8159                 esac
8160         fi
8161         case "$hostcat" in
8162         nidump*) ;;
8163         *)
8164                 case "$hostcat" in
8165                 *ypcat*) dflt=y;;
8166                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8167                                 dflt=y
8168                         else
8169                                 dflt=n
8170                         fi;;
8171                 *) dflt=n;;
8172                 esac
8173                 echo " "
8174                 rp='Are you getting the hosts file via yellow pages?'
8175                 . ./myread
8176                 case "$ans" in
8177                 y*) hostcat='ypcat hosts';;
8178                 *) hostcat='cat /etc/hosts';;
8179                 esac
8180                 ;;
8181         esac
8182 fi
8183 case "$hostcat" in
8184 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8185 esac
8186 case "$groupcat" in
8187 '') test -f /etc/group && groupcat='cat /etc/group';;
8188 esac
8189 case "$passcat" in
8190 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8191 esac
8192
8193 : now get the host name
8194 echo " "
8195 echo "Figuring out host name..." >&4
8196 case "$myhostname" in
8197 '') cont=true
8198         echo 'Maybe "hostname" will work...'
8199         if tans=`sh -c hostname 2>&1` ; then
8200                 myhostname=$tans
8201                 phostname=hostname
8202                 cont=''
8203         fi
8204         ;;
8205 *) cont='';;
8206 esac
8207 if $test "$cont"; then
8208         if ./xenix; then
8209                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8210                 if tans=`cat /etc/systemid 2>&1` ; then
8211                         myhostname=$tans
8212                         phostname='cat /etc/systemid'
8213                         echo "Whadyaknow.  Xenix always was a bit strange..."
8214                         cont=''
8215                 fi
8216         elif $test -r /etc/systemid; then
8217                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8218         fi
8219 fi
8220 if $test "$cont"; then
8221         echo 'No, maybe "uuname -l" will work...'
8222         if tans=`sh -c 'uuname -l' 2>&1` ; then
8223                 myhostname=$tans
8224                 phostname='uuname -l'
8225         else
8226                 echo 'Strange.  Maybe "uname -n" will work...'
8227                 if tans=`sh -c 'uname -n' 2>&1` ; then
8228                         myhostname=$tans
8229                         phostname='uname -n'
8230                 else
8231                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8232                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8233                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8234                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8235                         else
8236                                 case "$myhostname" in
8237                                 '') echo "Does this machine have an identity crisis or something?"
8238                                         phostname='';;
8239                                 *)
8240                                         echo "Well, you said $myhostname before..."
8241                                         phostname='echo $myhostname';;
8242                                 esac
8243                         fi
8244                 fi
8245         fi
8246 fi
8247 case "$myhostname" in
8248 '') myhostname=noname ;;
8249 esac
8250 : you do not want to know about this
8251 set $myhostname
8252 myhostname=$1
8253
8254 : verify guess
8255 if $test "$myhostname" ; then
8256         dflt=y
8257         rp='Your host name appears to be "'$myhostname'".'" Right?"
8258         . ./myread
8259         case "$ans" in
8260         y*) ;;
8261         *) myhostname='';;
8262         esac
8263 fi
8264
8265 : bad guess or no guess
8266 while $test "X$myhostname" = X ; do
8267         dflt=''
8268         rp="Please type the (one word) name of your host:"
8269         . ./myread
8270         myhostname="$ans"
8271 done
8272
8273 : translate upper to lower if necessary
8274 case "$myhostname" in
8275 *[A-Z]*)
8276         echo "(Normalizing case in your host name)"
8277         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8278         ;;
8279 esac
8280
8281 case "$myhostname" in
8282 *.*)
8283         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8284         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8285         echo "(Trimming domain name from host name--host name is now $myhostname)"
8286         ;;
8287 *) case "$mydomain" in
8288         '')
8289                 {
8290                         test "X$hostcat" = "Xypcat hosts" &&
8291                         ypmatch "$myhostname" hosts 2>/dev/null |\
8292                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8293                         $test -s hosts
8294                 } || {
8295                         test "X$hostcat" != "X" &&
8296                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8297                                         /[       ]$myhostname[  . ]/p" > hosts
8298                 }
8299                 tmp_re="[       . ]"
8300                 if $test -f hosts; then
8301                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8302                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8303                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8304                                 hosts | $sort | $uniq | \
8305                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8306                         case `$echo X$dflt` in
8307                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8308                                 dflt=.
8309                                 ;;
8310                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8311                                 ;;
8312                         esac
8313                 else
8314                         echo "(I cannot locate a hosts database anywhere)"
8315                         dflt=.
8316                 fi
8317                 case "$dflt" in
8318                 .)
8319                         tans=`./loc resolv.conf X /etc /usr/etc`
8320                         if $test -f "$tans"; then
8321                                 echo "(Attempting domain name extraction from $tans)"
8322                                 dflt=.`$sed -n -e 's/   / /g' \
8323                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8324                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8325                                 case "$dflt" in
8326                                 .) dflt=.`$sed -n -e 's/        / /g' \
8327                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8328                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8329                                         ;;
8330                                 esac
8331                         fi
8332                         ;;
8333                 esac
8334                 case "$dflt" in
8335                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8336                         dflt=.`sh -c domainname 2>/dev/null`
8337                         case "$dflt" in
8338                         '') dflt='.';;
8339                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8340                         esac
8341                         ;;
8342                 esac
8343                 case "$dflt$osname" in
8344                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8345                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8346                         ;;
8347                 esac
8348                 case "$dflt" in
8349                 .) echo "(Lost all hope -- silly guess then)"
8350                         dflt='.nonet'
8351                         ;;
8352                 esac
8353                 $rm -f hosts
8354                 ;;
8355         *) dflt="$mydomain";;
8356         esac;;
8357 esac
8358 echo " "
8359 rp="What is your domain name?"
8360 . ./myread
8361 tans="$ans"
8362 case "$ans" in
8363 '') ;;
8364 .*) ;;
8365 *) tans=".$tans";;
8366 esac
8367 mydomain="$tans"
8368
8369 : translate upper to lower if necessary
8370 case "$mydomain" in
8371 *[A-Z]*)
8372         echo "(Normalizing case in your domain name)"
8373         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8374         ;;
8375 esac
8376
8377 : a little sanity check here
8378 case "$phostname" in
8379 '') ;;
8380 *)
8381         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8382         $myhostname$mydomain|$myhostname) ;;
8383         *)
8384                 case "$phostname" in
8385                 sed*)
8386                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8387                         ;;
8388                 *)
8389                         echo "(That doesn't agree with your $phostname command, by the way.)"
8390                         ;;
8391                 esac
8392         ;;
8393         esac
8394         ;;
8395 esac
8396
8397 $cat <<EOM
8398
8399 I need to get your e-mail address in Internet format if possible, i.e.
8400 something like user@host.domain. Please answer accurately since I have
8401 no easy means to double check it. The default value provided below
8402 is most probably close to reality but may not be valid from outside
8403 your organization...
8404
8405 EOM
8406 cont=x
8407 while test "$cont"; do
8408         case "$cf_email" in
8409         '') dflt="$cf_by@$myhostname$mydomain";;
8410         *) dflt="$cf_email";;
8411         esac
8412         rp='What is your e-mail address?'
8413         . ./myread
8414         cf_email="$ans"
8415         case "$cf_email" in
8416         *@*.*) cont='' ;;
8417         *)
8418                 rp='Address does not look like an Internet one.  Use it anyway?'
8419                 case "$fastread" in
8420                 yes) dflt=y ;;
8421                 *) dflt=n ;;
8422                 esac
8423                 . ./myread
8424                 case "$ans" in
8425                 y*) cont='' ;;
8426                 *) echo " " ;;
8427                 esac
8428                 ;;
8429         esac
8430 done
8431
8432 $cat <<EOM
8433
8434 If you or somebody else will be maintaining perl at your site, please
8435 fill in the correct e-mail address here so that they may be contacted
8436 if necessary. Currently, the "perlbug" program included with perl
8437 will send mail to this address in addition to perlbug@perl.org. You may
8438 enter "none" for no administrator.
8439
8440 EOM
8441 case "$perladmin" in
8442 '') dflt="$cf_email";;
8443 *) dflt="$perladmin";;
8444 esac
8445 rp='Perl administrator e-mail address'
8446 . ./myread
8447 perladmin="$ans"
8448
8449 : determine whether to only install version-specific parts.
8450 echo " "
8451 $cat <<EOM
8452 Do you want to install only the version-specific parts of the perl
8453 distribution?  Usually you do *not* want to do this.
8454 EOM
8455 case "$versiononly" in
8456 "$define"|[Yy]*|true) dflt='y' ;;
8457 *) dflt='n';
8458 esac
8459 rp="Do you want to install only the version-specific parts of perl?"
8460 . ./myread
8461 case "$ans" in
8462 [yY]*)  val="$define";;
8463 *)      val="$undef" ;;
8464 esac
8465 set versiononly
8466 eval $setvar
8467
8468 case "$versiononly" in
8469 "$define") inc_version_list=''
8470            inc_version_list_init=0
8471            ;;
8472 esac
8473
8474 : figure out how to guarantee perl startup
8475 case "$startperl" in
8476 '')
8477         case "$sharpbang" in
8478         *!)
8479                 $cat <<EOH
8480
8481 I can use the #! construct to start perl on your system. This will
8482 make startup of perl scripts faster, but may cause problems if you
8483 want to share those scripts and perl is not in a standard place
8484 ($binexp/perl) on all your platforms. The alternative is to force
8485 a shell by starting the script with a single ':' character.
8486
8487 EOH
8488                 case "$versiononly" in
8489                 "$define")      dflt="$binexp/perl$version";;  
8490                 *)              dflt="$binexp/perl";;
8491                 esac
8492                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8493                 . ./myread
8494                 case "$ans" in
8495                 none)   startperl=": # use perl";;
8496                 *)      startperl="#!$ans"
8497                         if $test 30 -lt `echo "$ans" | wc -c`; then
8498                                 $cat >&4 <<EOM
8499
8500 WARNING:  Some systems limit the #! command to 32 characters.
8501 If you experience difficulty running Perl scripts with #!, try
8502 installing Perl in a directory with a shorter pathname.
8503
8504 EOM
8505                         fi ;;
8506                 esac
8507                 ;;
8508         *) startperl=": # use perl"
8509                 ;;
8510         esac
8511         ;;
8512 esac
8513 echo "I'll use $startperl to start perl scripts."
8514
8515 : figure best path for perl in scripts
8516 case "$perlpath" in
8517 '')
8518         case "$versiononly" in
8519         "$define")      perlpath="$binexp/perl$version";;
8520         *)              perlpath="$binexp/perl";;
8521         esac
8522         case "$startperl" in
8523         *!*) ;;
8524         *)
8525                 $cat <<EOH
8526
8527 I will use the "eval 'exec'" idiom to start Perl on your system.
8528 I can use the full path of your Perl binary for this purpose, but
8529 doing so may cause problems if you want to share those scripts and
8530 Perl is not always in a standard place ($binexp/perl).
8531
8532 EOH
8533                 dflt="$binexp/perl"
8534                 rp="What path shall I use in \"eval 'exec'\"?"
8535                 . ./myread
8536                 perlpath="$ans"
8537                 ;;
8538         esac
8539         ;;
8540 esac
8541 case "$startperl" in
8542 *!*)    ;;
8543 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8544 esac
8545
8546 : determine where public executable scripts go
8547 set scriptdir scriptdir
8548 eval $prefixit
8549 case "$scriptdir" in
8550 '')
8551         dflt="$bin"
8552         : guess some guesses
8553         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8554         $test -d /usr/share/bin     && dflt=/usr/share/bin
8555         $test -d /usr/local/script  && dflt=/usr/local/script
8556         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8557         $test -d $prefixexp/script  && dflt=$prefixexp/script
8558         set dflt
8559         eval $prefixup
8560         ;;
8561 *)  dflt="$scriptdir"
8562         ;;
8563 esac
8564 $cat <<EOM
8565  
8566 Some installations have a separate directory just for executable scripts so
8567 that they can mount it across multiple architectures but keep the scripts in
8568 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8569 Or you might just lump your scripts in with all your other executables.
8570  
8571 EOM
8572 fn=d~
8573 rp='Where do you keep publicly executable scripts?'
8574 . ./getfile
8575 if $test "X$ansexp" != "X$scriptdirexp"; then
8576         installscript=''
8577 fi
8578 scriptdir="$ans"
8579 scriptdirexp="$ansexp"
8580 : Change installation prefix, if necessary.
8581 if $test X"$prefix" != X"$installprefix"; then
8582         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8583 else
8584         installscript="$scriptdirexp"
8585 fi
8586
8587 : determine where add-on public executables go
8588 case "$sitebin" in
8589 '')     dflt=$siteprefix/bin ;;
8590 *)      dflt=$sitebin ;;
8591 esac
8592 fn=d~
8593 rp='Pathname where the add-on public executables should be installed?'
8594 . ./getfile
8595 sitebin="$ans"
8596 sitebinexp="$ansexp"
8597 : Change installation prefix, if necessary.
8598 if $test X"$prefix" != X"$installprefix"; then
8599         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8600 else
8601         installsitebin="$sitebinexp"
8602 fi
8603
8604 : determine where add-on html pages go
8605 : There is no standard location, so try to copy the previously-selected
8606 : directory structure for the core html pages.
8607 case "$sitehtml1dir" in
8608 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8609 *)     dflt=$sitehtml1dir ;;
8610 esac
8611 case "$dflt" in
8612 ''|' ') dflt=none ;;
8613 esac
8614 fn=dn+~
8615 rp='Pathname where the site-specific html pages should be installed?'
8616 . ./getfile
8617 sitehtml1dir="$ans"
8618 sitehtml1direxp="$ansexp"
8619 : Change installation prefix, if necessary.
8620 if $test X"$prefix" != X"$installprefix"; then
8621         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8622 else
8623         installsitehtml1dir="$sitehtml1direxp"
8624 fi
8625
8626 : determine where add-on library html pages go
8627 : There is no standard location, so try to copy the previously-selected
8628 : directory structure for the core html pages.
8629 case "$sitehtml3dir" in
8630 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8631 *)     dflt=$sitehtml3dir ;;
8632 esac
8633 case "$dflt" in
8634 ''|' ') dflt=none ;;
8635 esac
8636 fn=dn+~
8637 rp='Pathname where the site-specific library html pages should be installed?'
8638 . ./getfile
8639 sitehtml3dir="$ans"
8640 sitehtml3direxp="$ansexp"
8641 : Change installation prefix, if necessary.
8642 if $test X"$prefix" != X"$installprefix"; then
8643         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8644 else
8645         installsitehtml3dir="$sitehtml3direxp"
8646 fi
8647
8648 : determine where add-on manual pages go
8649 case "$siteman1dir" in
8650 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8651 *)      dflt=$siteman1dir ;;
8652 esac
8653 case "$dflt" in
8654 ''|' ') dflt=none ;;
8655 esac
8656 fn=dn+~
8657 rp='Pathname where the site-specific manual pages should be installed?'
8658 . ./getfile
8659 siteman1dir="$ans"
8660 siteman1direxp="$ansexp"
8661 : Change installation prefix, if necessary.
8662 if $test X"$prefix" != X"$installprefix"; then
8663         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8664 else
8665         installsiteman1dir="$siteman1direxp"
8666 fi
8667
8668 : determine where add-on library man pages go
8669 case "$siteman3dir" in
8670 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8671 *)      dflt=$siteman3dir ;;
8672 esac
8673 case "$dflt" in
8674 ''|' ') dflt=none ;;
8675 esac
8676 fn=dn+~
8677 rp='Pathname where the site-specific library manual pages should be installed?'
8678 . ./getfile
8679 siteman3dir="$ans"
8680 siteman3direxp="$ansexp"
8681 : Change installation prefix, if necessary.
8682 if $test X"$prefix" != X"$installprefix"; then
8683         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8684 else
8685         installsiteman3dir="$siteman3direxp"
8686 fi
8687
8688 : determine where add-on public executable scripts go
8689 case "$sitescript" in
8690 '')     dflt=$siteprefix/script
8691         $test -d $dflt || dflt=$sitebin ;;
8692 *)  dflt="$sitescript" ;;
8693 esac
8694 fn=d~+
8695 rp='Pathname where add-on public executable scripts should be installed?'
8696 . ./getfile
8697 sitescript="$ans"
8698 sitescriptexp="$ansexp"
8699 : Change installation prefix, if necessary.
8700 if $test X"$prefix" != X"$installprefix"; then
8701         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8702 else
8703         installsitescript="$sitescriptexp"
8704 fi
8705
8706 case "$usefaststdio" in
8707 $define|true|[yY]*|'')
8708         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8709         case "$xversion" in
8710         [68])   dflt='y' ;;
8711         *)      dflt='n' ;;
8712         esac
8713         ;;
8714 *) dflt='n';;
8715 esac
8716 cat <<EOM
8717
8718 Perl can be built to use 'fast stdio', which means using the stdio
8719 library but also directly manipulating the stdio buffers to enable
8720 faster I/O.  Using stdio is better for backward compatibility (especially
8721 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8722 interface has been preferred instead of stdio.
8723
8724 If this doesn't make any sense to you, just accept the default '$dflt'.
8725 EOM
8726 rp='Use the "fast stdio" if available?'
8727 . ./myread
8728 case "$ans" in
8729 y|Y)    val="$define" ;;     
8730 *)      val="$undef" ;;
8731 esac
8732 set usefaststdio
8733 eval $setvar
8734
8735
8736 : define an is-a-typedef? function
8737 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8738 case "$inclist" in
8739 "") inclist="sys/types.h";;
8740 esac;
8741 eval "varval=\$$var";
8742 case "$varval" in
8743 "")
8744         $rm -f temp.c;
8745         for inc in $inclist; do
8746                 echo "#include <$inc>" >>temp.c;
8747         done;
8748         echo "#ifdef $type" >> temp.c;
8749         echo "printf(\"We have $type\");" >> temp.c;
8750         echo "#endif" >> temp.c;
8751         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8752         if $contains $type temp.E >/dev/null 2>&1; then
8753                 eval "$var=\$type";
8754         else
8755                 eval "$var=\$def";
8756         fi;
8757         $rm -f temp.?;;
8758 *) eval "$var=\$varval";;
8759 esac'
8760
8761 : define an is-a-typedef? function that prompts if the type is not available.
8762 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8763 case "$inclist" in
8764 "") inclist="sys/types.h";;
8765 esac;
8766 eval "varval=\$$var";
8767 case "$varval" in
8768 "")
8769         $rm -f temp.c;
8770         for inc in $inclist; do
8771                 echo "#include <$inc>" >>temp.c;
8772         done;
8773         echo "#ifdef $type" >> temp.c;
8774         echo "printf(\"We have $type\");" >> temp.c;
8775         echo "#endif" >> temp.c;
8776         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8777         echo " " ;
8778         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8779         if $contains $type temp.E >/dev/null 2>&1; then
8780                 echo "$type found." >&4;
8781                 eval "$var=\$type";
8782         else
8783                 echo "$type NOT found." >&4;
8784                 dflt="$def";
8785                 . ./myread ;
8786                 eval "$var=\$ans";
8787         fi;
8788         $rm -f temp.?;;
8789 *) eval "$var=\$varval";;
8790 esac'
8791
8792 : see what type lseek is declared as in the kernel
8793 rp="What is the type used for lseek's offset on this system?"
8794 set off_t lseektype long stdio.h sys/types.h
8795 eval $typedef_ask
8796
8797 echo " "
8798 echo "Checking to see how big your file offsets are..." >&4
8799 $cat >try.c <<EOCP
8800 #include <sys/types.h>
8801 #include <stdio.h>
8802 int main()
8803 {
8804     printf("%d\n", (int)sizeof($lseektype));
8805     return(0); 
8806 }
8807 EOCP
8808 set try
8809 if eval $compile_ok; then
8810         lseeksize=`$run ./try`
8811         echo "Your file offsets are $lseeksize bytes long."
8812 else
8813         dflt=$longsize
8814         echo " "
8815         echo "(I can't seem to compile the test program.  Guessing...)"
8816         rp="What is the size of your file offsets (in bytes)?"
8817         . ./myread
8818         lseeksize="$ans"
8819 fi
8820 $rm -f try.c try
8821
8822 : see what type file positions are declared as in the library
8823 rp="What is the type for file position used by fsetpos()?"
8824 set fpos_t fpostype long stdio.h sys/types.h
8825 eval $typedef_ask
8826
8827 echo " "
8828 case "$fpostype" in
8829 *_t) zzz="$fpostype"    ;;
8830 *)   zzz="fpos_t"       ;;
8831 esac
8832 echo "Checking the size of $zzz..." >&4 
8833 cat > try.c <<EOCP
8834 #include <sys/types.h>
8835 #include <stdio.h>
8836 #$i_stdlib I_STDLIB
8837 #ifdef I_STDLIB
8838 #include <stdlib.h>
8839 #endif
8840 int main() {
8841     printf("%d\n", (int)sizeof($fpostype));
8842     exit(0);
8843 }
8844 EOCP
8845 set try
8846 if eval $compile_ok; then
8847         yyy=`$run ./try`
8848         case "$yyy" in
8849         '')     fpossize=4
8850                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8851                 ;;
8852         *)      fpossize=$yyy
8853                 echo "Your $zzz is $fpossize bytes long."
8854                 ;;
8855         esac
8856 else
8857         dflt="$longsize"
8858         echo " " >&4
8859         echo "(I can't compile the test program.  Guessing...)" >&4
8860         rp="What is the size of your file positions (in bytes)?"
8861         . ./myread
8862         fpossize="$ans"
8863 fi
8864
8865 # Backward compatibility (uselfs is deprecated).
8866 case "$uselfs" in
8867 "$define"|true|[yY]*)
8868         cat <<EOM >&4
8869
8870 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8871 EOM
8872         uselargefiles="$define"
8873         ;;
8874 esac                          
8875
8876 case "$lseeksize:$fpossize" in
8877 8:8) cat <<EOM
8878
8879 You can have files larger than 2 gigabytes.
8880 EOM
8881    val="$define" ;;
8882 *)    case "$uselargefiles" in
8883    "$undef"|false|[nN]*) dflt='n' ;;
8884    *)   dflt='y' ;;
8885    esac
8886    cat <<EOM
8887
8888 Perl can be built to understand large files (files larger than 2 gigabytes)
8889 on some systems.  To do so, Configure can be run with -Duselargefiles.
8890
8891 If this doesn't make any sense to you, just accept the default '$dflt'.
8892 EOM
8893    rp='Try to understand large files, if available?'
8894    . ./myread
8895    case "$ans" in
8896    y|Y)         val="$define" ;;
8897    *)           val="$undef"  ;;
8898    esac
8899    ;;
8900 esac
8901 set uselargefiles
8902 eval $setvar
8903 : Look for a hint-file generated 'call-back-unit'.  If the
8904 : user has specified that a large files perl is to be built,
8905 : we may need to set or change some other defaults.
8906 if $test -f uselargefiles.cbu; then
8907         echo "Your platform has some specific hints regarding large file builds, using them..."
8908         . ./uselargefiles.cbu
8909 fi
8910 case "$uselargefiles" in
8911 "$define")
8912         if $test -f uselargefiles.cbu; then
8913                 echo " "
8914                 echo "Rechecking to see how big your file offsets are..." >&4
8915                 $cat >try.c <<EOCP
8916 #include <sys/types.h>
8917 #include <stdio.h>
8918 int main()
8919 {
8920     printf("%d\n", (int)sizeof($lseektype));
8921     return(0); 
8922 }
8923 EOCP
8924                 set try
8925                 if eval $compile_ok; then
8926                         lseeksize=`$run ./try`
8927                         $echo "Your file offsets are now $lseeksize bytes long."
8928                 else
8929                         dflt="$lseeksize"
8930                         echo " "
8931                         echo "(I can't seem to compile the test program.  Guessing...)"
8932                         rp="What is the size of your file offsets (in bytes)?"
8933                         . ./myread
8934                         lseeksize="$ans"
8935                 fi
8936                 case "$fpostype" in
8937                 *_t) zzz="$fpostype"    ;;
8938                 *)   zzz="fpos_t"       ;;
8939                 esac
8940                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8941                 $cat > try.c <<EOCP
8942 #include <sys/types.h>
8943 #include <stdio.h>
8944 #$i_stdlib I_STDLIB
8945 #ifdef I_STDLIB
8946 #include <stdlib.h>
8947 #endif
8948 int main() {
8949     printf("%d\n", (int)sizeof($fpostype));
8950     return(0);
8951 }
8952 EOCP
8953                 set try
8954                 if eval $compile_ok; then
8955                         yyy=`$run ./try`
8956                         dflt="$lseeksize"
8957                         case "$yyy" in
8958                         '')     echo " "
8959                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8960                                 ;;
8961                         *)      fpossize=$yyy
8962                                 echo " $fpossize bytes." >&4
8963                                 ;;
8964                         esac
8965                 else
8966                         dflt="$fpossize"
8967                         echo " "
8968                         echo "(I can't compile the test program.  Guessing...)" >&4
8969                         rp="What is the size of your file positions (in bytes)?"
8970                         . ./myread
8971                         fpossize="$ans"
8972                 fi
8973                 $rm -f try.c try
8974         fi
8975         ;;
8976 esac
8977
8978 case "$vendorprefix" in
8979 '')     d_vendorbin="$undef"
8980         vendorbin=''
8981         vendorbinexp=''
8982         ;;
8983 *)      d_vendorbin="$define"
8984         : determine where vendor-supplied executables go.
8985         case "$vendorbin" in
8986         '') dflt=$vendorprefix/bin ;;
8987         *)      dflt="$vendorbin" ;;
8988         esac
8989         fn=d~+
8990         rp='Pathname for the vendor-supplied executables directory?'
8991         . ./getfile
8992         vendorbin="$ans"
8993         vendorbinexp="$ansexp"
8994         ;;
8995 esac
8996 : Change installation prefix, if necessary.
8997 if $test X"$prefix" != X"$installprefix"; then
8998         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8999 else
9000         installvendorbin="$vendorbinexp"
9001 fi
9002
9003 case "$vendorprefix" in
9004 '')     vendorhtml1dir=''
9005         vendorhtml1direxp=''
9006         ;;
9007 *)      : determine where vendor-supplied html pages go.
9008         : There is no standard location, so try to copy the previously-selected
9009         : directory structure for the core html pages.
9010         : XXX Better default suggestions would be welcome.
9011         case "$vendorhtml1dir" in
9012         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9013         *)      dflt=$vendorhtml1dir ;;
9014         esac
9015         case "$dflt" in
9016         ''|' ') dflt=none ;;
9017         esac
9018         fn=dn+~
9019         rp='Pathname for the vendor-supplied html pages?'
9020         . ./getfile
9021         vendorhtml1dir="$ans"
9022         vendorhtml1direxp="$ansexp"
9023         ;;
9024 esac
9025 : Use ' ' for none so value is preserved next time through Configure
9026 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9027 : Change installation prefix, if necessary.
9028 if $test X"$prefix" != X"$installprefix"; then
9029         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9030 else
9031         installvendorhtml1dir="$vendorhtml1direxp"
9032 fi
9033
9034 case "$vendorprefix" in
9035 '')     vendorhtml3dir=''
9036         vendorhtml3direxp=''
9037         ;;
9038 *)      : determine where vendor-supplied module html pages go.
9039         : There is no standard location, so try to copy the previously-selected
9040         : directory structure for the core html pages.
9041         : XXX Better default suggestions would be welcome.
9042         case "$vendorhtml3dir" in
9043         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9044         *)      dflt=$vendorhtml3dir ;;
9045         esac
9046         case "$dflt" in
9047         ''|' ') dflt=none ;;
9048         esac
9049         fn=dn+~
9050         rp='Pathname for the vendor-supplied html pages?'
9051         . ./getfile
9052         vendorhtml3dir="$ans"
9053         vendorhtml3direxp="$ansexp"
9054         ;;
9055 esac
9056 : Use ' ' for none so value is preserved next time through Configure
9057 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9058 : Change installation prefix, if necessary.
9059 if $test X"$prefix" != X"$installprefix"; then
9060         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9061 else
9062         installvendorhtml3dir="$vendorhtml3direxp"
9063 fi
9064
9065 case "$vendorprefix" in
9066 '')     vendorman1dir=''
9067         vendorman1direxp=''
9068         ;;
9069 *)      : determine where vendor-supplied manual pages go.
9070         case "$vendorman1dir" in
9071         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9072         *)      dflt=$vendorman1dir ;;
9073         esac
9074         case "$dflt" in
9075         ''|' ') dflt=none ;;
9076         esac
9077         fn=nd~+
9078         rp='Pathname for the vendor-supplied manual section 1 pages?'
9079         . ./getfile
9080         vendorman1dir="$ans"
9081         vendorman1direxp="$ansexp"
9082         ;;
9083 esac
9084 : Use ' ' for none so value is preserved next time through Configure
9085 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9086 : Change installation prefix, if necessary.
9087 if $test X"$prefix" != X"$installprefix"; then
9088         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9089 else
9090         installvendorman1dir="$vendorman1direxp"
9091 fi
9092
9093 case "$vendorprefix" in
9094 '')     vendorman3dir=''
9095         vendorman3direxp=''
9096         ;;
9097 *)      : determine where vendor-supplied module manual pages go.
9098         case "$vendorman3dir" in
9099         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9100         *)      dflt=$vendorman3dir ;;
9101         esac
9102         case "$dflt" in
9103         ''|' ') dflt=none ;;
9104         esac
9105         fn=nd~+
9106         rp='Pathname for the vendor-supplied manual section 3 pages?'
9107         . ./getfile
9108         vendorman3dir="$ans"
9109         vendorman3direxp="$ansexp"
9110         ;;
9111 esac
9112 : Use ' ' for none so value is preserved next time through Configure
9113 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9114 : Change installation prefix, if necessary.
9115 if $test X"$prefix" != X"$installprefix"; then
9116         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9117 else
9118         installvendorman3dir="$vendorman3direxp"
9119 fi
9120
9121 case "$vendorprefix" in
9122 '')     d_vendorscript="$undef"
9123         vendorscript=''
9124         vendorscriptexp=''
9125         ;;
9126 *)      d_vendorscript="$define"
9127         : determine where vendor-supplied scripts go.
9128         case "$vendorscript" in
9129         '')     dflt=$vendorprefix/script
9130                 $test -d $dflt || dflt=$vendorbin ;;
9131         *)  dflt="$vendorscript" ;;
9132         esac
9133         $cat <<EOM
9134
9135 The installation process will create a directory for 
9136 vendor-supplied scripts.
9137
9138 EOM
9139         fn=d~+
9140         rp='Pathname for the vendor-supplied scripts directory?'
9141         . ./getfile
9142         vendorscript="$ans"
9143         vendorscriptexp="$ansexp"
9144         ;;
9145 esac
9146 : Change installation prefix, if necessary.
9147 if $test X"$prefix" != X"$installprefix"; then
9148         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9149 else
9150         installvendorscript="$vendorscriptexp"
9151 fi
9152
9153 : see if qgcvt exists
9154 set qgcvt d_qgcvt
9155 eval $inlibc
9156
9157 echo " "
9158
9159 if $test X"$d_longdbl" = X"$define"; then
9160
9161 echo "Checking how to print long doubles..." >&4
9162
9163 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9164         $cat >try.c <<'EOCP'
9165 #include <sys/types.h>
9166 #include <stdio.h>
9167 int main() {
9168   double d = 123.456;
9169   printf("%.3f\n", d);
9170 }
9171 EOCP
9172         set try
9173         if eval $compile; then
9174                 yyy=`$run ./try`
9175                 case "$yyy" in
9176                 123.456)
9177                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9178                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9179                         echo "We will use %f."
9180                         ;;
9181                 esac
9182         fi
9183 fi
9184
9185 if $test X"$sPRIfldbl" = X; then
9186         $cat >try.c <<'EOCP'
9187 #include <sys/types.h>
9188 #include <stdio.h>
9189 int main() {
9190   long double d = 123.456;
9191   printf("%.3Lf\n", d);
9192 }
9193 EOCP
9194         set try
9195         if eval $compile; then
9196                 yyy=`$run ./try`
9197                 case "$yyy" in
9198                 123.456)
9199                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9200                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9201                         echo "We will use %Lf."
9202                         ;;
9203                 esac
9204         fi
9205 fi
9206
9207 if $test X"$sPRIfldbl" = X; then
9208         $cat >try.c <<'EOCP'
9209 #include <sys/types.h>
9210 #include <stdio.h>
9211 int main() {
9212   long double d = 123.456;
9213   printf("%.3llf\n", d);
9214 }
9215 EOCP
9216         set try
9217         if eval $compile; then
9218                 yyy=`$run ./try`
9219                 case "$yyy" in
9220                 123.456)
9221                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9222                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9223                         echo "We will use %llf."
9224                         ;;
9225                 esac
9226         fi
9227 fi
9228
9229 if $test X"$sPRIfldbl" = X; then
9230         $cat >try.c <<'EOCP'
9231 #include <sys/types.h>
9232 #include <stdio.h>
9233 int main() {
9234   long double d = 123.456;
9235   printf("%.3lf\n", d);
9236 }
9237 EOCP
9238         set try
9239         if eval $compile; then
9240                 yyy=`$run ./try`
9241                 case "$yyy" in
9242                 123.456)
9243                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9244                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9245                         echo "We will use %lf."
9246                         ;;
9247                 esac
9248         fi
9249 fi
9250
9251 if $test X"$sPRIfldbl" = X; then
9252         echo "Cannot figure out how to print long doubles." >&4
9253 else
9254         sSCNfldbl=$sPRIfldbl    # expect consistency
9255 fi
9256
9257 $rm -f try try.*
9258
9259 fi # d_longdbl
9260
9261 case "$sPRIfldbl" in
9262 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9263         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9264         d_SCNfldbl="$undef";
9265         ;;
9266 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9267         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9268         d_SCNfldbl="$define";
9269         ;;
9270 esac
9271
9272 : Check how to convert floats to strings.
9273
9274 if test "X$d_Gconvert" = X; then
9275
9276 echo " "
9277 echo "Checking for an efficient way to convert floats to strings."
9278 echo " " > try.c
9279 case "$uselongdouble" in
9280 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9281 esac
9282 case "$d_longdbl" in
9283 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9284 esac
9285 case "$d_PRIgldbl" in
9286 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9287 esac
9288 $cat >>try.c <<EOP
9289 #ifdef TRY_gconvert
9290 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9291 char *myname = "gconvert";
9292 #endif
9293 #ifdef TRY_gcvt
9294 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9295 char *myname = "gcvt";
9296 #endif
9297 #ifdef TRY_qgcvt
9298 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9299 char *myname = "qgcvt";
9300 #define DOUBLETYPE long double
9301 #endif
9302 #ifdef TRY_sprintf
9303 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9304 #ifdef HAS_PRIgldbl
9305 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9306 #else
9307 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9308 #endif
9309 #else
9310 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9311 #endif
9312 char *myname = "sprintf";
9313 #endif
9314
9315 #ifndef DOUBLETYPE
9316 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9317 #define DOUBLETYPE long double
9318 #else
9319 #define DOUBLETYPE double
9320 #endif
9321 #endif
9322
9323 #include <stdio.h>
9324
9325 #define I_STDLIB $i_stdlib
9326 #ifdef I_STDLIB
9327 #include <stdlib.h>
9328 #endif
9329
9330 int
9331 checkit(expect, got)
9332 char *expect;
9333 char *got;
9334 {
9335     if (strcmp(expect, got)) {
9336                 printf("%s oddity:  Expected %s, got %s\n",
9337                         myname, expect, got);
9338                 exit(1);
9339         }
9340 }
9341
9342 int main()
9343
9344         char buf[64]; 
9345         buf[63] = '\0';
9346
9347         /* This must be 1st test on (which?) platform */
9348         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9349         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9350         checkit("0.1", buf);
9351
9352         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9353         checkit("0.01", buf);
9354
9355         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9356         checkit("0.001", buf);
9357
9358         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9359         checkit("0.0001", buf);
9360
9361         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9362         if (strlen(buf) > 5)
9363             checkit("9e-005", buf); /* for Microsoft ?? */
9364         else
9365             checkit("9e-05", buf);
9366
9367         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9368         checkit("1", buf);
9369
9370         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9371         checkit("1.1", buf);
9372
9373         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9374         checkit("1.01", buf);
9375
9376         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9377         checkit("1.001", buf);
9378
9379         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9380         checkit("1.0001", buf);
9381
9382         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9383         checkit("1.00001", buf);
9384
9385         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9386         checkit("1.000001", buf);
9387
9388         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9389         checkit("0", buf);
9390
9391         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9392         checkit("-1", buf);
9393
9394         /* Some Linux gcvt's give 1.e+5 here. */
9395         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9396         checkit("100000", buf);
9397         
9398         /* Some Linux gcvt's give -1.e+5 here. */
9399         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9400         checkit("-100000", buf);
9401
9402         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9403         checkit("123.456", buf);
9404
9405         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9406         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9407         /* 34 should be enough to scare even long double
9408          * places into using the e notation. */
9409         if (strlen(buf) > 5)
9410             checkit("1e+034", buf); /* for Microsoft */
9411         else
9412             checkit("1e+34", buf);
9413
9414         /* For Perl, if you add additional tests here, also add them to
9415          * t/base/num.t for benefit of platforms not using Configure or
9416          * overriding d_Gconvert */
9417
9418         exit(0);
9419 }
9420 EOP
9421 : first add preferred functions to our list
9422 xxx_list=""
9423 for xxx_convert in $gconvert_preference; do
9424     case $xxx_convert in
9425     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9426     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9427     esac 
9428 done
9429 : then add any others
9430 for xxx_convert in gconvert gcvt sprintf; do
9431     case "$xxx_list" in
9432     *$xxx_convert*) ;;
9433     *) xxx_list="$xxx_list $xxx_convert" ;;
9434     esac 
9435 done
9436
9437 case "$d_longdbl$uselongdouble" in
9438 "$define$define")
9439     : again, add prefered functions to our list first
9440     xxx_ld_list=""
9441     for xxx_convert in $gconvert_ld_preference; do
9442         case $xxx_convert in
9443         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9444         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9445         esac
9446     done
9447     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9448     for xxx_convert in qgcvt sprintf $xxx_list; do
9449         case "$xxx_ld_list" in
9450         $xxx_convert*|*" $xxx_convert"*) ;;
9451         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9452         esac
9453     done
9454     : if sprintf cannot do long doubles, move it to the end
9455     if test "$d_PRIgldbl" != "$define"; then
9456         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9457     fi
9458     : if no qgcvt, remove it
9459     if test "$d_qgcvt" != "$define"; then
9460         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9461     fi
9462     : use the ld_list
9463     xxx_list="$xxx_ld_list"
9464     ;;
9465 esac
9466
9467 for xxx_convert in $xxx_list; do
9468         echo "Trying $xxx_convert..."
9469         $rm -f try try$_o
9470         set try -DTRY_$xxx_convert
9471         if eval $compile; then
9472                 echo "$xxx_convert() found." >&4
9473                 if $run ./try; then
9474                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9475                         break;
9476                 else
9477                         echo "...But $xxx_convert didn't work as I expected."
9478                         xxx_convert=''
9479                 fi
9480         else
9481                 echo "$xxx_convert NOT found." >&4
9482         fi
9483 done
9484
9485 if test X$xxx_convert = X; then
9486     echo "*** WHOA THERE!!! ***" >&4
9487     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9488     xxx_convert=sprintf
9489 fi
9490
9491 case "$xxx_convert" in
9492 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9493 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9494 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9495 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9496    "$define$define$define")
9497       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9498    "$define$define$undef")
9499       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9500    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9501    esac
9502    ;;  
9503 esac
9504
9505 fi
9506
9507 : see if _fwalk exists
9508 set fwalk d__fwalk
9509 eval $inlibc
9510
9511 : Initialize h_fcntl
9512 h_fcntl=false
9513
9514 : Initialize h_sysfile
9515 h_sysfile=false
9516
9517 : access call always available on UNIX
9518 set access d_access
9519 eval $inlibc
9520
9521 : locate the flags for 'access()'
9522 case "$d_access" in
9523 "$define")
9524         echo " "
9525         $cat >access.c <<EOCP
9526 #include <sys/types.h>
9527 #ifdef I_FCNTL
9528 #include <fcntl.h>
9529 #endif
9530 #ifdef I_SYS_FILE
9531 #include <sys/file.h>
9532 #endif
9533 #ifdef I_UNISTD
9534 #include <unistd.h>
9535 #endif
9536 #$i_stdlib I_STDLIB
9537 #ifdef I_STDLIB
9538 #include <stdlib.h>
9539 #endif
9540 int main() {
9541         exit(R_OK);
9542 }
9543 EOCP
9544         : check sys/file.h first, no particular reason here
9545         if $test `./findhdr sys/file.h` && \
9546                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9547                 h_sysfile=true;
9548                 echo "<sys/file.h> defines the *_OK access constants." >&4
9549         elif $test `./findhdr fcntl.h` && \
9550                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9551                 h_fcntl=true;
9552                 echo "<fcntl.h> defines the *_OK access constants." >&4
9553         elif $test `./findhdr unistd.h` && \
9554                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9555                 echo "<unistd.h> defines the *_OK access constants." >&4
9556         else
9557                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9558         fi
9559         ;;
9560 esac
9561 $rm -f access*
9562
9563 : see if accessx exists
9564 set accessx d_accessx
9565 eval $inlibc
9566
9567 : see if aintl exists
9568 set aintl d_aintl
9569 eval $inlibc
9570
9571 : see if alarm exists
9572 set alarm d_alarm
9573 eval $inlibc
9574
9575 : see if POSIX threads are available
9576 set pthread.h i_pthread
9577 eval $inhdr
9578
9579 : define a fucntion to check prototypes
9580 $cat > protochk <<EOSH
9581 $startsh
9582 cc="$cc"
9583 optimize="$optimize"
9584 ccflags="$ccflags"
9585 prototype="$prototype"
9586 define="$define"
9587 rm=$rm
9588 usethreads=$usethreads
9589 i_pthread=$i_pthread
9590 pthread_h_first=$pthread_h_first
9591 EOSH
9592
9593 $cat >> protochk <<'EOSH'
9594
9595 $rm -f try.c
9596 foo="$1"
9597 shift
9598 while test $# -ge 2; do
9599         case "$1" in
9600                 $define) echo "#include <$2>" >> try.c ;;
9601                 literal) echo "$2" >> try.c ;;
9602         esac
9603     # Extra magic for the benefit of systems that need pthread.h
9604     # to be included early to correctly detect threadsafe functions.
9605     # Such functions must guarantee themselves, though, that the usethreads
9606     # and i_pthread have been defined, before calling protochk.
9607     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9608         echo "#include <pthread.h>" >> try.c
9609         pthread_h_done=yes
9610     fi
9611     shift 2
9612 done
9613 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9614 cat >> try.c <<'EOCP'
9615 #ifdef CAN_PROTOTYPE
9616 #define _(args) args
9617 #else
9618 #define _(args) ()
9619 #endif
9620 EOCP
9621 echo "$foo" >> try.c
9622 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9623 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9624 status=$?
9625 $rm -f try.[co]
9626 exit $status
9627 EOSH
9628 chmod +x protochk
9629 $eunicefix protochk
9630
9631 hasproto='varname=$1; func=$2; shift; shift;
9632 while $test $# -ge 2; do
9633         case "$1" in
9634         $define) echo "#include <$2>";;
9635         esac ;
9636     shift 2;
9637 done > try.c;
9638 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9639 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9640         echo "$func() prototype found.";
9641         val="$define";
9642 else
9643         echo "$func() prototype NOT found.";
9644         val="$undef";
9645 fi;
9646 set $varname;
9647 eval $setvar;
9648 $rm -f try.c tryout.c'
9649
9650 : see if sys/types.h has to be included
9651 set sys/types.h i_systypes
9652 eval $inhdr
9653
9654 : see if sys/select.h has to be included
9655 set sys/select.h i_sysselct
9656 eval $inhdr
9657
9658 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9659 while $test $# -ge 2; do
9660         case "$1" in
9661         $define) echo "#include <$2>";;
9662         esac ;
9663     shift 2;
9664 done > try.c;
9665 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9666 set try;
9667 if eval $compile; then
9668         val="$define";
9669 else
9670         val="$undef";
9671 fi;
9672 set $varname;
9673 eval $setvar;
9674 $rm -f try.c try.o'
9675
9676 : see if we should include time.h, sys/time.h, or both
9677 echo " "
9678 if test "X$timeincl" = X; then
9679         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9680         $echo $n "I'm now running the test program...$c"
9681         $cat >try.c <<EOCP
9682 #include <sys/types.h>
9683 #ifdef I_TIME
9684 #include <time.h>
9685 #endif
9686 #ifdef I_SYSTIME
9687 #ifdef SYSTIMEKERNEL
9688 #define KERNEL
9689 #endif
9690 #include <sys/time.h>
9691 #endif
9692 #ifdef I_SYSSELECT
9693 #include <sys/select.h>
9694 #endif
9695 #$i_stdlib I_STDLIB
9696 #ifdef I_STDLIB
9697 #include <stdlib.h>
9698 #endif
9699 int main()
9700 {
9701         struct tm foo;
9702 #ifdef S_TIMEVAL
9703         struct timeval bar;
9704 #endif
9705 #ifdef S_TIMEZONE
9706         struct timezone tzp;
9707 #endif
9708         if (foo.tm_sec == foo.tm_sec)
9709                 exit(0);
9710 #ifdef S_TIMEVAL
9711         if (bar.tv_sec == bar.tv_sec)
9712                 exit(0);
9713 #endif
9714         exit(1);
9715 }
9716 EOCP
9717         flags=''
9718         for s_timezone in '-DS_TIMEZONE' ''; do
9719         sysselect=''
9720         for s_timeval in '-DS_TIMEVAL' ''; do
9721         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9722         for i_time in '' '-DI_TIME'; do
9723         for i_systime in '-DI_SYSTIME' ''; do
9724                 case "$flags" in
9725                 '') $echo $n ".$c"
9726                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9727                         if eval $compile; then
9728                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9729                                 shift
9730                                 flags="$*"
9731                                 echo " "
9732                                 $echo $n "Succeeded with $flags$c"
9733                         fi
9734                         ;;
9735                 esac
9736         done
9737         done
9738         done
9739         done
9740         done
9741         timeincl=''
9742         echo " "
9743         case "$flags" in
9744         *SYSTIMEKERNEL*) i_systimek="$define"
9745                 timeincl=`./findhdr sys/time.h`
9746                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9747         *) i_systimek="$undef";;
9748         esac
9749         case "$flags" in
9750         *I_TIME*) i_time="$define"
9751                 timeincl=`./findhdr time.h`" $timeincl"
9752                 echo "We'll include <time.h>." >&4;;
9753         *) i_time="$undef";;
9754         esac
9755         case "$flags" in
9756         *I_SYSTIME*) i_systime="$define"
9757                 timeincl=`./findhdr sys/time.h`" $timeincl"
9758                 echo "We'll include <sys/time.h>." >&4;;
9759         *) i_systime="$undef";;
9760         esac
9761         $rm -f try.c try
9762 fi
9763 : see if struct tm knows about tm_zone
9764 case "$i_systime$i_time" in
9765 *$define*) 
9766         echo " "
9767         echo "Checking to see if your struct tm has tm_zone field..." >&4
9768         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9769         eval $hasfield
9770         ;;
9771 *)      val="$undef"
9772         set d_tm_tm_zone
9773         eval $setvar
9774         ;;
9775 esac
9776 case "$d_tm_tm_zone" in
9777 "$define")      echo "Yes, it does."   ;;
9778 *)              echo "No, it doesn't." ;;
9779 esac
9780 : see if struct tm knows about tm_gmtoff
9781 case "$i_systime$i_time" in
9782 *$define*) 
9783         echo " "
9784         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9785         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9786         eval $hasfield
9787         ;;
9788 *)      val="$undef"
9789         set d_tm_tm_gmtoff
9790         eval $setvar
9791         ;;
9792 esac
9793 case "$d_tm_tm_gmtoff" in
9794 "$define")      echo "Yes, it does."   ;;
9795 *)              echo "No, it doesn't." ;;
9796 esac
9797
9798 : see if asctime_r exists
9799 set asctime_r d_asctime_r
9800 eval $inlibc
9801 case "$d_asctime_r" in
9802 "$define")
9803         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9804         case "$d_asctime_r_proto:$usethreads" in
9805         ":define")      d_asctime_r_proto=define
9806                 set d_asctime_r_proto asctime_r $hdrs
9807                 eval $hasproto ;;
9808         *)      ;;
9809         esac
9810         case "$d_asctime_r_proto" in
9811         define)
9812         case "$asctime_r_proto" in
9813         ''|0) try='char* asctime_r(const struct tm*, char*);'
9814         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9815         esac
9816         case "$asctime_r_proto" in
9817         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9818         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9819         esac
9820         case "$asctime_r_proto" in
9821         ''|0) try='int asctime_r(const struct tm*, char*);'
9822         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9823         esac
9824         case "$asctime_r_proto" in
9825         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9826         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9827         esac
9828         case "$asctime_r_proto" in
9829         ''|0)   d_asctime_r=undef
9830                 asctime_r_proto=0
9831                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9832         * )     case "$asctime_r_proto" in
9833                 REENTRANT_PROTO*) ;;
9834                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9835                 esac
9836                 echo "Prototype: $try" ;;
9837         esac
9838         ;;
9839         *)      case "$usethreads" in
9840                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9841                 esac
9842                 d_asctime_r=undef
9843                 asctime_r_proto=0
9844                 ;;
9845         esac
9846         ;;
9847 *)      asctime_r_proto=0
9848         ;;
9849 esac
9850
9851 : see if atolf exists
9852 set atolf d_atolf
9853 eval $inlibc
9854
9855 : see if atoll exists
9856 set atoll d_atoll
9857 eval $inlibc
9858
9859 : Look for GNU-cc style attribute checking
9860 echo " "
9861 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9862 $cat >attrib.c <<'EOCP'
9863 #include <stdio.h>
9864 void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
9865 EOCP
9866 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9867         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9868                 echo "Your C compiler doesn't fully support __attribute__."
9869                 val="$undef"
9870         else
9871                 echo "Your C compiler supports __attribute__."
9872                 val="$define"
9873         fi
9874 else
9875         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9876         val="$undef"
9877 fi
9878 set d_attribut
9879 eval $setvar
9880 $rm -f attrib*
9881
9882 : see if bcmp exists
9883 set bcmp d_bcmp
9884 eval $inlibc
9885
9886 : see if bcopy exists
9887 set bcopy d_bcopy
9888 eval $inlibc
9889
9890 : see if this is a unistd.h system
9891 set unistd.h i_unistd
9892 eval $inhdr
9893
9894 : see if getpgrp exists
9895 set getpgrp d_getpgrp
9896 eval $inlibc
9897
9898 case "$d_getpgrp" in
9899 "$define")
9900         echo " "
9901         echo "Checking to see which flavor of getpgrp is in use..."
9902         $cat >try.c <<EOP
9903 #$i_unistd I_UNISTD
9904 #include <sys/types.h>
9905 #ifdef I_UNISTD
9906 #  include <unistd.h>
9907 #endif
9908 #$i_stdlib I_STDLIB
9909 #ifdef I_STDLIB
9910 #include <stdlib.h>
9911 #endif
9912 int main()
9913 {
9914         if (getuid() == 0) {
9915                 printf("(I see you are running Configure as super-user...)\n");
9916                 setuid(1);
9917         }
9918 #ifdef TRY_BSD_PGRP
9919         if (getpgrp(1) == 0)
9920                 exit(0);
9921 #else
9922         if (getpgrp() > 0)
9923                 exit(0);
9924 #endif
9925         exit(1);
9926 }
9927 EOP
9928         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9929                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9930                 val="$define"
9931         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9932                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9933                 val="$undef"
9934         else
9935                 echo "I can't seem to compile and run the test program."
9936                 if ./usg; then
9937                         xxx="a USG one, i.e. you use getpgrp()."
9938                 else
9939                         # SVR4 systems can appear rather BSD-ish.
9940                         case "$i_unistd" in
9941                         $undef)
9942                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9943                                 val="$define"
9944                                 ;;
9945                         $define)
9946                                 xxx="probably a USG one, i.e. you use getpgrp()."
9947                                 val="$undef"
9948                                 ;;
9949                         esac
9950                 fi
9951                 echo "Assuming your getpgrp is $xxx" >&4
9952         fi
9953         ;;
9954 *) val="$undef";;
9955 esac
9956 set d_bsdgetpgrp
9957 eval $setvar
9958 $rm -f try try.*
9959
9960 : see if setpgrp exists
9961 set setpgrp d_setpgrp
9962 eval $inlibc
9963
9964 case "$d_setpgrp" in
9965 "$define")
9966         echo " "
9967         echo "Checking to see which flavor of setpgrp is in use..."
9968         $cat >try.c <<EOP
9969 #$i_unistd I_UNISTD
9970 #include <sys/types.h>
9971 #ifdef I_UNISTD
9972 #  include <unistd.h>
9973 #endif
9974 #$i_stdlib I_STDLIB
9975 #ifdef I_STDLIB
9976 #include <stdlib.h>
9977 #endif
9978 int main()
9979 {
9980         if (getuid() == 0) {
9981                 printf("(I see you are running Configure as super-user...)\n");
9982                 setuid(1);
9983         }
9984 #ifdef TRY_BSD_PGRP
9985         if (-1 == setpgrp(1, 1))
9986                 exit(0);
9987 #else
9988         if (setpgrp() != -1)
9989                 exit(0);
9990 #endif
9991         exit(1);
9992 }
9993 EOP
9994         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9995                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9996                 val="$define"
9997         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9998                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9999                 val="$undef"
10000         else
10001                 echo "(I can't seem to compile and run the test program.)"
10002                 if ./usg; then
10003                         xxx="a USG one, i.e. you use setpgrp()."
10004                 else
10005                         # SVR4 systems can appear rather BSD-ish.
10006                         case "$i_unistd" in
10007                         $undef)
10008                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10009                                 val="$define"
10010                                 ;;
10011                         $define)
10012                                 xxx="probably a USG one, i.e. you use setpgrp()."
10013                                 val="$undef"
10014                                 ;;
10015                         esac
10016                 fi
10017                 echo "Assuming your setpgrp is $xxx" >&4
10018         fi
10019         ;;
10020 *) val="$undef";;
10021 esac
10022 set d_bsdsetpgrp
10023 eval $setvar
10024 $rm -f try try.*
10025 : see if bzero exists
10026 set bzero d_bzero
10027 eval $inlibc
10028
10029 : see if signal is declared as pointer to function returning int or void
10030 echo " "
10031 xxx=`./findhdr signal.h`
10032 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10033 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10034         echo "You have int (*signal())() instead of void." >&4
10035         val="$undef"
10036 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10037         echo "You have void (*signal())()." >&4
10038         val="$define"
10039 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10040         echo "You have int (*signal())() instead of void." >&4
10041         val="$undef"
10042 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10043         echo "You have void (*signal())()." >&4
10044         val="$define"
10045 else
10046         case "$d_voidsig" in
10047         '')
10048         echo "I can't determine whether signal handler returns void or int..." >&4
10049                 dflt=void
10050                 rp="What type does your signal handler return?"
10051                 . ./myread
10052                 case "$ans" in
10053                 v*) val="$define";;
10054                 *) val="$undef";;
10055                 esac;;
10056         "$define")
10057                 echo "As you already told me, signal handler returns void." >&4
10058                 val="$define"
10059                 ;;
10060         *)      echo "As you already told me, signal handler returns int." >&4
10061                 val="$undef"
10062                 ;;
10063         esac
10064 fi
10065 set d_voidsig
10066 eval $setvar
10067 case "$d_voidsig" in
10068 "$define") signal_t="void";;
10069 *) signal_t="int";;
10070 esac
10071 $rm -f $$.tmp
10072
10073 : check for ability to cast large floats to 32-bit ints.
10074 echo " "
10075 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10076 if $test "$intsize" -ge 4; then
10077         xxx=int
10078 else
10079         xxx=long
10080 fi
10081 $cat >try.c <<EOCP
10082 #include <stdio.h>
10083 #$i_stdlib I_STDLIB
10084 #ifdef I_STDLIB
10085 #include <stdlib.h>
10086 #endif
10087 #include <sys/types.h>
10088 #include <signal.h>
10089 $signal_t blech(s) int s; { exit(3); }
10090 int main()
10091 {
10092         $xxx i32;
10093         double f, g;
10094         int result = 0;
10095         char str[16];
10096         signal(SIGFPE, blech);
10097
10098         /* Don't let compiler optimize the test away.  Store the number 
10099            in a writable string for gcc to pass to sscanf under HP/UX.
10100         */
10101         sprintf(str, "2147483647");
10102         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10103         g = 10 * f;
10104         i32  = ($xxx) g;
10105
10106         /* x86 processors will probably give 0x8000 0000, which is a
10107            sign change.  We don't want that.  We want to mimic SPARC
10108            behavior here, which is to preserve the sign and give
10109            back 0x7fff ffff.
10110         */
10111         if (i32 != ($xxx) f)
10112                 result |= 1;
10113         exit(result);
10114 }
10115 EOCP
10116 set try
10117 if eval $compile_ok; then
10118         $run ./try
10119         yyy=$?
10120 else
10121         echo "(I can't seem to compile the test program--assuming it can't)"
10122         yyy=1
10123 fi
10124 case "$yyy" in
10125 0)      val="$define"
10126         echo "Yup, it can."
10127         ;;
10128 *)      val="$undef"
10129         echo "Nope, it can't."
10130         ;;
10131 esac
10132 set d_casti32
10133 eval $setvar
10134 $rm -f try try.*
10135
10136 : check for ability to cast negative floats to unsigned
10137 echo " "
10138 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10139 $cat >try.c <<EOCP
10140 #include <stdio.h>
10141 #$i_stdlib I_STDLIB
10142 #ifdef I_STDLIB
10143 #include <stdlib.h>
10144 #endif
10145 #include <sys/types.h>
10146 #include <signal.h>
10147 $signal_t blech(s) int s; { exit(7); }
10148 $signal_t blech_in_list(s) int s; { exit(4); }
10149 unsigned long dummy_long(p) unsigned long p; { return p; }
10150 unsigned int dummy_int(p) unsigned int p; { return p; }
10151 unsigned short dummy_short(p) unsigned short p; { return p; }
10152 int main()
10153 {
10154         double f;
10155         unsigned long along;
10156         unsigned int aint;
10157         unsigned short ashort;
10158         int result = 0;
10159         char str[16];
10160         
10161         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10162            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10163            optimized the whole file away
10164         */
10165         /* Store the number in a writable string for gcc to pass to 
10166            sscanf under HP/UX.
10167         */
10168         sprintf(str, "-123");
10169         sscanf(str, "%lf", &f);  /* f = -123.; */
10170
10171         signal(SIGFPE, blech);
10172         along = (unsigned long)f;
10173         aint = (unsigned int)f;
10174         ashort = (unsigned short)f;
10175         if (along != (unsigned long)-123)
10176                 result |= 1;
10177         if (aint != (unsigned int)-123)
10178                 result |= 1;
10179         if (ashort != (unsigned short)-123)
10180                 result |= 1;
10181         sprintf(str, "1073741824.");
10182         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10183         f = f + f;
10184         along = 0;
10185         along = (unsigned long)f;
10186         if (along != 0x80000000)
10187                 result |= 2;
10188         f -= 1.;
10189         along = 0;
10190         along = (unsigned long)f;
10191         if (along != 0x7fffffff)
10192                 result |= 1;
10193         f += 2.;
10194         along = 0;
10195         along = (unsigned long)f;
10196         if (along != 0x80000001)
10197                 result |= 2;
10198         if (result)
10199                 exit(result);
10200         signal(SIGFPE, blech_in_list);
10201         sprintf(str, "123.");
10202         sscanf(str, "%lf", &f);  /* f = 123.; */
10203         along = dummy_long((unsigned long)f);
10204         aint = dummy_int((unsigned int)f);
10205         ashort = dummy_short((unsigned short)f);
10206         if (along != (unsigned long)123)
10207                 result |= 4;
10208         if (aint != (unsigned int)123)
10209                 result |= 4;
10210         if (ashort != (unsigned short)123)
10211                 result |= 4;
10212         exit(result);
10213
10214 }
10215 EOCP
10216 set try
10217 if eval $compile_ok; then
10218         $run ./try
10219         castflags=$?
10220 else
10221         echo "(I can't seem to compile the test program--assuming it can't)"
10222         castflags=7
10223 fi
10224 case "$castflags" in
10225 0)      val="$define"
10226         echo "Yup, it can."
10227         ;;
10228 *)      val="$undef"
10229         echo "Nope, it can't."
10230         ;;
10231 esac
10232 set d_castneg
10233 eval $setvar
10234 $rm -f try.*
10235
10236 : see if vprintf exists
10237 echo " "
10238 if set vprintf val -f d_vprintf; eval $csym; $val; then
10239         echo 'vprintf() found.' >&4
10240         val="$define"
10241         $cat >try.c <<EOF
10242 #include <varargs.h>
10243 #$i_stdlib I_STDLIB
10244 #ifdef I_STDLIB
10245 #include <stdlib.h>
10246 #endif
10247
10248 int main() { xxx("foo"); }
10249
10250 xxx(va_alist)
10251 va_dcl
10252 {
10253         va_list args;
10254         char buf[10];
10255
10256         va_start(args);
10257         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10258 }
10259 EOF
10260         set try
10261         if eval $compile && $run ./try; then
10262                 echo "Your vsprintf() returns (int)." >&4
10263                 val2="$undef"
10264         else
10265                 echo "Your vsprintf() returns (char*)." >&4
10266                 val2="$define"
10267         fi
10268 else
10269         echo 'vprintf() NOT found.' >&4
10270                 val="$undef"
10271                 val2="$undef"
10272 fi
10273 $rm -f try try.*
10274 set d_vprintf
10275 eval $setvar
10276 val=$val2
10277 set d_charvspr
10278 eval $setvar
10279
10280 : see if chown exists
10281 set chown d_chown
10282 eval $inlibc
10283
10284 : see if chroot exists
10285 set chroot d_chroot
10286 eval $inlibc
10287
10288 : see if chsize exists
10289 set chsize d_chsize
10290 eval $inlibc
10291
10292 : see if class exists
10293 set class d_class
10294 eval $inlibc
10295
10296 hasstruct='varname=$1; struct=$2; shift; shift;
10297 while $test $# -ge 2; do
10298         case "$1" in
10299         $define) echo "#include <$2>";;
10300         esac ;
10301     shift 2;
10302 done > try.c;
10303 echo "int main () { struct $struct foo; }" >> try.c;
10304 set try;
10305 if eval $compile; then
10306         val="$define";
10307 else
10308         val="$undef";
10309 fi;
10310 set $varname;
10311 eval $setvar;
10312 $rm -f try.c try.o'
10313
10314 socketlib=''
10315 sockethdr=''
10316 : see whether socket exists
10317 echo " "
10318 $echo $n "Hmm... $c" >&4
10319 if set socket val -f d_socket; eval $csym; $val; then
10320         echo "Looks like you have Berkeley networking support." >&4
10321         d_socket="$define"
10322         if set setsockopt val -f; eval $csym; $val; then
10323                 d_oldsock="$undef"
10324         else
10325                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10326                 d_oldsock="$define"
10327         fi
10328 else
10329         if $contains socklib libc.list >/dev/null 2>&1; then
10330                 echo "Looks like you have Berkeley networking support." >&4
10331                 d_socket="$define"
10332                 : we will have to assume that it supports the 4.2 BSD interface
10333                 d_oldsock="$undef"
10334         else
10335                 echo "You don't have Berkeley networking in libc$_a..." >&4
10336                 if test "X$d_socket" = "X$define"; then
10337                    echo "...but you seem to believe that you have sockets." >&4
10338                 else
10339                         for net in net socket
10340                         do
10341                                 if test -f /usr/lib/lib$net$_a; then
10342                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10343                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10344                                         if $contains socket libc.list >/dev/null 2>&1; then
10345                                                 d_socket="$define"
10346                                                 socketlib="-l$net"
10347                                                 case "$net" in
10348                                                 net)
10349                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10350                                                         sockethdr="-I/usr/netinclude"
10351                                                         ;;
10352                                                 esac
10353                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10354                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10355                                                         d_oldsock="$undef"
10356                                                 else
10357                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10358                                                         d_oldsock="$define"
10359                                                 fi
10360                                                 break
10361                                         fi
10362                                 fi
10363                         done
10364                         if test "X$d_socket" != "X$define"; then
10365                            echo "or anywhere else I see." >&4
10366                            d_socket="$undef"
10367                            d_oldsock="$undef"
10368                         fi
10369                 fi
10370         fi
10371 fi
10372
10373 : see if socketpair exists
10374 set socketpair d_sockpair
10375 eval $inlibc
10376
10377
10378 echo " "
10379 echo "Checking the availability of certain socket constants..." >&4
10380 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10381         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10382         $cat >try.c <<EOF
10383 #include <sys/types.h>
10384 #include <sys/socket.h>
10385 int main() {
10386     int i = $ENUM;
10387 }
10388 EOF
10389         val="$undef"
10390         set try; if eval $compile; then
10391                 val="$define"
10392         fi
10393         set d_${enum}; eval $setvar
10394         $rm -f try.c try
10395 done
10396
10397 : see if this is a sys/uio.h system
10398 set sys/uio.h i_sysuio
10399 eval $inhdr
10400
10401
10402 echo " "
10403 echo "Checking to see if your system supports struct cmsghdr..." >&4
10404 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10405 eval $hasstruct
10406 case "$d_cmsghdr_s" in
10407 "$define")      echo "Yes, it does."   ;;
10408 *)              echo "No, it doesn't." ;;
10409 esac
10410
10411
10412 : check for const keyword
10413 echo " "
10414 echo 'Checking to see if your C compiler knows about "const"...' >&4
10415 $cat >const.c <<'EOCP'
10416 typedef struct spug { int drokk; } spug;
10417 int main()
10418 {
10419         const char *foo;
10420         const spug y;
10421 }
10422 EOCP
10423 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10424         val="$define"
10425         echo "Yup, it does."
10426 else
10427         val="$undef"
10428         echo "Nope, it doesn't."
10429 fi
10430 set d_const
10431 eval $setvar
10432
10433 : see if copysignl exists
10434 set copysignl d_copysignl
10435 eval $inlibc
10436
10437 : see if crypt exists
10438 echo " "
10439 set crypt d_crypt
10440 eval $inlibc
10441 case "$d_crypt" in
10442 $define) cryptlib='' ;;
10443 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10444                 echo 'crypt() found.' >&4
10445                 val="$define"
10446                 cryptlib=''
10447         else
10448                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10449                 if $test -z "$cryptlib"; then
10450                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10451                 else
10452                         cryptlib=-lcrypt
10453                 fi
10454                 if $test -z "$cryptlib"; then
10455                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10456                 else
10457                         cryptlib=-lcrypt
10458                 fi
10459                 if $test -z "$cryptlib"; then
10460                         cryptlib=`./loc libcrypt$_a "" $libpth`
10461                 else
10462                         cryptlib=-lcrypt
10463                 fi
10464                 if $test -z "$cryptlib"; then
10465                         echo 'crypt() NOT found.' >&4
10466                         val="$undef"
10467                 else
10468                         val="$define"
10469                 fi
10470         fi
10471         set d_crypt
10472         eval $setvar
10473         ;;
10474 esac
10475
10476 : see if this is a crypt.h system
10477 set crypt.h i_crypt
10478 eval $inhdr
10479
10480 : see if crypt_r exists
10481 set crypt_r d_crypt_r
10482 eval $inlibc
10483 case "$d_crypt_r" in
10484 "$define")
10485         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10486         case "$d_crypt_r_proto:$usethreads" in
10487         ":define")      d_crypt_r_proto=define
10488                 set d_crypt_r_proto crypt_r $hdrs
10489                 eval $hasproto ;;
10490         *)      ;;
10491         esac
10492         case "$d_crypt_r_proto" in
10493         define)
10494         case "$crypt_r_proto" in
10495         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10496         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10497         esac
10498         case "$crypt_r_proto" in
10499         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10500         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10501         esac
10502         case "$crypt_r_proto" in
10503         ''|0)   d_crypt_r=undef
10504                 crypt_r_proto=0
10505                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10506         * )     case "$crypt_r_proto" in
10507                 REENTRANT_PROTO*) ;;
10508                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10509                 esac
10510                 echo "Prototype: $try" ;;
10511         esac
10512         ;;
10513         *)      case "$usethreads" in
10514                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10515                 esac
10516                 d_crypt_r=undef
10517                 crypt_r_proto=0
10518                 ;;
10519         esac
10520         ;;
10521 *)      crypt_r_proto=0
10522         ;;
10523 esac
10524
10525 : get csh whereabouts
10526 case "$csh" in
10527 'csh') val="$undef" ;;
10528 *) val="$define" ;;
10529 esac
10530 set d_csh
10531 eval $setvar
10532 : Respect a hint or command line value for full_csh.
10533 case "$full_csh" in
10534 '') full_csh=$csh ;;
10535 esac
10536
10537 : see if ctermid_r exists
10538 set ctermid_r d_ctermid_r
10539 eval $inlibc
10540 case "$d_ctermid_r" in
10541 "$define")
10542         hdrs="$i_systypes sys/types.h define stdio.h "
10543         case "$d_ctermid_r_proto:$usethreads" in
10544         ":define")      d_ctermid_r_proto=define
10545                 set d_ctermid_r_proto ctermid_r $hdrs
10546                 eval $hasproto ;;
10547         *)      ;;
10548         esac
10549         case "$d_ctermid_r_proto" in
10550         define)
10551         case "$ctermid_r_proto" in
10552         ''|0) try='char* ctermid_r(char*);'
10553         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10554         esac
10555         case "$ctermid_r_proto" in
10556         ''|0)   d_ctermid_r=undef
10557                 ctermid_r_proto=0
10558                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10559         * )     case "$ctermid_r_proto" in
10560                 REENTRANT_PROTO*) ;;
10561                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10562                 esac
10563                 echo "Prototype: $try" ;;
10564         esac
10565         ;;
10566         *)      case "$usethreads" in
10567                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10568                 esac
10569                 d_ctermid_r=undef
10570                 ctermid_r_proto=0
10571                 ;;
10572         esac
10573         ;;
10574 *)      ctermid_r_proto=0
10575         ;;
10576 esac
10577
10578 : see if ctime_r exists
10579 set ctime_r d_ctime_r
10580 eval $inlibc
10581 case "$d_ctime_r" in
10582 "$define")
10583         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10584         case "$d_ctime_r_proto:$usethreads" in
10585         ":define")      d_ctime_r_proto=define
10586                 set d_ctime_r_proto ctime_r $hdrs
10587                 eval $hasproto ;;
10588         *)      ;;
10589         esac
10590         case "$d_ctime_r_proto" in
10591         define)
10592         case "$ctime_r_proto" in
10593         ''|0) try='char* ctime_r(const time_t*, char*);'
10594         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10595         esac
10596         case "$ctime_r_proto" in
10597         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10598         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10599         esac
10600         case "$ctime_r_proto" in
10601         ''|0) try='int ctime_r(const time_t*, char*);'
10602         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10603         esac
10604         case "$ctime_r_proto" in
10605         ''|0) try='int ctime_r(const time_t*, char*, int);'
10606         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10607         esac
10608         case "$ctime_r_proto" in
10609         ''|0)   d_ctime_r=undef
10610                 ctime_r_proto=0
10611                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10612         * )     case "$ctime_r_proto" in
10613                 REENTRANT_PROTO*) ;;
10614                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10615                 esac
10616                 echo "Prototype: $try" ;;
10617         esac
10618         ;;
10619         *)      case "$usethreads" in
10620                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10621                 esac
10622                 d_ctime_r=undef
10623                 ctime_r_proto=0
10624                 ;;
10625         esac
10626         ;;
10627 *)      ctime_r_proto=0
10628         ;;
10629 esac
10630
10631 : see if cuserid exists
10632 set cuserid d_cuserid
10633 eval $inlibc
10634
10635 : see if this is a limits.h system
10636 set limits.h i_limits
10637 eval $inhdr
10638
10639 : see if this is a float.h system
10640 set float.h i_float
10641 eval $inhdr
10642
10643 : See if number of significant digits in a double precision number is known
10644 echo " "
10645 $cat >dbl_dig.c <<EOM
10646 #$i_limits I_LIMITS
10647 #$i_float I_FLOAT
10648 #ifdef I_LIMITS
10649 #include <limits.h>
10650 #endif
10651 #ifdef I_FLOAT
10652 #include <float.h>
10653 #endif
10654 #ifdef DBL_DIG
10655 printf("Contains DBL_DIG");
10656 #endif
10657 EOM
10658 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10659 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10660         echo "DBL_DIG found." >&4
10661         val="$define"
10662 else
10663         echo "DBL_DIG NOT found." >&4
10664         val="$undef"
10665 fi
10666 $rm -f dbl_dig.?
10667 set d_dbl_dig
10668 eval $setvar
10669
10670 : see if dbm.h is available
10671 : see if dbmclose exists
10672 set dbmclose d_dbmclose
10673 eval $inlibc
10674
10675 case "$d_dbmclose" in
10676 $define)
10677         set dbm.h i_dbm
10678         eval $inhdr
10679         case "$i_dbm" in
10680         $define)
10681                 val="$undef"
10682                 set i_rpcsvcdbm
10683                 eval $setvar
10684                 ;;
10685         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10686                 eval $inhdr
10687                 ;;
10688         esac
10689         ;;
10690 *)      echo "We won't be including <dbm.h>"
10691         val="$undef"
10692         set i_dbm
10693         eval $setvar
10694         val="$undef"
10695         set i_rpcsvcdbm
10696         eval $setvar
10697         ;;
10698 esac
10699
10700 : see if prototype for dbminit is available
10701 echo " "
10702 set d_dbminitproto dbminit $i_dbm dbm.h
10703 eval $hasproto
10704
10705 : see if difftime exists
10706 set difftime d_difftime
10707 eval $inlibc
10708
10709 : see if this is a dirent system
10710 echo " "
10711 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10712         val="$define"
10713         echo "<dirent.h> found." >&4
10714 else
10715         val="$undef"
10716         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10717                 echo "<sys/dir.h> found." >&4
10718                 echo " "
10719         else
10720                 xinc=`./findhdr sys/ndir.h`
10721         fi
10722         echo "<dirent.h> NOT found." >&4
10723 fi
10724 set i_dirent
10725 eval $setvar
10726
10727 : Look for type of directory structure.
10728 echo " "
10729 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10730
10731 case "$direntrytype" in
10732 ''|' ')
10733         case "$i_dirent" in
10734         $define) guess1='struct dirent' ;;
10735         *) guess1='struct direct'  ;;
10736         esac
10737         ;;
10738 *)      guess1="$direntrytype"
10739         ;;
10740 esac
10741
10742 case "$guess1" in
10743 'struct dirent') guess2='struct direct' ;;
10744 *) guess2='struct dirent' ;;
10745 esac
10746                 
10747 if $contains "$guess1" try.c >/dev/null 2>&1; then
10748         direntrytype="$guess1"
10749         echo "Your directory entries are $direntrytype." >&4
10750 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10751         direntrytype="$guess2"
10752         echo "Your directory entries seem to be $direntrytype." >&4
10753 else
10754         echo "I don't recognize your system's directory entries." >&4
10755         rp="What type is used for directory entries on this system?"
10756         dflt="$guess1"
10757         . ./myread
10758         direntrytype="$ans"
10759 fi
10760 $rm -f try.c
10761
10762
10763 : see if the directory entry stores field length
10764 echo " "
10765 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10766 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10767         echo "Good, your directory entry keeps length information in d_namlen." >&4
10768         val="$define"
10769 else
10770         echo "Your directory entry does not know about the d_namlen field." >&4
10771         val="$undef"
10772 fi
10773 set d_dirnamlen
10774 eval $setvar
10775 $rm -f try.c
10776
10777 : see if this is an sysdir system
10778 set sys/dir.h i_sysdir
10779 eval $inhdr
10780
10781 : see if this is an sysndir system
10782 set sys/ndir.h i_sysndir
10783 eval $inhdr
10784
10785 : Look for dirfd
10786 echo " "
10787 $cat >dirfd.c <<EOM
10788 #include <stdio.h>
10789 #$i_stdlib I_STDLIB
10790 #ifdef I_STDLIB
10791 #include <stdlib.h>
10792 #endif
10793 #$i_dirent I_DIRENT             /**/
10794 #$i_sysdir I_SYS_DIR            /**/
10795 #$i_sysndir I_SYS_NDIR          /**/
10796 #$i_systypes I_SYS_TYPES        /**/
10797 #if defined(I_SYS_TYPES)
10798 #include <sys/types.h>
10799 #endif
10800 #if defined(I_DIRENT)
10801 #include <dirent.h>
10802 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10803 #include <sys/dir.h>
10804 #endif
10805 #else
10806 #ifdef I_SYS_NDIR
10807 #include <sys/ndir.h>
10808 #else
10809 #ifdef I_SYS_DIR
10810 #ifdef hp9000s500
10811 #include <ndir.h>       /* may be wrong in the future */
10812 #else
10813 #include <sys/dir.h>
10814 #endif
10815 #endif
10816 #endif
10817 #endif 
10818 int main() {
10819         DIR *dirp = opendir(".");
10820         if (dirfd(dirp) >= 0)
10821                 exit(0);
10822         else
10823                 exit(1);
10824 }
10825 EOM
10826 set dirfd
10827 if eval $compile; then
10828         val="$define"
10829 fi
10830 case "$val" in
10831 $define)        echo "dirfd() found." >&4       ;;
10832 *)              echo "dirfd() NOT found." >&4   ;;
10833 esac
10834 set d_dirfd
10835 eval $setvar
10836 $rm -f dirfd*
10837
10838 : see if dlerror exists
10839 xxx_runnm="$runnm"
10840 runnm=false
10841 set dlerror d_dlerror
10842 eval $inlibc
10843 runnm="$xxx_runnm"
10844
10845 : see if dlfcn is available
10846 set dlfcn.h i_dlfcn
10847 eval $inhdr
10848
10849 case "$usedl" in
10850 $define|y|true)
10851         $cat << EOM
10852
10853 On a few systems, the dynamically loaded modules that perl generates and uses
10854 will need a different extension than shared libs. The default will probably
10855 be appropriate.
10856
10857 EOM
10858         case "$dlext" in
10859         '')     dflt="$so" ;;
10860         *)      dflt="$dlext" ;;
10861         esac
10862         rp='What is the extension of dynamically loaded modules'
10863         . ./myread
10864         dlext="$ans"
10865         ;;
10866 *)
10867         dlext="none"
10868         ;;
10869 esac
10870
10871 : Check if dlsym need a leading underscore
10872 echo " "
10873 val="$undef"
10874
10875 case "$dlsrc" in
10876 dl_dlopen.xs)
10877         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10878         $cat >dyna.c <<'EOM'
10879 fred () { }
10880 EOM
10881
10882 $cat >fred.c<<EOM
10883
10884 #include <stdio.h>
10885 #$i_stdlib I_STDLIB
10886 #ifdef I_STDLIB
10887 #include <stdlib.h>
10888 #endif
10889 #$i_dlfcn I_DLFCN
10890 #ifdef I_DLFCN
10891 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10892 #else
10893 #include <sys/types.h>
10894 #include <nlist.h>
10895 #include <link.h>
10896 #endif
10897
10898 extern int fred() ;
10899
10900 int main()
10901 {
10902     void * handle ;
10903     void * symbol ;
10904 #ifndef RTLD_LAZY
10905     int mode = 1 ;
10906 #else
10907     int mode = RTLD_LAZY ;
10908 #endif
10909     handle = dlopen("./dyna.$dlext", mode) ;
10910     if (handle == NULL) {
10911         printf ("1\n") ;
10912         fflush (stdout) ;
10913         exit(0);
10914     }
10915     symbol = dlsym(handle, "fred") ;
10916     if (symbol == NULL) {
10917         /* try putting a leading underscore */
10918         symbol = dlsym(handle, "_fred") ;
10919         if (symbol == NULL) {
10920             printf ("2\n") ;
10921             fflush (stdout) ;
10922             exit(0);
10923         }
10924         printf ("3\n") ;
10925     }
10926     else
10927         printf ("4\n") ;
10928     fflush (stdout) ;
10929     exit(0);
10930 }
10931 EOM
10932         : Call the object file tmp-dyna.o in case dlext=o.
10933         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10934                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10935                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10936                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10937                 xxx=`$run ./fred`
10938                 case $xxx in
10939                 1)      echo "Test program failed using dlopen." >&4
10940                         echo "Perhaps you should not use dynamic loading." >&4;;
10941                 2)      echo "Test program failed using dlsym." >&4
10942                         echo "Perhaps you should not use dynamic loading." >&4;;
10943                 3)      echo "dlsym needs a leading underscore" >&4
10944                         val="$define" ;;
10945                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10946                 esac
10947         else
10948                 echo "I can't compile and run the test program." >&4
10949                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10950         fi
10951         ;;
10952 esac
10953                 
10954 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10955
10956 set d_dlsymun
10957 eval $setvar
10958
10959 : see if drand48_r exists
10960 set drand48_r d_drand48_r
10961 eval $inlibc
10962 case "$d_drand48_r" in
10963 "$define")
10964         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10965         case "$d_drand48_r_proto:$usethreads" in
10966         ":define")      d_drand48_r_proto=define
10967                 set d_drand48_r_proto drand48_r $hdrs
10968                 eval $hasproto ;;
10969         *)      ;;
10970         esac
10971         case "$d_drand48_r_proto" in
10972         define)
10973         case "$drand48_r_proto" in
10974         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10975         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10976         esac
10977         case "$drand48_r_proto" in
10978         ''|0)   d_drand48_r=undef
10979                 drand48_r_proto=0
10980                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10981         * )     case "$drand48_r_proto" in
10982                 REENTRANT_PROTO*) ;;
10983                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10984                 esac
10985                 echo "Prototype: $try" ;;
10986         esac
10987         ;;
10988         *)      case "$usethreads" in
10989                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10990                 esac
10991                 d_drand48_r=undef
10992                 drand48_r_proto=0
10993                 ;;
10994         esac
10995         ;;
10996 *)      drand48_r_proto=0
10997         ;;
10998 esac
10999
11000 : see if prototype for drand48 is available
11001 echo " "
11002 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11003 eval $hasproto
11004
11005 : see if dup2 exists
11006 set dup2 d_dup2
11007 eval $inlibc
11008
11009 : see if eaccess exists
11010 set eaccess d_eaccess
11011 eval $inlibc
11012
11013 : see if endgrent exists
11014 set endgrent d_endgrent
11015 eval $inlibc
11016
11017 : see if this is an grp system
11018 set grp.h i_grp
11019 eval $inhdr
11020
11021 case "$i_grp" in
11022 $define)
11023         xxx=`./findhdr grp.h`
11024         $cppstdin $cppflags $cppminus < $xxx >$$.h
11025
11026         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11027                 val="$define"
11028         else
11029                 val="$undef"
11030         fi
11031         set d_grpasswd
11032         eval $setvar
11033
11034         $rm -f $$.h
11035         ;;
11036 *)
11037         val="$undef";
11038         set d_grpasswd; eval $setvar
11039         ;;
11040 esac
11041
11042 : see if endgrent_r exists
11043 set endgrent_r d_endgrent_r
11044 eval $inlibc
11045 case "$d_endgrent_r" in
11046 "$define")
11047         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11048         case "$d_endgrent_r_proto:$usethreads" in
11049         ":define")      d_endgrent_r_proto=define
11050                 set d_endgrent_r_proto endgrent_r $hdrs
11051                 eval $hasproto ;;
11052         *)      ;;
11053         esac
11054         case "$d_endgrent_r_proto" in
11055         define)
11056         case "$endgrent_r_proto" in
11057         ''|0) try='int endgrent_r(FILE**);'
11058         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11059         esac
11060         case "$endgrent_r_proto" in
11061         ''|0) try='void endgrent_r(FILE**);'
11062         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11063         esac
11064         case "$endgrent_r_proto" in
11065         ''|0)   d_endgrent_r=undef
11066                 endgrent_r_proto=0
11067                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11068         * )     case "$endgrent_r_proto" in
11069                 REENTRANT_PROTO*) ;;
11070                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11071                 esac
11072                 echo "Prototype: $try" ;;
11073         esac
11074         ;;
11075         *)      case "$usethreads" in
11076                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11077                 esac
11078                 d_endgrent_r=undef
11079                 endgrent_r_proto=0
11080                 ;;
11081         esac
11082         ;;
11083 *)      endgrent_r_proto=0
11084         ;;
11085 esac
11086
11087 : see if endhostent exists
11088 set endhostent d_endhent
11089 eval $inlibc
11090
11091 : see if this is a netdb.h system
11092 set netdb.h i_netdb
11093 eval $inhdr
11094
11095 : see if endhostent_r exists
11096 set endhostent_r d_endhostent_r
11097 eval $inlibc
11098 case "$d_endhostent_r" in
11099 "$define")
11100         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11101         case "$d_endhostent_r_proto:$usethreads" in
11102         ":define")      d_endhostent_r_proto=define
11103                 set d_endhostent_r_proto endhostent_r $hdrs
11104                 eval $hasproto ;;
11105         *)      ;;
11106         esac
11107         case "$d_endhostent_r_proto" in
11108         define)
11109         case "$endhostent_r_proto" in
11110         ''|0) try='int endhostent_r(struct hostent_data*);'
11111         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11112         esac
11113         case "$endhostent_r_proto" in
11114         ''|0) try='void endhostent_r(struct hostent_data*);'
11115         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11116         esac
11117         case "$endhostent_r_proto" in
11118         ''|0)   d_endhostent_r=undef
11119                 endhostent_r_proto=0
11120                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11121         * )     case "$endhostent_r_proto" in
11122                 REENTRANT_PROTO*) ;;
11123                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11124                 esac
11125                 echo "Prototype: $try" ;;
11126         esac
11127         ;;
11128         *)      case "$usethreads" in
11129                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11130                 esac
11131                 d_endhostent_r=undef
11132                 endhostent_r_proto=0
11133                 ;;
11134         esac
11135         ;;
11136 *)      endhostent_r_proto=0
11137         ;;
11138 esac
11139
11140 : see if endnetent exists
11141 set endnetent d_endnent
11142 eval $inlibc
11143
11144 : see if endnetent_r exists
11145 set endnetent_r d_endnetent_r
11146 eval $inlibc
11147 case "$d_endnetent_r" in
11148 "$define")
11149         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11150         case "$d_endnetent_r_proto:$usethreads" in
11151         ":define")      d_endnetent_r_proto=define
11152                 set d_endnetent_r_proto endnetent_r $hdrs
11153                 eval $hasproto ;;
11154         *)      ;;
11155         esac
11156         case "$d_endnetent_r_proto" in
11157         define)
11158         case "$endnetent_r_proto" in
11159         ''|0) try='int endnetent_r(struct netent_data*);'
11160         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11161         esac
11162         case "$endnetent_r_proto" in
11163         ''|0) try='void endnetent_r(struct netent_data*);'
11164         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11165         esac
11166         case "$endnetent_r_proto" in
11167         ''|0)   d_endnetent_r=undef
11168                 endnetent_r_proto=0
11169                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11170         * )     case "$endnetent_r_proto" in
11171                 REENTRANT_PROTO*) ;;
11172                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11173                 esac
11174                 echo "Prototype: $try" ;;
11175         esac
11176         ;;
11177         *)      case "$usethreads" in
11178                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11179                 esac
11180                 d_endnetent_r=undef
11181                 endnetent_r_proto=0
11182                 ;;
11183         esac
11184         ;;
11185 *)      endnetent_r_proto=0
11186         ;;
11187 esac
11188
11189 : see if endprotoent exists
11190 set endprotoent d_endpent
11191 eval $inlibc
11192
11193 : see if endprotoent_r exists
11194 set endprotoent_r d_endprotoent_r
11195 eval $inlibc
11196 case "$d_endprotoent_r" in
11197 "$define")
11198         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11199         case "$d_endprotoent_r_proto:$usethreads" in
11200         ":define")      d_endprotoent_r_proto=define
11201                 set d_endprotoent_r_proto endprotoent_r $hdrs
11202                 eval $hasproto ;;
11203         *)      ;;
11204         esac
11205         case "$d_endprotoent_r_proto" in
11206         define)
11207         case "$endprotoent_r_proto" in
11208         ''|0) try='int endprotoent_r(struct protoent_data*);'
11209         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11210         esac
11211         case "$endprotoent_r_proto" in
11212         ''|0) try='void endprotoent_r(struct protoent_data*);'
11213         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11214         esac
11215         case "$endprotoent_r_proto" in
11216         ''|0)   d_endprotoent_r=undef
11217                 endprotoent_r_proto=0
11218                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11219         * )     case "$endprotoent_r_proto" in
11220                 REENTRANT_PROTO*) ;;
11221                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11222                 esac
11223                 echo "Prototype: $try" ;;
11224         esac
11225         ;;
11226         *)      case "$usethreads" in
11227                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11228                 esac
11229                 d_endprotoent_r=undef
11230                 endprotoent_r_proto=0
11231                 ;;
11232         esac
11233         ;;
11234 *)      endprotoent_r_proto=0
11235         ;;
11236 esac
11237
11238 : see if endpwent exists
11239 set endpwent d_endpwent
11240 eval $inlibc
11241
11242 : see if this is a pwd.h system
11243 set pwd.h i_pwd
11244 eval $inhdr
11245
11246 case "$i_pwd" in
11247 $define)
11248         xxx=`./findhdr pwd.h`
11249         $cppstdin $cppflags $cppminus < $xxx >$$.h
11250
11251         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11252                 val="$define"
11253         else
11254                 val="$undef"
11255         fi
11256         set d_pwquota
11257         eval $setvar
11258
11259         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11260                 val="$define"
11261         else
11262                 val="$undef"
11263         fi
11264         set d_pwage
11265         eval $setvar
11266
11267         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11268                 val="$define"
11269         else
11270                 val="$undef"
11271         fi
11272         set d_pwchange
11273         eval $setvar
11274
11275         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11276                 val="$define"
11277         else
11278                 val="$undef"
11279         fi
11280         set d_pwclass
11281         eval $setvar
11282
11283         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11284                 val="$define"
11285         else
11286                 val="$undef"
11287         fi
11288         set d_pwexpire
11289         eval $setvar
11290
11291         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11292                 val="$define"
11293         else
11294                 val="$undef"
11295         fi
11296         set d_pwcomment
11297         eval $setvar
11298
11299         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11300                 val="$define"
11301         else
11302                 val="$undef"
11303         fi
11304         set d_pwgecos
11305         eval $setvar
11306
11307         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11308                 val="$define"
11309         else
11310                 val="$undef"
11311         fi
11312         set d_pwpasswd
11313         eval $setvar
11314
11315         $rm -f $$.h
11316         ;;
11317 *)
11318         val="$undef"; 
11319         set d_pwquota; eval $setvar
11320         set d_pwage; eval $setvar
11321         set d_pwchange; eval $setvar
11322         set d_pwclass; eval $setvar
11323         set d_pwexpire; eval $setvar
11324         set d_pwcomment; eval $setvar
11325         set d_pwgecos; eval $setvar
11326         set d_pwpasswd; eval $setvar
11327         ;;
11328 esac
11329
11330 : see if endpwent_r exists
11331 set endpwent_r d_endpwent_r
11332 eval $inlibc
11333 case "$d_endpwent_r" in
11334 "$define")
11335         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11336         case "$d_endpwent_r_proto:$usethreads" in
11337         ":define")      d_endpwent_r_proto=define
11338                 set d_endpwent_r_proto endpwent_r $hdrs
11339                 eval $hasproto ;;
11340         *)      ;;
11341         esac
11342         case "$d_endpwent_r_proto" in
11343         define)
11344         case "$endpwent_r_proto" in
11345         ''|0) try='int endpwent_r(FILE**);'
11346         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11347         esac
11348         case "$endpwent_r_proto" in
11349         ''|0) try='void endpwent_r(FILE**);'
11350         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11351         esac
11352         case "$endpwent_r_proto" in
11353         ''|0)   d_endpwent_r=undef
11354                 endpwent_r_proto=0
11355                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11356         * )     case "$endpwent_r_proto" in
11357                 REENTRANT_PROTO*) ;;
11358                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11359                 esac
11360                 echo "Prototype: $try" ;;
11361         esac
11362         ;;
11363         *)      case "$usethreads" in
11364                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11365                 esac
11366                 d_endpwent_r=undef
11367                 endpwent_r_proto=0
11368                 ;;
11369         esac
11370         ;;
11371 *)      endpwent_r_proto=0
11372         ;;
11373 esac
11374
11375 : see if endservent exists
11376 set endservent d_endsent
11377 eval $inlibc
11378
11379 : see if endservent_r exists
11380 set endservent_r d_endservent_r
11381 eval $inlibc
11382 case "$d_endservent_r" in
11383 "$define")
11384         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11385         case "$d_endservent_r_proto:$usethreads" in
11386         ":define")      d_endservent_r_proto=define
11387                 set d_endservent_r_proto endservent_r $hdrs
11388                 eval $hasproto ;;
11389         *)      ;;
11390         esac
11391         case "$d_endservent_r_proto" in
11392         define)
11393         case "$endservent_r_proto" in
11394         ''|0) try='int endservent_r(struct servent_data*);'
11395         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11396         esac
11397         case "$endservent_r_proto" in
11398         ''|0) try='void endservent_r(struct servent_data*);'
11399         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11400         esac
11401         case "$endservent_r_proto" in
11402         ''|0)   d_endservent_r=undef
11403                 endservent_r_proto=0
11404                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11405         * )     case "$endservent_r_proto" in
11406                 REENTRANT_PROTO*) ;;
11407                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11408                 esac
11409                 echo "Prototype: $try" ;;
11410         esac
11411         ;;
11412         *)      case "$usethreads" in
11413                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11414                 esac
11415                 d_endservent_r=undef
11416                 endservent_r_proto=0
11417                 ;;
11418         esac
11419         ;;
11420 *)      endservent_r_proto=0
11421         ;;
11422 esac
11423
11424 : Locate the flags for 'open()'
11425 echo " "
11426 $cat >try.c <<EOCP
11427 #include <sys/types.h>
11428 #ifdef I_FCNTL
11429 #include <fcntl.h>
11430 #endif
11431 #ifdef I_SYS_FILE
11432 #include <sys/file.h>
11433 #endif
11434 #$i_stdlib I_STDLIB
11435 #ifdef I_STDLIB
11436 #include <stdlib.h>
11437 #endif
11438 int main() {
11439         if(O_RDONLY);
11440 #ifdef O_TRUNC
11441         exit(0);
11442 #else
11443         exit(1);
11444 #endif
11445 }
11446 EOCP
11447 : check sys/file.h first to get FREAD on Sun
11448 if $test `./findhdr sys/file.h` && \
11449                 set try -DI_SYS_FILE && eval $compile; then
11450         h_sysfile=true;
11451         echo "<sys/file.h> defines the O_* constants..." >&4
11452         if $run ./try; then
11453                 echo "and you have the 3 argument form of open()." >&4
11454                 val="$define"
11455         else
11456                 echo "but not the 3 argument form of open().  Oh, well." >&4
11457                 val="$undef"
11458         fi
11459 elif $test `./findhdr fcntl.h` && \
11460                 set try -DI_FCNTL && eval $compile; then
11461         h_fcntl=true;
11462         echo "<fcntl.h> defines the O_* constants..." >&4
11463         if $run ./try; then
11464                 echo "and you have the 3 argument form of open()." >&4
11465                 val="$define"
11466         else
11467                 echo "but not the 3 argument form of open().  Oh, well." >&4
11468                 val="$undef"
11469         fi
11470 else
11471         val="$undef"
11472         echo "I can't find the O_* constant definitions!  You got problems." >&4
11473 fi
11474 set d_open3
11475 eval $setvar
11476 $rm -f try try.*
11477
11478 : see which of string.h or strings.h is needed
11479 echo " "
11480 strings=`./findhdr string.h`
11481 if $test "$strings" && $test -r "$strings"; then
11482         echo "Using <string.h> instead of <strings.h>." >&4
11483         val="$define"
11484 else
11485         val="$undef"
11486         strings=`./findhdr strings.h`
11487         if $test "$strings" && $test -r "$strings"; then
11488                 echo "Using <strings.h> instead of <string.h>." >&4
11489         else
11490                 echo "No string header found -- You'll surely have problems." >&4
11491         fi
11492 fi
11493 set i_string
11494 eval $setvar
11495 case "$i_string" in
11496 "$undef") strings=`./findhdr strings.h`;;
11497 *)        strings=`./findhdr string.h`;;
11498 esac
11499
11500 : see if this is a sys/file.h system
11501 val=''
11502 set sys/file.h val
11503 eval $inhdr
11504
11505 : do we need to include sys/file.h ?
11506 case "$val" in
11507 "$define")
11508         echo " "
11509         if $h_sysfile; then
11510                 val="$define"
11511                 echo "We'll be including <sys/file.h>." >&4
11512         else
11513                 val="$undef"
11514                 echo "We won't be including <sys/file.h>." >&4
11515         fi
11516         ;;
11517 *)
11518         h_sysfile=false
11519         ;;
11520 esac
11521 set i_sysfile
11522 eval $setvar
11523
11524 : see if fcntl.h is there
11525 val=''
11526 set fcntl.h val
11527 eval $inhdr
11528
11529 : see if we can include fcntl.h
11530 case "$val" in
11531 "$define")
11532         echo " "
11533         if $h_fcntl; then
11534                 val="$define"
11535                 echo "We'll be including <fcntl.h>." >&4
11536         else
11537                 val="$undef"
11538                 if $h_sysfile; then
11539         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11540                 else
11541                         echo "We won't be including <fcntl.h>." >&4
11542                 fi
11543         fi
11544         ;;
11545 *)
11546         h_fcntl=false
11547         val="$undef"
11548         ;;
11549 esac
11550 set i_fcntl
11551 eval $setvar
11552
11553 : check for non-blocking I/O stuff
11554 case "$h_sysfile" in
11555 true) echo "#include <sys/file.h>" > head.c;;
11556 *)
11557        case "$h_fcntl" in
11558        true) echo "#include <fcntl.h>" > head.c;;
11559        *) echo "#include <sys/fcntl.h>" > head.c;;
11560        esac
11561        ;;
11562 esac
11563 echo " "
11564 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11565 case "$o_nonblock" in
11566 '')
11567         $cat head.c > try.c
11568         $cat >>try.c <<EOCP
11569 #include <stdio.h>
11570 #$i_stdlib I_STDLIB
11571 #ifdef I_STDLIB
11572 #include <stdlib.h>
11573 #endif
11574 #$i_fcntl I_FCNTL
11575 #ifdef I_FCNTL
11576 #include <fcntl.h>
11577 #endif
11578 int main() {
11579 #ifdef O_NONBLOCK
11580         printf("O_NONBLOCK\n");
11581         exit(0);
11582 #endif
11583 #ifdef O_NDELAY
11584         printf("O_NDELAY\n");
11585         exit(0);
11586 #endif
11587 #ifdef FNDELAY
11588         printf("FNDELAY\n");
11589         exit(0);
11590 #endif
11591         exit(0);
11592 }
11593 EOCP
11594         set try
11595         if eval $compile_ok; then
11596                 o_nonblock=`$run ./try`
11597                 case "$o_nonblock" in
11598                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11599                 *) echo "Seems like we can use $o_nonblock.";;
11600                 esac
11601         else
11602                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11603         fi
11604         ;;
11605 *) echo "Using $hint value $o_nonblock.";;
11606 esac
11607 $rm -f try try.* .out core
11608
11609 echo " "
11610 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11611 case "$eagain" in
11612 '')
11613         $cat head.c > try.c
11614         $cat >>try.c <<EOCP
11615 #include <errno.h>
11616 #include <sys/types.h>
11617 #include <signal.h>
11618 #include <stdio.h> 
11619 #$i_stdlib I_STDLIB
11620 #ifdef I_STDLIB
11621 #include <stdlib.h>
11622 #endif
11623 #$i_fcntl I_FCNTL
11624 #ifdef I_FCNTL
11625 #include <fcntl.h>
11626 #endif
11627 #define MY_O_NONBLOCK $o_nonblock
11628 #ifndef errno  /* XXX need better Configure test */
11629 extern int errno;
11630 #endif
11631 #$i_unistd I_UNISTD
11632 #ifdef I_UNISTD
11633 #include <unistd.h>
11634 #endif
11635 #$i_string I_STRING
11636 #ifdef I_STRING
11637 #include <string.h>
11638 #else
11639 #include <strings.h>
11640 #endif
11641 $signal_t blech(x) int x; { exit(3); }
11642 EOCP
11643         $cat >> try.c <<'EOCP'
11644 int main()
11645 {
11646         int pd[2];
11647         int pu[2];
11648         char buf[1];
11649         char string[100];
11650
11651         pipe(pd);       /* Down: child -> parent */
11652         pipe(pu);       /* Up: parent -> child */
11653         if (0 != fork()) {
11654                 int ret;
11655                 close(pd[1]);   /* Parent reads from pd[0] */
11656                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11657 #ifdef F_SETFL
11658                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11659                         exit(1);
11660 #else
11661                 exit(4);
11662 #endif
11663                 signal(SIGALRM, blech);
11664                 alarm(5);
11665                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11666                         exit(2);
11667                 sprintf(string, "%d\n", ret);
11668                 write(2, string, strlen(string));
11669                 alarm(0);
11670 #ifdef EAGAIN
11671                 if (errno == EAGAIN) {
11672                         printf("EAGAIN\n");
11673                         goto ok;
11674                 }
11675 #endif
11676 #ifdef EWOULDBLOCK
11677                 if (errno == EWOULDBLOCK)
11678                         printf("EWOULDBLOCK\n");
11679 #endif
11680         ok:
11681                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11682                 sleep(2);                               /* Give it time to close our pipe */
11683                 alarm(5);
11684                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11685                 alarm(0);
11686                 sprintf(string, "%d\n", ret);
11687                 write(4, string, strlen(string));
11688                 exit(0);
11689         }
11690
11691         close(pd[0]);                   /* We write to pd[1] */
11692         close(pu[1]);                   /* We read from pu[0] */
11693         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11694         close(pd[1]);                   /* Pipe pd is now fully closed! */
11695         exit(0);                                /* Bye bye, thank you for playing! */
11696 }
11697 EOCP
11698         set try
11699         if eval $compile_ok; then
11700                 echo "$startsh" >mtry
11701                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11702                 chmod +x mtry
11703                 ./mtry >/dev/null 2>&1
11704                 case $? in
11705                 0) eagain=`$cat try.out`;;
11706                 1) echo "Could not perform non-blocking setting!";;
11707                 2) echo "I did a successful read() for something that was not there!";;
11708                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11709                 4) echo "Could not find F_SETFL!";;
11710                 *) echo "Something terribly wrong happened during testing.";;
11711                 esac
11712                 rd_nodata=`$cat try.ret`
11713                 echo "A read() system call with no data present returns $rd_nodata."
11714                 case "$rd_nodata" in
11715                 0|-1) ;;
11716                 *)
11717                         echo "(That's peculiar, fixing that to be -1.)"
11718                         rd_nodata=-1
11719                         ;;
11720                 esac
11721                 case "$eagain" in
11722                 '')
11723                         echo "Forcing errno EAGAIN on read() with no data available."
11724                         eagain=EAGAIN
11725                         ;;
11726                 *)
11727                         echo "Your read() sets errno to $eagain when no data is available."
11728                         ;;
11729                 esac
11730                 status=`$cat try.err`
11731                 case "$status" in
11732                 0) echo "And it correctly returns 0 to signal EOF.";;
11733                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11734                 *) echo "However, your read() returns '$status' on EOF??";;
11735                 esac
11736                 val="$define"
11737                 if test "$status" = "$rd_nodata"; then
11738                         echo "WARNING: you can't distinguish between EOF and no data!"
11739                         val="$undef"
11740                 fi
11741         else
11742                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11743                 eagain=EAGAIN
11744         fi
11745         set d_eofnblk
11746         eval $setvar
11747         ;;
11748 *)
11749         echo "Using $hint value $eagain."
11750         echo "Your read() returns $rd_nodata when no data is present."
11751         case "$d_eofnblk" in
11752         "$define") echo "And you can see EOF because read() returns 0.";;
11753         "$undef") echo "But you can't see EOF status from read() returned value.";;
11754         *)
11755                 echo "(Assuming you can't see EOF status from read anyway.)"
11756                 d_eofnblk=$undef
11757                 ;;
11758         esac
11759         ;;
11760 esac
11761 $rm -f try try.* .out core head.c mtry
11762
11763 : see if _ptr and _cnt from stdio act std
11764 echo " "
11765
11766 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11767         echo "(Looks like you have stdio.h from BSD.)"
11768         case "$stdio_ptr" in
11769         '') stdio_ptr='((fp)->_p)'
11770                 ptr_lval=$define
11771                 ;;
11772         *)      ptr_lval=$d_stdio_ptr_lval;;
11773         esac
11774         case "$stdio_cnt" in
11775         '') stdio_cnt='((fp)->_r)'
11776                 cnt_lval=$define
11777                 ;;
11778         *)      cnt_lval=$d_stdio_cnt_lval;;
11779         esac
11780         case "$stdio_base" in
11781         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11782         esac
11783         case "$stdio_bufsiz" in
11784         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11785         esac
11786 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11787         echo "(Looks like you have stdio.h from Linux.)"
11788         case "$stdio_ptr" in
11789         '') stdio_ptr='((fp)->_IO_read_ptr)'
11790                 ptr_lval=$define
11791                 ;;
11792         *)      ptr_lval=$d_stdio_ptr_lval;;
11793         esac
11794         case "$stdio_cnt" in
11795         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11796                 cnt_lval=$undef
11797                 ;;
11798         *)      cnt_lval=$d_stdio_cnt_lval;;
11799         esac
11800         case "$stdio_base" in
11801         '') stdio_base='((fp)->_IO_read_base)';;
11802         esac
11803         case "$stdio_bufsiz" in
11804         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11805         esac
11806 else
11807         case "$stdio_ptr" in
11808         '') stdio_ptr='((fp)->_ptr)'
11809                 ptr_lval=$define
11810                 ;;
11811         *)      ptr_lval=$d_stdio_ptr_lval;;
11812         esac
11813         case "$stdio_cnt" in
11814         '') stdio_cnt='((fp)->_cnt)'
11815                 cnt_lval=$define
11816                 ;;
11817         *)      cnt_lval=$d_stdio_cnt_lval;;
11818         esac
11819         case "$stdio_base" in
11820         '') stdio_base='((fp)->_base)';;
11821         esac
11822         case "$stdio_bufsiz" in
11823         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11824         esac
11825 fi
11826
11827 : test whether _ptr and _cnt really work
11828 echo "Checking how std your stdio is..." >&4
11829 $cat >try.c <<EOP
11830 #include <stdio.h>
11831 #$i_stdlib I_STDLIB
11832 #ifdef I_STDLIB
11833 #include <stdlib.h>
11834 #endif
11835 #define FILE_ptr(fp)    $stdio_ptr
11836 #define FILE_cnt(fp)    $stdio_cnt
11837 int main() {
11838         FILE *fp = fopen("try.c", "r");
11839         char c = getc(fp);
11840         if (
11841                 18 <= FILE_cnt(fp) &&
11842                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11843         )
11844                 exit(0);
11845         exit(1);
11846 }
11847 EOP
11848 val="$undef"
11849 set try
11850 if eval $compile && $to try.c; then
11851         if $run ./try; then
11852                 echo "Your stdio acts pretty std."
11853                 val="$define"
11854         else
11855                 echo "Your stdio isn't very std."
11856         fi
11857 else
11858         echo "Your stdio doesn't appear very std."
11859 fi
11860 $rm -f try.c try
11861
11862 # glibc 2.2.90 and above apparently change stdio streams so Perl's
11863 # direct buffer manipulation no longer works.  The Configure tests
11864 # should be changed to correctly detect this, but until then,
11865 # the following check should at least let perl compile and run.
11866 # (This quick fix should be updated before 5.8.1.)
11867 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
11868 # A. Dougherty, June 3, 2002.
11869 case "$d_gnulibc" in
11870 $define)
11871         case "$gnulibc_version" in
11872         2.[01]*)  ;;
11873         2.2) ;;
11874         2.2.[0-9]) ;;
11875         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
11876                 val="$undef"
11877                 ;;
11878         esac
11879         ;;
11880 esac
11881 set d_stdstdio
11882 eval $setvar
11883
11884 : Can _ptr be used as an lvalue?
11885 case "$d_stdstdio$ptr_lval" in
11886 $define$define) val=$define ;;
11887 *) val=$undef ;;
11888 esac
11889 set d_stdio_ptr_lval
11890 eval $setvar
11891
11892 : Can _cnt be used as an lvalue?
11893 case "$d_stdstdio$cnt_lval" in
11894 $define$define) val=$define ;;
11895 *) val=$undef ;;
11896 esac
11897 set d_stdio_cnt_lval
11898 eval $setvar
11899
11900
11901 : test whether setting _ptr sets _cnt as a side effect
11902 d_stdio_ptr_lval_sets_cnt="$undef"
11903 d_stdio_ptr_lval_nochange_cnt="$undef"
11904 case "$d_stdio_ptr_lval$d_stdstdio" in
11905 $define$define)
11906         echo "Checking to see what happens if we set the stdio ptr..." >&4
11907 $cat >try.c <<EOP
11908 #include <stdio.h>
11909 /* Can we scream? */
11910 /* Eat dust sed :-) */
11911 /* In the buffer space, no one can hear you scream. */
11912 #$i_stdlib I_STDLIB
11913 #ifdef I_STDLIB
11914 #include <stdlib.h>
11915 #endif
11916 #define FILE_ptr(fp)    $stdio_ptr
11917 #define FILE_cnt(fp)    $stdio_cnt
11918 #include <sys/types.h>
11919 int main() {
11920         FILE *fp = fopen("try.c", "r");
11921         int c;
11922         char *ptr;
11923         size_t cnt;
11924         if (!fp) {
11925             puts("Fail even to read");
11926             exit(1);
11927         }
11928         c = getc(fp); /* Read away the first # */
11929         if (c == EOF) {
11930             puts("Fail even to read");
11931             exit(1);
11932         }
11933         if (!(
11934                 18 <= FILE_cnt(fp) &&
11935                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11936         )) {
11937                 puts("Fail even to read");
11938                 exit (1);
11939         }
11940         ptr = (char*) FILE_ptr(fp);
11941         cnt = (size_t)FILE_cnt(fp);
11942
11943         FILE_ptr(fp) += 42;
11944
11945         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11946                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11947                 exit (1);
11948         }
11949         if (FILE_cnt(fp) <= 20) {
11950                 printf ("Fail (<20 chars to test)");
11951                 exit (1);
11952         }
11953         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11954                 puts("Fail compare");
11955                 exit (1);
11956         }
11957         if (cnt == FILE_cnt(fp)) {
11958                 puts("Pass_unchanged");
11959                 exit (0);
11960         }       
11961         if (FILE_cnt(fp) == (cnt - 42)) {
11962                 puts("Pass_changed");
11963                 exit (0);
11964         }
11965         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11966         return 1;
11967
11968 }
11969 EOP
11970         set try
11971         if eval $compile && $to try.c; then
11972                 case `$run ./try` in
11973                 Pass_changed)
11974                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11975                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11976                 Pass_unchanged)
11977                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11978                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11979                 Fail*)
11980                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11981                 *)
11982                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11983         esac
11984         else
11985                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11986         fi
11987         $rm -f try.c try
11988         ;;
11989 esac
11990
11991 : see if _base is also standard
11992 val="$undef"
11993 case "$d_stdstdio" in
11994 $define)
11995         $cat >try.c <<EOP
11996 #include <stdio.h>
11997 #$i_stdlib I_STDLIB
11998 #ifdef I_STDLIB
11999 #include <stdlib.h>
12000 #endif
12001 #define FILE_base(fp)   $stdio_base
12002 #define FILE_bufsiz(fp) $stdio_bufsiz
12003 int main() {
12004         FILE *fp = fopen("try.c", "r");
12005         char c = getc(fp);
12006         if (
12007                 19 <= FILE_bufsiz(fp) &&
12008                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12009         )
12010                 exit(0);
12011         exit(1);
12012 }
12013 EOP
12014         set try
12015         if eval $compile && $to try.c; then
12016                 if $run ./try; then
12017                         echo "And its _base field acts std."
12018                         val="$define"
12019                 else
12020                         echo "But its _base field isn't std."
12021                 fi
12022         else
12023                 echo "However, it seems to be lacking the _base field."
12024         fi
12025         $rm -f try.c try
12026         ;;
12027 esac
12028 set d_stdiobase
12029 eval $setvar
12030
12031 : see if fast_stdio exists
12032 val="$undef"
12033 case "$d_stdstdio:$d_stdio_ptr_lval" in
12034 "$define:$define")
12035         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12036         *$define*)
12037                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12038                 val="$define"
12039                 ;;
12040         esac
12041         ;;
12042 esac
12043 set d_faststdio
12044 eval $setvar
12045
12046
12047
12048 : see if fchdir exists
12049 set fchdir d_fchdir
12050 eval $inlibc
12051
12052 : see if fchmod exists
12053 set fchmod d_fchmod
12054 eval $inlibc
12055
12056 : see if fchown exists
12057 set fchown d_fchown
12058 eval $inlibc
12059
12060 : see if this is an fcntl system
12061 set fcntl d_fcntl
12062 eval $inlibc
12063
12064 echo " "
12065 : See if fcntl-based locking works.
12066 $cat >try.c <<EOCP
12067 #$i_stdlib I_STDLIB
12068 #ifdef I_STDLIB
12069 #include <stdlib.h>
12070 #endif
12071 #include <unistd.h>
12072 #include <fcntl.h>
12073 #include <signal.h>
12074 $signal_t blech(x) int x; { exit(3); }
12075 int main() {
12076 #if defined(F_SETLK) && defined(F_SETLKW)
12077      struct flock flock;
12078      int retval, fd;
12079      fd = open("try.c", O_RDONLY);
12080      flock.l_type = F_RDLCK;
12081      flock.l_whence = SEEK_SET;
12082      flock.l_start = flock.l_len = 0;
12083      signal(SIGALRM, blech);
12084      alarm(10);
12085      retval = fcntl(fd, F_SETLK, &flock);
12086      close(fd);
12087      (retval < 0 ? exit(2) : exit(0));
12088 #else
12089      exit(2);
12090 #endif
12091 }
12092 EOCP
12093 echo "Checking if fcntl-based file locking works... "
12094 case "$d_fcntl" in
12095 "$define")
12096         set try
12097         if eval $compile_ok; then
12098                 if $run ./try; then
12099                         echo "Yes, it seems to work."
12100                         val="$define"
12101                 else
12102                         echo "Nope, it didn't work."
12103                         val="$undef"
12104                         case "$?" in
12105                         3) $cat >&4 <<EOM
12106 ***
12107 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12108 *** This is (almost) impossible.
12109 *** If your NFS lock daemons are not feeling well, something like
12110 *** this may happen, please investigate.  Cannot continue, aborting.
12111 ***
12112 EOM
12113                                 exit 1
12114                                 ;;
12115                         esac
12116                 fi
12117         else
12118                 echo "I'm unable to compile the test program, so I'll assume not."
12119                 val="$undef"
12120         fi
12121         ;;
12122 *) val="$undef";
12123         echo "Nope, since you don't even have fcntl()."
12124         ;;
12125 esac
12126 set d_fcntl_can_lock
12127 eval $setvar
12128 $rm -f try*
12129
12130
12131 : check for fd_set items
12132 $cat <<EOM
12133
12134 Checking to see how well your C compiler handles fd_set and friends ...
12135 EOM
12136 $cat >try.c <<EOCP
12137 #$i_stdlib I_STDLIB
12138 #ifdef I_STDLIB
12139 #include <stdlib.h>
12140 #endif
12141 #$i_systime I_SYS_TIME
12142 #$i_sysselct I_SYS_SELECT
12143 #$d_socket HAS_SOCKET
12144 #include <sys/types.h>
12145 #ifdef HAS_SOCKET
12146 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12147 #endif
12148 #ifdef I_SYS_TIME
12149 #include <sys/time.h>
12150 #endif
12151 #ifdef I_SYS_SELECT
12152 #include <sys/select.h>
12153 #endif
12154 int main() {
12155         fd_set fds;
12156
12157 #ifdef TRYBITS
12158         if(fds.fds_bits);
12159 #endif
12160
12161 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12162         exit(0);
12163 #else
12164         exit(1);
12165 #endif
12166 }
12167 EOCP
12168 set try -DTRYBITS
12169 if eval $compile; then
12170         d_fds_bits="$define"
12171         d_fd_set="$define"
12172         echo "Well, your system knows about the normal fd_set typedef..." >&4
12173         if $run ./try; then
12174                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12175                 d_fd_macros="$define"
12176         else
12177                 $cat >&4 <<'EOM'
12178 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12179 EOM
12180                 d_fd_macros="$undef"
12181         fi
12182 else
12183         $cat <<'EOM'
12184 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12185 EOM
12186         set try
12187         if eval $compile; then
12188                 d_fds_bits="$undef"
12189                 d_fd_set="$define"
12190                 echo "Well, your system has some sort of fd_set available..." >&4
12191                 if $run ./try; then
12192                         echo "and you have the normal fd_set macros." >&4
12193                         d_fd_macros="$define"
12194                 else
12195                         $cat <<'EOM'
12196 but not the normal fd_set macros!  Gross!  More work for me...
12197 EOM
12198                         d_fd_macros="$undef"
12199                 fi
12200         else
12201         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12202                 d_fd_set="$undef"
12203                 d_fds_bits="$undef"
12204                 d_fd_macros="$undef"
12205         fi
12206 fi
12207 $rm -f try try.*
12208
12209 : see if fgetpos exists
12210 set fgetpos d_fgetpos
12211 eval $inlibc
12212
12213 : see if finite exists
12214 set finite d_finite
12215 eval $inlibc
12216
12217 : see if finitel exists
12218 set finitel d_finitel
12219 eval $inlibc
12220
12221 : see if flock exists
12222 set flock d_flock
12223 eval $inlibc
12224
12225 : see if prototype for flock is available
12226 echo " "
12227 set d_flockproto flock $i_sysfile sys/file.h
12228 eval $hasproto
12229
12230 : see if fork exists
12231 set fork d_fork
12232 eval $inlibc
12233
12234 : see if fp_class exists
12235 set fp_class d_fp_class
12236 eval $inlibc
12237
12238 : see if pathconf exists
12239 set pathconf d_pathconf
12240 eval $inlibc
12241
12242 : see if fpathconf exists
12243 set fpathconf d_fpathconf
12244 eval $inlibc
12245
12246 : see if fpclass exists
12247 set fpclass d_fpclass
12248 eval $inlibc
12249
12250 : see if fpclassify exists
12251 set fpclassify d_fpclassify
12252 eval $inlibc
12253
12254 : see if fpclassl exists
12255 set fpclassl d_fpclassl
12256 eval $inlibc
12257
12258
12259 : check for fpos64_t
12260 echo " "
12261 echo "Checking to see if you have fpos64_t..." >&4
12262 $cat >try.c <<EOCP
12263 #include <stdio.h>
12264 int main() { fpos64_t x = 7; }
12265 EOCP
12266 set try
12267 if eval $compile; then
12268         val="$define"
12269         echo "You have fpos64_t."
12270 else
12271         val="$undef"
12272         echo "You do not have fpos64_t."
12273         case "$fpossize" in
12274         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12275         esac
12276 fi
12277 $rm -f try.* try
12278 set d_fpos64_t
12279 eval $setvar
12280
12281 : see if frexpl exists
12282 set frexpl d_frexpl
12283 eval $inlibc
12284
12285 : see if this is a sys/param system
12286 set sys/param.h i_sysparam
12287 eval $inhdr
12288
12289 : see if this is a sys/mount.h system
12290 set sys/mount.h i_sysmount
12291 eval $inhdr
12292
12293
12294 echo " "
12295 echo "Checking to see if your system supports struct fs_data..." >&4
12296 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12297 eval $hasstruct
12298 case "$d_fs_data_s" in
12299 "$define")      echo "Yes, it does."   ;;
12300 *)              echo "No, it doesn't." ;;
12301 esac
12302
12303 : see if fseeko exists
12304 set fseeko d_fseeko
12305 eval $inlibc
12306 case "$longsize" in
12307 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12308 esac
12309
12310 : see if fsetpos exists
12311 set fsetpos d_fsetpos
12312 eval $inlibc
12313
12314
12315 : see if fstatfs exists
12316 set fstatfs d_fstatfs
12317 eval $inlibc
12318
12319
12320 : see if statvfs exists
12321 set statvfs d_statvfs
12322 eval $inlibc
12323
12324 : see if fstatvfs exists
12325 set fstatvfs d_fstatvfs
12326 eval $inlibc
12327
12328
12329 : see if fsync exists
12330 set fsync d_fsync
12331 eval $inlibc
12332
12333 : see if ftello exists
12334 set ftello d_ftello
12335 eval $inlibc
12336 case "$longsize" in
12337 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12338 esac
12339
12340 : see if getcwd exists
12341 set getcwd d_getcwd
12342 eval $inlibc
12343
12344 : see if getespwnam exists
12345 set getespwnam d_getespwnam
12346 eval $inlibc
12347
12348
12349 : see if getfsstat exists
12350 set getfsstat d_getfsstat
12351 eval $inlibc
12352
12353 : see if getgrent exists
12354 set getgrent d_getgrent
12355 eval $inlibc
12356
12357 : see if getgrent_r exists
12358 set getgrent_r d_getgrent_r
12359 eval $inlibc
12360 case "$d_getgrent_r" in
12361 "$define")
12362         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12363         case "$d_getgrent_r_proto:$usethreads" in
12364         ":define")      d_getgrent_r_proto=define
12365                 set d_getgrent_r_proto getgrent_r $hdrs
12366                 eval $hasproto ;;
12367         *)      ;;
12368         esac
12369         case "$d_getgrent_r_proto" in
12370         define)
12371         case "$getgrent_r_proto" in
12372         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12373         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12374         esac
12375         case "$getgrent_r_proto" in
12376         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12377         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12378         esac
12379         case "$getgrent_r_proto" in
12380         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12381         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12382         esac
12383         case "$getgrent_r_proto" in
12384         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12385         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12386         esac
12387         case "$getgrent_r_proto" in
12388         ''|0) try='int getgrent_r(struct group*, char*, int);'
12389         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12390         esac
12391         case "$getgrent_r_proto" in
12392         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12393         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12394         esac
12395         case "$getgrent_r_proto" in
12396         ''|0)   d_getgrent_r=undef
12397                 getgrent_r_proto=0
12398                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12399         * )     case "$getgrent_r_proto" in
12400                 REENTRANT_PROTO*) ;;
12401                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12402                 esac
12403                 echo "Prototype: $try" ;;
12404         esac
12405         ;;
12406         *)      case "$usethreads" in
12407                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12408                 esac
12409                 d_getgrent_r=undef
12410                 getgrent_r_proto=0
12411                 ;;
12412         esac
12413         ;;
12414 *)      getgrent_r_proto=0
12415         ;;
12416 esac
12417
12418 : see if getgrgid_r exists
12419 set getgrgid_r d_getgrgid_r
12420 eval $inlibc
12421 case "$d_getgrgid_r" in
12422 "$define")
12423         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12424         case "$d_getgrgid_r_proto:$usethreads" in
12425         ":define")      d_getgrgid_r_proto=define
12426                 set d_getgrgid_r_proto getgrgid_r $hdrs
12427                 eval $hasproto ;;
12428         *)      ;;
12429         esac
12430         case "$d_getgrgid_r_proto" in
12431         define)
12432         case "$getgrgid_r_proto" in
12433         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12434         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12435         esac
12436         case "$getgrgid_r_proto" in
12437         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12438         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12439         esac
12440         case "$getgrgid_r_proto" in
12441         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12442         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12443         esac
12444         case "$getgrgid_r_proto" in
12445         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12446         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12447         esac
12448         case "$getgrgid_r_proto" in
12449         ''|0)   d_getgrgid_r=undef
12450                 getgrgid_r_proto=0
12451                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12452         * )     case "$getgrgid_r_proto" in
12453                 REENTRANT_PROTO*) ;;
12454                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12455                 esac
12456                 echo "Prototype: $try" ;;
12457         esac
12458         ;;
12459         *)      case "$usethreads" in
12460                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12461                 esac
12462                 d_getgrgid_r=undef
12463                 getgrgid_r_proto=0
12464                 ;;
12465         esac
12466         ;;
12467 *)      getgrgid_r_proto=0
12468         ;;
12469 esac
12470
12471 : see if getgrnam_r exists
12472 set getgrnam_r d_getgrnam_r
12473 eval $inlibc
12474 case "$d_getgrnam_r" in
12475 "$define")
12476         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12477         case "$d_getgrnam_r_proto:$usethreads" in
12478         ":define")      d_getgrnam_r_proto=define
12479                 set d_getgrnam_r_proto getgrnam_r $hdrs
12480                 eval $hasproto ;;
12481         *)      ;;
12482         esac
12483         case "$d_getgrnam_r_proto" in
12484         define)
12485         case "$getgrnam_r_proto" in
12486         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12487         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12488         esac
12489         case "$getgrnam_r_proto" in
12490         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12491         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12492         esac
12493         case "$getgrnam_r_proto" in
12494         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12495         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12496         esac
12497         case "$getgrnam_r_proto" in
12498         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12499         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12500         esac
12501         case "$getgrnam_r_proto" in
12502         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12503         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12504         esac
12505         case "$getgrnam_r_proto" in
12506         ''|0)   d_getgrnam_r=undef
12507                 getgrnam_r_proto=0
12508                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12509         * )     case "$getgrnam_r_proto" in
12510                 REENTRANT_PROTO*) ;;
12511                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12512                 esac
12513                 echo "Prototype: $try" ;;
12514         esac
12515         ;;
12516         *)      case "$usethreads" in
12517                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12518                 esac
12519                 d_getgrnam_r=undef
12520                 getgrnam_r_proto=0
12521                 ;;
12522         esac
12523         ;;
12524 *)      getgrnam_r_proto=0
12525         ;;
12526 esac
12527
12528 : see if gethostbyaddr exists
12529 set gethostbyaddr d_gethbyaddr
12530 eval $inlibc
12531
12532 : see if gethostbyname exists
12533 set gethostbyname d_gethbyname
12534 eval $inlibc
12535
12536 : see if gethostent exists
12537 set gethostent d_gethent
12538 eval $inlibc
12539
12540 : see how we will look up host name
12541 echo " "
12542 call=''
12543 if set gethostname val -f d_gethname; eval $csym; $val; then
12544         echo 'gethostname() found.' >&4
12545         d_gethname="$define"
12546         call=gethostname
12547 fi
12548 if set uname val -f d_uname; eval $csym; $val; then
12549         if ./xenix; then
12550                 $cat <<'EOM'
12551 uname() was found, but you're running xenix, and older versions of xenix
12552 have a broken uname(). If you don't really know whether your xenix is old
12553 enough to have a broken system call, use the default answer.
12554
12555 EOM
12556                 dflt=y
12557                 case "$d_uname" in
12558                 "$define") dflt=n;;
12559                 esac
12560                 rp='Is your uname() broken?'
12561                 . ./myread
12562                 case "$ans" in
12563                 n*) d_uname="$define"; call=uname;;
12564                 esac
12565         else
12566                 echo 'uname() found.' >&4
12567                 d_uname="$define"
12568                 case "$call" in
12569                 '') call=uname ;;
12570                 esac
12571         fi
12572 fi
12573 case "$d_gethname" in
12574 '') d_gethname="$undef";;
12575 esac
12576 case "$d_uname" in
12577 '') d_uname="$undef";;
12578 esac
12579 case "$d_uname$d_gethname" in
12580 *define*)
12581         dflt=n
12582         cat <<EOM
12583  
12584 Every now and then someone has a $call() that lies about the hostname
12585 but can't be fixed for political or economic reasons.  If you wish, I can
12586 pretend $call() isn't there and maybe compute hostname at run-time
12587 thanks to the '$phostname' command.
12588
12589 EOM
12590         rp="Shall I ignore $call() from now on?"
12591         . ./myread
12592         case "$ans" in
12593         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12594         esac;;
12595 esac
12596 case "$phostname" in
12597 '') aphostname='';;
12598 *) case "$aphostname" in
12599         /*) ;;
12600         *) set X $phostname
12601                 shift
12602                 file=$1
12603                 shift
12604                 file=`./loc $file $file $pth`
12605                 aphostname=`echo $file $*`
12606                 ;;
12607         esac
12608         ;;
12609 esac
12610 case "$d_uname$d_gethname" in
12611 *define*) ;;
12612 *)
12613         case "$phostname" in
12614         '')
12615                 echo "There will be no way for $package to get your hostname." >&4;;
12616         *)
12617         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12618                 ;;
12619         esac;;
12620 esac
12621 case "$d_phostname" in
12622 '') d_phostname="$undef";;
12623 esac
12624
12625 : see if gethostbyaddr_r exists
12626 set gethostbyaddr_r d_gethostbyaddr_r
12627 eval $inlibc
12628 case "$d_gethostbyaddr_r" in
12629 "$define")
12630         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12631         case "$d_gethostbyaddr_r_proto:$usethreads" in
12632         ":define")      d_gethostbyaddr_r_proto=define
12633                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12634                 eval $hasproto ;;
12635         *)      ;;
12636         esac
12637         case "$d_gethostbyaddr_r_proto" in
12638         define)
12639         case "$gethostbyaddr_r_proto" in
12640         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12641         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12642         esac
12643         case "$gethostbyaddr_r_proto" in
12644         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12645         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12646         esac
12647         case "$gethostbyaddr_r_proto" in
12648         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12649         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12650         esac
12651         case "$gethostbyaddr_r_proto" in
12652         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12653         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12654         esac
12655         case "$gethostbyaddr_r_proto" in
12656         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12657         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12658         esac
12659         case "$gethostbyaddr_r_proto" in
12660         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12661         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12662         esac
12663         case "$gethostbyaddr_r_proto" in
12664         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12665         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12666         esac
12667         case "$gethostbyaddr_r_proto" in
12668         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12669         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12670         esac
12671         case "$gethostbyaddr_r_proto" in
12672         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12673         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12674         esac
12675         case "$gethostbyaddr_r_proto" in
12676         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12677         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12678         esac
12679         case "$gethostbyaddr_r_proto" in
12680         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12681         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12682         esac
12683         case "$gethostbyaddr_r_proto" in
12684         ''|0)   d_gethostbyaddr_r=undef
12685                 gethostbyaddr_r_proto=0
12686                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12687         * )     case "$gethostbyaddr_r_proto" in
12688                 REENTRANT_PROTO*) ;;
12689                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12690                 esac
12691                 echo "Prototype: $try" ;;
12692         esac
12693         ;;
12694         *)      case "$usethreads" in
12695                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12696                 esac
12697                 d_gethostbyaddr_r=undef
12698                 gethostbyaddr_r_proto=0
12699                 ;;
12700         esac
12701         ;;
12702 *)      gethostbyaddr_r_proto=0
12703         ;;
12704 esac
12705
12706 : see if gethostbyname_r exists
12707 set gethostbyname_r d_gethostbyname_r
12708 eval $inlibc
12709 case "$d_gethostbyname_r" in
12710 "$define")
12711         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12712         case "$d_gethostbyname_r_proto:$usethreads" in
12713         ":define")      d_gethostbyname_r_proto=define
12714                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12715                 eval $hasproto ;;
12716         *)      ;;
12717         esac
12718         case "$d_gethostbyname_r_proto" in
12719         define)
12720         case "$gethostbyname_r_proto" in
12721         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12722         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12723         esac
12724         case "$gethostbyname_r_proto" in
12725         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12726         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12727         esac
12728         case "$gethostbyname_r_proto" in
12729         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12730         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12731         esac
12732         case "$gethostbyname_r_proto" in
12733         ''|0)   d_gethostbyname_r=undef
12734                 gethostbyname_r_proto=0
12735                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12736         * )     case "$gethostbyname_r_proto" in
12737                 REENTRANT_PROTO*) ;;
12738                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12739                 esac
12740                 echo "Prototype: $try" ;;
12741         esac
12742         ;;
12743         *)      case "$usethreads" in
12744                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12745                 esac
12746                 d_gethostbyname_r=undef
12747                 gethostbyname_r_proto=0
12748                 ;;
12749         esac
12750         ;;
12751 *)      gethostbyname_r_proto=0
12752         ;;
12753 esac
12754
12755 : see if gethostent_r exists
12756 set gethostent_r d_gethostent_r
12757 eval $inlibc
12758 case "$d_gethostent_r" in
12759 "$define")
12760         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12761         case "$d_gethostent_r_proto:$usethreads" in
12762         ":define")      d_gethostent_r_proto=define
12763                 set d_gethostent_r_proto gethostent_r $hdrs
12764                 eval $hasproto ;;
12765         *)      ;;
12766         esac
12767         case "$d_gethostent_r_proto" in
12768         define)
12769         case "$gethostent_r_proto" in
12770         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12771         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12772         esac
12773         case "$gethostent_r_proto" in
12774         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12775         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12776         esac
12777         case "$gethostent_r_proto" in
12778         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12779         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12780         esac
12781         case "$gethostent_r_proto" in
12782         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12783         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12784         esac
12785         case "$gethostent_r_proto" in
12786         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12787         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12788         esac
12789         case "$gethostent_r_proto" in
12790         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12791         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12792         esac
12793         case "$gethostent_r_proto" in
12794         ''|0)   d_gethostent_r=undef
12795                 gethostent_r_proto=0
12796                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12797         * )     case "$gethostent_r_proto" in
12798                 REENTRANT_PROTO*) ;;
12799                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12800                 esac
12801                 echo "Prototype: $try" ;;
12802         esac
12803         ;;
12804         *)      case "$usethreads" in
12805                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12806                 esac
12807                 d_gethostent_r=undef
12808                 gethostent_r_proto=0
12809                 ;;
12810         esac
12811         ;;
12812 *)      gethostent_r_proto=0
12813         ;;
12814 esac
12815
12816 : see if prototypes for various gethostxxx netdb.h functions are available
12817 echo " "
12818 set d_gethostprotos gethostent $i_netdb netdb.h
12819 eval $hasproto
12820
12821 : see if getitimer exists
12822 set getitimer d_getitimer
12823 eval $inlibc
12824
12825 : see if getlogin exists
12826 set getlogin d_getlogin
12827 eval $inlibc
12828
12829 : see if getlogin_r exists
12830 set getlogin_r d_getlogin_r
12831 eval $inlibc
12832 case "$d_getlogin_r" in
12833 "$define")
12834         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12835         case "$d_getlogin_r_proto:$usethreads" in
12836         ":define")      d_getlogin_r_proto=define
12837                 set d_getlogin_r_proto getlogin_r $hdrs
12838                 eval $hasproto ;;
12839         *)      ;;
12840         esac
12841         case "$d_getlogin_r_proto" in
12842         define)
12843         case "$getlogin_r_proto" in
12844         ''|0) try='int getlogin_r(char*, size_t);'
12845         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12846         esac
12847         case "$getlogin_r_proto" in
12848         ''|0) try='int getlogin_r(char*, int);'
12849         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12850         esac
12851         case "$getlogin_r_proto" in
12852         ''|0) try='char* getlogin_r(char*, size_t);'
12853         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12854         esac
12855         case "$getlogin_r_proto" in
12856         ''|0) try='char* getlogin_r(char*, int);'
12857         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12858         esac
12859         case "$getlogin_r_proto" in
12860         ''|0)   d_getlogin_r=undef
12861                 getlogin_r_proto=0
12862                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12863         * )     case "$getlogin_r_proto" in
12864                 REENTRANT_PROTO*) ;;
12865                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12866                 esac
12867                 echo "Prototype: $try" ;;
12868         esac
12869         ;;
12870         *)      case "$usethreads" in
12871                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12872                 esac
12873                 d_getlogin_r=undef
12874                 getlogin_r_proto=0
12875                 ;;
12876         esac
12877         ;;
12878 *)      getlogin_r_proto=0
12879         ;;
12880 esac
12881
12882 : see if getmnt exists
12883 set getmnt d_getmnt
12884 eval $inlibc
12885
12886 : see if getmntent exists
12887 set getmntent d_getmntent
12888 eval $inlibc
12889
12890 : see if getnetbyaddr exists
12891 set getnetbyaddr d_getnbyaddr
12892 eval $inlibc
12893
12894 : see if getnetbyname exists
12895 set getnetbyname d_getnbyname
12896 eval $inlibc
12897
12898 : see if getnetent exists
12899 set getnetent d_getnent
12900 eval $inlibc
12901
12902 : see if getnetbyaddr_r exists
12903 set getnetbyaddr_r d_getnetbyaddr_r
12904 eval $inlibc
12905 case "$d_getnetbyaddr_r" in
12906 "$define")
12907         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12908         case "$d_getnetbyaddr_r_proto:$usethreads" in
12909         ":define")      d_getnetbyaddr_r_proto=define
12910                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12911                 eval $hasproto ;;
12912         *)      ;;
12913         esac
12914         case "$d_getnetbyaddr_r_proto" in
12915         define)
12916         case "$getnetbyaddr_r_proto" in
12917         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12918         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12919         esac
12920         case "$getnetbyaddr_r_proto" in
12921         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12922         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12923         esac
12924         case "$getnetbyaddr_r_proto" in
12925         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12926         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12927         esac
12928         case "$getnetbyaddr_r_proto" in
12929         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12930         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12931         esac
12932         case "$getnetbyaddr_r_proto" in
12933         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12934         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12935         esac
12936         case "$getnetbyaddr_r_proto" in
12937         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12938         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12939         esac
12940         case "$getnetbyaddr_r_proto" in
12941         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12942         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12943         esac
12944         case "$getnetbyaddr_r_proto" in
12945         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12946         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12947         esac
12948         case "$getnetbyaddr_r_proto" in
12949         ''|0)   d_getnetbyaddr_r=undef
12950                 getnetbyaddr_r_proto=0
12951                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12952         * )     case "$getnetbyaddr_r_proto" in
12953                 REENTRANT_PROTO*) ;;
12954                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12955                 esac
12956                 echo "Prototype: $try" ;;
12957         esac
12958         ;;
12959         *)      case "$usethreads" in
12960                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12961                 esac
12962                 d_getnetbyaddr_r=undef
12963                 getnetbyaddr_r_proto=0
12964                 ;;
12965         esac
12966         ;;
12967 *)      getnetbyaddr_r_proto=0
12968         ;;
12969 esac
12970
12971 : see if getnetbyname_r exists
12972 set getnetbyname_r d_getnetbyname_r
12973 eval $inlibc
12974 case "$d_getnetbyname_r" in
12975 "$define")
12976         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12977         case "$d_getnetbyname_r_proto:$usethreads" in
12978         ":define")      d_getnetbyname_r_proto=define
12979                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12980                 eval $hasproto ;;
12981         *)      ;;
12982         esac
12983         case "$d_getnetbyname_r_proto" in
12984         define)
12985         case "$getnetbyname_r_proto" in
12986         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12987         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12988         esac
12989         case "$getnetbyname_r_proto" in
12990         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12991         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12992         esac
12993         case "$getnetbyname_r_proto" in
12994         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12995         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12996         esac
12997         case "$getnetbyname_r_proto" in
12998         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12999         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13000         esac
13001         case "$getnetbyname_r_proto" in
13002         ''|0)   d_getnetbyname_r=undef
13003                 getnetbyname_r_proto=0
13004                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13005         * )     case "$getnetbyname_r_proto" in
13006                 REENTRANT_PROTO*) ;;
13007                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13008                 esac
13009                 echo "Prototype: $try" ;;
13010         esac
13011         ;;
13012         *)      case "$usethreads" in
13013                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13014                 esac
13015                 d_getnetbyname_r=undef
13016                 getnetbyname_r_proto=0
13017                 ;;
13018         esac
13019         ;;
13020 *)      getnetbyname_r_proto=0
13021         ;;
13022 esac
13023
13024 : see if getnetent_r exists
13025 set getnetent_r d_getnetent_r
13026 eval $inlibc
13027 case "$d_getnetent_r" in
13028 "$define")
13029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13030         case "$d_getnetent_r_proto:$usethreads" in
13031         ":define")      d_getnetent_r_proto=define
13032                 set d_getnetent_r_proto getnetent_r $hdrs
13033                 eval $hasproto ;;
13034         *)      ;;
13035         esac
13036         case "$d_getnetent_r_proto" in
13037         define)
13038         case "$getnetent_r_proto" in
13039         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13040         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13041         esac
13042         case "$getnetent_r_proto" in
13043         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13044         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13045         esac
13046         case "$getnetent_r_proto" in
13047         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13048         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13049         esac
13050         case "$getnetent_r_proto" in
13051         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13052         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13053         esac
13054         case "$getnetent_r_proto" in
13055         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13056         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13057         esac
13058         case "$getnetent_r_proto" in
13059         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13060         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13061         esac
13062         case "$getnetent_r_proto" in
13063         ''|0)   d_getnetent_r=undef
13064                 getnetent_r_proto=0
13065                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13066         * )     case "$getnetent_r_proto" in
13067                 REENTRANT_PROTO*) ;;
13068                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13069                 esac
13070                 echo "Prototype: $try" ;;
13071         esac
13072         ;;
13073         *)      case "$usethreads" in
13074                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13075                 esac
13076                 d_getnetent_r=undef
13077                 getnetent_r_proto=0
13078                 ;;
13079         esac
13080         ;;
13081 *)      getnetent_r_proto=0
13082         ;;
13083 esac
13084
13085 : see if prototypes for various getnetxxx netdb.h functions are available
13086 echo " "
13087 set d_getnetprotos getnetent $i_netdb netdb.h
13088 eval $hasproto
13089
13090 : see if getpagesize exists
13091 set getpagesize d_getpagsz
13092 eval $inlibc
13093
13094
13095 : see if getprotobyname exists
13096 set getprotobyname d_getpbyname
13097 eval $inlibc
13098
13099 : see if getprotobynumber exists
13100 set getprotobynumber d_getpbynumber
13101 eval $inlibc
13102
13103 : see if getprotoent exists
13104 set getprotoent d_getpent
13105 eval $inlibc
13106
13107 : see if getpgid exists
13108 set getpgid d_getpgid
13109 eval $inlibc
13110
13111 : see if getpgrp2 exists
13112 set getpgrp2 d_getpgrp2
13113 eval $inlibc
13114
13115 : see if getppid exists
13116 set getppid d_getppid
13117 eval $inlibc
13118
13119 : see if getpriority exists
13120 set getpriority d_getprior
13121 eval $inlibc
13122
13123 : see if getprotobyname_r exists
13124 set getprotobyname_r d_getprotobyname_r
13125 eval $inlibc
13126 case "$d_getprotobyname_r" in
13127 "$define")
13128         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13129         case "$d_getprotobyname_r_proto:$usethreads" in
13130         ":define")      d_getprotobyname_r_proto=define
13131                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13132                 eval $hasproto ;;
13133         *)      ;;
13134         esac
13135         case "$d_getprotobyname_r_proto" in
13136         define)
13137         case "$getprotobyname_r_proto" in
13138         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13139         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13140         esac
13141         case "$getprotobyname_r_proto" in
13142         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13143         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13144         esac
13145         case "$getprotobyname_r_proto" in
13146         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13147         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13148         esac
13149         case "$getprotobyname_r_proto" in
13150         ''|0)   d_getprotobyname_r=undef
13151                 getprotobyname_r_proto=0
13152                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13153         * )     case "$getprotobyname_r_proto" in
13154                 REENTRANT_PROTO*) ;;
13155                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13156                 esac
13157                 echo "Prototype: $try" ;;
13158         esac
13159         ;;
13160         *)      case "$usethreads" in
13161                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13162                 esac
13163                 d_getprotobyname_r=undef
13164                 getprotobyname_r_proto=0
13165                 ;;
13166         esac
13167         ;;
13168 *)      getprotobyname_r_proto=0
13169         ;;
13170 esac
13171
13172 : see if getprotobynumber_r exists
13173 set getprotobynumber_r d_getprotobynumber_r
13174 eval $inlibc
13175 case "$d_getprotobynumber_r" in
13176 "$define")
13177         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13178         case "$d_getprotobynumber_r_proto:$usethreads" in
13179         ":define")      d_getprotobynumber_r_proto=define
13180                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13181                 eval $hasproto ;;
13182         *)      ;;
13183         esac
13184         case "$d_getprotobynumber_r_proto" in
13185         define)
13186         case "$getprotobynumber_r_proto" in
13187         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13188         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13189         esac
13190         case "$getprotobynumber_r_proto" in
13191         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13192         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13193         esac
13194         case "$getprotobynumber_r_proto" in
13195         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13196         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13197         esac
13198         case "$getprotobynumber_r_proto" in
13199         ''|0)   d_getprotobynumber_r=undef
13200                 getprotobynumber_r_proto=0
13201                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13202         * )     case "$getprotobynumber_r_proto" in
13203                 REENTRANT_PROTO*) ;;
13204                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13205                 esac
13206                 echo "Prototype: $try" ;;
13207         esac
13208         ;;
13209         *)      case "$usethreads" in
13210                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13211                 esac
13212                 d_getprotobynumber_r=undef
13213                 getprotobynumber_r_proto=0
13214                 ;;
13215         esac
13216         ;;
13217 *)      getprotobynumber_r_proto=0
13218         ;;
13219 esac
13220
13221 : see if getprotoent_r exists
13222 set getprotoent_r d_getprotoent_r
13223 eval $inlibc
13224 case "$d_getprotoent_r" in
13225 "$define")
13226         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13227         case "$d_getprotoent_r_proto:$usethreads" in
13228         ":define")      d_getprotoent_r_proto=define
13229                 set d_getprotoent_r_proto getprotoent_r $hdrs
13230                 eval $hasproto ;;
13231         *)      ;;
13232         esac
13233         case "$d_getprotoent_r_proto" in
13234         define)
13235         case "$getprotoent_r_proto" in
13236         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13237         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13238         esac
13239         case "$getprotoent_r_proto" in
13240         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13241         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13242         esac
13243         case "$getprotoent_r_proto" in
13244         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13245         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13246         esac
13247         case "$getprotoent_r_proto" in
13248         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13249         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13250         esac
13251         case "$getprotoent_r_proto" in
13252         ''|0)   d_getprotoent_r=undef
13253                 getprotoent_r_proto=0
13254                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13255         * )     case "$getprotoent_r_proto" in
13256                 REENTRANT_PROTO*) ;;
13257                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13258                 esac
13259                 echo "Prototype: $try" ;;
13260         esac
13261         ;;
13262         *)      case "$usethreads" in
13263                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13264                 esac
13265                 d_getprotoent_r=undef
13266                 getprotoent_r_proto=0
13267                 ;;
13268         esac
13269         ;;
13270 *)      getprotoent_r_proto=0
13271         ;;
13272 esac
13273
13274 : see if prototypes for various getprotoxxx netdb.h functions are available
13275 echo " "
13276 set d_getprotoprotos getprotoent $i_netdb netdb.h
13277 eval $hasproto
13278
13279 : see if getprpwnam exists
13280 set getprpwnam d_getprpwnam
13281 eval $inlibc
13282
13283 : see if getpwent exists
13284 set getpwent d_getpwent
13285 eval $inlibc
13286
13287 : see if getpwent_r exists
13288 set getpwent_r d_getpwent_r
13289 eval $inlibc
13290 case "$d_getpwent_r" in
13291 "$define")
13292         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13293         case "$d_getpwent_r_proto:$usethreads" in
13294         ":define")      d_getpwent_r_proto=define
13295                 set d_getpwent_r_proto getpwent_r $hdrs
13296                 eval $hasproto ;;
13297         *)      ;;
13298         esac
13299         case "$d_getpwent_r_proto" in
13300         define)
13301         case "$getpwent_r_proto" in
13302         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13303         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13304         esac
13305         case "$getpwent_r_proto" in
13306         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13307         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13308         esac
13309         case "$getpwent_r_proto" in
13310         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13311         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13312         esac
13313         case "$getpwent_r_proto" in
13314         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13315         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13316         esac
13317         case "$getpwent_r_proto" in
13318         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13319         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13320         esac
13321         case "$getpwent_r_proto" in
13322         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13323         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13324         esac
13325         case "$getpwent_r_proto" in
13326         ''|0)   d_getpwent_r=undef
13327                 getpwent_r_proto=0
13328                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13329         * )     case "$getpwent_r_proto" in
13330                 REENTRANT_PROTO*) ;;
13331                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13332                 esac
13333                 echo "Prototype: $try" ;;
13334         esac
13335         ;;
13336         *)      case "$usethreads" in
13337                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13338                 esac
13339                 d_getpwent_r=undef
13340                 getpwent_r_proto=0
13341                 ;;
13342         esac
13343         ;;
13344 *)      getpwent_r_proto=0
13345         ;;
13346 esac
13347
13348 : see if getpwnam_r exists
13349 set getpwnam_r d_getpwnam_r
13350 eval $inlibc
13351 case "$d_getpwnam_r" in
13352 "$define")
13353         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13354         case "$d_getpwnam_r_proto:$usethreads" in
13355         ":define")      d_getpwnam_r_proto=define
13356                 set d_getpwnam_r_proto getpwnam_r $hdrs
13357                 eval $hasproto ;;
13358         *)      ;;
13359         esac
13360         case "$d_getpwnam_r_proto" in
13361         define)
13362         case "$getpwnam_r_proto" in
13363         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13364         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13365         esac
13366         case "$getpwnam_r_proto" in
13367         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13368         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13369         esac
13370         case "$getpwnam_r_proto" in
13371         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13372         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13373         esac
13374         case "$getpwnam_r_proto" in
13375         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13376         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13377         esac
13378         case "$getpwnam_r_proto" in
13379         ''|0)   d_getpwnam_r=undef
13380                 getpwnam_r_proto=0
13381                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13382         * )     case "$getpwnam_r_proto" in
13383                 REENTRANT_PROTO*) ;;
13384                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13385                 esac
13386                 echo "Prototype: $try" ;;
13387         esac
13388         ;;
13389         *)      case "$usethreads" in
13390                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13391                 esac
13392                 d_getpwnam_r=undef
13393                 getpwnam_r_proto=0
13394                 ;;
13395         esac
13396         ;;
13397 *)      getpwnam_r_proto=0
13398         ;;
13399 esac
13400
13401 : see if getpwuid_r exists
13402 set getpwuid_r d_getpwuid_r
13403 eval $inlibc
13404 case "$d_getpwuid_r" in
13405 "$define")
13406         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13407         case "$d_getpwuid_r_proto:$usethreads" in
13408         ":define")      d_getpwuid_r_proto=define
13409                 set d_getpwuid_r_proto getpwuid_r $hdrs
13410                 eval $hasproto ;;
13411         *)      ;;
13412         esac
13413         case "$d_getpwuid_r_proto" in
13414         define)
13415         case "$getpwuid_r_proto" in
13416         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13417         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13418         esac
13419         case "$getpwuid_r_proto" in
13420         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13421         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13422         esac
13423         case "$getpwuid_r_proto" in
13424         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13425         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13426         esac
13427         case "$getpwuid_r_proto" in
13428         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13429         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13430         esac
13431         case "$getpwuid_r_proto" in
13432         ''|0)   d_getpwuid_r=undef
13433                 getpwuid_r_proto=0
13434                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13435         * )     case "$getpwuid_r_proto" in
13436                 REENTRANT_PROTO*) ;;
13437                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13438                 esac
13439                 echo "Prototype: $try" ;;
13440         esac
13441         ;;
13442         *)      case "$usethreads" in
13443                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13444                 esac
13445                 d_getpwuid_r=undef
13446                 getpwuid_r_proto=0
13447                 ;;
13448         esac
13449         ;;
13450 *)      getpwuid_r_proto=0
13451         ;;
13452 esac
13453
13454
13455 : see if getservbyname exists
13456 set getservbyname d_getsbyname
13457 eval $inlibc
13458
13459 : see if getservbyport exists
13460 set getservbyport d_getsbyport
13461 eval $inlibc
13462
13463 : see if getservent exists
13464 set getservent d_getsent
13465 eval $inlibc
13466
13467 : see if getservbyname_r exists
13468 set getservbyname_r d_getservbyname_r
13469 eval $inlibc
13470 case "$d_getservbyname_r" in
13471 "$define")
13472         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13473         case "$d_getservbyname_r_proto:$usethreads" in
13474         ":define")      d_getservbyname_r_proto=define
13475                 set d_getservbyname_r_proto getservbyname_r $hdrs
13476                 eval $hasproto ;;
13477         *)      ;;
13478         esac
13479         case "$d_getservbyname_r_proto" in
13480         define)
13481         case "$getservbyname_r_proto" in
13482         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13483         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13484         esac
13485         case "$getservbyname_r_proto" in
13486         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13487         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13488         esac
13489         case "$getservbyname_r_proto" in
13490         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13491         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13492         esac
13493         case "$getservbyname_r_proto" in
13494         ''|0)   d_getservbyname_r=undef
13495                 getservbyname_r_proto=0
13496                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13497         * )     case "$getservbyname_r_proto" in
13498                 REENTRANT_PROTO*) ;;
13499                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13500                 esac
13501                 echo "Prototype: $try" ;;
13502         esac
13503         ;;
13504         *)      case "$usethreads" in
13505                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13506                 esac
13507                 d_getservbyname_r=undef
13508                 getservbyname_r_proto=0
13509                 ;;
13510         esac
13511         ;;
13512 *)      getservbyname_r_proto=0
13513         ;;
13514 esac
13515
13516 : see if getservbyport_r exists
13517 set getservbyport_r d_getservbyport_r
13518 eval $inlibc
13519 case "$d_getservbyport_r" in
13520 "$define")
13521         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13522         case "$d_getservbyport_r_proto:$usethreads" in
13523         ":define")      d_getservbyport_r_proto=define
13524                 set d_getservbyport_r_proto getservbyport_r $hdrs
13525                 eval $hasproto ;;
13526         *)      ;;
13527         esac
13528         case "$d_getservbyport_r_proto" in
13529         define)
13530         case "$getservbyport_r_proto" in
13531         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13532         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13533         esac
13534         case "$getservbyport_r_proto" in
13535         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13536         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13537         esac
13538         case "$getservbyport_r_proto" in
13539         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13540         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13541         esac
13542         case "$getservbyport_r_proto" in
13543         ''|0)   d_getservbyport_r=undef
13544                 getservbyport_r_proto=0
13545                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13546         * )     case "$getservbyport_r_proto" in
13547                 REENTRANT_PROTO*) ;;
13548                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13549                 esac
13550                 echo "Prototype: $try" ;;
13551         esac
13552         ;;
13553         *)      case "$usethreads" in
13554                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13555                 esac
13556                 d_getservbyport_r=undef
13557                 getservbyport_r_proto=0
13558                 ;;
13559         esac
13560         ;;
13561 *)      getservbyport_r_proto=0
13562         ;;
13563 esac
13564
13565 : see if getservent_r exists
13566 set getservent_r d_getservent_r
13567 eval $inlibc
13568 case "$d_getservent_r" in
13569 "$define")
13570         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13571         case "$d_getservent_r_proto:$usethreads" in
13572         ":define")      d_getservent_r_proto=define
13573                 set d_getservent_r_proto getservent_r $hdrs
13574                 eval $hasproto ;;
13575         *)      ;;
13576         esac
13577         case "$d_getservent_r_proto" in
13578         define)
13579         case "$getservent_r_proto" in
13580         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13581         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13582         esac
13583         case "$getservent_r_proto" in
13584         ''|0) try='int getservent_r(struct servent*, char*, int);'
13585         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13586         esac
13587         case "$getservent_r_proto" in
13588         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13589         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13590         esac
13591         case "$getservent_r_proto" in
13592         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13593         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13594         esac
13595         case "$getservent_r_proto" in
13596         ''|0)   d_getservent_r=undef
13597                 getservent_r_proto=0
13598                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13599         * )     case "$getservent_r_proto" in
13600                 REENTRANT_PROTO*) ;;
13601                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13602                 esac
13603                 echo "Prototype: $try" ;;
13604         esac
13605         ;;
13606         *)      case "$usethreads" in
13607                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13608                 esac
13609                 d_getservent_r=undef
13610                 getservent_r_proto=0
13611                 ;;
13612         esac
13613         ;;
13614 *)      getservent_r_proto=0
13615         ;;
13616 esac
13617
13618 : see if prototypes for various getservxxx netdb.h functions are available
13619 echo " "
13620 set d_getservprotos getservent $i_netdb netdb.h
13621 eval $hasproto
13622
13623 : see if getspnam exists
13624 set getspnam d_getspnam
13625 eval $inlibc
13626
13627 : see if this is a shadow.h system
13628 set shadow.h i_shadow
13629 eval $inhdr
13630
13631 : see if getspnam_r exists
13632 set getspnam_r d_getspnam_r
13633 eval $inlibc
13634 case "$d_getspnam_r" in
13635 "$define")
13636         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13637         case "$d_getspnam_r_proto:$usethreads" in
13638         ":define")      d_getspnam_r_proto=define
13639                 set d_getspnam_r_proto getspnam_r $hdrs
13640                 eval $hasproto ;;
13641         *)      ;;
13642         esac
13643         case "$d_getspnam_r_proto" in
13644         define)
13645         case "$getspnam_r_proto" in
13646         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13647         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13648         esac
13649         case "$getspnam_r_proto" in
13650         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13651         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13652         esac
13653         case "$getspnam_r_proto" in
13654         ''|0)   d_getspnam_r=undef
13655                 getspnam_r_proto=0
13656                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13657         * )     case "$getspnam_r_proto" in
13658                 REENTRANT_PROTO*) ;;
13659                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13660                 esac
13661                 echo "Prototype: $try" ;;
13662         esac
13663         ;;
13664         *)      case "$usethreads" in
13665                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13666                 esac
13667                 d_getspnam_r=undef
13668                 getspnam_r_proto=0
13669                 ;;
13670         esac
13671         ;;
13672 *)      getspnam_r_proto=0
13673         ;;
13674 esac
13675
13676 : see if gettimeofday or ftime exists
13677 set gettimeofday d_gettimeod
13678 eval $inlibc
13679 case "$d_gettimeod" in
13680 "$undef")
13681         set ftime d_ftime 
13682         eval $inlibc
13683         ;;
13684 *)
13685         val="$undef"; set d_ftime; eval $setvar
13686         ;;
13687 esac
13688 case "$d_gettimeod$d_ftime" in
13689 "$undef$undef")
13690         echo " "
13691         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13692         ;;
13693 esac
13694
13695 : see if gmtime_r exists
13696 set gmtime_r d_gmtime_r
13697 eval $inlibc
13698 case "$d_gmtime_r" in
13699 "$define")
13700         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13701         case "$d_gmtime_r_proto:$usethreads" in
13702         ":define")      d_gmtime_r_proto=define
13703                 set d_gmtime_r_proto gmtime_r $hdrs
13704                 eval $hasproto ;;
13705         *)      ;;
13706         esac
13707         case "$d_gmtime_r_proto" in
13708         define)
13709         case "$gmtime_r_proto" in
13710         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13711         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13712         esac
13713         case "$gmtime_r_proto" in
13714         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13715         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13716         esac
13717         case "$gmtime_r_proto" in
13718         ''|0)   d_gmtime_r=undef
13719                 gmtime_r_proto=0
13720                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13721         * )     case "$gmtime_r_proto" in
13722                 REENTRANT_PROTO*) ;;
13723                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13724                 esac
13725                 echo "Prototype: $try" ;;
13726         esac
13727         ;;
13728         *)      case "$usethreads" in
13729                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13730                 esac
13731                 d_gmtime_r=undef
13732                 gmtime_r_proto=0
13733                 ;;
13734         esac
13735         ;;
13736 *)      gmtime_r_proto=0
13737         ;;
13738 esac
13739
13740 : see if hasmntopt exists
13741 set hasmntopt d_hasmntopt
13742 eval $inlibc
13743
13744 : see if this is a netinet/in.h or sys/in.h system
13745 set netinet/in.h i_niin sys/in.h i_sysin
13746 eval $inhdr
13747
13748 : see if arpa/inet.h has to be included
13749 set arpa/inet.h i_arpainet
13750 eval $inhdr
13751
13752 : see if htonl --and friends-- exists
13753 val=''
13754 set htonl val
13755 eval $inlibc
13756
13757 : Maybe they are macros.
13758 case "$val" in
13759 $undef)
13760         $cat >htonl.c <<EOM
13761 #include <stdio.h>
13762 #include <sys/types.h>
13763 #$i_niin I_NETINET_IN
13764 #$i_sysin I_SYS_IN
13765 #$i_arpainet I_ARPA_INET
13766 #ifdef I_NETINET_IN
13767 #include <netinet/in.h>
13768 #endif
13769 #ifdef I_SYS_IN
13770 #include <sys/in.h>
13771 #endif
13772 #ifdef I_ARPA_INET
13773 #include <arpa/inet.h>
13774 #endif
13775 #ifdef htonl
13776 printf("Defined as a macro.");
13777 #endif
13778 EOM
13779         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13780         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13781                 val="$define"
13782                 echo "But it seems to be defined as a macro." >&4
13783         fi
13784         $rm -f htonl.?
13785         ;;
13786 esac
13787 set d_htonl
13788 eval $setvar
13789
13790 : see if ilogbl exists
13791 set ilogbl d_ilogbl
13792 eval $inlibc
13793
13794 : index or strchr
13795 echo " "
13796 if set index val -f; eval $csym; $val; then
13797         if set strchr val -f d_strchr; eval $csym; $val; then
13798                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13799                         val="$define"
13800                         vali="$undef"
13801                         echo "strchr() found." >&4
13802                 else
13803                         val="$undef"
13804                         vali="$define"
13805                         echo "index() found." >&4
13806                 fi
13807         else
13808                 val="$undef"
13809                 vali="$define"
13810                 echo "index() found." >&4
13811         fi
13812 else
13813         if set strchr val -f d_strchr; eval $csym; $val; then
13814                 val="$define"
13815                 vali="$undef"
13816                 echo "strchr() found." >&4
13817         else
13818                 echo "No index() or strchr() found!" >&4
13819                 val="$undef"
13820                 vali="$undef"
13821         fi
13822 fi
13823 set d_strchr; eval $setvar
13824 val="$vali"
13825 set d_index; eval $setvar
13826
13827 : check whether inet_aton exists
13828 set inet_aton d_inetaton
13829 eval $inlibc
13830
13831 : Look for isascii
13832 echo " "
13833 $cat >isascii.c <<EOCP
13834 #include <stdio.h>
13835 #include <ctype.h>
13836 #$i_stdlib I_STDLIB
13837 #ifdef I_STDLIB
13838 #include <stdlib.h>
13839 #endif
13840 int main() {
13841         int c = 'A';
13842         if (isascii(c))
13843                 exit(0);
13844         else
13845                 exit(1);
13846 }
13847 EOCP
13848 set isascii
13849 if eval $compile; then
13850         echo "isascii() found." >&4
13851         val="$define"
13852 else
13853         echo "isascii() NOT found." >&4
13854         val="$undef"
13855 fi
13856 set d_isascii
13857 eval $setvar
13858 $rm -f isascii*
13859
13860 : see if isfinite exists
13861 set isfinite d_isfinite
13862 eval $inlibc
13863
13864 : see if isinf exists
13865 set isinf d_isinf
13866 eval $inlibc
13867
13868 : see if isnan exists
13869 set isnan d_isnan
13870 eval $inlibc
13871
13872 : see if isnanl exists
13873 set isnanl d_isnanl
13874 eval $inlibc
13875
13876 : see if killpg exists
13877 set killpg d_killpg
13878 eval $inlibc
13879
13880 : see if lchown exists
13881 echo " "
13882 $cat > try.c <<'EOCP'
13883 /* System header to define __stub macros and hopefully few prototypes,
13884     which can conflict with char lchown(); below.  */
13885 #include <assert.h>
13886 /* Override any gcc2 internal prototype to avoid an error.  */
13887 /* We use char because int might match the return type of a gcc2
13888    builtin and then its argument prototype would still apply.  */
13889 char lchown();
13890 int main() {
13891     /*  The GNU C library defines this for functions which it implements
13892         to always fail with ENOSYS.  Some functions are actually named
13893         something starting with __ and the normal name is an alias.  */
13894 #if defined (__stub_lchown) || defined (__stub___lchown)
13895 choke me
13896 #else
13897 lchown();
13898 #endif
13899 ; return 0; }
13900 EOCP
13901 set try
13902 if eval $compile; then
13903     $echo "lchown() found." >&4
13904     val="$define"
13905 else
13906     $echo "lchown() NOT found." >&4
13907     val="$undef"
13908 fi
13909 set d_lchown
13910 eval $setvar
13911
13912 : See if number of significant digits in a double precision number is known
13913 echo " "
13914 $cat >ldbl_dig.c <<EOM
13915 #$i_limits I_LIMITS
13916 #$i_float I_FLOAT
13917 #ifdef I_LIMITS
13918 #include <limits.h>
13919 #endif
13920 #ifdef I_FLOAT
13921 #include <float.h>
13922 #endif
13923 #ifdef LDBL_DIG
13924 printf("Contains LDBL_DIG");
13925 #endif
13926 EOM
13927 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13928 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13929         echo "LDBL_DIG found." >&4
13930         val="$define"
13931 else
13932         echo "LDBL_DIG NOT found." >&4
13933         val="$undef"
13934 fi
13935 $rm -f ldbl_dig.?
13936 set d_ldbl_dig
13937 eval $setvar
13938
13939 : see if link exists
13940 set link d_link
13941 eval $inlibc
13942
13943 : see if localtime_r exists
13944 set localtime_r d_localtime_r
13945 eval $inlibc
13946 case "$d_localtime_r" in
13947 "$define")
13948         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13949         case "$d_localtime_r_proto:$usethreads" in
13950         ":define")      d_localtime_r_proto=define
13951                 set d_localtime_r_proto localtime_r $hdrs
13952                 eval $hasproto ;;
13953         *)      ;;
13954         esac
13955         case "$d_localtime_r_proto" in
13956         define)
13957         case "$localtime_r_proto" in
13958         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13959         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13960         esac
13961         case "$localtime_r_proto" in
13962         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13963         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13964         esac
13965         case "$localtime_r_proto" in
13966         ''|0)   d_localtime_r=undef
13967                 localtime_r_proto=0
13968                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13969         * )     case "$localtime_r_proto" in
13970                 REENTRANT_PROTO*) ;;
13971                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13972                 esac
13973                 echo "Prototype: $try" ;;
13974         esac
13975         ;;
13976         *)      case "$usethreads" in
13977                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13978                 esac
13979                 d_localtime_r=undef
13980                 localtime_r_proto=0
13981                 ;;
13982         esac
13983         ;;
13984 *)      localtime_r_proto=0
13985         ;;
13986 esac
13987
13988 : see if localeconv exists
13989 set localeconv d_locconv
13990 eval $inlibc
13991
13992 : see if lockf exists
13993 set lockf d_lockf
13994 eval $inlibc
13995
13996 : see if prototype for lseek is available
13997 echo " "
13998 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13999 eval $hasproto
14000
14001 : see if lstat exists
14002 set lstat d_lstat
14003 eval $inlibc
14004
14005 : see if madvise exists
14006 set madvise d_madvise
14007 eval $inlibc
14008
14009 : see if mblen exists
14010 set mblen d_mblen
14011 eval $inlibc
14012
14013 : see if mbstowcs exists
14014 set mbstowcs d_mbstowcs
14015 eval $inlibc
14016
14017 : see if mbtowc exists
14018 set mbtowc d_mbtowc
14019 eval $inlibc
14020
14021 : see if memchr exists
14022 set memchr d_memchr
14023 eval $inlibc
14024
14025 : see if memcmp exists
14026 set memcmp d_memcmp
14027 eval $inlibc
14028
14029 : see if memcpy exists
14030 set memcpy d_memcpy
14031 eval $inlibc
14032
14033 : see if memmove exists
14034 set memmove d_memmove
14035 eval $inlibc
14036
14037 : see if memset exists
14038 set memset d_memset
14039 eval $inlibc
14040
14041 : see if mkdir exists
14042 set mkdir d_mkdir
14043 eval $inlibc
14044
14045 : see if mkdtemp exists
14046 set mkdtemp d_mkdtemp
14047 eval $inlibc
14048
14049 : see if mkfifo exists
14050 set mkfifo d_mkfifo
14051 eval $inlibc
14052
14053 : see if mkstemp exists
14054 set mkstemp d_mkstemp
14055 eval $inlibc
14056
14057 : see if mkstemps exists
14058 set mkstemps d_mkstemps
14059 eval $inlibc
14060
14061 : see if mktime exists
14062 set mktime d_mktime
14063 eval $inlibc
14064
14065 : see if this is a sys/mman.h system
14066 set sys/mman.h i_sysmman
14067 eval $inhdr
14068
14069 : see if mmap exists
14070 set mmap d_mmap
14071 eval $inlibc
14072 : see what shmat returns
14073 : default to something harmless
14074 mmaptype='void *'
14075 case "$i_sysmman$d_mmap" in
14076 "$define$define")
14077         $cat >mmap.c <<'END'
14078 #include <sys/mman.h>
14079 void *mmap();
14080 END
14081         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14082                 mmaptype='void *'
14083         else
14084                 mmaptype='caddr_t'
14085         fi
14086         echo "and it returns ($mmaptype)." >&4
14087         ;;
14088 esac
14089
14090
14091
14092 : see if sqrtl exists
14093 set sqrtl d_sqrtl
14094 eval $inlibc
14095
14096 : see if scalbnl exists
14097 set scalbnl d_scalbnl
14098 eval $inlibc
14099
14100 : see if modfl exists
14101 set modfl d_modfl
14102 eval $inlibc
14103
14104 : see if prototype for modfl is available
14105 echo " "
14106 set d_modflproto modfl math.h
14107 eval $hasproto
14108
14109 d_modfl_pow32_bug="$undef"
14110
14111 case "$d_longdbl$d_modfl" in
14112 $define$define)
14113         $cat <<EOM
14114 Checking to see whether your modfl() is okay for large values...
14115 EOM
14116 $cat >try.c <<EOCP
14117 #include <math.h> 
14118 #include <stdio.h>
14119 EOCP
14120 if $test "X$d_modflproto" != "X$define"; then
14121         $cat >>try.c <<EOCP
14122 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14123 long double modfl (long double, long double *);
14124 EOCP
14125 fi
14126 $cat >>try.c <<EOCP
14127 int main() {
14128     long double nv = 4294967303.15;
14129     long double v, w;
14130     v = modfl(nv, &w);         
14131 #ifdef __GLIBC__
14132     printf("glibc");
14133 #endif
14134     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14135     return 0;
14136 }
14137 EOCP
14138         case "$osname:$gccversion" in
14139         aix:)   saveccflags="$ccflags"
14140                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14141         esac
14142         set try
14143         if eval $compile; then
14144                 foo=`$run ./try`
14145                 case "$foo" in
14146                 *" 4294967303.150000 1.150000 4294967302.000000")
14147                         echo >&4 "Your modfl() is broken for large values."
14148                         d_modfl_pow32_bug="$define"
14149                         case "$foo" in
14150                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14151                         ;;
14152                         esac
14153                         ;;
14154                 *" 4294967303.150000 0.150000 4294967303.000000")
14155                         echo >&4 "Your modfl() seems okay for large values."
14156                         ;;
14157                 *)      echo >&4 "I don't understand your modfl() at all."
14158                         d_modfl="$undef"
14159                         ;;
14160                 esac
14161                 $rm -f try.* try core core.try.*
14162         else
14163                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14164                 d_modfl="$undef"
14165         fi
14166         case "$osname:$gccversion" in
14167         aix:)   ccflags="$saveccflags" ;; # restore
14168         esac
14169         ;;
14170 esac
14171
14172 if $test "$uselongdouble" = "$define"; then
14173     message=""
14174     if $test "$d_sqrtl" != "$define"; then
14175         message="$message sqrtl"
14176     fi
14177     if $test "$d_modfl" != "$define"; then
14178         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14179             echo "You have both aintl and copysignl, so I can emulate modfl."
14180         else
14181             message="$message modfl"
14182         fi
14183     fi
14184     if $test "$d_frexpl" != "$define"; then
14185         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14186             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14187         else
14188             message="$message frexpl"
14189         fi
14190     fi
14191
14192     if $test "$message" != ""; then
14193         $cat <<EOM >&4
14194
14195 *** You requested the use of long doubles but you do not seem to have
14196 *** the following mathematical functions needed for long double support:
14197 ***    $message
14198 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14199 *** Cannot continue, aborting.
14200
14201 EOM
14202
14203         exit 1
14204     fi
14205 fi
14206
14207 : see if mprotect exists
14208 set mprotect d_mprotect
14209 eval $inlibc
14210
14211 : see if msgctl exists
14212 set msgctl d_msgctl
14213 eval $inlibc
14214
14215 : see if msgget exists
14216 set msgget d_msgget
14217 eval $inlibc
14218
14219 : see if msgsnd exists
14220 set msgsnd d_msgsnd
14221 eval $inlibc
14222
14223 : see if msgrcv exists
14224 set msgrcv d_msgrcv
14225 eval $inlibc
14226
14227 : see how much of the 'msg*(2)' library is present.
14228 h_msg=true
14229 echo " "
14230 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14231 *"$undef"*) h_msg=false;;
14232 esac
14233 case "$osname" in
14234 freebsd)
14235     case "`ipcs 2>&1`" in
14236     "SVID messages"*"not configured"*)
14237         echo "Your $osname does not have the msg*(2) configured." >&4
14238         h_msg=false
14239         val="$undef"
14240         set msgctl d_msgctl
14241         eval $setvar
14242         set msgget d_msgget
14243         eval $setvar
14244         set msgsnd d_msgsnd
14245         eval $setvar
14246         set msgrcv d_msgrcv
14247         eval $setvar
14248         ;;
14249     esac
14250     ;;
14251 esac
14252 : we could also check for sys/ipc.h ...
14253 if $h_msg && $test `./findhdr sys/msg.h`; then
14254         echo "You have the full msg*(2) library." >&4
14255         val="$define"
14256 else
14257         echo "You don't have the full msg*(2) library." >&4
14258         val="$undef"
14259 fi
14260 set d_msg
14261 eval $setvar
14262
14263
14264 echo " "
14265 echo "Checking to see if your system supports struct msghdr..." >&4
14266 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14267 eval $hasstruct
14268 case "$d_msghdr_s" in
14269 "$define")      echo "Yes, it does."   ;;
14270 *)              echo "No, it doesn't." ;;
14271 esac
14272
14273
14274 : see if msync exists
14275 set msync d_msync
14276 eval $inlibc
14277
14278 : see if munmap exists
14279 set munmap d_munmap
14280 eval $inlibc
14281
14282 : see if nice exists
14283 set nice d_nice
14284 eval $inlibc
14285
14286 : see if this is a langinfo.h system
14287 set langinfo.h i_langinfo
14288 eval $inhdr
14289
14290 : see if nl_langinfo exists
14291 set nl_langinfo d_nl_langinfo
14292 eval $inlibc
14293
14294 : check for length of character
14295 echo " "
14296 case "$charsize" in
14297 '')
14298         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14299         $cat >try.c <<EOCP
14300 #include <stdio.h>
14301 #$i_stdlib I_STDLIB
14302 #ifdef I_STDLIB
14303 #include <stdlib.h>
14304 #endif
14305 int main()
14306 {
14307     printf("%d\n", (int)sizeof(char));
14308     exit(0);
14309 }
14310 EOCP
14311         set try
14312         if eval $compile_ok; then
14313                 dflt=`$run ./try`
14314         else
14315                 dflt='1'
14316                 echo "(I can't seem to compile the test program.  Guessing...)"
14317         fi
14318         ;;
14319 *)
14320         dflt="$charsize"
14321         ;;
14322 esac
14323 rp="What is the size of a character (in bytes)?"
14324 . ./myread
14325 charsize="$ans"
14326 $rm -f try.c try
14327
14328 : check for volatile keyword
14329 echo " "
14330 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14331 $cat >try.c <<'EOCP'
14332 int main()
14333 {
14334         typedef struct _goo_struct goo_struct;
14335         goo_struct * volatile goo = ((goo_struct *)0);
14336         struct _goo_struct {
14337                 long long_int;
14338                 int reg_int;
14339                 char char_var;
14340         };
14341         typedef unsigned short foo_t;
14342         char *volatile foo;
14343         volatile int bar;
14344         volatile foo_t blech;
14345         foo = foo;
14346 }
14347 EOCP
14348 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14349         val="$define"
14350         echo "Yup, it does."
14351 else
14352         val="$undef"
14353         echo "Nope, it doesn't."
14354 fi
14355 set d_volatile
14356 eval $setvar
14357 $rm -f try.*
14358
14359
14360 echo " "
14361 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14362
14363 case "$use64bitint:$d_quad:$quadtype" in
14364 define:define:?*)
14365         ivtype="$quadtype"
14366         uvtype="$uquadtype"
14367         ivsize=8
14368         uvsize=8
14369         ;;
14370 *)      ivtype="long"
14371         uvtype="unsigned long"
14372         ivsize=$longsize
14373         uvsize=$longsize
14374         ;;
14375 esac
14376
14377 case "$uselongdouble:$d_longdbl" in
14378 define:define)
14379         nvtype="long double"
14380         nvsize=$longdblsize
14381         ;;
14382 *)      nvtype=double
14383         nvsize=$doublesize
14384         ;;
14385 esac
14386
14387 $echo "(IV will be "$ivtype", $ivsize bytes)"
14388 $echo "(UV will be "$uvtype", $uvsize bytes)"
14389 $echo "(NV will be "$nvtype", $nvsize bytes)"
14390
14391 $cat >try.c <<EOCP
14392 #$i_inttypes I_INTTYPES
14393 #ifdef I_INTTYPES
14394 #include <inttypes.h>
14395 #endif
14396 #include <stdio.h>
14397 int main() {
14398 #ifdef INT8
14399    int8_t i =  INT8_MAX;
14400   uint8_t u = UINT8_MAX;
14401   printf("int8_t\n");
14402 #endif
14403 #ifdef INT16
14404    int16_t i =  INT16_MAX;
14405   uint16_t i = UINT16_MAX;
14406   printf("int16_t\n");
14407 #endif
14408 #ifdef INT32
14409    int32_t i =  INT32_MAX;
14410   uint32_t u = UINT32_MAX;
14411   printf("int32_t\n");
14412 #endif
14413 }
14414 EOCP
14415
14416 case "$i8type" in
14417 '')     case "$charsize" in
14418         1)      i8type=char
14419                 u8type="unsigned char"
14420                 i8size=$charsize
14421                 u8size=$charsize
14422                 ;;
14423         esac
14424         ;;
14425 esac
14426 case "$i8type" in
14427 '')     set try -DINT8
14428         if eval $compile; then
14429                 case "`$run ./try`" in
14430                 int8_t) i8type=int8_t
14431                         u8type=uint8_t
14432                         i8size=1
14433                         u8size=1
14434                         ;;
14435                 esac
14436         fi
14437         ;;
14438 esac
14439 case "$i8type" in
14440 '')     if $test $charsize -ge 1; then
14441                 i8type=char
14442                 u8type="unsigned char"
14443                 i8size=$charsize
14444                 u8size=$charsize
14445         fi
14446         ;;
14447 esac
14448
14449 case "$i16type" in
14450 '')     case "$shortsize" in
14451         2)      i16type=short
14452                 u16type="unsigned short"
14453                 i16size=$shortsize
14454                 u16size=$shortsize
14455                 ;;
14456         esac
14457         ;;
14458 esac
14459 case "$i16type" in
14460 '')     set try -DINT16
14461         if eval $compile; then
14462                 case "`$run ./try`" in
14463                 int16_t)
14464                         i16type=int16_t
14465                         u16type=uint16_t
14466                         i16size=2
14467                         u16size=2
14468                         ;;
14469                 esac
14470         fi
14471         ;;
14472 esac
14473 case "$i16type" in
14474 '')     if $test $shortsize -ge 2; then
14475                 i16type=short
14476                 u16type="unsigned short"
14477                 i16size=$shortsize
14478                 u16size=$shortsize
14479         fi
14480         ;;
14481 esac
14482
14483 case "$i32type" in
14484 '')     case "$longsize" in
14485         4)      i32type=long
14486                 u32type="unsigned long"
14487                 i32size=$longsize
14488                 u32size=$longsize
14489                 ;;
14490         *)      case "$intsize" in
14491                 4)      i32type=int
14492                         u32type="unsigned int"
14493                         i32size=$intsize
14494                         u32size=$intsize
14495                         ;;
14496                 esac
14497                 ;;
14498         esac
14499         ;;
14500 esac
14501 case "$i32type" in
14502 '')     set try -DINT32
14503         if eval $compile; then
14504                 case "`$run ./try`" in
14505                 int32_t)
14506                         i32type=int32_t
14507                         u32type=uint32_t
14508                         i32size=4
14509                         u32size=4
14510                         ;;
14511                 esac
14512         fi
14513         ;;
14514 esac
14515 case "$i32type" in
14516 '')     if $test $intsize -ge 4; then
14517                 i32type=int
14518                 u32type="unsigned int"
14519                 i32size=$intsize
14520                 u32size=$intsize
14521         fi
14522         ;;
14523 esac
14524
14525 case "$i64type" in
14526 '')     case "$d_quad:$quadtype" in
14527         define:?*)
14528                 i64type="$quadtype"
14529                 u64type="$uquadtype"
14530                 i64size=8
14531                 u64size=8
14532                 ;;
14533         esac
14534         ;;
14535 esac
14536
14537 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14538 : volatile so that the compiler has to store it out to memory.
14539 if test X"$d_volatile" = X"$define"; then
14540         volatile=volatile
14541 fi
14542 $cat <<EOP >try.c
14543 #include <stdio.h>
14544 #$i_stdlib I_STDLIB
14545 #ifdef I_STDLIB
14546 #include <stdlib.h>
14547 #endif
14548 #include <sys/types.h>
14549 #include <signal.h>
14550 #ifdef SIGFPE
14551 $volatile int bletched = 0;
14552 $signal_t blech(s) int s; { bletched = 1; }
14553 #endif
14554 int main() {
14555     $uvtype u = 0;
14556     $nvtype d;
14557     int     n = 8 * $uvsize;
14558     int     i;
14559 #ifdef SIGFPE
14560     signal(SIGFPE, blech);
14561 #endif
14562
14563     for (i = 0; i < n; i++) {
14564       u = u << 1 | ($uvtype)1;
14565       d = ($nvtype)u;
14566       if (($uvtype)d != u)
14567         break;
14568       if (d <= 0)
14569         break;
14570       d = ($nvtype)(u - 1);
14571       if (($uvtype)d != (u - 1))
14572         break;
14573 #ifdef SIGFPE
14574       if (bletched) {
14575         break;
14576 #endif
14577       } 
14578     }
14579     printf("%d\n", ((i == n) ? -n : i));
14580     exit(0);
14581 }
14582 EOP
14583 set try
14584
14585 d_nv_preserves_uv="$undef"
14586 if eval $compile; then
14587         nv_preserves_uv_bits="`$run ./try`"
14588 fi
14589 case "$nv_preserves_uv_bits" in
14590 \-[1-9]*)       
14591         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14592         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14593         d_nv_preserves_uv="$define"
14594         ;;
14595 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14596         d_nv_preserves_uv="$undef" ;;
14597 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14598         nv_preserves_uv_bits="$undef" ;;
14599 esac
14600
14601 $rm -f try.* try
14602
14603
14604 : check for off64_t
14605 echo " "
14606 echo "Checking to see if you have off64_t..." >&4
14607 $cat >try.c <<EOCP
14608 #include <sys/types.h>
14609 #include <unistd.h>
14610 int main() { off64_t x = 7; }
14611 EOCP
14612 set try
14613 if eval $compile; then
14614         val="$define"
14615         echo "You have off64_t."
14616 else
14617         val="$undef"
14618         echo "You do not have off64_t."
14619         case "$lseeksize" in
14620         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14621         esac
14622 fi
14623 $rm -f try.* try
14624 set d_off64_t
14625 eval $setvar
14626
14627 : how to create joinable pthreads
14628 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14629         echo " "
14630         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14631         $cat >try.c <<'EOCP'
14632 #include <pthread.h>
14633 int main() {
14634     int detachstate = JOINABLE;
14635 }
14636 EOCP
14637         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14638         if eval $compile; then
14639                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14640                 val="$undef" # Yes, undef.
14641                 set d_old_pthread_create_joinable
14642                 eval $setvar
14643                 val=""
14644                 set old_pthread_create_joinable
14645                 eval $setvar
14646         else
14647                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14648                 if eval $compile; then
14649                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14650                         val="$define"
14651                         set d_old_pthread_create_joinable
14652                         eval $setvar
14653                         val=PTHREAD_CREATE_UNDETACHED
14654                         set old_pthread_create_joinable
14655                         eval $setvar
14656                 else            
14657                         set try -DJOINABLE=__UNDETACHED
14658                         if eval $compile; then
14659                                 echo "You seem to use __UNDETACHED." >&4
14660                                 val="$define"
14661                                 set d_old_pthread_create_joinable
14662                                 eval $setvar
14663                                 val=__UNDETACHED
14664                                 set old_pthread_create_joinable
14665                                 eval $setvar
14666                         else
14667                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14668                                 val="$define"
14669                                 set d_old_pthread_create_joinable
14670                                 eval $setvar
14671                                 val=0
14672                                 set old_pthread_create_joinable
14673                                 eval $setvar
14674                         fi
14675                 fi
14676         fi
14677         $rm -f try try.*
14678 else
14679     d_old_pthread_create_joinable="$undef"
14680     old_pthread_create_joinable=""
14681 fi
14682
14683 : see if pause exists
14684 set pause d_pause
14685 eval $inlibc
14686
14687 : see if pipe exists
14688 set pipe d_pipe
14689 eval $inlibc
14690
14691 : see if poll exists
14692 set poll d_poll
14693 eval $inlibc
14694
14695 : see if readlink exists
14696 set readlink d_readlink
14697 eval $inlibc
14698
14699 echo " "
14700 procselfexe=''
14701 val="$undef"
14702 case "$d_readlink" in
14703 "$define")
14704         if $issymlink /proc/self/exe ; then
14705                 $ls -l /proc/self/exe > reflect
14706                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14707                         echo "You have Linux-like /proc/self/exe."
14708                         procselfexe='"/proc/self/exe"'
14709                         val="$define"
14710                 fi
14711         fi
14712         if $issymlink /proc/curproc/file ; then
14713                 $ls -l /proc/curproc/file > reflect
14714                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14715                         echo "You have BSD-like /proc/curproc/file."
14716                         procselfexe='"/proc/curproc/file"'
14717                         val="$define"
14718                 fi
14719         fi
14720         ;;
14721 esac
14722 $rm -f reflect
14723 set d_procselfexe
14724 eval $setvar
14725
14726 : see whether the pthread_atfork exists
14727 $cat >try.c <<EOP
14728 #include <pthread.h>
14729 #include <stdio.h>
14730 int main() {
14731 #ifdef  PTHREAD_ATFORK
14732         pthread_atfork(NULL,NULL,NULL);
14733 #endif
14734 }
14735 EOP
14736
14737 : see if pthread_atfork exists
14738 set try -DPTHREAD_ATFORK
14739 if eval $compile; then
14740     val="$define"
14741 else
14742     val="$undef"
14743 fi
14744 case "$usethreads" in
14745 $define)
14746         case "$val" in
14747         $define) echo 'pthread_atfork found.' >&4        ;;
14748         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14749         esac
14750 esac
14751 set d_pthread_atfork
14752 eval $setvar
14753
14754 : see if pthread_attr_setscope exists
14755 set pthread_attr_setscope d_pthread_attr_setscope
14756 eval $inlibc
14757
14758
14759 : see whether the various POSIXish _yields exist
14760 $cat >try.c <<EOP
14761 #include <pthread.h>
14762 #include <stdio.h>
14763 int main() {
14764 #ifdef SCHED_YIELD
14765         sched_yield();
14766 #else
14767 #ifdef PTHREAD_YIELD
14768         pthread_yield();
14769 #else
14770 #ifdef PTHREAD_YIELD_NULL
14771         pthread_yield(NULL);
14772 #endif
14773 #endif
14774 #endif
14775 }
14776 EOP
14777 : see if sched_yield exists
14778 set try -DSCHED_YIELD
14779 if eval $compile; then
14780     val="$define"
14781     sched_yield='sched_yield()'
14782 else
14783     val="$undef"
14784 fi
14785 case "$usethreads" in
14786 $define)
14787         case "$val" in
14788         $define) echo 'sched_yield() found.' >&4        ;;
14789         *)       echo 'sched_yield() NOT found.' >&4    ;;
14790         esac
14791 esac
14792 set d_sched_yield
14793 eval $setvar
14794
14795 : see if pthread_yield exists
14796 set try -DPTHREAD_YIELD
14797 if eval $compile; then
14798     val="$define"
14799     case "$sched_yield" in
14800     '') sched_yield='pthread_yield()' ;;
14801     esac
14802 else
14803     set try -DPTHREAD_YIELD_NULL
14804     if eval $compile; then
14805         val="$define"
14806         case "$sched_yield" in
14807         '') sched_yield='pthread_yield(NULL)' ;;
14808         esac
14809     else
14810         val="$undef"
14811     fi
14812 fi
14813 case "$usethreads" in
14814 $define)
14815         case "$val" in
14816         $define) echo 'pthread_yield() found.' >&4      ;;
14817         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14818         esac
14819         ;;
14820 esac
14821 set d_pthread_yield
14822 eval $setvar
14823
14824 case "$sched_yield" in
14825 '') sched_yield=undef ;;
14826 esac
14827
14828 $rm -f try try.*
14829
14830 : see if random_r exists
14831 set random_r d_random_r
14832 eval $inlibc
14833 case "$d_random_r" in
14834 "$define")
14835         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14836         case "$d_random_r_proto:$usethreads" in
14837         ":define")      d_random_r_proto=define
14838                 set d_random_r_proto random_r $hdrs
14839                 eval $hasproto ;;
14840         *)      ;;
14841         esac
14842         case "$d_random_r_proto" in
14843         define)
14844         case "$random_r_proto" in
14845         ''|0) try='int random_r(int*, struct random_data*);'
14846         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14847         esac
14848         case "$random_r_proto" in
14849         ''|0) try='int random_r(long*, struct random_data*);'
14850         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14851         esac
14852         case "$random_r_proto" in
14853         ''|0) try='int random_r(struct random_data*, int32_t*);'
14854         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
14855         esac
14856         case "$random_r_proto" in
14857         ''|0)   d_random_r=undef
14858                 random_r_proto=0
14859                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14860         * )     case "$random_r_proto" in
14861                 REENTRANT_PROTO*) ;;
14862                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14863                 esac
14864                 echo "Prototype: $try" ;;
14865         esac
14866         ;;
14867         *)      case "$usethreads" in
14868                 define) echo "random_r has no prototype, not using it." >&4 ;;
14869                 esac
14870                 d_random_r=undef
14871                 random_r_proto=0
14872                 ;;
14873         esac
14874         ;;
14875 *)      random_r_proto=0
14876         ;;
14877 esac
14878
14879 : see if readdir and friends exist
14880 set readdir d_readdir
14881 eval $inlibc
14882 set seekdir d_seekdir
14883 eval $inlibc
14884 set telldir d_telldir
14885 eval $inlibc
14886 set rewinddir d_rewinddir
14887 eval $inlibc
14888
14889 : see if readdir64_r exists
14890 set readdir64_r d_readdir64_r
14891 eval $inlibc
14892 case "$d_readdir64_r" in
14893 "$define")
14894         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14895         case "$d_readdir64_r_proto:$usethreads" in
14896         ":define")      d_readdir64_r_proto=define
14897                 set d_readdir64_r_proto readdir64_r $hdrs
14898                 eval $hasproto ;;
14899         *)      ;;
14900         esac
14901         case "$d_readdir64_r_proto" in
14902         define)
14903         case "$readdir64_r_proto" in
14904         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14905         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14906         esac
14907         case "$readdir64_r_proto" in
14908         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14909         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14910         esac
14911         case "$readdir64_r_proto" in
14912         ''|0)   d_readdir64_r=undef
14913                 readdir64_r_proto=0
14914                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14915         * )     case "$readdir64_r_proto" in
14916                 REENTRANT_PROTO*) ;;
14917                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14918                 esac
14919                 echo "Prototype: $try" ;;
14920         esac
14921         ;;
14922         *)      case "$usethreads" in
14923                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14924                 esac
14925                 d_readdir64_r=undef
14926                 readdir64_r_proto=0
14927                 ;;
14928         esac
14929         ;;
14930 *)      readdir64_r_proto=0
14931         ;;
14932 esac
14933
14934 : see if readdir_r exists
14935 set readdir_r d_readdir_r
14936 eval $inlibc
14937 case "$d_readdir_r" in
14938 "$define")
14939         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14940         case "$d_readdir_r_proto:$usethreads" in
14941         ":define")      d_readdir_r_proto=define
14942                 set d_readdir_r_proto readdir_r $hdrs
14943                 eval $hasproto ;;
14944         *)      ;;
14945         esac
14946         case "$d_readdir_r_proto" in
14947         define)
14948         case "$readdir_r_proto" in
14949         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14950         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14951         esac
14952         case "$readdir_r_proto" in
14953         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14954         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14955         esac
14956         case "$readdir_r_proto" in
14957         ''|0)   d_readdir_r=undef
14958                 readdir_r_proto=0
14959                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14960         * )     case "$readdir_r_proto" in
14961                 REENTRANT_PROTO*) ;;
14962                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14963                 esac
14964                 echo "Prototype: $try" ;;
14965         esac
14966         ;;
14967         *)      case "$usethreads" in
14968                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14969                 esac
14970                 d_readdir_r=undef
14971                 readdir_r_proto=0
14972                 ;;
14973         esac
14974         ;;
14975 *)      readdir_r_proto=0
14976         ;;
14977 esac
14978
14979 : see if readv exists
14980 set readv d_readv
14981 eval $inlibc
14982
14983 : see if recvmsg exists
14984 set recvmsg d_recvmsg
14985 eval $inlibc
14986
14987 : see if rename exists
14988 set rename d_rename
14989 eval $inlibc
14990
14991 : see if rmdir exists
14992 set rmdir d_rmdir
14993 eval $inlibc
14994
14995 : see if memory.h is available.
14996 val=''
14997 set memory.h val
14998 eval $inhdr
14999
15000 : See if it conflicts with string.h
15001 case "$val" in
15002 $define)
15003         case "$strings" in
15004         '') ;;
15005         *)
15006                 $cppstdin $cppflags $cppminus < $strings > mem.h
15007                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15008                         echo " "
15009                         echo "We won't be including <memory.h>."
15010                         val="$undef"
15011                 fi
15012                 $rm -f mem.h
15013                 ;;
15014         esac
15015 esac
15016 set i_memory
15017 eval $setvar
15018
15019 : can bcopy handle overlapping blocks?
15020 echo " "
15021 val="$undef"
15022 case "$d_memmove" in
15023 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15024 *)      case "$d_bcopy" in
15025         "$define")
15026                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15027                 $cat >try.c <<EOCP
15028 #$i_memory I_MEMORY
15029 #$i_stdlib I_STDLIB
15030 #$i_string I_STRING
15031 #$i_unistd I_UNISTD
15032 EOCP
15033         $cat >>try.c <<'EOCP'
15034 #include <stdio.h>
15035 #ifdef I_MEMORY
15036 #  include <memory.h>
15037 #endif
15038 #ifdef I_STDLIB
15039 #  include <stdlib.h>
15040 #endif
15041 #ifdef I_STRING
15042 #  include <string.h>
15043 #else
15044 #  include <strings.h>
15045 #endif
15046 #ifdef I_UNISTD
15047 #  include <unistd.h>  /* Needed for NetBSD */
15048 #endif
15049 int main()
15050 {
15051 char buf[128], abc[128];
15052 char *b;
15053 int len;
15054 int off;
15055 int align;
15056
15057 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15058    try to store the string in read-only memory. */
15059 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15060
15061 for (align = 7; align >= 0; align--) {
15062         for (len = 36; len; len--) {
15063                 b = buf+align;
15064                 bcopy(abc, b, len);
15065                 for (off = 1; off <= len; off++) {
15066                         bcopy(b, b+off, len);
15067                         bcopy(b+off, b, len);
15068                         if (bcmp(b, abc, len))
15069                                 exit(1);
15070                 }
15071         }
15072 }
15073 exit(0);
15074 }
15075 EOCP
15076                 set try
15077                 if eval $compile_ok; then
15078                         if ./try 2>/dev/null; then
15079                                 echo "Yes, it can."
15080                                 val="$define"
15081                         else
15082                                 echo "It can't, sorry."
15083                         fi
15084                 else
15085                         echo "(I can't compile the test program, so we'll assume not...)"
15086                 fi
15087                 ;;
15088         esac
15089         $rm -f try.* try core
15090         ;;
15091 esac
15092 set d_safebcpy
15093 eval $setvar
15094
15095 : can memcpy handle overlapping blocks?
15096 echo " "
15097 val="$undef"
15098 case "$d_memmove" in
15099 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15100 *)      case "$d_memcpy" in
15101         "$define")
15102                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15103                 $cat >try.c <<EOCP
15104 #$i_memory I_MEMORY
15105 #$i_stdlib I_STDLIB
15106 #$i_string I_STRING
15107 #$i_unistd I_UNISTD
15108 EOCP
15109         $cat >>try.c <<'EOCP'
15110 #include <stdio.h>
15111 #ifdef I_MEMORY
15112 #  include <memory.h>
15113 #endif
15114 #ifdef I_STDLIB
15115 #  include <stdlib.h>
15116 #endif
15117 #ifdef I_STRING
15118 #  include <string.h>
15119 #else
15120 #  include <strings.h>
15121 #endif
15122 #ifdef I_UNISTD
15123 #  include <unistd.h>  /* Needed for NetBSD */
15124 #endif
15125 int main()
15126 {
15127 char buf[128], abc[128];
15128 char *b;
15129 int len;
15130 int off;
15131 int align;
15132
15133 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15134    try to store the string in read-only memory. */
15135 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15136
15137 for (align = 7; align >= 0; align--) {
15138         for (len = 36; len; len--) {
15139                 b = buf+align;
15140                 memcpy(b, abc, len);
15141                 for (off = 1; off <= len; off++) {
15142                         memcpy(b+off, b, len);
15143                         memcpy(b, b+off, len);
15144                         if (memcmp(b, abc, len))
15145                                 exit(1);
15146                 }
15147         }
15148 }
15149 exit(0);
15150 }
15151 EOCP
15152                 set try
15153                 if eval $compile_ok; then
15154                         if ./try 2>/dev/null; then
15155                                 echo "Yes, it can."
15156                                 val="$define"
15157                         else
15158                                 echo "It can't, sorry."
15159                         fi
15160                 else
15161                         echo "(I can't compile the test program, so we'll assume not...)"
15162                 fi
15163                 ;;
15164         esac
15165         $rm -f try.* try core
15166         ;;
15167 esac
15168 set d_safemcpy
15169 eval $setvar
15170
15171 : can memcmp be trusted to compare relative magnitude?
15172 val="$undef"
15173 case "$d_memcmp" in
15174 "$define")
15175         echo " "
15176         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15177         $cat >try.c <<EOCP
15178 #$i_memory I_MEMORY
15179 #$i_stdlib I_STDLIB
15180 #$i_string I_STRING
15181 #$i_unistd I_UNISTD
15182 EOCP
15183         $cat >>try.c <<'EOCP'
15184 #include <stdio.h>
15185 #ifdef I_MEMORY
15186 #  include <memory.h>
15187 #endif
15188 #ifdef I_STDLIB
15189 #  include <stdlib.h>
15190 #endif
15191 #ifdef I_STRING
15192 #  include <string.h>
15193 #else
15194 #  include <strings.h>
15195 #endif
15196 #ifdef I_UNISTD
15197 #  include <unistd.h>  /* Needed for NetBSD */
15198 #endif
15199 int main()
15200 {
15201 char a = -1;
15202 char b = 0;
15203 if ((a < b) && memcmp(&a, &b, 1) < 0)
15204         exit(1);
15205 exit(0);
15206 }
15207 EOCP
15208         set try
15209         if eval $compile_ok; then
15210                 if $run ./try 2>/dev/null; then
15211                         echo "Yes, it can."
15212                         val="$define"
15213                 else
15214                         echo "No, it can't (it uses signed chars)."
15215                 fi
15216         else
15217                 echo "(I can't compile the test program, so we'll assume not...)"
15218         fi
15219         ;;
15220 esac
15221 $rm -f try.* try core
15222 set d_sanemcmp
15223 eval $setvar
15224
15225 : see if prototype for sbrk is available
15226 echo " "
15227 set d_sbrkproto sbrk $i_unistd unistd.h
15228 eval $hasproto
15229
15230 : see if select exists
15231 set select d_select
15232 eval $inlibc
15233
15234 : see if semctl exists
15235 set semctl d_semctl
15236 eval $inlibc
15237
15238 : see if semget exists
15239 set semget d_semget
15240 eval $inlibc
15241
15242 : see if semop exists
15243 set semop d_semop
15244 eval $inlibc
15245
15246 : see how much of the 'sem*(2)' library is present.
15247 h_sem=true
15248 echo " "
15249 case "$d_semctl$d_semget$d_semop" in
15250 *"$undef"*) h_sem=false;;
15251 esac
15252 case "$osname" in
15253 freebsd)
15254     case "`ipcs 2>&1`" in
15255     "SVID messages"*"not configured"*)
15256         echo "Your $osname does not have the sem*(2) configured." >&4
15257         h_sem=false
15258         val="$undef"
15259         set semctl d_semctl
15260         eval $setvar
15261         set semget d_semget
15262         eval $setvar
15263         set semop d_semop
15264         eval $setvar
15265         ;;
15266     esac
15267     ;;
15268 esac
15269 : we could also check for sys/ipc.h ...
15270 if $h_sem && $test `./findhdr sys/sem.h`; then
15271         echo "You have the full sem*(2) library." >&4
15272         val="$define"
15273 else
15274         echo "You don't have the full sem*(2) library." >&4
15275         val="$undef"
15276 fi
15277 set d_sem
15278 eval $setvar
15279
15280 : see whether sys/sem.h defines union semun
15281 echo " "
15282 $cat > try.c <<'END'
15283 #include <sys/types.h>
15284 #include <sys/ipc.h>
15285 #include <sys/sem.h>
15286 int main () { union semun semun; semun.buf = 0; }
15287 END
15288 set try
15289 if eval $compile; then
15290     echo "You have union semun in <sys/sem.h>." >&4
15291     val="$define"
15292 else
15293     echo "You do not have union semun in <sys/sem.h>." >&4
15294     val="$undef"
15295 fi
15296 $rm -f try try.c
15297 set d_union_semun
15298 eval $setvar
15299
15300 : see how to do semctl IPC_STAT
15301 case "$d_sem" in
15302 $define)
15303     echo " "
15304     $cat > try.h <<END
15305 #ifndef S_IRUSR
15306 #   ifdef S_IREAD
15307 #       define S_IRUSR S_IREAD
15308 #       define S_IWUSR S_IWRITE
15309 #       define S_IXUSR S_IEXEC
15310 #   else
15311 #       define S_IRUSR 0400
15312 #       define S_IWUSR 0200
15313 #       define S_IXUSR 0100
15314 #   endif
15315 #   define S_IRGRP (S_IRUSR>>3)
15316 #   define S_IWGRP (S_IWUSR>>3)
15317 #   define S_IXGRP (S_IXUSR>>3)
15318 #   define S_IROTH (S_IRUSR>>6)
15319 #   define S_IWOTH (S_IWUSR>>6)
15320 #   define S_IXOTH (S_IXUSR>>6)
15321 #endif
15322 #ifndef S_IRWXU
15323 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15324 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15325 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15326 #endif
15327 END
15328     : see whether semctl IPC_STAT can use union semun
15329     val="$undef"
15330     case "$d_semctl_semun" in
15331     '')
15332       $cat > try.c <<END
15333 #include <sys/types.h>
15334 #include <sys/ipc.h>
15335 #include <sys/sem.h>
15336 #include <sys/stat.h>
15337 #include <stdio.h>
15338 #include <errno.h>
15339 #include "try.h"
15340 #ifndef errno
15341 extern int errno;
15342 #endif
15343 #$d_union_semun HAS_UNION_SEMUN
15344 int main() {
15345     union semun
15346 #ifndef HAS_UNION_SEMUN
15347     {
15348         int val;
15349         struct semid_ds *buf;
15350         unsigned short *array;
15351     }
15352 #endif
15353     arg;
15354     int sem, st;
15355
15356 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15357     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15358     if (sem > -1) {
15359         struct semid_ds argbuf;
15360         arg.buf = &argbuf;
15361 #       ifdef IPC_STAT
15362         st = semctl(sem, 0, IPC_STAT, arg);
15363         if (st == 0)
15364             printf("semun\n");
15365         else
15366 #       endif /* IPC_STAT */
15367             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15368 #       ifdef IPC_RMID
15369         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15370 #       endif /* IPC_RMID */
15371             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15372     } else
15373 #endif /* IPC_PRIVATE && ... */
15374         printf("semget failed: errno = %d\n", errno);
15375   return 0;
15376 }
15377 END
15378       set try
15379       if eval $compile; then
15380           xxx=`$run ./try`
15381           case "$xxx" in
15382           semun) val="$define" ;;
15383           esac
15384       fi
15385       $rm -f try try.c
15386       ;;
15387     esac
15388     set d_semctl_semun
15389     eval $setvar
15390     case "$d_semctl_semun" in
15391     $define)
15392         echo "You can use union semun for semctl IPC_STAT." >&4
15393         also='also'
15394         ;;
15395     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15396         also=''
15397         ;;
15398     esac
15399
15400     : see whether semctl IPC_STAT can use struct semid_ds pointer
15401     val="$undef"
15402     case "$d_semctl_semid_ds" in
15403     '')
15404       $cat > try.c <<'END'
15405 #include <sys/types.h>
15406 #include <sys/ipc.h>
15407 #include <sys/sem.h>
15408 #include <sys/stat.h>
15409 #include "try.h"
15410 #include <stdio.h>
15411 #include <errno.h>
15412 #ifndef errno
15413 extern int errno;
15414 #endif
15415 int main() {
15416     struct semid_ds arg;
15417     int sem, st;
15418
15419 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15420     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15421     if (sem > -1) {
15422 #       ifdef IPC_STAT
15423         st = semctl(sem, 0, IPC_STAT, &arg);
15424         if (st == 0)
15425             printf("semid_ds\n");
15426         else
15427 #       endif /* IPC_STAT */
15428             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15429 #       ifdef IPC_RMID
15430         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15431 #       endif /* IPC_RMID */
15432             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15433     } else
15434 #endif /* IPC_PRIVATE && ... */
15435         printf("semget failed: errno = %d\n", errno);
15436
15437     return 0;
15438 }
15439 END
15440       set try
15441       if eval $compile; then
15442           xxx=`$run ./try`
15443           case "$xxx" in
15444           semid_ds) val="$define" ;;
15445           esac
15446       fi
15447       $rm -f try try.c
15448       ;;
15449     esac
15450     set d_semctl_semid_ds
15451     eval $setvar
15452     case "$d_semctl_semid_ds" in
15453     $define)
15454         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15455         ;;
15456     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15457         ;;
15458     esac
15459     $rm -f try.h
15460     ;;
15461 *)  val="$undef"
15462
15463     # We do not have the full sem*(2) library, so assume we can not
15464     # use either.
15465
15466     set d_semctl_semun
15467     eval $setvar
15468
15469     set d_semctl_semid_ds
15470     eval $setvar
15471     ;;
15472 esac
15473
15474 : see if sendmsg exists
15475 set sendmsg d_sendmsg
15476 eval $inlibc
15477
15478 : see if setegid exists
15479 set setegid d_setegid
15480 eval $inlibc
15481
15482 : see if seteuid exists
15483 set seteuid d_seteuid
15484 eval $inlibc
15485
15486 : see if setgrent exists
15487 set setgrent d_setgrent
15488 eval $inlibc
15489
15490 : see if setgrent_r exists
15491 set setgrent_r d_setgrent_r
15492 eval $inlibc
15493 case "$d_setgrent_r" in
15494 "$define")
15495         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15496         case "$d_setgrent_r_proto:$usethreads" in
15497         ":define")      d_setgrent_r_proto=define
15498                 set d_setgrent_r_proto setgrent_r $hdrs
15499                 eval $hasproto ;;
15500         *)      ;;
15501         esac
15502         case "$d_setgrent_r_proto" in
15503         define)
15504         case "$setgrent_r_proto" in
15505         ''|0) try='int setgrent_r(FILE**);'
15506         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15507         esac
15508         case "$setgrent_r_proto" in
15509         ''|0) try='void setgrent_r(FILE**);'
15510         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15511         esac
15512         case "$setgrent_r_proto" in
15513         ''|0)   d_setgrent_r=undef
15514                 setgrent_r_proto=0
15515                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15516         * )     case "$setgrent_r_proto" in
15517                 REENTRANT_PROTO*) ;;
15518                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15519                 esac
15520                 echo "Prototype: $try" ;;
15521         esac
15522         ;;
15523         *)      case "$usethreads" in
15524                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15525                 esac
15526                 d_setgrent_r=undef
15527                 setgrent_r_proto=0
15528                 ;;
15529         esac
15530         ;;
15531 *)      setgrent_r_proto=0
15532         ;;
15533 esac
15534
15535 : see if sethostent exists
15536 set sethostent d_sethent
15537 eval $inlibc
15538
15539 : see if sethostent_r exists
15540 set sethostent_r d_sethostent_r
15541 eval $inlibc
15542 case "$d_sethostent_r" in
15543 "$define")
15544         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15545         case "$d_sethostent_r_proto:$usethreads" in
15546         ":define")      d_sethostent_r_proto=define
15547                 set d_sethostent_r_proto sethostent_r $hdrs
15548                 eval $hasproto ;;
15549         *)      ;;
15550         esac
15551         case "$d_sethostent_r_proto" in
15552         define)
15553         case "$sethostent_r_proto" in
15554         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15555         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15556         esac
15557         case "$sethostent_r_proto" in
15558         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15559         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15560         esac
15561         case "$sethostent_r_proto" in
15562         ''|0)   d_sethostent_r=undef
15563                 sethostent_r_proto=0
15564                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15565         * )     case "$sethostent_r_proto" in
15566                 REENTRANT_PROTO*) ;;
15567                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15568                 esac
15569                 echo "Prototype: $try" ;;
15570         esac
15571         ;;
15572         *)      case "$usethreads" in
15573                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15574                 esac
15575                 d_sethostent_r=undef
15576                 sethostent_r_proto=0
15577                 ;;
15578         esac
15579         ;;
15580 *)      sethostent_r_proto=0
15581         ;;
15582 esac
15583
15584 : see if setitimer exists
15585 set setitimer d_setitimer
15586 eval $inlibc
15587
15588 : see if setlinebuf exists
15589 set setlinebuf d_setlinebuf
15590 eval $inlibc
15591
15592 : see if setlocale exists
15593 set setlocale d_setlocale
15594 eval $inlibc
15595
15596 : see if locale.h is available
15597 set locale.h i_locale
15598 eval $inhdr
15599
15600 : see if setlocale_r exists
15601 set setlocale_r d_setlocale_r
15602 eval $inlibc
15603 case "$d_setlocale_r" in
15604 "$define")
15605         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15606         case "$d_setlocale_r_proto:$usethreads" in
15607         ":define")      d_setlocale_r_proto=define
15608                 set d_setlocale_r_proto setlocale_r $hdrs
15609                 eval $hasproto ;;
15610         *)      ;;
15611         esac
15612         case "$d_setlocale_r_proto" in
15613         define)
15614         case "$setlocale_r_proto" in
15615         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15616         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15617         esac
15618         case "$setlocale_r_proto" in
15619         ''|0)   d_setlocale_r=undef
15620                 setlocale_r_proto=0
15621                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15622         * )     case "$setlocale_r_proto" in
15623                 REENTRANT_PROTO*) ;;
15624                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15625                 esac
15626                 echo "Prototype: $try" ;;
15627         esac
15628         ;;
15629         *)      case "$usethreads" in
15630                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15631                 esac
15632                 d_setlocale_r=undef
15633                 setlocale_r_proto=0
15634                 ;;
15635         esac
15636         ;;
15637 *)      setlocale_r_proto=0
15638         ;;
15639 esac
15640
15641 : see if setnetent exists
15642 set setnetent d_setnent
15643 eval $inlibc
15644
15645 : see if setnetent_r exists
15646 set setnetent_r d_setnetent_r
15647 eval $inlibc
15648 case "$d_setnetent_r" in
15649 "$define")
15650         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15651         case "$d_setnetent_r_proto:$usethreads" in
15652         ":define")      d_setnetent_r_proto=define
15653                 set d_setnetent_r_proto setnetent_r $hdrs
15654                 eval $hasproto ;;
15655         *)      ;;
15656         esac
15657         case "$d_setnetent_r_proto" in
15658         define)
15659         case "$setnetent_r_proto" in
15660         ''|0) try='int setnetent_r(int, struct netent_data*);'
15661         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15662         esac
15663         case "$setnetent_r_proto" in
15664         ''|0) try='void setnetent_r(int, struct netent_data*);'
15665         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15666         esac
15667         case "$setnetent_r_proto" in
15668         ''|0)   d_setnetent_r=undef
15669                 setnetent_r_proto=0
15670                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15671         * )     case "$setnetent_r_proto" in
15672                 REENTRANT_PROTO*) ;;
15673                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15674                 esac
15675                 echo "Prototype: $try" ;;
15676         esac
15677         ;;
15678         *)      case "$usethreads" in
15679                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15680                 esac
15681                 d_setnetent_r=undef
15682                 setnetent_r_proto=0
15683                 ;;
15684         esac
15685         ;;
15686 *)      setnetent_r_proto=0
15687         ;;
15688 esac
15689
15690 : see if setprotoent exists
15691 set setprotoent d_setpent
15692 eval $inlibc
15693
15694 : see if setpgid exists
15695 set setpgid d_setpgid
15696 eval $inlibc
15697
15698 : see if setpgrp2 exists
15699 set setpgrp2 d_setpgrp2
15700 eval $inlibc
15701
15702 : see if setpriority exists
15703 set setpriority d_setprior
15704 eval $inlibc
15705
15706 : see if setproctitle exists
15707 set setproctitle d_setproctitle
15708 eval $inlibc
15709
15710 : see if setprotoent_r exists
15711 set setprotoent_r d_setprotoent_r
15712 eval $inlibc
15713 case "$d_setprotoent_r" in
15714 "$define")
15715         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15716         case "$d_setprotoent_r_proto:$usethreads" in
15717         ":define")      d_setprotoent_r_proto=define
15718                 set d_setprotoent_r_proto setprotoent_r $hdrs
15719                 eval $hasproto ;;
15720         *)      ;;
15721         esac
15722         case "$d_setprotoent_r_proto" in
15723         define)
15724         case "$setprotoent_r_proto" in
15725         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15726         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15727         esac
15728         case "$setprotoent_r_proto" in
15729         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15730         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15731         esac
15732         case "$setprotoent_r_proto" in
15733         ''|0)   d_setprotoent_r=undef
15734                 setprotoent_r_proto=0
15735                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15736         * )     case "$setprotoent_r_proto" in
15737                 REENTRANT_PROTO*) ;;
15738                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15739                 esac
15740                 echo "Prototype: $try" ;;
15741         esac
15742         ;;
15743         *)      case "$usethreads" in
15744                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15745                 esac
15746                 d_setprotoent_r=undef
15747                 setprotoent_r_proto=0
15748                 ;;
15749         esac
15750         ;;
15751 *)      setprotoent_r_proto=0
15752         ;;
15753 esac
15754
15755 : see if setpwent exists
15756 set setpwent d_setpwent
15757 eval $inlibc
15758
15759 : see if setpwent_r exists
15760 set setpwent_r d_setpwent_r
15761 eval $inlibc
15762 case "$d_setpwent_r" in
15763 "$define")
15764         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15765         case "$d_setpwent_r_proto:$usethreads" in
15766         ":define")      d_setpwent_r_proto=define
15767                 set d_setpwent_r_proto setpwent_r $hdrs
15768                 eval $hasproto ;;
15769         *)      ;;
15770         esac
15771         case "$d_setpwent_r_proto" in
15772         define)
15773         case "$setpwent_r_proto" in
15774         ''|0) try='int setpwent_r(FILE**);'
15775         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15776         esac
15777         case "$setpwent_r_proto" in
15778         ''|0) try='void setpwent_r(FILE**);'
15779         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15780         esac
15781         case "$setpwent_r_proto" in
15782         ''|0)   d_setpwent_r=undef
15783                 setpwent_r_proto=0
15784                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15785         * )     case "$setpwent_r_proto" in
15786                 REENTRANT_PROTO*) ;;
15787                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15788                 esac
15789                 echo "Prototype: $try" ;;
15790         esac
15791         ;;
15792         *)      case "$usethreads" in
15793                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15794                 esac
15795                 d_setpwent_r=undef
15796                 setpwent_r_proto=0
15797                 ;;
15798         esac
15799         ;;
15800 *)      setpwent_r_proto=0
15801         ;;
15802 esac
15803
15804 : see if setregid exists
15805 set setregid d_setregid
15806 eval $inlibc
15807 set setresgid d_setresgid
15808 eval $inlibc
15809
15810 : see if setreuid exists
15811 set setreuid d_setreuid
15812 eval $inlibc
15813 set setresuid d_setresuid
15814 eval $inlibc
15815
15816 : see if setrgid exists
15817 set setrgid d_setrgid
15818 eval $inlibc
15819
15820 : see if setruid exists
15821 set setruid d_setruid
15822 eval $inlibc
15823
15824 : see if setservent exists
15825 set setservent d_setsent
15826 eval $inlibc
15827
15828 : see if setservent_r exists
15829 set setservent_r d_setservent_r
15830 eval $inlibc
15831 case "$d_setservent_r" in
15832 "$define")
15833         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15834         case "$d_setservent_r_proto:$usethreads" in
15835         ":define")      d_setservent_r_proto=define
15836                 set d_setservent_r_proto setservent_r $hdrs
15837                 eval $hasproto ;;
15838         *)      ;;
15839         esac
15840         case "$d_setservent_r_proto" in
15841         define)
15842         case "$setservent_r_proto" in
15843         ''|0) try='int setservent_r(int, struct servent_data*);'
15844         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15845         esac
15846         case "$setservent_r_proto" in
15847         ''|0) try='void setservent_r(int, struct servent_data*);'
15848         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15849         esac
15850         case "$setservent_r_proto" in
15851         ''|0)   d_setservent_r=undef
15852                 setservent_r_proto=0
15853                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15854         * )     case "$setservent_r_proto" in
15855                 REENTRANT_PROTO*) ;;
15856                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15857                 esac
15858                 echo "Prototype: $try" ;;
15859         esac
15860         ;;
15861         *)      case "$usethreads" in
15862                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15863                 esac
15864                 d_setservent_r=undef
15865                 setservent_r_proto=0
15866                 ;;
15867         esac
15868         ;;
15869 *)      setservent_r_proto=0
15870         ;;
15871 esac
15872
15873 : see if setsid exists
15874 set setsid d_setsid
15875 eval $inlibc
15876
15877 : see if setvbuf exists
15878 set setvbuf d_setvbuf
15879 eval $inlibc
15880
15881 : see if sfio.h is available
15882 set sfio.h i_sfio
15883 eval $inhdr
15884
15885
15886 : see if sfio library is available
15887 case "$i_sfio" in
15888 $define)
15889         val=''
15890         set sfreserve val
15891         eval $inlibc
15892         ;;
15893 *)
15894         val="$undef"
15895         ;;
15896 esac
15897 : Ok, but do we want to use it.
15898 case "$val" in
15899 $define)
15900         case "$usesfio" in
15901         true|$define|[yY]*) dflt='y';;
15902         *) dflt='n';;
15903         esac
15904         echo "$package can use the sfio library, but it is experimental."
15905         case "$useperlio" in
15906         "$undef")
15907             echo "For sfio also the PerlIO abstraction layer is needed."
15908             echo "Earlier you said you wouldn't want that."
15909             ;;
15910         esac
15911         rp="You seem to have sfio available, do you want to try using it?"
15912         . ./myread
15913         case "$ans" in
15914         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15915                 useperlio="$define"
15916                 val="$define"
15917                 ;;
15918         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15919                 val="$undef"
15920                 ;;
15921         esac
15922         ;;
15923 *)      case "$usesfio" in
15924         true|$define|[yY]*)
15925                 echo "Sorry, cannot find sfio on this machine." >&4
15926                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15927                 val="$undef"
15928                 ;;
15929         esac
15930         ;;
15931 esac
15932 set d_sfio
15933 eval $setvar
15934 case "$d_sfio" in
15935 $define) usesfio='true';;
15936 *) usesfio='false';;
15937 esac
15938 case "$d_sfio" in
15939 $define) ;;
15940 *)      : Remove sfio from list of libraries to use
15941         case "$libs" in
15942         *-lsfio*)
15943                 echo "Removing unneeded -lsfio from library list" >&4
15944                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15945                 shift
15946                 libs="$*"
15947                 echo "libs = $libs" >&4
15948                 ;;
15949         esac
15950 ;;
15951 esac
15952
15953
15954 : see if shmctl exists
15955 set shmctl d_shmctl
15956 eval $inlibc
15957
15958 : see if shmget exists
15959 set shmget d_shmget
15960 eval $inlibc
15961
15962 : see if shmat exists
15963 set shmat d_shmat
15964 eval $inlibc
15965 : see what shmat returns
15966 case "$d_shmat" in
15967 "$define")
15968         $cat >shmat.c <<'END'
15969 #include <sys/shm.h>
15970 void *shmat();
15971 END
15972         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15973                 shmattype='void *'
15974         else
15975                 shmattype='char *'
15976         fi
15977         echo "and it returns ($shmattype)." >&4
15978         : see if a prototype for shmat is available
15979         xxx=`./findhdr sys/shm.h`
15980         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15981         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15982                 val="$define"
15983         else
15984                 val="$undef"
15985         fi
15986         $rm -f shmat.[co]
15987         ;;
15988 *)
15989         val="$undef"
15990         ;;
15991 esac
15992 set d_shmatprototype
15993 eval $setvar
15994
15995 : see if shmdt exists
15996 set shmdt d_shmdt
15997 eval $inlibc
15998
15999 : see how much of the 'shm*(2)' library is present.
16000 h_shm=true
16001 echo " "
16002 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16003 *"$undef"*) h_shm=false;;
16004 esac
16005 case "$osname" in
16006 freebsd)
16007     case "`ipcs 2>&1`" in
16008     "SVID shared memory"*"not configured"*)
16009         echo "Your $osname does not have the shm*(2) configured." >&4
16010         h_shm=false
16011         val="$undef"
16012         set shmctl d_shmctl
16013         evat $setvar
16014         set shmget d_shmget
16015         evat $setvar
16016         set shmat d_shmat
16017         evat $setvar
16018         set shmdt d_shmdt
16019         evat $setvar
16020         ;;
16021     esac
16022     ;;
16023 esac
16024 : we could also check for sys/ipc.h ...
16025 if $h_shm && $test `./findhdr sys/shm.h`; then
16026         echo "You have the full shm*(2) library." >&4
16027         val="$define"
16028 else
16029         echo "You don't have the full shm*(2) library." >&4
16030         val="$undef"
16031 fi
16032 set d_shm
16033 eval $setvar
16034
16035 echo " "
16036 : see if we have sigaction
16037 if set sigaction val -f d_sigaction; eval $csym; $val; then
16038         echo 'sigaction() found.' >&4
16039         $cat > try.c <<EOP
16040 #include <stdio.h>
16041 #include <sys/types.h>
16042 #include <signal.h>
16043 #$i_stdlib I_STDLIB
16044 #ifdef I_STDLIB
16045 #include <stdlib.h>
16046 #endif
16047 int main()
16048 {
16049     struct sigaction act, oact;
16050     act.sa_flags = 0;
16051     oact.sa_handler = 0;
16052     /* so that act and oact are used */
16053     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16054 }
16055 EOP
16056         set try
16057         if eval $compile_ok; then
16058                 val="$define"
16059         else
16060                 echo "But you don't seem to have a useable struct sigaction." >&4
16061                 val="$undef"
16062         fi
16063 else
16064         echo 'sigaction NOT found.' >&4
16065         val="$undef"
16066 fi
16067 set d_sigaction; eval $setvar
16068 $rm -f try try$_o try.c
16069
16070 : see if sigprocmask exists
16071 set sigprocmask d_sigprocmask
16072 eval $inlibc
16073
16074 : see if sigsetjmp exists
16075 echo " "
16076 case "$d_sigsetjmp" in
16077 '')
16078         $cat >try.c <<EOP
16079 #include <setjmp.h>
16080 #$i_stdlib I_STDLIB
16081 #ifdef I_STDLIB
16082 #include <stdlib.h>
16083 #endif
16084 sigjmp_buf env;
16085 int set = 1;
16086 int main()
16087 {
16088         if (sigsetjmp(env,1))
16089                 exit(set);
16090         set = 0;
16091         siglongjmp(env, 1);
16092         exit(1);
16093 }
16094 EOP
16095         set try
16096         if eval $compile; then
16097                 if $run ./try >/dev/null 2>&1; then
16098                         echo "POSIX sigsetjmp found." >&4
16099                         val="$define"
16100                 else
16101                         $cat >&4 <<EOM
16102 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16103 I'll ignore them.
16104 EOM
16105                         val="$undef"
16106                 fi
16107         else
16108                 echo "sigsetjmp not found." >&4
16109                 val="$undef"
16110         fi
16111         ;;
16112 *) val="$d_sigsetjmp"
16113         case "$d_sigsetjmp" in
16114         $define) echo "POSIX sigsetjmp found." >&4;;
16115         $undef) echo "sigsetjmp not found." >&4;;
16116         esac
16117         ;;
16118 esac
16119 set d_sigsetjmp
16120 eval $setvar
16121 $rm -f try.c try
16122
16123 : see if sockatmark exists
16124 set sockatmark d_sockatmark
16125 eval $inlibc
16126
16127 : see if prototype for sockatmark is available
16128 echo " "
16129 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16130 eval $hasproto
16131
16132 : see if socks5_init exists
16133 set socks5_init d_socks5_init
16134 eval $inlibc
16135
16136 : see if srand48_r exists
16137 set srand48_r d_srand48_r
16138 eval $inlibc
16139 case "$d_srand48_r" in
16140 "$define")
16141         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16142         case "$d_srand48_r_proto:$usethreads" in
16143         ":define")      d_srand48_r_proto=define
16144                 set d_srand48_r_proto srand48_r $hdrs
16145                 eval $hasproto ;;
16146         *)      ;;
16147         esac
16148         case "$d_srand48_r_proto" in
16149         define)
16150         case "$srand48_r_proto" in
16151         ''|0) try='int srand48_r(long, struct drand48_data*);'
16152         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16153         esac
16154         case "$srand48_r_proto" in
16155         ''|0)   d_srand48_r=undef
16156                 srand48_r_proto=0
16157                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16158         * )     case "$srand48_r_proto" in
16159                 REENTRANT_PROTO*) ;;
16160                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16161                 esac
16162                 echo "Prototype: $try" ;;
16163         esac
16164         ;;
16165         *)      case "$usethreads" in
16166                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16167                 esac
16168                 d_srand48_r=undef
16169                 srand48_r_proto=0
16170                 ;;
16171         esac
16172         ;;
16173 *)      srand48_r_proto=0
16174         ;;
16175 esac
16176
16177 : see if srandom_r exists
16178 set srandom_r d_srandom_r
16179 eval $inlibc
16180 case "$d_srandom_r" in
16181 "$define")
16182         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16183         case "$d_srandom_r_proto:$usethreads" in
16184         ":define")      d_srandom_r_proto=define
16185                 set d_srandom_r_proto srandom_r $hdrs
16186                 eval $hasproto ;;
16187         *)      ;;
16188         esac
16189         case "$d_srandom_r_proto" in
16190         define)
16191         case "$srandom_r_proto" in
16192         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16193         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16194         esac
16195         case "$srandom_r_proto" in
16196         ''|0)   d_srandom_r=undef
16197                 srandom_r_proto=0
16198                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16199         * )     case "$srandom_r_proto" in
16200                 REENTRANT_PROTO*) ;;
16201                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16202                 esac
16203                 echo "Prototype: $try" ;;
16204         esac
16205         ;;
16206         *)      case "$usethreads" in
16207                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16208                 esac
16209                 d_srandom_r=undef
16210                 srandom_r_proto=0
16211                 ;;
16212         esac
16213         ;;
16214 *)      srandom_r_proto=0
16215         ;;
16216 esac
16217
16218 : see if prototype for setresgid is available
16219 echo " "
16220 set d_sresgproto setresgid $i_unistd unistd.h
16221 eval $hasproto
16222
16223 : see if prototype for setresuid is available
16224 echo " "
16225 set d_sresuproto setresuid $i_unistd unistd.h
16226 eval $hasproto
16227
16228 : see if sys/stat.h is available
16229 set sys/stat.h i_sysstat
16230 eval $inhdr
16231
16232
16233 : see if stat knows about block sizes
16234 echo " "
16235 echo "Checking to see if your struct stat has st_blocks field..." >&4
16236 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16237 eval $hasfield
16238
16239
16240 : see if this is a sys/vfs.h system
16241 set sys/vfs.h i_sysvfs
16242 eval $inhdr
16243
16244
16245 : see if this is a sys/statfs.h system
16246 set sys/statfs.h i_sysstatfs
16247 eval $inhdr
16248
16249
16250 echo " "
16251 echo "Checking to see if your system supports struct statfs..." >&4
16252 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
16253 eval $hasstruct
16254 case "$d_statfs_s" in
16255 "$define")      echo "Yes, it does."   ;;
16256 *)              echo "No, it doesn't." ;;
16257 esac
16258
16259
16260
16261 : see if struct statfs knows about f_flags
16262 case "$d_statfs_s" in
16263 define) 
16264         echo " "
16265         echo "Checking to see if your struct statfs has f_flags field..." >&4
16266         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
16267         eval $hasfield
16268         ;;
16269 *)      val="$undef"
16270         set d_statfs_f_flags
16271         eval $setvar
16272         ;;
16273 esac
16274 case "$d_statfs_f_flags" in
16275 "$define")      echo "Yes, it does."   ;;
16276 *)              echo "No, it doesn't." ;;
16277 esac
16278
16279 $cat >&4 <<EOM
16280 Checking how to access stdio streams by file descriptor number...
16281 EOM
16282 case "$stdio_stream_array" in
16283 '')     $cat >try.c <<EOCP
16284 #include <stdio.h>
16285 int main() {
16286   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16287     printf("yes\n");
16288 }
16289 EOCP
16290         for s in _iob __iob __sF
16291         do
16292                 set try -DSTDIO_STREAM_ARRAY=$s
16293                 if eval $compile; then
16294                         case "`$run ./try`" in
16295                         yes)    stdio_stream_array=$s; break ;;
16296                         esac
16297                 fi
16298         done
16299         $rm -f try.* try$exe_ext
16300 esac
16301 case "$stdio_stream_array" in
16302 '')     $cat >&4 <<EOM
16303 I can't figure out how to access stdio streams by file descriptor number.
16304 EOM
16305         d_stdio_stream_array="$undef"
16306         ;;
16307 *)      $cat >&4 <<EOM
16308 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16309 EOM
16310         d_stdio_stream_array="$define"
16311         ;;
16312 esac
16313
16314 : see if strcoll exists
16315 set strcoll d_strcoll
16316 eval $inlibc
16317
16318 : check for structure copying
16319 echo " "
16320 echo "Checking to see if your C compiler can copy structs..." >&4
16321 $cat >try.c <<'EOCP'
16322 int main()
16323 {
16324         struct blurfl {
16325                 int dyick;
16326         } foo, bar;
16327
16328         foo = bar;
16329 }
16330 EOCP
16331 if $cc -c try.c >/dev/null 2>&1 ; then
16332         val="$define"
16333         echo "Yup, it can."
16334 else
16335         val="$undef"
16336         echo "Nope, it can't."
16337 fi
16338 set d_strctcpy
16339 eval $setvar
16340 $rm -f try.*
16341
16342 : see if strerror and/or sys_errlist[] exist
16343 echo " "
16344 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16345     if set strerror val -f d_strerror; eval $csym; $val; then
16346                 echo 'strerror() found.' >&4
16347                 d_strerror="$define"
16348                 d_strerrm='strerror(e)'
16349                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16350                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16351                         d_syserrlst="$define"
16352                 else
16353                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16354                         d_syserrlst="$undef"
16355                 fi
16356     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16357                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16358                 echo 'strerror() found in string header.' >&4
16359                 d_strerror="$define"
16360                 d_strerrm='strerror(e)'
16361                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16362                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16363                                 d_syserrlst="$define"
16364                 else
16365                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16366                         d_syserrlst="$undef"
16367                 fi
16368     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16369                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16370                 d_strerror="$undef"
16371                 d_syserrlst="$define"
16372                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16373     else
16374                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16375                 d_strerror="$undef"
16376                 d_syserrlst="$undef"
16377                 d_strerrm='"unknown"'
16378     fi
16379 fi
16380
16381 : see if strerror_r exists
16382 set strerror_r d_strerror_r
16383 eval $inlibc
16384 case "$d_strerror_r" in
16385 "$define")
16386         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16387         case "$d_strerror_r_proto:$usethreads" in
16388         ":define")      d_strerror_r_proto=define
16389                 set d_strerror_r_proto strerror_r $hdrs
16390                 eval $hasproto ;;
16391         *)      ;;
16392         esac
16393         case "$d_strerror_r_proto" in
16394         define)
16395         case "$strerror_r_proto" in
16396         ''|0) try='int strerror_r(int, char*, size_t);'
16397         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16398         esac
16399         case "$strerror_r_proto" in
16400         ''|0) try='int strerror_r(int, char*, int);'
16401         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16402         esac
16403         case "$strerror_r_proto" in
16404         ''|0) try='char* strerror_r(int, char*, size_t);'
16405         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16406         esac
16407         case "$strerror_r_proto" in
16408         ''|0)   d_strerror_r=undef
16409                 strerror_r_proto=0
16410                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16411         * )     case "$strerror_r_proto" in
16412                 REENTRANT_PROTO*) ;;
16413                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16414                 esac
16415                 echo "Prototype: $try" ;;
16416         esac
16417         ;;
16418         *)      case "$usethreads" in
16419                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16420                 esac
16421                 d_strerror_r=undef
16422                 strerror_r_proto=0
16423                 ;;
16424         esac
16425         ;;
16426 *)      strerror_r_proto=0
16427         ;;
16428 esac
16429
16430 : see if strftime exists
16431 set strftime d_strftime
16432 eval $inlibc
16433
16434 : see if strlcat exists
16435 set strlcat d_strlcat
16436 eval $inlibc
16437
16438 : see if strlcpy exists
16439 set strlcpy d_strlcpy
16440 eval $inlibc
16441
16442 : see if strtod exists
16443 set strtod d_strtod
16444 eval $inlibc
16445
16446 : see if strtol exists
16447 set strtol d_strtol
16448 eval $inlibc
16449
16450 : see if strtold exists
16451 set strtold d_strtold
16452 eval $inlibc
16453
16454 : see if strtoll exists
16455 set strtoll d_strtoll
16456 eval $inlibc
16457
16458 case "$d_longlong-$d_strtoll" in
16459 "$define-$define")
16460         $cat <<EOM
16461 Checking whether your strtoll() works okay...
16462 EOM
16463         $cat >try.c <<'EOCP'
16464 #include <errno.h>
16465 #ifdef __hpux
16466 #define strtoll __strtoll
16467 #endif
16468 #ifdef __EMX__
16469 #define strtoll _strtoll
16470 #endif
16471 #include <stdio.h>
16472 extern long long int strtoll(char *s, char **, int); 
16473 static int bad = 0;
16474 int check(char *s, long long ell, int een) {
16475         long long gll;
16476         errno = 0;
16477         gll = strtoll(s, 0, 10);
16478         if (!((gll == ell) && (errno == een)))
16479                 bad++;
16480 }
16481 int main() {
16482         check(" 1",                                      1LL, 0);
16483         check(" 0",                                      0LL, 0);
16484         check("-1",                                     -1LL, 0);
16485         check("-9223372036854775808", -9223372036854775808LL, 0);
16486         check("-9223372036854775808", -9223372036854775808LL, 0);
16487         check(" 9223372036854775807",  9223372036854775807LL, 0);
16488         check("-9223372036854775808", -9223372036854775808LL, 0);
16489         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16490         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16491         if (!bad)
16492                 printf("ok\n");
16493 }
16494 EOCP
16495         set try
16496         if eval $compile; then
16497                 yyy=`$run ./try`
16498                 case "$yyy" in
16499                 ok) echo "Your strtoll() seems to be working okay." ;;
16500                 *) cat <<EOM >&4
16501 Your strtoll() doesn't seem to be working okay.
16502 EOM
16503                    d_strtoll="$undef"
16504                    ;;
16505                 esac
16506         else
16507                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16508                 d_strtoll="$undef"
16509         fi
16510         ;;
16511 esac
16512
16513 : see if strtoq exists
16514 set strtoq d_strtoq
16515 eval $inlibc
16516
16517 : see if strtoul exists
16518 set strtoul d_strtoul
16519 eval $inlibc
16520
16521 case "$d_strtoul" in
16522 "$define")
16523         $cat <<EOM
16524 Checking whether your strtoul() works okay...
16525 EOM
16526         $cat >try.c <<'EOCP'
16527 #include <errno.h>
16528 #include <stdio.h>
16529 extern unsigned long int strtoul(char *s, char **, int); 
16530 static int bad = 0;
16531 void check(char *s, unsigned long eul, int een) {
16532         unsigned long gul;
16533         errno = 0;
16534         gul = strtoul(s, 0, 10);
16535         if (!((gul == eul) && (errno == een)))
16536                 bad++;
16537 }
16538 int main() {
16539         check(" 1", 1L, 0);
16540         check(" 0", 0L, 0);
16541 EOCP
16542         case "$longsize" in
16543         8)
16544             $cat >>try.c <<'EOCP'
16545         check("18446744073709551615", 18446744073709551615UL, 0);
16546         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16547 #if 0 /* strtoul() for /^-/ strings is undefined. */
16548         check("-1", 18446744073709551615UL, 0);
16549         check("-18446744073709551614", 2, 0);
16550         check("-18446744073709551615", 1, 0);
16551         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16552         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16553 #endif
16554 EOCP
16555                 ;;
16556         4)
16557                     $cat >>try.c <<'EOCP'
16558         check("4294967295", 4294967295UL, 0);
16559         check("4294967296", 4294967295UL, ERANGE);
16560 #if 0 /* strtoul() for /^-/ strings is undefined. */
16561         check("-1", 4294967295UL, 0);
16562         check("-4294967294", 2, 0);
16563         check("-4294967295", 1, 0);
16564         check("-4294967296", 4294967295UL, ERANGE);
16565         check("-4294967297", 4294967295UL, ERANGE);
16566 #endif
16567 EOCP
16568                 ;;
16569         *)
16570 : Should we write these tests to be more portable by sprintf-ing
16571 : ~0 and then manipulating that char string as input for strtol?
16572                 ;;
16573         esac
16574         $cat >>try.c <<'EOCP'
16575         if (!bad)
16576                 printf("ok\n");
16577         return 0;
16578 }
16579 EOCP
16580         set try
16581         if eval $compile; then
16582                 case "`$run ./try`" in
16583                 ok) echo "Your strtoul() seems to be working okay." ;;
16584                 *) cat <<EOM >&4
16585 Your strtoul() doesn't seem to be working okay.
16586 EOM
16587                    d_strtoul="$undef"
16588                    ;;
16589                 esac
16590         fi
16591         ;;
16592 esac
16593
16594 : see if strtoull exists
16595 set strtoull d_strtoull
16596 eval $inlibc
16597
16598 case "$d_longlong-$d_strtoull" in
16599 "$define-$define")
16600         $cat <<EOM
16601 Checking whether your strtoull() works okay...
16602 EOM
16603         $cat >try.c <<'EOCP'
16604 #include <errno.h>
16605 #ifdef __hpux
16606 #define strtoull __strtoull
16607 #endif
16608 #include <stdio.h>
16609 extern unsigned long long int strtoull(char *s, char **, int); 
16610 static int bad = 0;
16611 int check(char *s, long long eull, int een) {
16612         long long gull;
16613         errno = 0;
16614         gull = strtoull(s, 0, 10);
16615         if (!((gull == eull) && (errno == een)))
16616                 bad++;
16617 }
16618 int main() {
16619         check(" 1",                                        1LL, 0);
16620         check(" 0",                                        0LL, 0);
16621         check("18446744073709551615",  18446744073709551615ULL, 0);
16622         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16623 #if 0 /* strtoull() for /^-/ strings is undefined. */
16624         check("-1",                    18446744073709551615ULL, 0);
16625         check("-18446744073709551614",                     2LL, 0);
16626         check("-18446744073709551615",                     1LL, 0);
16627         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16628         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16629 #endif
16630         if (!bad)
16631                 printf("ok\n");
16632 }
16633 EOCP
16634         set try
16635         if eval $compile; then
16636                 case "`$run ./try`" in
16637                 ok) echo "Your strtoull() seems to be working okay." ;;
16638                 *) cat <<EOM >&4
16639 Your strtoull() doesn't seem to be working okay.
16640 EOM
16641                    d_strtoull="$undef"
16642                    ;;
16643                 esac
16644         fi
16645         ;;
16646 esac
16647
16648 : see if strtouq exists
16649 set strtouq d_strtouq
16650 eval $inlibc
16651
16652 case "$d_strtouq" in
16653 "$define")
16654         $cat <<EOM
16655 Checking whether your strtouq() works okay...
16656 EOM
16657         $cat >try.c <<'EOCP'
16658 #include <errno.h>
16659 #include <stdio.h>
16660 extern unsigned long long int strtouq(char *s, char **, int); 
16661 static int bad = 0;
16662 void check(char *s, unsigned long long eull, int een) {
16663         unsigned long long gull;
16664         errno = 0;
16665         gull = strtouq(s, 0, 10);
16666         if (!((gull == eull) && (errno == een)))
16667                 bad++;
16668 }
16669 int main() {
16670         check(" 1",                                        1LL, 0);
16671         check(" 0",                                        0LL, 0);
16672         check("18446744073709551615",  18446744073709551615ULL, 0);
16673         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16674 #if 0 /* strtouq() for /^-/ strings is undefined. */
16675         check("-1",                    18446744073709551615ULL, 0);
16676         check("-18446744073709551614",                     2LL, 0);
16677         check("-18446744073709551615",                     1LL, 0);
16678         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16679         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16680 #endif
16681         if (!bad)
16682                 printf("ok\n");
16683         return 0;
16684 }
16685 EOCP
16686         set try
16687         if eval $compile; then
16688                 case "`$run ./try`" in
16689                 ok) echo "Your strtouq() seems to be working okay." ;;
16690                 *) cat <<EOM >&4
16691 Your strtouq() doesn't seem to be working okay.
16692 EOM
16693                    d_strtouq="$undef"
16694                    ;;
16695                 esac
16696         fi
16697         ;;
16698 esac
16699
16700 : see if strxfrm exists
16701 set strxfrm d_strxfrm
16702 eval $inlibc
16703
16704 : see if symlink exists
16705 set symlink d_symlink
16706 eval $inlibc
16707
16708 : see if syscall exists
16709 set syscall d_syscall
16710 eval $inlibc
16711
16712 : see if prototype for syscall is available
16713 echo " "
16714 set d_syscallproto syscall $i_unistd unistd.h
16715 eval $hasproto
16716
16717 : see if sysconf exists
16718 set sysconf d_sysconf
16719 eval $inlibc
16720
16721 : see if system exists
16722 set system d_system
16723 eval $inlibc
16724
16725 : see if tcgetpgrp exists
16726 set tcgetpgrp d_tcgetpgrp
16727 eval $inlibc
16728
16729 : see if tcsetpgrp exists
16730 set tcsetpgrp d_tcsetpgrp
16731 eval $inlibc
16732
16733 : see if prototype for telldir is available
16734 echo " "
16735 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16736 eval $hasproto
16737
16738 : see if time exists
16739 echo " "
16740 if test "X$d_time" = X -o X"$timetype" = X; then
16741     if set time val -f d_time; eval $csym; $val; then
16742                 echo 'time() found.' >&4
16743                 val="$define"
16744                 rp="What is the type returned by time() on this system?"
16745                 set time_t timetype long stdio.h sys/types.h
16746                 eval $typedef_ask
16747     else
16748                 echo 'time() not found, hope that will do.' >&4
16749                 val="$undef"
16750                 timetype='int';
16751     fi
16752     set d_time
16753     eval $setvar
16754 fi
16755
16756 : see if this is a sys/times.h system
16757 set sys/times.h i_systimes
16758 eval $inhdr
16759
16760 : see if times exists
16761 echo " "
16762 if set times val -f d_times; eval $csym; $val; then
16763         echo 'times() found.' >&4
16764         d_times="$define"
16765         inc=''
16766         case "$i_systimes" in
16767         "$define") inc='sys/times.h';;
16768         esac
16769         rp="What is the type returned by times() on this system?"
16770         set clock_t clocktype long stdio.h sys/types.h $inc
16771         eval $typedef_ask
16772 else
16773         echo 'times() NOT found, hope that will do.' >&4
16774         d_times="$undef"
16775         clocktype='int'
16776 fi
16777
16778 : see if tmpnam_r exists
16779 set tmpnam_r d_tmpnam_r
16780 eval $inlibc
16781 case "$d_tmpnam_r" in
16782 "$define")
16783         hdrs="$i_systypes sys/types.h define stdio.h "
16784         case "$d_tmpnam_r_proto:$usethreads" in
16785         ":define")      d_tmpnam_r_proto=define
16786                 set d_tmpnam_r_proto tmpnam_r $hdrs
16787                 eval $hasproto ;;
16788         *)      ;;
16789         esac
16790         case "$d_tmpnam_r_proto" in
16791         define)
16792         case "$tmpnam_r_proto" in
16793         ''|0) try='char* tmpnam_r(char*);'
16794         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16795         esac
16796         case "$tmpnam_r_proto" in
16797         ''|0)   d_tmpnam_r=undef
16798                 tmpnam_r_proto=0
16799                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16800         * )     case "$tmpnam_r_proto" in
16801                 REENTRANT_PROTO*) ;;
16802                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16803                 esac
16804                 echo "Prototype: $try" ;;
16805         esac
16806         ;;
16807         *)      case "$usethreads" in
16808                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16809                 esac
16810                 d_tmpnam_r=undef
16811                 tmpnam_r_proto=0
16812                 ;;
16813         esac
16814         ;;
16815 *)      tmpnam_r_proto=0
16816         ;;
16817 esac
16818
16819 : see if truncate exists
16820 set truncate d_truncate
16821 eval $inlibc
16822
16823 : see if ttyname_r exists
16824 set ttyname_r d_ttyname_r
16825 eval $inlibc
16826 case "$d_ttyname_r" in
16827 "$define")
16828         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16829         case "$d_ttyname_r_proto:$usethreads" in
16830         ":define")      d_ttyname_r_proto=define
16831                 set d_ttyname_r_proto ttyname_r $hdrs
16832                 eval $hasproto ;;
16833         *)      ;;
16834         esac
16835         case "$d_ttyname_r_proto" in
16836         define)
16837         case "$ttyname_r_proto" in
16838         ''|0) try='int ttyname_r(int, char*, size_t);'
16839         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16840         esac
16841         case "$ttyname_r_proto" in
16842         ''|0) try='int ttyname_r(int, char*, int);'
16843         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16844         esac
16845         case "$ttyname_r_proto" in
16846         ''|0) try='char* ttyname_r(int, char*, int);'
16847         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16848         esac
16849         case "$ttyname_r_proto" in
16850         ''|0)   d_ttyname_r=undef
16851                 ttyname_r_proto=0
16852                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16853         * )     case "$ttyname_r_proto" in
16854                 REENTRANT_PROTO*) ;;
16855                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16856                 esac
16857                 echo "Prototype: $try" ;;
16858         esac
16859         ;;
16860         *)      case "$usethreads" in
16861                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16862                 esac
16863                 d_ttyname_r=undef
16864                 ttyname_r_proto=0
16865                 ;;
16866         esac
16867         ;;
16868 *)      ttyname_r_proto=0
16869         ;;
16870 esac
16871
16872 : see if tzname[] exists
16873 echo " "
16874 if set tzname val -a d_tzname; eval $csym; $val; then
16875         val="$define"
16876         echo 'tzname[] found.' >&4
16877 else
16878         val="$undef"
16879         echo 'tzname[] NOT found.' >&4
16880 fi
16881 set d_tzname
16882 eval $setvar
16883
16884 case "$osname" in
16885 next|rhapsody|darwin) multiarch="$define" ;;
16886 esac
16887 case "$multiarch" in
16888 ''|[nN]*) multiarch="$undef" ;;
16889 esac
16890
16891 : check for ordering of bytes in a UV
16892 echo " "
16893 case "$usecrosscompile$multiarch" in
16894 *$define*)
16895         $cat <<EOM
16896 You seem to be either cross-compiling or doing a multiarchitecture build,
16897 skipping the byteorder check.
16898
16899 EOM
16900         byteorder='ffff'
16901         ;;
16902 *)
16903         case "$byteorder" in
16904         '')
16905                 $cat <<'EOM'
16906 In the following, larger digits indicate more significance.  A big-endian
16907 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16908 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16909 machines may have weird orders like 3412.  A Cray will report 87654321,
16910 an Alpha will report 12345678. If the test program works the default is
16911 probably right.
16912 I'm now running the test program...
16913 EOM
16914                 $cat >try.c <<EOCP
16915 #include <stdio.h>
16916 #$i_stdlib I_STDLIB
16917 #ifdef I_STDLIB
16918 #include <stdlib.h>
16919 #endif
16920 #include <sys/types.h>
16921 typedef $uvtype UV;
16922 int main()
16923 {
16924         int i;
16925         union {
16926                 UV l;
16927                 char c[$uvsize];
16928         } u;
16929
16930         if ($uvsize > 4)
16931                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16932         else
16933                 u.l = (UV)0x04030201;
16934         for (i = 0; i < $uvsize; i++)
16935                 printf("%c", u.c[i]+'0');
16936         printf("\n");
16937         exit(0);
16938 }
16939 EOCP
16940                 xxx_prompt=y
16941                 set try
16942                 if eval $compile && ./try > /dev/null; then
16943                         dflt=`$run ./try`
16944                         case "$dflt" in
16945                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16946                                 echo "(The test program ran ok.)"
16947                                 echo "byteorder=$dflt"
16948                                 xxx_prompt=n
16949                         ;;
16950                         ????|????????) echo "(The test program ran ok.)" ;;
16951                         *) echo "(The test program didn't run right for some reason.)" ;;
16952                         esac
16953                 else
16954                         dflt='4321'
16955                         cat <<'EOM'
16956 (I can't seem to compile the test program.  Guessing big-endian...)
16957 EOM
16958                 fi
16959                 case "$xxx_prompt" in
16960                 y)
16961                         rp="What is the order of bytes in $uvtype?"
16962                         . ./myread
16963                         byteorder="$ans"
16964                         ;;
16965                 *)      byteorder=$dflt
16966                         ;;
16967                 esac
16968                 ;;
16969         esac
16970         $rm -f try.c try
16971         ;;
16972 esac
16973
16974
16975 $cat <<EOM
16976
16977 Checking to see whether you can access character data unalignedly...
16978 EOM
16979 case "$d_u32align" in
16980 '')   $cat >try.c <<EOCP
16981 #include <stdio.h>
16982 #$i_stdlib I_STDLIB
16983 #ifdef I_STDLIB
16984 #include <stdlib.h>
16985 #endif
16986 #define U32 $u32type
16987 #define BYTEORDER 0x$byteorder
16988 #define U8 $u8type
16989 #include <signal.h>
16990 #ifdef SIGBUS
16991 $signal_t bletch(s) int s; { exit(4); }
16992 #endif
16993 int main() {
16994 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16995     U8 buf[8];
16996     U32 *up;
16997     int i;
16998
16999     if (sizeof(U32) != 4) {
17000         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17001         exit(1);
17002     }
17003
17004     fflush(stdout);
17005
17006 #ifdef SIGBUS
17007     signal(SIGBUS, bletch);
17008 #endif
17009
17010     buf[0] = 0;
17011     buf[1] = 0;
17012     buf[2] = 0;
17013     buf[3] = 1;
17014     buf[4] = 0;
17015     buf[5] = 0;
17016     buf[6] = 0;
17017     buf[7] = 1;
17018
17019     for (i = 0; i < 4; i++) {
17020         up = (U32*)(buf + i);
17021         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17022                (*up == 1 << (8*(3-i)))  /* little-endian */
17023               )
17024            )
17025         {
17026             printf("read failed (%x)\n", *up);
17027             exit(2);
17028         }
17029     }
17030
17031     /* write test */
17032     for (i = 0; i < 4; i++) {
17033         up = (U32*)(buf + i);
17034         *up = 0xBeef;
17035         if (*up != 0xBeef) {
17036             printf("write failed (%x)\n", *up);
17037             exit(3);
17038         }
17039     }
17040
17041     exit(0);
17042 #else
17043     printf("1\n");
17044     exit(1);
17045 #endif
17046     return 0;
17047 }
17048 EOCP
17049 set try
17050 if eval $compile_ok; then
17051         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17052         $run ./try 2>&1 >/dev/null
17053         case "$?" in
17054         0)      cat >&4 <<EOM
17055 You can access character data pretty unalignedly.
17056 EOM
17057                 d_u32align="$undef"
17058                 ;;
17059         *)      cat >&4 <<EOM
17060 It seems that you must access character data in an aligned manner.
17061 EOM
17062                 d_u32align="$define"
17063                 ;;
17064         esac
17065 else
17066         rp='Can you access character data at unaligned addresses?'
17067         dflt='n'
17068         . ./myread
17069         case "$ans" in
17070         [yY]*)  d_u32align="$undef"  ;;
17071         *)      d_u32align="$define" ;;
17072         esac
17073 fi
17074 $rm -f core core.try.* try.core
17075 ;;
17076 esac
17077
17078 : see if ualarm exists
17079 set ualarm d_ualarm
17080 eval $inlibc
17081
17082 : see if umask exists
17083 set umask d_umask
17084 eval $inlibc
17085
17086 : see if unordered exists
17087 set unordered d_unordered
17088 eval $inlibc
17089
17090 : see if usleep exists
17091 set usleep d_usleep
17092 eval $inlibc
17093
17094 : see if prototype for usleep is available
17095 echo " "
17096 set d_usleepproto usleep $i_unistd unistd.h
17097 eval $hasproto
17098
17099 : see if ustat exists
17100 set ustat d_ustat
17101 eval $inlibc
17102
17103 : backward compatibility for d_hvfork
17104 if test X$d_hvfork != X; then
17105         d_vfork="$d_hvfork"
17106         d_hvfork=''
17107 fi
17108 : see if there is a vfork
17109 val=''
17110 set vfork val
17111 eval $inlibc
17112
17113 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17114 : perl on Solaris 2.x, and probably elsewhere.
17115 case "$val" in
17116 $define)
17117         echo " "
17118         case "$usevfork" in
17119         false) dflt='n';;
17120         *) dflt='y';;
17121         esac
17122         cat <<'EOM'
17123  
17124 Perl can only use a vfork() that doesn't suffer from strict
17125 restrictions on calling functions or modifying global data in
17126 the child.  For example, glibc-2.1 contains such a vfork()
17127 that is unsuitable.  If your system provides a proper fork()
17128 call, chances are that you do NOT want perl to use vfork().
17129
17130 EOM
17131         rp="Do you still want to use vfork()?"
17132         . ./myread
17133         case "$ans" in
17134         y|Y) ;;
17135         *)
17136                 echo "Ok, we won't use vfork()."
17137                 val="$undef"
17138                 ;;
17139         esac
17140         ;;
17141 esac
17142 set d_vfork
17143 eval $setvar
17144 case "$d_vfork" in
17145 $define) usevfork='true';;
17146 *) usevfork='false';;
17147 esac
17148
17149 : see if closedir exists
17150 set closedir d_closedir
17151 eval $inlibc
17152
17153 case "$d_closedir" in
17154 "$define")
17155         echo " "
17156         echo "Checking whether closedir() returns a status..." >&4
17157         cat > try.c <<EOM
17158 #$i_dirent I_DIRENT             /**/
17159 #$i_sysdir I_SYS_DIR            /**/
17160 #$i_sysndir I_SYS_NDIR          /**/
17161 #$i_systypes I_SYS_TYPES        /**/
17162
17163 #if defined(I_SYS_TYPES)
17164 #include <sys/types.h>
17165 #endif
17166 #if defined(I_DIRENT)
17167 #include <dirent.h>
17168 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17169 #include <sys/dir.h>
17170 #endif
17171 #else
17172 #ifdef I_SYS_NDIR
17173 #include <sys/ndir.h>
17174 #else
17175 #ifdef I_SYS_DIR
17176 #ifdef hp9000s500
17177 #include <ndir.h>       /* may be wrong in the future */
17178 #else
17179 #include <sys/dir.h>
17180 #endif
17181 #endif
17182 #endif
17183 #endif 
17184 int main() { return closedir(opendir(".")); }
17185 EOM
17186         set try
17187         if eval $compile_ok; then
17188                 if $run ./try > /dev/null 2>&1 ; then
17189                         echo "Yes, it does."
17190                         val="$undef"
17191                 else
17192                         echo "No, it doesn't."
17193                         val="$define"
17194                 fi
17195         else
17196                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17197                 val="$define"
17198         fi
17199         ;;
17200 *)
17201         val="$undef";
17202         ;;
17203 esac
17204 set d_void_closedir
17205 eval $setvar
17206 $rm -f try try.*
17207 : see if there is a wait4
17208 set wait4 d_wait4
17209 eval $inlibc
17210
17211 : see if waitpid exists
17212 set waitpid d_waitpid
17213 eval $inlibc
17214
17215 : see if wcstombs exists
17216 set wcstombs d_wcstombs
17217 eval $inlibc
17218
17219 : see if wctomb exists
17220 set wctomb d_wctomb
17221 eval $inlibc
17222
17223 : see if writev exists
17224 set writev d_writev
17225 eval $inlibc
17226
17227 : preserve RCS keywords in files with variable substitution, grrr
17228 Date='$Date'
17229 Id='$Id'
17230 Log='$Log'
17231 RCSfile='$RCSfile'
17232 Revision='$Revision'
17233
17234 : check for alignment requirements
17235 echo " "
17236 case "$usecrosscompile$multiarch" in
17237 *$define*)
17238         $cat <<EOM
17239 You seem to be either cross-compiling or doing a multiarchitecture build,
17240 skipping the memory alignment check.
17241
17242 EOM
17243         case "$alignbytes" in
17244         '') alignbytes=8 ;;
17245         esac
17246         ;;
17247 *)
17248         case "$alignbytes" in
17249         '') echo "Checking alignment constraints..." >&4
17250                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17251                         $cat >try.c <<'EOCP'
17252 typedef long double NV;
17253 EOCP
17254                 else
17255                         $cat >try.c <<'EOCP'
17256 typedef double NV;
17257 EOCP
17258                 fi
17259                 $cat >>try.c <<'EOCP'
17260 #include <stdio.h>
17261 struct foobar {
17262         char foo;
17263         NV bar;
17264 } try_algn;
17265 int main()
17266 {
17267     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17268     return(0);
17269 }
17270 EOCP
17271                 set try
17272                 if eval $compile_ok; then
17273                         dflt=`$run ./try`
17274                 else
17275                         dflt='8'
17276                         echo "(I can't seem to compile the test program...)"
17277                 fi
17278                 ;;
17279         *) dflt="$alignbytes"
17280                 ;;
17281         esac
17282         rp="Doubles must be aligned on a how-many-byte boundary?"
17283         . ./myread
17284         alignbytes="$ans"
17285         $rm -f try.c try
17286         ;;
17287 esac
17288
17289
17290 : set the base revision
17291 baserev=5.0
17292
17293 : how do we concatenate cpp tokens here?
17294 echo " "
17295 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17296 $cat >cpp_stuff.c <<'EOCP'
17297 #define RCAT(a,b)a/**/b
17298 #define ACAT(a,b)a ## b
17299 RCAT(Rei,ser)
17300 ACAT(Cir,cus)
17301 EOCP
17302 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17303 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17304         echo "Oh!  Smells like ANSI's been here." >&4
17305         echo "We can catify or stringify, separately or together!"
17306         cpp_stuff=42
17307 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17308         echo "Ah, yes!  The good old days!" >&4
17309         echo "However, in the good old days we don't know how to stringify and"
17310         echo "catify at the same time."
17311         cpp_stuff=1
17312 else
17313         $cat >&4 <<EOM
17314 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17315 You're going to have to edit the values of CAT[2-5] in config.h...
17316 EOM
17317         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17318 fi
17319 $rm -f cpp_stuff.*
17320
17321 : see if this is a db.h system
17322 set db.h i_db
17323 eval $inhdr
17324
17325 case "$i_db" in
17326 $define)
17327         : Check db version.
17328         echo " "
17329         echo "Checking Berkeley DB version ..." >&4
17330         $cat >try.c <<EOCP
17331 #$d_const HASCONST
17332 #ifndef HASCONST
17333 #define const
17334 #endif
17335 #include <sys/types.h>
17336 #include <stdio.h>
17337 #$i_stdlib I_STDLIB
17338 #ifdef I_STDLIB
17339 #include <stdlib.h>
17340 #endif
17341 #include <db.h>
17342 int main(int argc, char *argv[])
17343 {
17344 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17345     int Major, Minor, Patch ;
17346     unsigned long Version ;
17347     (void)db_version(&Major, &Minor, &Patch) ;
17348     if (argc == 2) {
17349         printf("%d %d %d %d %d %d\n",
17350                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17351                Major, Minor, Patch);
17352         exit(0);
17353     }
17354     printf("You have Berkeley DB Version 2 or greater.\n");
17355
17356     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17357                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17358     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17359                 Major, Minor, Patch) ;
17360
17361     /* check that db.h & libdb are compatible */
17362     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17363         printf("db.h and libdb are incompatible.\n") ;
17364         exit(3);        
17365     }
17366
17367     printf("db.h and libdb are compatible.\n") ;
17368
17369     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17370                 + DB_VERSION_PATCH ;
17371
17372     /* needs to be >= 2.3.4 */
17373     if (Version < 2003004) {
17374     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17375         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17376         exit(2);        
17377     }
17378
17379     exit(0);
17380 #else
17381 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17382     if (argc == 2) {
17383         printf("1 0 0\n");
17384         exit(0);
17385     }
17386     printf("You have Berkeley DB Version 1.\n");
17387     exit(0);    /* DB version < 2: the coast is clear. */
17388 #else
17389     exit(1);    /* <db.h> not Berkeley DB? */
17390 #endif
17391 #endif
17392 }
17393 EOCP
17394         set try
17395         if eval $compile_ok && $run ./try; then
17396                 echo 'Looks OK.' >&4
17397                 set `$run ./try 1`
17398                 db_version_major=$1
17399                 db_version_minor=$2
17400                 db_version_patch=$3
17401         else
17402                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17403                 i_db=$undef
17404                 case " $libs " in
17405                 *"-ldb "*)
17406                         : Remove db from list of libraries to use
17407                         echo "Removing unusable -ldb from library list" >&4
17408                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17409                         shift
17410                         libs="$*"
17411                         echo "libs = $libs" >&4
17412                         ;;
17413                 esac
17414         fi
17415         $rm -f try.*
17416         ;;
17417 esac
17418
17419 case "$i_db" in
17420 define)
17421         : Check the return type needed for hash 
17422         echo " "
17423         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17424         $cat >try.c <<EOCP
17425 #$d_const HASCONST
17426 #ifndef HASCONST
17427 #define const
17428 #endif
17429 #include <sys/types.h>
17430 #include <db.h>
17431
17432 #ifndef DB_VERSION_MAJOR
17433 u_int32_t hash_cb (ptr, size)
17434 const void *ptr;
17435 size_t size;
17436 {
17437 }
17438 HASHINFO info;
17439 int main()
17440 {
17441         info.hash = hash_cb;
17442 }
17443 #endif
17444 EOCP
17445         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17446                 if $contains warning try.out >>/dev/null 2>&1 ; then
17447                         db_hashtype='int'
17448                 else
17449                         db_hashtype='u_int32_t'
17450                 fi
17451         else
17452                 : XXX Maybe we should just give up here.
17453                 db_hashtype=u_int32_t
17454                 $cat try.out >&4
17455                 echo "Help:  I can't seem to compile the db test program." >&4
17456                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17457         fi
17458         $rm -f try.*
17459         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17460         ;;
17461 *)      db_hashtype=u_int32_t
17462         ;;
17463 esac
17464 case "$i_db" in
17465 define)
17466         : Check the return type needed for prefix 
17467         echo " "
17468         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17469         cat >try.c <<EOCP
17470 #$d_const HASCONST
17471 #ifndef HASCONST
17472 #define const
17473 #endif
17474 #include <sys/types.h>
17475 #include <db.h>
17476
17477 #ifndef DB_VERSION_MAJOR
17478 size_t prefix_cb (key1, key2)
17479 const DBT *key1;
17480 const DBT *key2;
17481 {
17482 }
17483 BTREEINFO info;
17484 int main()
17485 {
17486         info.prefix = prefix_cb;
17487 }
17488 #endif
17489 EOCP
17490         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17491                 if $contains warning try.out >>/dev/null 2>&1 ; then
17492                         db_prefixtype='int'
17493                 else
17494                         db_prefixtype='size_t'
17495                 fi
17496         else
17497                 db_prefixtype='size_t'
17498                 : XXX Maybe we should just give up here.
17499                 $cat try.out >&4
17500                 echo "Help:  I can't seem to compile the db test program." >&4
17501                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17502         fi
17503         $rm -f try.*
17504         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17505         ;;
17506 *)      db_prefixtype='size_t'
17507         ;;
17508 esac
17509
17510
17511 : How can we generate normalized random numbers ?
17512 echo " "
17513 echo "Looking for a random number function..." >&4
17514 case "$randfunc" in
17515 '')
17516         if set drand48 val -f; eval $csym; $val; then
17517                 dflt="drand48"
17518                 echo "Good, found drand48()." >&4
17519         elif set random val -f; eval $csym; $val; then
17520                 dflt="random"
17521                 echo "OK, found random()." >&4
17522         else
17523                 dflt="rand"
17524                 echo "Yick, looks like I have to use rand()." >&4
17525         fi
17526         echo " "
17527         ;;
17528 *)
17529         dflt="$randfunc"
17530         ;;
17531 esac
17532 cont=true
17533
17534 case "$ccflags" in
17535 *-Dmy_rand=*|*-Dmy_srand=*)
17536         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17537         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17538         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17539         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17540         ;;
17541 esac
17542
17543 while $test "$cont"; do
17544         rp="Use which function to generate random numbers?"
17545         . ./myread
17546         if $test "$ans" = "$dflt"; then
17547                 : null
17548         else
17549                 randbits=''
17550         fi
17551         randfunc="$ans"
17552         if set $ans val -f; eval $csym; $val; then
17553                 cont=''
17554         else
17555                 dflt=y
17556                 rp="I cannot find function $ans. Use that name anyway?"
17557                 . ./myread
17558                 dflt=rand
17559                 case "$ans" in
17560                         [yY]*) cont='';;
17561                 esac
17562         fi
17563         case "$cont" in
17564         '')
17565                 case "$randfunc" in
17566                 drand48)
17567                         drand01="drand48()"
17568                         seedfunc="srand48"
17569                         randbits=48
17570                         randseedtype=long
17571                         ;;
17572                 rand|random)
17573                         case "$randbits" in
17574                         '')
17575 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17576                                 $cat >try.c <<EOCP
17577 #$i_unistd I_UNISTD
17578 #$i_stdlib I_STDLIB
17579 #include <stdio.h>
17580 #ifdef I_UNISTD
17581 #  include <unistd.h>
17582 #endif
17583 #ifdef I_STDLIB
17584 #  include <stdlib.h>
17585 #endif
17586 int main()
17587 {
17588         register int i;
17589         register unsigned long tmp;
17590         register unsigned long max = 0L;
17591
17592         for (i = 1000; i; i--) {
17593                 tmp = (unsigned long) $randfunc();
17594                 if (tmp > max) max = tmp;
17595         }
17596         for (i = 0; max; i++)
17597                 max /= 2;
17598         printf("%d\n",i);
17599 }
17600 EOCP
17601                                 set try
17602                                 if eval $compile_ok; then
17603                                         dflt=`try`
17604                                 else
17605                                         dflt='?'
17606                                         echo "(I can't seem to compile the test program...)"
17607                                 fi
17608                                 ;;
17609                         *)
17610                                 dflt="$randbits"
17611                                 ;;
17612                         esac
17613                         rp="How many bits does your $randfunc() function produce?"
17614                         . ./myread
17615                         randbits="$ans"
17616                         $rm -f try.c try
17617                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17618                         seedfunc="s$randfunc"
17619                         randseedtype=unsigned
17620                         ;;
17621                 *)
17622                         dflt="31"
17623                         rp="How many bits does your $randfunc() function produce?"
17624                         . ./myread
17625                         randbits="$ans"
17626                         seedfunc="s$randfunc"
17627                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17628                         if set $seedfunc val -f; eval $csym; $val; then
17629                                 echo "(Using $seedfunc() to seed random generator)"
17630                         else
17631                                 echo "(Warning: no $seedfunc() to seed random generator)"
17632                                 seedfunc=rand
17633                         fi
17634                         randseedtype=unsigned
17635                         ;;
17636                 esac
17637                 ;;
17638         esac
17639 done
17640
17641 echo " "
17642 echo "Determining whether or not we are on an EBCDIC system..." >&4
17643 $cat >try.c <<'EOM'
17644 int main()
17645 {
17646   if ('M'==0xd4) return 0;
17647   return 1;
17648 }
17649 EOM
17650
17651 val=$undef
17652 set try
17653 if eval $compile_ok; then
17654         if $run ./try; then
17655                 echo "You seem to speak EBCDIC." >&4
17656                 val="$define"
17657         else
17658                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17659         fi
17660 else
17661         echo "I'm unable to compile the test program." >&4
17662         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17663 fi
17664 $rm -f try try.*
17665 set ebcdic
17666 eval $setvar
17667
17668 echo " "
17669 $cat >&4 <<EOM
17670 Checking how to flush all pending stdio output...
17671 EOM
17672 # I only know how to find the first 32 possibly open files on SunOS.
17673 # See also hints/sunos_4_1.sh and util.c  --AD
17674 case "$osname" in
17675 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17676 esac
17677 $cat >>try.c <<EOCP
17678 #include <stdio.h>
17679 #$i_stdlib I_STDLIB
17680 #ifdef I_STDLIB
17681 #include <stdlib.h>
17682 #endif
17683 #$i_unistd I_UNISTD
17684 #ifdef I_UNISTD
17685 # include <unistd.h>
17686 #endif
17687 #$d_sysconf HAS_SYSCONF
17688 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17689 #ifdef HAS_STDIO_STREAM_ARRAY
17690 # define STDIO_STREAM_ARRAY $stdio_stream_array
17691 #endif
17692 int main() {
17693   FILE* p;
17694   unlink("try.out");
17695   p = fopen("try.out", "w");
17696 #ifdef TRY_FPUTC
17697   fputc('x', p);
17698 #else
17699 # ifdef TRY_FPRINTF
17700   fprintf(p, "x");
17701 # endif
17702 #endif
17703 #ifdef TRY_FFLUSH_NULL
17704   fflush(NULL);
17705 #endif
17706 #ifdef TRY_FFLUSH_ALL
17707   {
17708     long open_max = -1;
17709 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17710     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17711 # else
17712 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17713     open_max = sysconf(_SC_OPEN_MAX);
17714 #  else
17715 #   ifdef FOPEN_MAX
17716     open_max = FOPEN_MAX;
17717 #   else
17718 #    ifdef OPEN_MAX
17719     open_max = OPEN_MAX;
17720 #    else
17721 #     ifdef _NFILE
17722     open_max = _NFILE;
17723 #     endif
17724 #    endif
17725 #   endif
17726 #  endif
17727 # endif 
17728 # ifdef HAS_STDIO_STREAM_ARRAY
17729     if (open_max > 0) {
17730       long i;
17731       for (i = 0; i < open_max; i++)
17732             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17733                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17734                 STDIO_STREAM_ARRAY[i]._flag)
17735                 fflush(&STDIO_STREAM_ARRAY[i]);
17736     }   
17737   }
17738 # endif
17739 #endif
17740   _exit(42);
17741 }
17742 EOCP
17743 : first we have to find out how _not_ to flush
17744 $to try.c
17745 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17746     output=''
17747     set try -DTRY_FPUTC
17748     if eval $compile; then
17749             $run ./try 2>/dev/null
17750             code="$?"
17751             $from try.out
17752             if $test ! -s try.out -a "X$code" = X42; then
17753                 output=-DTRY_FPUTC
17754             fi
17755     fi
17756     case "$output" in
17757     '')
17758             set try -DTRY_FPRINTF
17759             if eval $compile; then
17760                     $run ./try 2>/dev/null
17761                     code="$?"
17762                     $from try.out
17763                     if $test ! -s try.out -a "X$code" = X42; then
17764                         output=-DTRY_FPRINTF
17765                     fi
17766             fi
17767         ;;
17768     esac
17769 fi
17770 : check for fflush NULL behaviour
17771 case "$fflushNULL" in
17772 '')     set try -DTRY_FFLUSH_NULL $output
17773         if eval $compile; then
17774                 $run ./try 2>/dev/null
17775                 code="$?"
17776                 $from try.out
17777                 if $test -s try.out -a "X$code" = X42; then
17778                         fflushNULL="`$cat try.out`"
17779                 else
17780                         if $test "X$code" != X42; then
17781                                 $cat >&4 <<EOM
17782 (If this test failed, don't worry, we'll try another method shortly.)
17783 EOM
17784                         fi
17785                 fi
17786         fi
17787         $rm -f core try.core core.try.*
17788         case "$fflushNULL" in
17789         x)      $cat >&4 <<EOM
17790 Your fflush(NULL) works okay for output streams.
17791 Let's see if it clobbers input pipes...
17792 EOM
17793 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17794 # bug that improperly flushes the input end of pipes.  So we avoid the
17795 # autoflush on fork/system/exec support for now. :-(
17796 $cat >tryp.c <<EOCP
17797 #include <stdio.h>
17798 int
17799 main(int argc, char **argv)
17800 {
17801     char buf[1024];
17802     int i;
17803     char *bp = buf;
17804     while (1) {
17805         while ((i = getc(stdin)) != -1
17806                && (*bp++ = i) != '\n'
17807                && bp < &buf[1024])
17808         /* DO NOTHING */ ;
17809         *bp = '\0';
17810         fprintf(stdout, "%s", buf);
17811         fflush(NULL);
17812         if (i == -1)
17813             return 0;
17814         bp = buf;
17815     }
17816 }
17817 EOCP
17818                 fflushNULL="$define"
17819                 set tryp
17820                 if eval $compile; then
17821                     $rm -f tryp.out
17822                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17823                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17824                        $cat >&4 <<EOM
17825 fflush(NULL) seems to behave okay with input streams.
17826 EOM
17827                         fflushNULL="$define"
17828                     else
17829                         $cat >&4 <<EOM
17830 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17831 EOM
17832                         fflushNULL="$undef"
17833                     fi
17834                 fi
17835                 $rm -f core tryp.c tryp.core core.tryp.*
17836                 ;;
17837         '')     $cat >&4 <<EOM
17838 Your fflush(NULL) isn't working (contrary to ANSI C).
17839 EOM
17840                 fflushNULL="$undef"
17841                 ;;
17842         *)      $cat >&4 <<EOM
17843 Cannot figure out whether your fflush(NULL) works or not.
17844 I'm assuming it doesn't (contrary to ANSI C).
17845 EOM
17846                 fflushNULL="$undef"
17847                 ;;
17848         esac
17849         ;;
17850 $define|true|[yY]*)
17851         fflushNULL="$define"
17852         ;;
17853 *)
17854         fflushNULL="$undef"
17855         ;;
17856 esac
17857 : check explicit looping only if NULL did not work, and if the pipe
17858 : bug does not show up on an explicit flush too
17859 case "$fflushNULL" in
17860 "$undef")
17861         $cat >tryp.c <<EOCP
17862 #include <stdio.h>
17863 int
17864 main(int argc, char **argv)
17865 {
17866     char buf[1024];
17867     int i;
17868     char *bp = buf;
17869     while (1) {
17870         while ((i = getc(stdin)) != -1
17871                && (*bp++ = i) != '\n'
17872                && bp < &buf[1024])
17873         /* DO NOTHING */ ;
17874         *bp = '\0';
17875         fprintf(stdout, "%s", buf);
17876         fflush(stdin);
17877         if (i == -1)
17878             return 0;
17879         bp = buf;
17880     }
17881 }
17882 EOCP
17883         set tryp
17884         if eval $compile; then
17885             $rm -f tryp.out
17886             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17887             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17888                $cat >&4 <<EOM
17889 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17890 EOM
17891                 : now check for fflushall behaviour
17892                 case "$fflushall" in
17893                 '')     set try -DTRY_FFLUSH_ALL $output
17894                         if eval $compile; then
17895                                 $cat >&4 <<EOM
17896 (Now testing the other method--but note that this also may fail.)
17897 EOM
17898                                 $run ./try 2>/dev/null
17899                                 code=$?
17900                                 $from try.out
17901                                 if $test -s try.out -a "X$code" = X42; then
17902                                         fflushall="`$cat try.out`"
17903                                 fi
17904                         fi
17905                         $rm -f core try.core core.try.*
17906                         case "$fflushall" in
17907                         x)      $cat >&4 <<EOM
17908 Whew. Flushing explicitly all the stdio streams works.
17909 EOM
17910                                 fflushall="$define"
17911                                 ;;
17912                         '')     $cat >&4 <<EOM
17913 Sigh. Flushing explicitly all the stdio streams doesn't work.
17914 EOM
17915                                 fflushall="$undef"
17916                                 ;;
17917                         *)      $cat >&4 <<EOM
17918 Cannot figure out whether flushing stdio streams explicitly works or not.
17919 I'm assuming it doesn't.
17920 EOM
17921                                 fflushall="$undef"
17922                                 ;;
17923                         esac
17924                         ;;
17925                 "$define"|true|[yY]*)
17926                         fflushall="$define"
17927                         ;;
17928                 *)
17929                         fflushall="$undef"
17930                         ;;
17931                 esac
17932             else
17933                 $cat >&4 <<EOM
17934 All is futile.  Even fflush(stdin) clobbers input pipes!
17935 EOM
17936                 fflushall="$undef"
17937             fi
17938         else
17939             fflushall="$undef"
17940         fi
17941         $rm -f core tryp.c tryp.core core.tryp.*
17942         ;;
17943 *)      fflushall="$undef"
17944         ;;
17945 esac
17946
17947 case "$fflushNULL$fflushall" in
17948 undefundef)
17949         $cat <<EOM
17950 OK, I give up.  I cannot figure out how to flush pending stdio output.
17951 We won't be flushing handles at all before fork/exec/popen.
17952 EOM
17953         ;;
17954 esac
17955 $rm -f try.* try$exe_ext
17956
17957 : Store the full pathname to the ar program for use in the C program
17958 : Respect a hint or command line value for full_ar.
17959 case "$full_ar" in
17960 '') full_ar=$ar ;;
17961 esac
17962
17963 : Store the full pathname to the sed program for use in the C program
17964 full_sed=$sed
17965
17966 : see what type gids are declared as in the kernel
17967 echo " "
17968 echo "Looking for the type for group ids returned by getgid()."
17969 set gid_t gidtype xxx stdio.h sys/types.h
17970 eval $typedef
17971 case "$gidtype" in
17972 xxx)
17973         xxx=`./findhdr sys/user.h`
17974         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17975         case $1 in
17976         unsigned) dflt="$1 $2" ;;
17977         *) dflt="$1" ;;
17978         esac
17979         ;;
17980 *) dflt="$gidtype";;
17981 esac
17982 case "$gidtype" in
17983 gid_t) echo "gid_t found." ;;
17984 *)      rp="What is the type for group ids returned by getgid()?"
17985         . ./myread
17986         gidtype="$ans"
17987         ;;
17988 esac
17989
17990 echo " "
17991 case "$gidtype" in
17992 *_t) zzz="$gidtype"     ;;
17993 *)   zzz="gid"          ;;
17994 esac
17995 echo "Checking the size of $zzz..." >&4 
17996 cat > try.c <<EOCP
17997 #include <sys/types.h>
17998 #include <stdio.h>
17999 #$i_stdlib I_STDLIB
18000 #ifdef I_STDLIB
18001 #include <stdlib.h>
18002 #endif
18003 int main() {
18004     printf("%d\n", (int)sizeof($gidtype));
18005     exit(0);
18006 }
18007 EOCP
18008 set try
18009 if eval $compile_ok; then
18010         yyy=`$run ./try`
18011         case "$yyy" in
18012         '')     gidsize=4
18013                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18014                 ;;
18015         *)      gidsize=$yyy
18016                 echo "Your $zzz is $gidsize bytes long."
18017                 ;;
18018         esac
18019 else
18020         gidsize=4
18021         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18022 fi
18023
18024
18025 echo " "
18026 case "$gidtype" in
18027 *_t) zzz="$gidtype"     ;;
18028 *)   zzz="gid"          ;;
18029 esac
18030 echo "Checking the sign of $zzz..." >&4 
18031 cat > try.c <<EOCP
18032 #include <sys/types.h>
18033 #include <stdio.h>
18034 int main() {
18035         $gidtype foo = -1;
18036         if (foo < 0)
18037                 printf("-1\n");
18038         else
18039                 printf("1\n");
18040 }
18041 EOCP
18042 set try
18043 if eval $compile; then
18044         yyy=`$run ./try`
18045         case "$yyy" in
18046         '')     gidsign=1
18047                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18048                 ;;
18049         *)      gidsign=$yyy
18050                 case "$gidsign" in
18051                  1) echo "Your $zzz is unsigned." ;;
18052                 -1) echo "Your $zzz is signed."   ;;
18053                 esac
18054                 ;;
18055         esac
18056 else
18057         gidsign=1
18058         echo "(I can't compile the test program--guessing unsigned.)" >&4
18059 fi
18060
18061
18062 echo " "
18063
18064 if $test X"$quadtype" != X; then
18065
18066 echo "Checking how to print 64-bit integers..." >&4
18067
18068 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18069         $cat >try.c <<'EOCP'
18070 #include <sys/types.h>
18071 #include <stdio.h>
18072 int main() {
18073   int q = 12345678901;
18074   printf("%ld\n", q);
18075 }
18076 EOCP
18077         set try
18078         if eval $compile; then
18079                 yyy=`$run ./try`
18080                 case "$yyy" in
18081                 12345678901)
18082                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18083                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18084                         echo "We will use %d."
18085                         ;;
18086                 esac
18087         fi
18088 fi
18089
18090 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18091         $cat >try.c <<'EOCP'
18092 #include <sys/types.h>
18093 #include <stdio.h>
18094 int main() {
18095   long q = 12345678901;
18096   printf("%ld\n", q);
18097 }
18098 EOCP
18099         set try
18100         if eval $compile; then
18101                 yyy=`$run ./try`
18102                 case "$yyy" in
18103                 12345678901)
18104                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18105                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18106                         echo "We will use %ld."
18107                         ;;
18108                 esac
18109         fi
18110 fi
18111
18112 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18113         $cat >try.c <<'EOCP'
18114 #include <sys/types.h>
18115 #include <inttypes.h>
18116 #include <stdio.h>
18117 int main() {
18118   int64_t q = 12345678901;
18119   printf("%" PRId64 "\n", q);
18120 }
18121 EOCP
18122         set try
18123         if eval $compile; then
18124                 yyy=`$run ./try`
18125                 case "$yyy" in
18126                 12345678901)
18127                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18128                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18129                         echo "We will use the C9X style."
18130                         ;;
18131                 esac
18132         fi
18133 fi
18134
18135 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18136         $cat >try.c <<EOCP
18137 #include <sys/types.h>
18138 #include <stdio.h>
18139 int main() {
18140   $quadtype q = 12345678901;
18141   printf("%Ld\n", q);
18142 }
18143 EOCP
18144         set try
18145         if eval $compile; then
18146                 yyy=`$run ./try`
18147                 case "$yyy" in
18148                 12345678901)
18149                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18150                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18151                         echo "We will use %Ld."
18152                         ;;
18153                 esac
18154         fi
18155 fi
18156
18157 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18158         $cat >try.c <<'EOCP'
18159 #include <sys/types.h>
18160 #include <stdio.h>
18161 int main() {
18162   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18163   printf("%lld\n", q);
18164 }
18165 EOCP
18166         set try
18167         if eval $compile; then
18168                 yyy=`$run ./try`
18169                 case "$yyy" in
18170                 12345678901)
18171                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18172                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18173                         echo "We will use the %lld style."
18174                         ;;
18175                 esac
18176         fi
18177 fi
18178
18179 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18180         $cat >try.c <<EOCP
18181 #include <sys/types.h>
18182 #include <stdio.h>
18183 int main() {
18184   $quadtype q = 12345678901;
18185   printf("%qd\n", q);
18186 }
18187 EOCP
18188         set try
18189         if eval $compile; then
18190                 yyy=`$run ./try`
18191                 case "$yyy" in
18192                 12345678901)
18193                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18194                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18195                         echo "We will use %qd."
18196                         ;;
18197                 esac
18198         fi
18199 fi
18200
18201 if $test X"$sPRId64" = X; then
18202         echo "Cannot figure out how to print 64-bit integers." >&4
18203 fi
18204
18205 $rm -f try try.*
18206
18207 fi
18208
18209 case "$sPRId64" in
18210 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18211         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18212         ;;
18213 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18214         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18215         ;;
18216 esac
18217
18218
18219 echo " "
18220 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18221
18222 if $test X"$ivsize" = X8; then
18223         ivdformat="$sPRId64"
18224         uvuformat="$sPRIu64"
18225         uvoformat="$sPRIo64"
18226         uvxformat="$sPRIx64"
18227         uvXUformat="$sPRIXU64"
18228 else
18229         if $test X"$ivsize" = X"$longsize"; then
18230                 ivdformat='"ld"'
18231                 uvuformat='"lu"'
18232                 uvoformat='"lo"'
18233                 uvxformat='"lx"'
18234                 uvXUformat='"lX"'
18235         else
18236                 if $test X"$ivsize" = X"$intsize"; then
18237                         ivdformat='"d"'
18238                         uvuformat='"u"'
18239                         uvoformat='"o"'
18240                         uvxformat='"x"'
18241                         uvXUformat='"X"'
18242                 else
18243                         : far out
18244                         if $test X"$ivsize" = X"$shortsize"; then
18245                                 ivdformat='"hd"'
18246                                 uvuformat='"hu"'
18247                                 uvoformat='"ho"'
18248                                 uvxformat='"hx"'
18249                                 uvXUformat='"hX"'
18250                         fi
18251                 fi
18252         fi
18253 fi
18254
18255 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18256         nveformat="$sPRIeldbl"
18257         nvfformat="$sPRIfldbl"
18258         nvgformat="$sPRIgldbl"
18259         nvEUformat="$sPRIEUldbl"
18260         nvFUformat="$sPRIFUldbl"
18261         nvGUformat="$sPRIGUldbl"
18262 else
18263         nveformat='"e"'
18264         nvfformat='"f"'
18265         nvgformat='"g"'
18266         nvEUformat='"E"'
18267         nvFUformat='"F"'
18268         nvGUformat='"G"'
18269 fi
18270
18271 case "$ivdformat" in
18272 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18273     exit 1
18274     ;;
18275 esac
18276
18277
18278 echo " "
18279 $echo "Checking the format string to be used for gids..." >&4
18280
18281 case "$gidsign" in
18282 -1)     if $test X"$gidsize" = X"$ivsize"; then
18283                 gidformat="$ivdformat"
18284         else
18285                 if $test X"$gidsize" = X"$longsize"; then
18286                         gidformat='"ld"'
18287                 else
18288                         if $test X"$gidsize" = X"$intsize"; then
18289                                 gidformat='"d"'
18290                         else
18291                                 if $test X"$gidsize" = X"$shortsize"; then
18292                                         gidformat='"hd"'
18293                                 fi
18294                         fi
18295                 fi
18296         fi
18297         ;;
18298 *)      if $test X"$gidsize" = X"$uvsize"; then
18299                 gidformat="$uvuformat"
18300         else
18301                 if $test X"$gidsize" = X"$longsize"; then
18302                         gidformat='"lu"'
18303                 else
18304                         if $test X"$gidsize" = X"$intsize"; then
18305                                 gidformat='"u"'
18306                         else
18307                                 if $test X"$gidsize" = X"$shortsize"; then
18308                                         gidformat='"hu"'
18309                                 fi
18310                         fi
18311                 fi
18312         fi
18313         ;;
18314 esac
18315
18316 : see if getgroups exists
18317 set getgroups d_getgrps
18318 eval $inlibc
18319
18320 : see if setgroups exists
18321 set setgroups d_setgrps
18322 eval $inlibc
18323
18324
18325 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18326 echo " "
18327 case "$d_getgrps$d_setgrps" in
18328 *define*)
18329         case "$groupstype" in
18330         '') dflt="$gidtype" ;;
18331         *)  dflt="$groupstype" ;;
18332         esac
18333         $cat <<EOM
18334 What type of pointer is the second argument to getgroups() and setgroups()?
18335 Usually this is the same as group ids, $gidtype, but not always.
18336
18337 EOM
18338         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18339         . ./myread
18340         groupstype="$ans"
18341         ;;
18342 *)  groupstype="$gidtype";;
18343 esac
18344
18345 echo " "
18346 echo "Checking if your $make program sets \$(MAKE)..." >&4
18347 case "$make_set_make" in
18348 '')
18349         $sed 's/^X //' > testmake.mak << 'EOF'
18350 Xall:
18351 X       @echo 'maketemp="$(MAKE)"'
18352 EOF
18353         case "`$make -f testmake.mak 2>/dev/null`" in
18354         *maketemp=*) make_set_make='#' ;;
18355         *)      make_set_make="MAKE=$make" ;;
18356         esac
18357         $rm -f testmake.mak
18358         ;;
18359 esac
18360 case "$make_set_make" in
18361 '#') echo "Yup, it does.";;
18362 *) echo "Nope, it doesn't.";;
18363 esac
18364
18365 : see what type is used for mode_t
18366 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18367 set mode_t modetype int stdio.h sys/types.h
18368 eval $typedef_ask
18369
18370 : see if stdarg is available
18371 echo " "
18372 if $test `./findhdr stdarg.h`; then
18373         echo "<stdarg.h> found." >&4
18374         valstd="$define"
18375 else
18376         echo "<stdarg.h> NOT found." >&4
18377         valstd="$undef"
18378 fi
18379
18380 : see if varags is available
18381 echo " "
18382 if $test `./findhdr varargs.h`; then
18383         echo "<varargs.h> found." >&4
18384 else
18385         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18386 fi
18387
18388 : set up the varargs testing programs
18389 $cat > varargs.c <<EOP
18390 #ifdef I_STDARG
18391 #include <stdarg.h>
18392 #endif
18393 #ifdef I_VARARGS
18394 #include <varargs.h>
18395 #endif
18396
18397 #ifdef I_STDARG
18398 int f(char *p, ...)
18399 #else
18400 int f(va_alist)
18401 va_dcl
18402 #endif
18403 {
18404         va_list ap;
18405 #ifndef I_STDARG
18406         char *p;
18407 #endif
18408 #ifdef I_STDARG
18409         va_start(ap,p);
18410 #else
18411         va_start(ap);
18412         p = va_arg(ap, char *);
18413 #endif
18414         va_end(ap);
18415 }
18416 EOP
18417 $cat > varargs <<EOP
18418 $startsh
18419 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18420         echo "true"
18421 else
18422         echo "false"
18423 fi
18424 $rm -f varargs$_o
18425 EOP
18426 chmod +x varargs
18427
18428 : now check which varargs header should be included
18429 echo " "
18430 i_varhdr=''
18431 case "$valstd" in
18432 "$define")
18433         if `./varargs I_STDARG`; then
18434                 val='stdarg.h'
18435         elif `./varargs I_VARARGS`; then
18436                 val='varargs.h'
18437         fi
18438         ;;
18439 *)
18440         if `./varargs I_VARARGS`; then
18441                 val='varargs.h'
18442         fi
18443         ;;
18444 esac
18445 case "$val" in
18446 '')
18447 echo "I could not find the definition for va_dcl... You have problems..." >&4
18448         val="$undef"; set i_stdarg; eval $setvar
18449         val="$undef"; set i_varargs; eval $setvar
18450         ;;
18451 *) 
18452         set i_varhdr
18453         eval $setvar
18454         case "$i_varhdr" in
18455         stdarg.h)
18456                 val="$define"; set i_stdarg; eval $setvar
18457                 val="$undef"; set i_varargs; eval $setvar
18458                 ;;
18459         varargs.h)
18460                 val="$undef"; set i_stdarg; eval $setvar
18461                 val="$define"; set i_varargs; eval $setvar
18462                 ;;
18463         esac
18464         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18465 esac
18466 $rm -f varargs*
18467
18468 : see if we need va_copy
18469 echo " "
18470 case "$i_stdarg" in
18471 "$define")
18472         $cat >try.c <<EOCP
18473 #include <stdarg.h>
18474 #include <stdio.h>
18475 #$i_stdlib I_STDLIB
18476 #ifdef I_STDLIB
18477 #include <stdlib.h>
18478 #endif
18479 #include <signal.h>
18480
18481 int
18482 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18483 {
18484   return vfprintf(f, fmt, *valp);
18485 }
18486  
18487 int    
18488 myvfprintf(FILE *f, const  char *fmt, va_list val)
18489 {
18490   return ivfprintf(f, fmt, &val);
18491 }
18492       
18493 int
18494 myprintf(char *fmt, ...) 
18495 {
18496   va_list val;
18497   va_start(val, fmt);
18498   return myvfprintf(stdout, fmt, val); 
18499 }         
18500
18501 int
18502 main(int ac, char **av)
18503 {
18504   signal(SIGSEGV, exit);
18505
18506   myprintf("%s%cs all right, then\n", "that", '\'');                            
18507   exit(0);      
18508 }
18509 EOCP
18510         set try
18511         if eval $compile && $run ./try 2>&1 >/dev/null; then
18512                 case "`$run ./try`" in
18513                 "that's all right, then")
18514                         okay=yes
18515                         ;;
18516                 esac
18517         fi
18518         case "$okay" in
18519         yes)    echo "It seems that you don't need va_copy()." >&4
18520                 need_va_copy="$undef"
18521                 ;;
18522         *)      echo "It seems that va_copy() or similar will be needed." >&4
18523                 need_va_copy="$define"
18524                 ;;
18525         esac
18526         $rm -f try.* core core.* *.core *.core.*
18527         ;;
18528 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18529         ;;
18530 esac
18531
18532 : see what type is used for size_t
18533 rp="What is the type used for the length parameter for string functions?"
18534 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18535 eval $typedef_ask
18536
18537 : check for type of arguments to gethostbyaddr. 
18538 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18539         case "$d_gethbyaddr" in
18540         $define)
18541                 $cat <<EOM
18542
18543 Checking to see what type of arguments are accepted by gethostbyaddr().
18544 EOM
18545                 hdrs="$define sys/types.h
18546                         $d_socket sys/socket.h 
18547                         $i_niin netinet/in.h 
18548                         $i_netdb netdb.h
18549                         $i_unistd unistd.h"
18550                 : The first arg can 'char *' or 'void *'
18551                 : The second arg is some of integral type
18552                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18553                         for yyy in size_t long int; do
18554                                 case "$netdb_host_type" in
18555                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18556                                         if ./protochk "$try" $hdrs; then
18557                                                 echo "Your system accepts $xxx for the first arg."
18558                                                 echo "...and $yyy for the second arg."
18559                                                 netdb_host_type="$xxx"
18560                                                 netdb_hlen_type="$yyy"
18561                                         fi
18562                                         ;;
18563                                 esac
18564                         done
18565                 done
18566                 : In case none of those worked, prompt the user.
18567                 case "$netdb_host_type" in
18568                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18569                         dflt='char *'
18570                         . ./myread
18571                         netdb_host_type=$ans
18572                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18573                         dflt="$sizetype"
18574                         . ./myread
18575                         netdb_hlen_type=$ans
18576                         ;;
18577                 esac
18578                 ;;
18579         *)      : no gethostbyaddr, so pick harmless defaults
18580                 netdb_host_type='char *'
18581                 netdb_hlen_type="$sizetype"
18582                 ;;
18583         esac
18584         # Remove the "const" if needed. -- but then we'll have a 
18585         # prototype clash!
18586         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18587 fi
18588
18589 : check for type of argument to gethostbyname. 
18590 if test "X$netdb_name_type" = X ; then
18591         case "$d_gethbyname" in
18592         $define)
18593                 $cat <<EOM
18594
18595 Checking to see what type of argument is accepted by gethostbyname().
18596 EOM
18597                 hdrs="$define sys/types.h
18598                         $d_socket sys/socket.h 
18599                         $i_niin netinet/in.h 
18600                         $i_netdb netdb.h
18601                         $i_unistd unistd.h"
18602                 for xxx in "const char *" "char *"; do
18603                         case "$netdb_name_type" in
18604                         '')     try="extern struct hostent *gethostbyname($xxx);"
18605                                 if ./protochk "$try" $hdrs; then
18606                                         echo "Your system accepts $xxx."
18607                                         netdb_name_type="$xxx"
18608                                 fi
18609                                 ;;
18610                         esac
18611                 done
18612                 : In case none of those worked, prompt the user.
18613                 case "$netdb_name_type" in
18614                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18615                         dflt='char *'
18616                         . ./myread
18617                         netdb_name_type=$ans
18618                         ;;
18619                 esac
18620                 ;;
18621         *)      : no gethostbyname, so pick harmless default
18622                 netdb_name_type='char *'
18623                 ;;
18624         esac
18625 fi
18626
18627 : check for type of 1st argument to getnetbyaddr. 
18628 if test "X$netdb_net_type" = X ; then
18629         case "$d_getnbyaddr" in
18630         $define)
18631                 $cat <<EOM
18632
18633 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18634 EOM
18635                 hdrs="$define sys/types.h
18636                         $d_socket sys/socket.h 
18637                         $i_niin netinet/in.h 
18638                         $i_netdb netdb.h
18639                         $i_unistd unistd.h"
18640                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18641                         case "$netdb_net_type" in
18642                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18643                                 if ./protochk "$try" $hdrs; then
18644                                         echo "Your system accepts $xxx."
18645                                         netdb_net_type="$xxx"
18646                                 fi
18647                                 ;;
18648                         esac
18649                 done
18650                 : In case none of those worked, prompt the user.
18651                 case "$netdb_net_type" in
18652                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18653                         dflt='long'
18654                         . ./myread
18655                         netdb_net_type=$ans
18656                         ;;
18657                 esac
18658                 ;;
18659         *)      : no getnetbyaddr, so pick harmless default
18660                 netdb_net_type='long'
18661                 ;;
18662         esac
18663 fi
18664 : locate the preferred pager for this system
18665 fn=f/
18666 case "$pager" in
18667 '')
18668         dflt=''
18669         case "$pg" in
18670         /*) dflt=$pg;;
18671         [a-zA-Z]:/*) dflt=$pg;;
18672         esac
18673         case "$more" in
18674         /*) dflt=$more;;
18675         [a-zA-Z]:/*) dflt=$more;;
18676         esac
18677         case "$less" in
18678         /*) dflt=$less;;
18679         [a-zA-Z]:/*) dflt=$less;;
18680         esac
18681         case "$dflt" in
18682         '') dflt=/usr/ucb/more;;
18683         esac
18684         ;;
18685 *)      dflt="$pager"
18686         : Instruct ./getfile to trust the hinted or previous pager value,
18687         : even if it does not begin with a slash.  For example, on os2,
18688         : pager might be cmd /c more.  See comments in UU/getfile.
18689         fn="f/($pager)"
18690         ;;
18691 esac
18692 echo " "
18693 rp='What pager is used on your system?'
18694 . ./getfile
18695 pager="$ans"
18696
18697 : see what type pids are declared as in the kernel
18698 rp="What is the type of process ids on this system?"
18699 set pid_t pidtype int stdio.h sys/types.h
18700 eval $typedef_ask
18701
18702 : see if ar generates random libraries by itself
18703 echo " "
18704 echo "Checking how to generate random libraries on your machine..." >&4
18705 echo 'int bar1() { return bar2(); }' > bar1.c
18706 echo 'int bar2() { return 2; }' > bar2.c
18707 $cat > foo.c <<EOP
18708 #$i_stdlib I_STDLIB
18709 #ifdef I_STDLIB
18710 #include <stdlib.h>
18711 #endif
18712 int main() { printf("%d\n", bar1()); exit(0); }
18713 EOP
18714 $cc $ccflags -c bar1.c >/dev/null 2>&1
18715 $cc $ccflags -c bar2.c >/dev/null 2>&1
18716 $cc $ccflags -c foo.c >/dev/null 2>&1
18717 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18718 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18719         $run ./foobar >/dev/null 2>&1; then
18720         echo "$ar appears to generate random libraries itself."
18721         orderlib=false
18722         ranlib=":"
18723 elif $ar ts bar$_a >/dev/null 2>&1 &&
18724         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18725         $run ./foobar >/dev/null 2>&1; then
18726                 echo "a table of contents needs to be added with '$ar ts'."
18727                 orderlib=false
18728                 ranlib="$ar ts"
18729 else
18730         case "$ranlib" in
18731         :) ranlib='';;
18732         '')
18733                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18734                 $test -f $ranlib || ranlib=''
18735                 ;;
18736         esac
18737         if $test -n "$ranlib"; then
18738                 echo "your system has '$ranlib'; we'll use that."
18739                 orderlib=false
18740         else
18741                 echo "your system doesn't seem to support random libraries"
18742                 echo "so we'll use lorder and tsort to order the libraries."
18743                 orderlib=true
18744                 ranlib=":"
18745         fi
18746 fi
18747 $rm -f foo* bar* 
18748
18749 : check for type of arguments to select. 
18750 case "$selecttype" in
18751 '') case "$d_select" in
18752         $define)
18753                 echo " "
18754                 $cat <<EOM
18755 Checking to see what type of arguments are accepted by select().
18756 EOM
18757                 hdrs="$define sys/types.h
18758                         $i_systime sys/time.h 
18759                         $i_sysselct sys/select.h
18760                         $d_socket sys/socket.h"
18761                 : The first arg can be int, unsigned, or size_t
18762                 : The last arg may or may not be 'const'
18763                 val=''
18764                 : void pointer has been seen but using that
18765                 : breaks the selectminbits test
18766                 for xxx in 'fd_set *' 'int *'; do
18767                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18768                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18769                                         case "$val" in
18770                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18771                                                 if ./protochk "$try" $hdrs; then
18772                                                         echo "Your system accepts $xxx."
18773                                                         val="$xxx"
18774                                                 fi
18775                                                 ;;
18776                                         esac
18777                                 done
18778                         done
18779                 done
18780                 case "$val" in
18781                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18782                         case "$d_fd_set" in
18783                                 $define) dflt="fd_set *" ;;
18784                                 *)              dflt="int *" ;;
18785                         esac
18786                         . ./myread
18787                         val=$ans
18788                         ;;
18789                 esac
18790                 selecttype="$val"
18791                 ;;
18792         *)      : no select, so pick a harmless default
18793                 selecttype='int *'
18794                 ;;
18795         esac
18796         ;;
18797 esac
18798
18799 : check for the select 'width'
18800 case "$selectminbits" in
18801 '') safebits=`expr $ptrsize \* 8`
18802     case "$d_select" in
18803         $define)
18804                 $cat <<EOM
18805
18806 Checking to see on how many bits at a time your select() operates...
18807 EOM
18808                 $cat >try.c <<EOCP
18809 #include <sys/types.h>
18810 #$i_time I_TIME
18811 #$i_systime I_SYS_TIME
18812 #$i_systimek I_SYS_TIME_KERNEL
18813 #ifdef I_TIME
18814 #   include <time.h>
18815 #endif
18816 #ifdef I_SYS_TIME
18817 #   ifdef I_SYS_TIME_KERNEL
18818 #       define KERNEL
18819 #   endif
18820 #   include <sys/time.h>
18821 #   ifdef I_SYS_TIME_KERNEL
18822 #       undef KERNEL
18823 #   endif
18824 #endif
18825 #$i_sysselct I_SYS_SELECT
18826 #ifdef I_SYS_SELECT
18827 #include <sys/select.h>
18828 #endif
18829 #$d_socket HAS_SOCKET
18830 #ifdef HAS_SOCKET
18831 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18832 #endif
18833 #include <stdio.h>
18834 #$i_stdlib I_STDLIB
18835 #ifdef I_STDLIB
18836 #include <stdlib.h>
18837 #endif
18838 $selecttype b;
18839 #define S sizeof(*(b))
18840 #define MINBITS 64
18841 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18842 #define NBITS  (NBYTES * 8)
18843 int main() {
18844     char *s = malloc(NBYTES);
18845     struct timeval t;
18846     int i;
18847     FILE* fp;
18848     int fd;
18849
18850     if (!s)
18851         exit(1);
18852     fclose(stdin);
18853     fp = fopen("try.c", "r");
18854     if (fp == 0)
18855       exit(2);
18856     fd = fileno(fp);
18857     if (fd < 0)
18858       exit(3);
18859     b = ($selecttype)s;
18860     for (i = 0; i < NBITS; i++)
18861         FD_SET(i, b);
18862     t.tv_sec  = 0;
18863     t.tv_usec = 0;
18864     select(fd + 1, b, 0, 0, &t);
18865     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18866     free(s);
18867     printf("%d\n", i + 1);
18868     return 0;
18869 }
18870 EOCP
18871                 set try
18872                 if eval $compile_ok; then
18873                         selectminbits=`$run ./try`
18874                         case "$selectminbits" in
18875                         '')     cat >&4 <<EOM
18876 Cannot figure out on how many bits at a time your select() operates.
18877 I'll play safe and guess it is $safebits bits.
18878 EOM
18879                                 selectminbits=$safebits
18880                                 bits="$safebits bits"
18881                                 ;;
18882                         1)      bits="1 bit" ;;
18883                         *)      bits="$selectminbits bits" ;;
18884                         esac
18885                         echo "Your select() operates on $bits at a time." >&4
18886                 else
18887                         rp='What is the minimum number of bits your select() operates on?'
18888                         case "$byteorder" in
18889                         12345678)       dflt=64 ;;
18890                         1234)           dflt=32 ;;
18891                         *)              dflt=1  ;;
18892                         esac
18893                         . ./myread
18894                         val=$ans
18895                         selectminbits="$val"
18896                 fi
18897                 $rm -f try.* try
18898                 ;;
18899         *)      : no select, so pick a harmless default
18900                 selectminbits=$safebits
18901                 ;;
18902         esac
18903         ;;
18904 esac
18905
18906 : Trace out the files included by signal.h, then look for SIGxxx names.
18907 : Remove SIGARRAYSIZE used by HPUX.
18908 : Remove SIGSTKSIZE used by Linux.
18909 : Remove SIGSTKSZ used by Posix.
18910 : Remove SIGTYP void lines used by OS2.
18911 : Some cpps, like os390, dont give the file name anywhere
18912 if [ "X$fieldn" = X ]; then
18913         : Just make some guesses.  We check them later.
18914         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18915 else
18916         xxx=`echo '#include <signal.h>' |
18917         $cppstdin $cppminus $cppflags 2>/dev/null |
18918         $grep '^[       ]*#.*include' | 
18919         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18920 fi
18921 : Check this list of files to be sure we have parsed the cpp output ok.
18922 : This will also avoid potentially non-existent files, such 
18923 : as ../foo/bar.h
18924 xxxfiles=''
18925 for xx in $xxx /dev/null ; do
18926         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18927 done
18928 : If we have found no files, at least try signal.h
18929 case "$xxxfiles" in
18930 '')     xxxfiles=`./findhdr signal.h` ;;
18931 esac
18932 xxx=`awk '
18933 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18934         print substr($2, 4, 20)
18935 }
18936 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18937         print substr($3, 4, 20)
18938 }' $xxxfiles`
18939 : Append some common names just in case the awk scan failed.
18940 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18941 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18942 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18943 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18944 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18945
18946 : generate a few handy files for later
18947 $cat > signal.c <<EOCP
18948 #include <sys/types.h>
18949 #include <signal.h>
18950 #$i_stdlib I_STDLIB
18951 #ifdef I_STDLIB
18952 #include <stdlib.h>
18953 #endif
18954 #include <stdio.h>
18955 int main() {
18956
18957 /* Strange style to avoid deeply-nested #if/#else/#endif */
18958 #ifndef NSIG
18959 #  ifdef _NSIG
18960 #    define NSIG (_NSIG)
18961 #  endif
18962 #endif
18963
18964 #ifndef NSIG
18965 #  ifdef SIGMAX
18966 #    define NSIG (SIGMAX+1)
18967 #  endif
18968 #endif
18969
18970 #ifndef NSIG
18971 #  ifdef SIG_MAX
18972 #    define NSIG (SIG_MAX+1)
18973 #  endif
18974 #endif
18975
18976 #ifndef NSIG
18977 #  ifdef MAXSIG
18978 #    define NSIG (MAXSIG+1)
18979 #  endif
18980 #endif
18981
18982 #ifndef NSIG
18983 #  ifdef MAX_SIG
18984 #    define NSIG (MAX_SIG+1)
18985 #  endif
18986 #endif
18987
18988 #ifndef NSIG
18989 #  ifdef SIGARRAYSIZE
18990 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18991 #  endif
18992 #endif
18993
18994 #ifndef NSIG
18995 #  ifdef _sys_nsig
18996 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18997 #  endif
18998 #endif
18999
19000 /* Default to some arbitrary number that's big enough to get most
19001    of the common signals.
19002 */
19003 #ifndef NSIG
19004 #    define NSIG 50
19005 #endif
19006
19007 printf("NSIG %d\n", NSIG);
19008
19009 #ifndef JUST_NSIG
19010
19011 EOCP
19012
19013 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19014 {
19015         printf "#ifdef SIG"; printf $1; printf "\n"
19016         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19017         printf $1; printf ");\n"
19018         printf "#endif\n"
19019 }
19020 END {
19021         printf "#endif /* JUST_NSIG */\n";
19022         printf "exit(0);\n}\n";
19023 }
19024 ' >>signal.c
19025 $cat >signal.awk <<'EOP'
19026 BEGIN { ndups = 0 }
19027 $1 ~ /^NSIG$/ { nsig = $2 }
19028 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19029     if ($2 > maxsig) { maxsig = $2 }
19030     if (sig_name[$2]) {
19031         dup_name[ndups] = $1
19032         dup_num[ndups] = $2
19033         ndups++ 
19034     }
19035     else {
19036         sig_name[$2] = $1
19037         sig_num[$2] = $2
19038     }
19039 }
19040 END { 
19041     if (nsig == 0) {
19042         nsig = maxsig + 1
19043     }
19044     printf("NSIG %d\n", nsig);
19045     for (n = 1; n < nsig; n++) {
19046         if (sig_name[n]) {
19047             printf("%s %d\n", sig_name[n], sig_num[n])
19048         }
19049         else {
19050             printf("NUM%d %d\n", n, n) 
19051         }
19052     }
19053     for (n = 0; n < ndups; n++) {
19054         printf("%s %d\n", dup_name[n], dup_num[n])
19055     }
19056 }
19057 EOP
19058 $cat >signal_cmd <<EOS
19059 $startsh
19060 if $test -s signal.lst; then
19061     echo "Using your existing signal.lst file"
19062         exit 0
19063 fi
19064 xxx="$xxx"
19065 EOS
19066 $cat >>signal_cmd <<'EOS'
19067
19068 set signal
19069 if eval $compile_ok; then
19070         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19071 else
19072         echo "(I can't seem be able to compile the whole test program)" >&4
19073         echo "(I'll try it in little pieces.)" >&4
19074         set signal -DJUST_NSIG
19075         if eval $compile_ok; then
19076                 $run ./signal$_exe > signal.nsg
19077                 $cat signal.nsg
19078         else
19079                 echo "I can't seem to figure out how many signals you have." >&4
19080                 echo "Guessing 50." >&4
19081                 echo 'NSIG 50' > signal.nsg
19082         fi
19083         : Now look at all the signal names, one at a time.
19084         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19085                 $cat > signal.c <<EOCP
19086 #include <sys/types.h>
19087 #include <signal.h>
19088 #include <stdio.h>
19089 int main() {
19090 printf("$xx %d\n", SIG${xx});
19091 return 0;
19092 }
19093 EOCP
19094                 set signal
19095                 if eval $compile; then
19096                         echo "SIG${xx} found."
19097                         $run ./signal$_exe  >> signal.ls1
19098                 else
19099                         echo "SIG${xx} NOT found."
19100                 fi
19101         done
19102         if $test -s signal.ls1; then
19103                 $cat signal.nsg signal.ls1 |
19104                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19105         fi
19106
19107 fi
19108 if $test -s signal.lst; then
19109         :
19110 else
19111         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19112         echo 'kill -l' >signal
19113         set X `csh -f <signal`
19114         $rm -f signal
19115         shift
19116         case $# in
19117         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19118         esac
19119         echo $@ | $tr ' ' $trnl | \
19120             $awk '{ printf "%s %d\n", $1, ++s; }
19121                   END { printf "NSIG %d\n", ++s }' >signal.lst
19122 fi
19123 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19124 EOS
19125 chmod a+x signal_cmd
19126 $eunicefix signal_cmd
19127
19128 : generate list of signal names
19129 echo " "
19130 case "$sig_name_init" in
19131 '') doinit=yes ;;
19132 *)  case "$sig_num_init" in
19133     ''|*,*) doinit=yes ;;
19134     esac ;;
19135 esac
19136 case "$doinit" in
19137 yes)
19138         echo "Generating a list of signal names and numbers..." >&4
19139         . ./signal_cmd
19140         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19141         sig_name=`$awk 'BEGIN { printf "ZERO " }
19142                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19143         sig_num=`$awk  'BEGIN { printf "0 " }
19144                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19145         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19146                              !/^NSIG/   { printf "\"%s\", ", $1 }
19147                              END        { printf "0\n" }' signal.lst`
19148         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19149                              !/^NSIG/   { printf "%d, ", $2}
19150                              END        { printf "0\n"}' signal.lst`
19151         ;;
19152 esac
19153 echo "The following $sig_count signals are available:"
19154 echo " "
19155 echo $sig_name | $awk \
19156 'BEGIN { linelen = 0 }
19157 {
19158         for (i = 1; i <= NF; i++) {
19159                 name = "SIG" $i " "
19160                 linelen = linelen + length(name)
19161                 if (linelen > 70) {
19162                         printf "\n"
19163                         linelen = length(name)
19164                 }
19165                 printf "%s", name
19166         }
19167         printf "\n"
19168 }'
19169 sig_size=`echo $sig_name | awk '{print NF}'`
19170 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19171
19172 echo " "
19173 case "$sizetype" in
19174 *_t) zzz="$sizetype"    ;;
19175 *)   zzz="filesize"     ;;
19176 esac
19177 echo "Checking the size of $zzz..." >&4 
19178 cat > try.c <<EOCP
19179 #include <sys/types.h>
19180 #include <stdio.h>
19181 #$i_stdlib I_STDLIB
19182 #ifdef I_STDLIB
19183 #include <stdlib.h>
19184 #endif
19185 int main() {
19186     printf("%d\n", (int)sizeof($sizetype));
19187     exit(0);
19188 }
19189 EOCP
19190 set try
19191 if eval $compile_ok; then
19192         yyy=`$run ./try`
19193         case "$yyy" in
19194         '')     sizesize=4
19195                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19196                 ;;
19197         *)      sizesize=$yyy
19198                 echo "Your $zzz size is $sizesize bytes."
19199                 ;;
19200         esac
19201 else
19202         sizesize=4
19203         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19204 fi
19205
19206
19207 : check for socklen_t
19208 echo " "
19209 echo "Checking to see if you have socklen_t..." >&4
19210 $cat >try.c <<EOCP
19211 #include <sys/types.h>
19212 #$d_socket HAS_SOCKET
19213 #ifdef HAS_SOCKET
19214 #include <sys/socket.h>
19215 #endif
19216 int main() { socklen_t x = 16; }
19217 EOCP
19218 set try
19219 if eval $compile; then
19220         val="$define"
19221         echo "You have socklen_t."
19222 else
19223         val="$undef"
19224         echo "You do not have socklen_t."
19225         case "$sizetype" in
19226         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19227         esac
19228 fi
19229 $rm -f try try.*
19230 set d_socklen_t
19231 eval $setvar
19232
19233 : see if this is a socks.h system
19234 set socks.h i_socks
19235 eval $inhdr
19236
19237 : check for type of the size argument to socket calls
19238 case "$d_socket" in
19239 "$define")
19240         $cat <<EOM
19241
19242 Checking to see what type is the last argument of accept().
19243 EOM
19244         yyy=''
19245         case "$d_socklen_t" in
19246         "$define") yyy="$yyy socklen_t"
19247         esac
19248         yyy="$yyy $sizetype int long unsigned"
19249         for xxx in $yyy; do
19250                 case "$socksizetype" in
19251                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19252                         case "$usesocks" in
19253                         "$define")
19254                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19255                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19256                                         socksizetype="$xxx"
19257                                 fi
19258                                 ;;
19259                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19260                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19261                                         socksizetype="$xxx"
19262                                 fi
19263                                 ;;
19264                         esac
19265                         ;;
19266                 esac
19267         done
19268 : In case none of those worked, prompt the user.
19269         case "$socksizetype" in
19270         '')     rp='What is the type for socket address structure sizes?'
19271                 dflt='int'
19272                 . ./myread
19273                 socksizetype=$ans
19274                 ;;
19275         esac
19276         ;;
19277 *)      : no sockets, so pick relatively harmless default
19278         socksizetype='int'
19279         ;;
19280 esac
19281
19282 : see what type is used for signed size_t
19283 set ssize_t ssizetype int stdio.h sys/types.h
19284 eval $typedef
19285 dflt="$ssizetype"
19286 $cat > try.c <<EOM
19287 #include <stdio.h>
19288 #$i_stdlib I_STDLIB
19289 #ifdef I_STDLIB
19290 #include <stdlib.h>
19291 #endif
19292 #include <sys/types.h>
19293 #define Size_t $sizetype
19294 #define SSize_t $dflt
19295 int main()
19296 {
19297         if (sizeof(Size_t) == sizeof(SSize_t))
19298                 printf("$dflt\n");
19299         else if (sizeof(Size_t) == sizeof(int))
19300                 printf("int\n");
19301         else 
19302                 printf("long\n");
19303         exit(0);
19304 }
19305 EOM
19306 echo " "
19307 set try
19308 if eval $compile_ok && $run ./try > /dev/null; then
19309         ssizetype=`$run ./try`
19310         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19311 else
19312         $cat >&4 <<EOM
19313 Help! I can't compile and run the ssize_t test program: please enlighten me!
19314 (This is probably a misconfiguration in your system or libraries, and
19315 you really ought to fix it.  Still, I'll try anyway.)
19316
19317 I need a type that is the same size as $sizetype, but is guaranteed to
19318 be signed.  Common values are ssize_t, int and long.
19319
19320 EOM
19321         rp="What signed type is the same size as $sizetype?"
19322         . ./myread
19323         ssizetype="$ans"
19324 fi
19325 $rm -f try try.*
19326
19327 : see what type of char stdio uses.
19328 echo " "
19329 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19330 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19331         echo "Your stdio uses unsigned chars." >&4
19332         stdchar="unsigned char"
19333 else
19334         echo "Your stdio uses signed chars." >&4
19335         stdchar="char"
19336 fi
19337 $rm -f stdioh
19338
19339
19340
19341 : see what type uids are declared as in the kernel
19342 echo " "
19343 echo "Looking for the type for user ids returned by getuid()."
19344 set uid_t uidtype xxx stdio.h sys/types.h
19345 eval $typedef
19346 case "$uidtype" in
19347 xxx)
19348         xxx=`./findhdr sys/user.h`
19349         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19350         case $1 in
19351         unsigned) dflt="$1 $2" ;;
19352         *) dflt="$1" ;;
19353         esac
19354         ;;
19355 *) dflt="$uidtype";;
19356 esac
19357 case "$uidtype" in
19358 uid_t)  echo "uid_t found." ;;
19359 *)      rp="What is the type for user ids returned by getuid()?"
19360         . ./myread
19361         uidtype="$ans"
19362         ;;
19363 esac
19364
19365 echo " "
19366 case "$uidtype" in
19367 *_t) zzz="$uidtype"     ;;
19368 *)   zzz="uid"          ;;
19369 esac
19370 echo "Checking the size of $zzz..." >&4 
19371 cat > try.c <<EOCP
19372 #include <sys/types.h>
19373 #include <stdio.h>
19374 #$i_stdlib I_STDLIB
19375 #ifdef I_STDLIB
19376 #include <stdlib.h>
19377 #endif
19378 int main() {
19379     printf("%d\n", (int)sizeof($uidtype));
19380     exit(0);
19381 }
19382 EOCP
19383 set try
19384 if eval $compile_ok; then
19385         yyy=`$run ./try`
19386         case "$yyy" in
19387         '')     uidsize=4
19388                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19389                 ;;
19390         *)      uidsize=$yyy
19391                 echo "Your $zzz is $uidsize bytes long."
19392                 ;;
19393         esac
19394 else
19395         uidsize=4
19396         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19397 fi
19398
19399 echo " "
19400 case "$uidtype" in
19401 *_t) zzz="$uidtype"     ;;
19402 *)   zzz="uid"          ;;
19403 esac
19404 echo "Checking the sign of $zzz..." >&4
19405 cat > try.c <<EOCP
19406 #include <sys/types.h>
19407 #include <stdio.h>
19408 int main() {
19409         $uidtype foo = -1;
19410         if (foo < 0)
19411                 printf("-1\n");
19412         else
19413                 printf("1\n");
19414 }
19415 EOCP
19416 set try
19417 if eval $compile; then
19418         yyy=`$run ./try`
19419         case "$yyy" in
19420         '')     uidsign=1
19421                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19422                 ;;
19423         *)      uidsign=$yyy
19424                 case "$uidsign" in
19425                  1) echo "Your $zzz is unsigned." ;;
19426                 -1) echo "Your $zzz is signed."   ;;
19427                 esac
19428                 ;;
19429         esac
19430 else
19431         uidsign=1
19432         echo "(I can't compile the test program--guessing unsigned.)" >&4
19433 fi
19434
19435
19436
19437 echo " "
19438 $echo "Checking the format string to be used for uids..." >&4
19439
19440 case "$uidsign" in
19441 -1)     if $test X"$uidsize" = X"$ivsize"; then
19442                 uidformat="$ivdformat"
19443         else
19444                 if $test X"$uidsize" = X"$longsize"; then
19445                         uidformat='"ld"'
19446                 else
19447                         if $test X"$uidsize" = X"$intsize"; then
19448                                 uidformat='"d"'
19449                         else
19450                                 if $test X"$uidsize" = X"$shortsize"; then
19451                                         uidformat='"hd"'
19452                                 fi
19453                         fi
19454                 fi
19455         fi
19456         ;;
19457 *)      if $test X"$uidsize" = X"$uvsize"; then
19458                 uidformat="$uvuformat"
19459         else
19460                 if $test X"$uidsize" = X"$longsize"; then
19461                         uidformat='"lu"'
19462                 else
19463                         if $test X"$uidsize" = X"$intsize"; then
19464                                 uidformat='"u"'
19465                         else
19466                                 if $test X"$uidsize" = X"$shortsize"; then
19467                                         uidformat='"hu"'
19468                                 fi
19469                         fi
19470                 fi
19471         fi
19472         ;;
19473 esac
19474
19475 : determine compiler compiler
19476 case "$yacc" in
19477 '')
19478         dflt=yacc;;
19479 *)
19480         dflt="$yacc";;
19481 esac
19482 echo " "
19483 comp='yacc'
19484 if $test -f "$byacc$_exe"; then
19485         dflt="$byacc"
19486         comp="byacc or $comp"
19487 fi
19488 if $test -f "$bison$_exe"; then
19489         comp="$comp or bison -y"
19490 fi
19491 rp="Which compiler compiler ($comp) shall I use?"
19492 . ./myread
19493 yacc="$ans"
19494 case "$yacc" in
19495 *bis*)
19496         case "$yacc" in
19497         *-y*) ;;
19498         *)
19499                 yacc="$yacc -y"
19500                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19501                 ;;
19502         esac
19503         ;;
19504 esac
19505
19506 : see if this is a fp.h system
19507 set fp.h i_fp
19508 eval $inhdr
19509
19510 : see if this is a fp_class.h system
19511 set fp_class.h i_fp_class
19512 eval $inhdr
19513
19514 : see if this is a ieeefp.h system
19515 case "$i_ieeefp" in
19516 '' ) set ieeefp.h i_ieeefp
19517      eval $inhdr
19518      ;;
19519 esac
19520
19521 : see if this is a libutil.h system
19522 set libutil.h i_libutil
19523 eval $inhdr
19524
19525 : see if mach cthreads are available
19526 if test "X$usethreads" = "X$define"; then
19527         set mach/cthreads.h i_machcthr
19528         eval $inhdr
19529 else
19530         i_machcthr="$undef"
19531 fi
19532
19533
19534
19535 : see if this is a math.h system
19536 set math.h i_math
19537 eval $inhdr
19538
19539 : see if this is a mntent.h system
19540 set mntent.h i_mntent
19541 eval $inhdr
19542
19543 : see if ndbm.h is available
19544 set ndbm.h t_ndbm
19545 eval $inhdr
19546
19547 case "$t_ndbm" in
19548 $undef)
19549     # Some Linux distributions such as RedHat 7.1 put the
19550     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19551     if $test -f /usr/include/gdbm/ndbm.h; then
19552         echo '<gdbm/ndbm.h> found.'
19553         ccflags="$ccflags -I/usr/include/gdbm"
19554         cppflags="$cppflags -I/usr/include/gdbm"
19555         t_ndbm=$define
19556     fi
19557     ;;
19558 esac
19559
19560 case "$t_ndbm" in
19561 $define)
19562         : see if dbm_open exists
19563         set dbm_open d_dbm_open
19564         eval $inlibc
19565         case "$d_dbm_open" in
19566         $undef)
19567                 t_ndbm="$undef"
19568                 echo "We won't be including <ndbm.h>"
19569                 ;;
19570         esac
19571         ;;
19572 esac
19573 val="$t_ndbm"
19574 set i_ndbm
19575 eval $setvar
19576
19577 : see if net/errno.h is available
19578 val=''
19579 set net/errno.h val
19580 eval $inhdr
19581
19582 : Unfortunately, it causes problems on some systems.  Arrgh.
19583 case "$val" in
19584 $define)
19585         cat > try.c <<'EOM'
19586 #include <stdio.h>
19587 #include <errno.h>
19588 #include <net/errno.h>
19589 int func()
19590 {
19591         return ENOTSOCK;
19592 }
19593 EOM
19594         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19595                 echo "We'll be including <net/errno.h>." >&4
19596         else
19597                 echo "We won't be including <net/errno.h>." >&4
19598                 val="$undef"
19599         fi
19600         $rm -f try.* try
19601         ;;
19602 esac
19603 set i_neterrno
19604 eval $setvar
19605
19606 : see if netinet/tcp.h is available
19607 set netinet/tcp.h i_netinettcp
19608 eval $inhdr
19609
19610 : see if this is a poll.h system
19611 set poll.h i_poll
19612 eval $inhdr
19613
19614 : see if this is a prot.h system
19615 set prot.h i_prot
19616 eval $inhdr
19617
19618 echo " "
19619 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19620 $cat <<'EOSH' > Cppsym.know
19621 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19622 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19623 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19624 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19625 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19626 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19627 bull c cadmus clipper CMU COFF COMPILER_VERSION
19628 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19629 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19630 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19631 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19632 GLIBC GLIBC_MINOR
19633 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19634 H3050R H3050RX hbullx20 hcx host_mips
19635 hp200 hp300 hp700 HP700 hp800 hp9000
19636 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19637 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19638 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19639 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19640 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19641 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19642 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19643 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19644 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19645 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19646 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19647 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19648 MATH_HAS_NO_SIDE_EFFECTS
19649 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19650 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19651 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19652 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19653 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19654 NetBSD news1500 news1700 news1800 news1900 news3700
19655 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19656 ns32016 ns32332 ns32k nsc32000
19657 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19658 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19659 pc532 pdp11 PGC PIC plexus PORTAR posix
19660 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19661 POSIX_C_SOURCE POSIX_SOURCE POWER
19662 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19663 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19664 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19665 sony sony_news sonyrisc sparc sparclite spectrum
19666 stardent stdc STDC_EXT stratos sun sun3 sun386
19667 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19668 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19669 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19670 sysV68 sysV88 Tek4132 Tek4300 titan
19671 TM3200 TM5400 TM5600
19672 tower tower32 tower32_200 tower32_600 tower32_700
19673 tower32_800 tower32_850 tss
19674 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19675 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19676 unix UNIX95 UNIX99 unixpc unos
19677 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19678 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19679 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19680 USGr4 USGr4_2
19681 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19682 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19683 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19684 z8000
19685 EOSH
19686 # Maybe put other stuff here too.
19687 cat <<EOSH >>Cppsym.know
19688 $osname
19689 EOSH
19690 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19691 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19692 $cat Cppsym.know > Cppsym.c
19693 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19694 $rm -f Cppsym.a Cppsym.b Cppsym.c
19695 cat <<EOSH > Cppsym
19696 $startsh
19697 if $test \$# -gt 0; then
19698     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19699     if $test -s Cppsym.got; then
19700         $rm -f Cppsym.got
19701         exit 0
19702     fi
19703     $rm -f Cppsym.got
19704     exit 1
19705 else
19706     $tr " " "$trnl" | ./Cppsym.try
19707     exit 0
19708 fi
19709 EOSH
19710 chmod +x Cppsym
19711 $eunicefix Cppsym
19712 cat <<EOSH > Cppsym.try
19713 $startsh
19714 cat <<'EOCP' > try.c
19715 #include <stdio.h>
19716 int main() {
19717 EOCP
19718 $awk \\
19719 EOSH
19720 cat <<'EOSH' >> Cppsym.try
19721 'length($1) > 0 {
19722     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19723     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19724     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19725     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19726 }'       >> try.c
19727 echo 'return 0;}' >> try.c
19728 EOSH
19729 cat <<EOSH >> Cppsym.try
19730 ccflags="$ccflags"
19731 case "$osname-$gccversion" in
19732 irix-) ccflags="\$ccflags -woff 1178" ;;
19733 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19734 esac
19735 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19736 EOSH
19737 chmod +x Cppsym.try
19738 $eunicefix Cppsym.try
19739 ./Cppsym < Cppsym.know > Cppsym.true
19740 : now check the C compiler for additional symbols
19741 postprocess_cc_v=''
19742 case "$osname" in
19743 aix) postprocess_cc_v="|$tr , ' '" ;;
19744 esac
19745 $cat >ccsym <<EOS
19746 $startsh
19747 $cat >tmp.c <<EOF
19748 extern int foo;
19749 EOF
19750 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19751 do
19752         case "\$i" in
19753         -D*) echo "\$i" | $sed 's/^-D//';;
19754         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19755         esac
19756 done
19757 $rm -f try.c
19758 EOS
19759 postprocess_cc_v=''
19760 chmod +x ccsym
19761 $eunicefix ccsym
19762 ./ccsym > ccsym1.raw
19763 if $test -s ccsym1.raw; then
19764        $sort ccsym1.raw | $uniq >ccsym.raw
19765 else
19766        mv ccsym1.raw ccsym.raw
19767 fi
19768
19769 $awk '/\=/ { print $0; next }
19770         { print $0"=1" }' ccsym.raw >ccsym.list
19771 $awk '/\=/ { print $0; next }
19772         { print $0"=1" }' Cppsym.true >ccsym.true
19773 $comm -13 ccsym.true ccsym.list >ccsym.own
19774 $comm -12 ccsym.true ccsym.list >ccsym.com
19775 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19776 also=''
19777 if $test -z ccsym.raw; then
19778         echo "Your C compiler doesn't seem to define any symbols!" >&4
19779         echo " "
19780         echo "However, your C preprocessor defines the following symbols:"
19781         $cat Cppsym.true
19782         ccsymbols=''
19783         cppsymbols=`$cat Cppsym.true`
19784         cppsymbols=`echo $cppsymbols`
19785         cppccsymbols="$cppsymbols"
19786 else
19787         if $test -s ccsym.com; then
19788                 echo "Your C compiler and pre-processor define these symbols:"
19789                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19790                 also='also '
19791                 symbols='ones'
19792                 cppccsymbols=`$cat ccsym.com`
19793                 cppccsymbols=`echo $cppccsymbols`
19794                 $test "$silent" || sleep 1
19795         fi
19796         if $test -s ccsym.cpp; then
19797                 $test "$also" && echo " "
19798                 echo "Your C pre-processor ${also}defines the following symbols:"
19799                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19800                 also='further '
19801                 cppsymbols=`$cat ccsym.cpp`
19802                 cppsymbols=`echo $cppsymbols`
19803                 $test "$silent" || sleep 1
19804         fi
19805         if $test -s ccsym.own; then
19806                 $test "$also" && echo " "
19807                 echo "Your C compiler ${also}defines the following cpp symbols:"
19808                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19809                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19810                 ccsymbols=`$cat ccsym.own`
19811                 ccsymbols=`echo $ccsymbols`
19812                 $test "$silent" || sleep 1
19813         fi
19814 fi
19815
19816 : see if this is a termio system
19817 val="$undef"
19818 val2="$undef"
19819 val3="$undef"
19820 if $test `./findhdr termios.h`; then
19821         set tcsetattr i_termios
19822         eval $inlibc
19823         val3="$i_termios"
19824 fi
19825 echo " "
19826 case "$val3" in
19827 "$define") echo "You have POSIX termios.h... good!" >&4;;
19828 *) if ./Cppsym pyr; then
19829                 case "`/bin/universe`" in
19830                 ucb) if $test `./findhdr sgtty.h`; then
19831                                 val2="$define"
19832                                 echo "<sgtty.h> found." >&4
19833                         else
19834                                 echo "System is pyramid with BSD universe."
19835                                 echo "<sgtty.h> not found--you could have problems." >&4
19836                         fi;;
19837                 *) if $test `./findhdr termio.h`; then
19838                                 val="$define"
19839                                 echo "<termio.h> found." >&4
19840                         else
19841                                 echo "System is pyramid with USG universe."
19842                                 echo "<termio.h> not found--you could have problems." >&4
19843                         fi;;
19844                 esac
19845         elif ./usg; then
19846                 if $test `./findhdr termio.h`; then
19847                         echo "<termio.h> found." >&4
19848                         val="$define"
19849                 elif $test `./findhdr sgtty.h`; then
19850                         echo "<sgtty.h> found." >&4
19851                         val2="$define"
19852                 else
19853 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19854                 fi
19855         else
19856                 if $test `./findhdr sgtty.h`; then
19857                         echo "<sgtty.h> found." >&4
19858                         val2="$define"
19859                 elif $test `./findhdr termio.h`; then
19860                         echo "<termio.h> found." >&4
19861                         val="$define"
19862                 else
19863 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19864                 fi
19865         fi;;
19866 esac
19867 set i_termio; eval $setvar
19868 val=$val2; set i_sgtty; eval $setvar
19869 val=$val3; set i_termios; eval $setvar
19870
19871 : see if stddef is available
19872 set stddef.h i_stddef
19873 eval $inhdr
19874
19875 : see if this is a sunmath.h system
19876 set sunmath.h i_sunmath
19877 eval $inhdr
19878
19879 : see if sys/access.h is available
19880 set sys/access.h i_sysaccess
19881 eval $inhdr
19882
19883 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19884 set sys/filio.h i_sysfilio
19885 eval $inhdr
19886 echo " "
19887 if $test `./findhdr sys/ioctl.h`; then
19888         val="$define"
19889         echo '<sys/ioctl.h> found.' >&4
19890 else
19891         val="$undef"
19892         if $test $i_sysfilio = "$define"; then
19893             echo '<sys/ioctl.h> NOT found.' >&4
19894         else
19895                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19896                 $test $i_termio = "$define" && xxx="termio.h"
19897                 $test $i_termios = "$define" && xxx="termios.h"
19898 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19899         fi
19900 fi
19901 set i_sysioctl
19902 eval $setvar
19903
19904 : see if socket ioctl defs are in sys/sockio.h
19905 echo " "
19906 xxx=`./findhdr sys/sockio.h`
19907 if $test "$xxx"; then
19908         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19909                 val="$define"
19910                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19911         else
19912                 val="$undef"
19913                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19914         fi
19915 else
19916         val="$undef"
19917         $cat <<EOM
19918 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19919 EOM
19920 fi
19921 set i_syssockio
19922 eval $setvar
19923
19924
19925 : see if this is a syslog.h system
19926 set syslog.h i_syslog
19927 eval $inhdr
19928
19929
19930 : see if this is a sys/mode.h system
19931 set sys/mode.h i_sysmode
19932 eval $inhdr
19933
19934 : see if sys/resource.h has to be included
19935 set sys/resource.h i_sysresrc
19936 eval $inhdr
19937
19938 : see if sys/security.h is available
19939 set sys/security.h i_syssecrt
19940 eval $inhdr
19941
19942 : see if this is a sys/statvfs.h system
19943 set sys/statvfs.h i_sysstatvfs
19944 eval $inhdr
19945
19946 : see if this is a sys/un.h system
19947 set sys/un.h i_sysun
19948 eval $inhdr
19949
19950
19951 : see if this is a sys/utsname.h system
19952 set sys/utsname.h i_sysutsname
19953 eval $inhdr
19954
19955 : see if this is a syswait system
19956 set sys/wait.h i_syswait
19957 eval $inhdr
19958
19959 : see if this is a ustat.h system
19960 set ustat.h i_ustat
19961 eval $inhdr
19962
19963 : see if this is an utime system
19964 set utime.h i_utime
19965 eval $inhdr
19966
19967 : see if this is a values.h system
19968 set values.h i_values
19969 eval $inhdr
19970
19971 : see if this is a vfork system
19972 case "$d_vfork" in
19973 "$define")
19974         set vfork.h i_vfork
19975         eval $inhdr
19976         ;;
19977 *)
19978         i_vfork="$undef"
19979         ;;
19980 esac
19981
19982 : see if gdbm.h is available
19983 set gdbm.h t_gdbm
19984 eval $inhdr
19985 case "$t_gdbm" in
19986 $define)
19987         : see if gdbm_open exists
19988         set gdbm_open d_gdbm_open
19989         eval $inlibc
19990         case "$d_gdbm_open" in
19991         $undef)
19992                 t_gdbm="$undef"
19993                 echo "We won't be including <gdbm.h>"
19994                 ;;
19995         esac
19996         ;;
19997 esac
19998 val="$t_gdbm"
19999 set i_gdbm
20000 eval $setvar
20001
20002 echo " "
20003 echo "Looking for extensions..." >&4
20004 : If we are using the old config.sh, known_extensions may contain
20005 : old or inaccurate or duplicate values.
20006 known_extensions=''
20007 nonxs_extensions=''
20008 : We do not use find because it might not be available.
20009 : We do not just use MANIFEST because the user may have dropped
20010 : some additional extensions into the source tree and expect them
20011 : to be built.
20012
20013 : Function to recursively find available extensions, ignoring DynaLoader
20014 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20015 find_extensions='
20016     for xxx in *; do
20017        case "$xxx" in
20018            DynaLoader|dynaload) ;;
20019            *)
20020            if $test -f $xxx/$xxx.xs; then
20021                known_extensions="$known_extensions $1$xxx";
20022            elif $test -f $xxx/Makefile.PL; then
20023                nonxs_extensions="$nonxs_extensions $1$xxx";
20024            else
20025                if $test -d $xxx -a $# -lt 10; then
20026                    set $1$xxx/ $*;
20027                    cd "$xxx";
20028                    eval $find_extensions;
20029                    cd ..;
20030                    shift;
20031                fi;
20032            fi
20033            ;;
20034        esac;
20035     done'
20036 tdir=`pwd`
20037 cd "$rsrc/ext"
20038 set X
20039 shift
20040 eval $find_extensions
20041 # Special case:  Add in threads/shared since it is not picked up by the
20042 # recursive find above (and adding in general recursive finding breaks
20043 # SDBM_File/sdbm).  A.D.  10/25/2001.
20044 known_extensions="$known_extensions threads/shared"
20045 set X $nonxs_extensions
20046 shift
20047 nonxs_extensions="$*"
20048 set X $known_extensions
20049 shift
20050 known_extensions="$*"
20051 cd "$tdir"
20052
20053 : Now see which are supported on this system.
20054 avail_ext=''
20055 for xxx in $known_extensions ; do
20056         case "$xxx" in
20057         DB_File|db_file)
20058                 case "$i_db" in
20059                 $define) avail_ext="$avail_ext $xxx" ;;
20060                 esac
20061                 ;;
20062         GDBM_File|gdbm_fil)
20063                 case "$i_gdbm" in 
20064                 $define) avail_ext="$avail_ext $xxx" ;;
20065                 esac
20066                 ;;
20067         I18N/Langinfo|i18n_lan)
20068                 case "$i_langinfo$d_nl_langinfo" in 
20069                 $define$define) avail_ext="$avail_ext $xxx" ;;
20070                 esac
20071                 ;;
20072         NDBM_File|ndbm_fil)
20073                 case "$i_ndbm" in
20074                 $define)
20075                     case "$osname-$use64bitint" in
20076                     hpux-define)
20077                         case "$libs" in
20078                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20079                         esac
20080                         ;;
20081                     *) avail_ext="$avail_ext $xxx" ;;
20082                     esac
20083                     ;;
20084                 esac
20085                 ;;
20086         ODBM_File|odbm_fil) 
20087                 case "${i_dbm}${i_rpcsvcdbm}" in
20088                 *"${define}"*)
20089                     case "$osname-$use64bitint" in
20090                     hpux-define)
20091                         case "$libs" in
20092                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20093                         esac
20094                         ;;
20095                     *) avail_ext="$avail_ext $xxx" ;;
20096                     esac
20097                     ;;
20098                 esac
20099                 ;;
20100         POSIX|posix)
20101                 case "$useposix" in
20102                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20103                 esac
20104                 ;;
20105         Opcode|opcode)
20106                 case "$useopcode" in
20107                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20108                 esac
20109                 ;;
20110         Socket|socket)
20111                 case "$d_socket" in 
20112                 true|$define|y)
20113                     case "$osname" in
20114                     beos) ;; # not unless BONE
20115                     *) avail_ext="$avail_ext $xxx" ;;
20116                     esac
20117                     ;;
20118                 esac
20119                 ;;
20120         Sys/Syslog|sys/syslog)
20121                 : XXX syslog requires socket
20122                 case "$d_socket" in 
20123                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20124                 esac
20125                 ;;
20126         Thread|thread)
20127                 case "$usethreads" in
20128                 true|$define|y)
20129                         case "$useithreads" in
20130                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20131                         esac
20132                 esac
20133                 ;;
20134         XS/APItest|xs/apitest)
20135                 # This is just for testing.  Skip it unless we have dynamic loading.
20136
20137                 case "$usedl" in
20138                 $define) avail_ext="$avail_ext $xxx" ;;
20139                 esac
20140                 ;;
20141         XS/Typemap|xs/typemap)
20142                 # This is just for testing.  Skip it unless we have dynamic loading.
20143                 case "$usedl" in
20144                 $define) avail_ext="$avail_ext $xxx" ;;
20145                 esac
20146                 ;;
20147         threads|threads/shared)
20148                 # threads and threads::shared are special cases.
20149                 # To stop people from asking "Perl 5.8.0 was supposed
20150                 # to have this new fancy threads implementation but my
20151                 # perl doesn't have it" and from people trying to
20152                 # (re)install the threads module using CPAN.pm and
20153                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20154                 # the threads.pm and threads/shared.pm will always be
20155                 # there, croaking informatively ("you need to rebuild
20156                 # all of Perl with threads, sorry") when threads haven't
20157                 # been compiled in.
20158                 # --jhi
20159                 avail_ext="$avail_ext $xxx"
20160                 ;;
20161         IPC/SysV|ipc/sysv)
20162                 : XXX Do we need a useipcsysv variable here
20163                 case "${d_msg}${d_sem}${d_shm}" in 
20164                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20165                 esac
20166                 ;;
20167         *)      avail_ext="$avail_ext $xxx"
20168                 ;;
20169         esac
20170 done
20171
20172 set X $avail_ext
20173 shift
20174 avail_ext="$*"
20175
20176 case "$onlyextensions" in
20177 '') ;;
20178 *)  keepextensions=''
20179     echo "You have requested that only certains extensions be included..." >&4
20180     for i in $onlyextensions; do
20181         case " $avail_ext " in
20182         *" $i "*)
20183             echo "Keeping extension $i."
20184             keepextensions="$keepextensions $i"
20185             ;;
20186         *) echo "Ignoring extension $i." ;;
20187         esac
20188     done
20189     avail_ext="$keepextensions"
20190     ;;
20191 esac
20192
20193 case "$noextensions" in
20194 '') ;;
20195 *)  keepextensions=''
20196     echo "You have requested that certain extensions be ignored..." >&4
20197     for i in $avail_ext; do
20198         case " $noextensions " in
20199         *" $i "*) echo "Ignoring extension $i." ;;
20200         *) echo "Keeping extension $i.";
20201            keepextensions="$keepextensions $i"
20202            ;;
20203         esac
20204     done
20205     avail_ext="$keepextensions"
20206     ;;
20207 esac
20208
20209 : Now see which nonxs extensions are supported on this system.
20210 : For now assume all are.
20211 nonxs_ext=''
20212 for xxx in $nonxs_extensions ; do
20213         case "$xxx" in
20214         *)      nonxs_ext="$nonxs_ext $xxx"
20215                 ;;
20216         esac
20217 done
20218
20219 set X $nonxs_ext
20220 shift
20221 nonxs_ext="$*"
20222
20223 case $usedl in
20224 $define)
20225         $cat <<EOM
20226 A number of extensions are supplied with $package.  You may choose to
20227 compile these extensions for dynamic loading (the default), compile
20228 them into the $package executable (static loading), or not include
20229 them at all.  Answer "none" to include no extensions.
20230 Note that DynaLoader is always built and need not be mentioned here.
20231
20232 EOM
20233         case "$dynamic_ext" in
20234         '')
20235                 : Exclude those listed in static_ext
20236                 dflt=''
20237                 for xxx in $avail_ext; do
20238                         case " $static_ext " in
20239                         *" $xxx "*) ;;
20240                         *) dflt="$dflt $xxx" ;;
20241                         esac
20242                 done
20243                 set X $dflt
20244                 shift
20245                 dflt="$*"
20246                 ;;
20247         *)      dflt="$dynamic_ext"
20248                 # Perhaps we are reusing an old out-of-date config.sh.
20249                 case "$hint" in
20250                 previous)
20251                         if test X"$dynamic_ext" != X"$avail_ext"; then
20252                                 $cat <<EOM
20253 NOTICE:  Your previous config.sh list may be incorrect. 
20254 The extensions now available to you are 
20255         ${avail_ext}
20256 but the default list from your previous config.sh is
20257         ${dynamic_ext} 
20258
20259 EOM
20260                         fi
20261                         ;;
20262                 esac
20263                 ;;
20264         esac
20265         case "$dflt" in
20266         '')     dflt=none;;
20267         esac
20268         rp="What extensions do you wish to load dynamically?"
20269         . ./myread
20270         case "$ans" in
20271         none) dynamic_ext=' ' ;;
20272         *) dynamic_ext="$ans" ;;
20273         esac
20274
20275         case "$static_ext" in
20276         '')
20277                 : Exclude those already listed in dynamic linking
20278                 dflt=''
20279                 for xxx in $avail_ext; do
20280                         case " $dynamic_ext " in
20281                         *" $xxx "*) ;;
20282                         *) dflt="$dflt $xxx" ;;
20283                         esac
20284                 done
20285                 set X $dflt
20286                 shift
20287                 dflt="$*"
20288                 ;;
20289         *)  dflt="$static_ext" 
20290                 ;;
20291         esac
20292
20293         case "$dflt" in
20294         '')     dflt=none;;
20295         esac
20296         rp="What extensions do you wish to load statically?"
20297         . ./myread
20298         case "$ans" in
20299         none) static_ext=' ' ;;
20300         *) static_ext="$ans" ;;
20301         esac
20302         ;;
20303 *)
20304         $cat <<EOM
20305 A number of extensions are supplied with $package.  Answer "none" 
20306 to include no extensions. 
20307 Note that DynaLoader is always built and need not be mentioned here.
20308
20309 EOM
20310         case "$static_ext" in
20311         '') dflt="$avail_ext" ;;
20312         *)      dflt="$static_ext"
20313                 # Perhaps we are reusing an old out-of-date config.sh.
20314                 case "$hint" in
20315                 previous)
20316                         if test X"$static_ext" != X"$avail_ext"; then
20317                                 $cat <<EOM
20318 NOTICE:  Your previous config.sh list may be incorrect. 
20319 The extensions now available to you are 
20320         ${avail_ext}
20321 but the default list from your previous config.sh is
20322         ${static_ext} 
20323
20324 EOM
20325                         fi
20326                         ;;
20327                 esac
20328                 ;;
20329         esac
20330         : Exclude those that are not xs extensions
20331         case "$dflt" in
20332         '')     dflt=none;;
20333         esac
20334         rp="What extensions do you wish to include?"
20335         . ./myread
20336         case "$ans" in
20337         none) static_ext=' ' ;;
20338         *) static_ext="$ans" ;;
20339         esac
20340         ;;
20341 esac
20342 #        
20343 # Encode is a special case.  If we are building Encode as a static
20344 # extension, we need to explicitly list its subextensions as well.
20345 # For other nested extensions, this is handled automatically by
20346 # the appropriate Makefile.PL.
20347 case " $static_ext " in
20348         *" Encode "*) # Add the subextensions of Encode
20349         cd "$rsrc/ext"
20350         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20351                 static_ext="$static_ext Encode/$xxx"
20352         done
20353         cd "$tdir"
20354         ;;
20355 esac
20356
20357 set X $dynamic_ext $static_ext $nonxs_ext
20358 shift
20359 extensions="$*"
20360
20361 # Sanity check:  We require an extension suitable for use with
20362 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20363 # should show up as failures in the test suite, but it's helpful to
20364 # catch them now.) The 'extensions' list is normally sorted
20365 # alphabetically, so we need to accept either
20366 #    DB_File ... Fcntl ... IO  ....
20367 # or something like
20368 #    Fcntl ... NDBM_File ... IO  ....
20369 case " $extensions"  in
20370 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20371 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20372 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20373 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20374    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20375    ;;
20376 esac
20377
20378 : Remove libraries needed only for extensions
20379 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20380 : The exception is SunOS 4.x, which needs them.
20381 case "${osname}X${osvers}" in
20382 sunos*X4*)
20383     perllibs="$libs"
20384     ;;
20385 *) case "$usedl" in
20386     $define|true|[yY]*)
20387             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20388             shift
20389             perllibs="$*"
20390             ;;
20391     *)  perllibs="$libs"
20392             ;;
20393     esac
20394     ;;
20395 esac
20396
20397 : Remove build directory name from cppstdin so it can be used from
20398 : either the present location or the final installed location.
20399 echo " "
20400 : Get out of the UU directory to get correct path name.
20401 cd ..
20402 case "$cppstdin" in
20403 `pwd`/cppstdin)
20404         echo "Stripping down cppstdin path name"
20405         cppstdin=cppstdin
20406         ;;
20407 esac
20408 cd UU
20409
20410 : end of configuration questions
20411 echo " "
20412 echo "End of configuration questions."
20413 echo " "
20414
20415 : back to where it started
20416 if test -d ../UU; then
20417         cd ..
20418 fi
20419
20420 : configuration may be patched via a 'config.arch' file
20421 if $test -f config.arch; then
20422         echo "I see a config.arch file, loading it."
20423         . ./config.arch
20424 fi
20425
20426 : configuration may be patched via a 'config.over' file
20427 if $test -f config.over; then
20428         echo " "
20429         dflt=y
20430         rp='I see a config.over file.  Do you wish to load it?'
20431         . UU/myread
20432         case "$ans" in
20433         n*) echo "OK, I'll ignore it.";;
20434         *)      . ./config.over
20435                 echo "Configuration override changes have been loaded."
20436                 ;;
20437         esac
20438 fi
20439
20440 : in case they want portability, strip down executable paths
20441 case "$d_portable" in
20442 "$define")
20443         echo " "
20444         echo "Stripping down executable paths..." >&4
20445         for file in $loclist $trylist; do
20446                 eval temp=\$$file
20447                 eval $file=`basename $temp`
20448         done
20449         ;;
20450 esac
20451
20452 : create config.sh file
20453 echo " "
20454 echo "Creating config.sh..." >&4
20455 $spitshell <<EOT >config.sh
20456 $startsh
20457 #
20458 # This file was produced by running the Configure script. It holds all the
20459 # definitions figured out by Configure. Should you modify one of these values,
20460 # do not forget to propagate your changes by running "Configure -der". You may
20461 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20462 #
20463
20464 # Package name      : $package
20465 # Source directory  : $src
20466 # Configuration time: $cf_time
20467 # Configured by     : $cf_by
20468 # Target system     : $myuname
20469
20470 Author='$Author'
20471 Date='$Date'
20472 Header='$Header'
20473 Id='$Id'
20474 Locker='$Locker'
20475 Log='$Log'
20476 Mcc='$Mcc'
20477 RCSfile='$RCSfile'
20478 Revision='$Revision'
20479 Source='$Source'
20480 State='$State'
20481 _a='$_a'
20482 _exe='$_exe'
20483 _o='$_o'
20484 afs='$afs'
20485 afsroot='$afsroot'
20486 alignbytes='$alignbytes'
20487 ansi2knr='$ansi2knr'
20488 aphostname='$aphostname'
20489 api_revision='$api_revision'
20490 api_subversion='$api_subversion'
20491 api_version='$api_version'
20492 api_versionstring='$api_versionstring'
20493 ar='$ar'
20494 archlib='$archlib'
20495 archlibexp='$archlibexp'
20496 archname64='$archname64'
20497 archname='$archname'
20498 archobjs='$archobjs'
20499 asctime_r_proto='$asctime_r_proto'
20500 awk='$awk'
20501 baserev='$baserev'
20502 bash='$bash'
20503 bin='$bin'
20504 binexp='$binexp'
20505 bison='$bison'
20506 byacc='$byacc'
20507 byteorder='$byteorder'
20508 c='$c'
20509 castflags='$castflags'
20510 cat='$cat'
20511 cc='$cc'
20512 cccdlflags='$cccdlflags'
20513 ccdlflags='$ccdlflags'
20514 ccflags='$ccflags'
20515 ccflags_uselargefiles='$ccflags_uselargefiles'
20516 ccname='$ccname'
20517 ccsymbols='$ccsymbols'
20518 ccversion='$ccversion'
20519 cf_by='$cf_by'
20520 cf_email='$cf_email'
20521 cf_time='$cf_time'
20522 charsize='$charsize'
20523 chgrp='$chgrp'
20524 chmod='$chmod'
20525 chown='$chown'
20526 clocktype='$clocktype'
20527 comm='$comm'
20528 compress='$compress'
20529 contains='$contains'
20530 cp='$cp'
20531 cpio='$cpio'
20532 cpp='$cpp'
20533 cpp_stuff='$cpp_stuff'
20534 cppccsymbols='$cppccsymbols'
20535 cppflags='$cppflags'
20536 cpplast='$cpplast'
20537 cppminus='$cppminus'
20538 cpprun='$cpprun'
20539 cppstdin='$cppstdin'
20540 cppsymbols='$cppsymbols'
20541 crypt_r_proto='$crypt_r_proto'
20542 cryptlib='$cryptlib'
20543 csh='$csh'
20544 ctermid_r_proto='$ctermid_r_proto'
20545 ctime_r_proto='$ctime_r_proto'
20546 d_Gconvert='$d_Gconvert'
20547 d_PRIEUldbl='$d_PRIEUldbl'
20548 d_PRIFUldbl='$d_PRIFUldbl'
20549 d_PRIGUldbl='$d_PRIGUldbl'
20550 d_PRIXU64='$d_PRIXU64'
20551 d_PRId64='$d_PRId64'
20552 d_PRIeldbl='$d_PRIeldbl'
20553 d_PRIfldbl='$d_PRIfldbl'
20554 d_PRIgldbl='$d_PRIgldbl'
20555 d_PRIi64='$d_PRIi64'
20556 d_PRIo64='$d_PRIo64'
20557 d_PRIu64='$d_PRIu64'
20558 d_PRIx64='$d_PRIx64'
20559 d_SCNfldbl='$d_SCNfldbl'
20560 d__fwalk='$d__fwalk'
20561 d_access='$d_access'
20562 d_accessx='$d_accessx'
20563 d_aintl='$d_aintl'
20564 d_alarm='$d_alarm'
20565 d_archlib='$d_archlib'
20566 d_asctime_r='$d_asctime_r'
20567 d_atolf='$d_atolf'
20568 d_atoll='$d_atoll'
20569 d_attribut='$d_attribut'
20570 d_bcmp='$d_bcmp'
20571 d_bcopy='$d_bcopy'
20572 d_bsd='$d_bsd'
20573 d_bsdgetpgrp='$d_bsdgetpgrp'
20574 d_bsdsetpgrp='$d_bsdsetpgrp'
20575 d_bzero='$d_bzero'
20576 d_casti32='$d_casti32'
20577 d_castneg='$d_castneg'
20578 d_charvspr='$d_charvspr'
20579 d_chown='$d_chown'
20580 d_chroot='$d_chroot'
20581 d_chsize='$d_chsize'
20582 d_class='$d_class'
20583 d_closedir='$d_closedir'
20584 d_cmsghdr_s='$d_cmsghdr_s'
20585 d_const='$d_const'
20586 d_copysignl='$d_copysignl'
20587 d_crypt='$d_crypt'
20588 d_crypt_r='$d_crypt_r'
20589 d_csh='$d_csh'
20590 d_ctermid_r='$d_ctermid_r'
20591 d_ctime_r='$d_ctime_r'
20592 d_cuserid='$d_cuserid'
20593 d_dbl_dig='$d_dbl_dig'
20594 d_dbminitproto='$d_dbminitproto'
20595 d_difftime='$d_difftime'
20596 d_dirfd='$d_dirfd'
20597 d_dirnamlen='$d_dirnamlen'
20598 d_dlerror='$d_dlerror'
20599 d_dlopen='$d_dlopen'
20600 d_dlsymun='$d_dlsymun'
20601 d_dosuid='$d_dosuid'
20602 d_drand48_r='$d_drand48_r'
20603 d_drand48proto='$d_drand48proto'
20604 d_dup2='$d_dup2'
20605 d_eaccess='$d_eaccess'
20606 d_endgrent='$d_endgrent'
20607 d_endgrent_r='$d_endgrent_r'
20608 d_endhent='$d_endhent'
20609 d_endhostent_r='$d_endhostent_r'
20610 d_endnent='$d_endnent'
20611 d_endnetent_r='$d_endnetent_r'
20612 d_endpent='$d_endpent'
20613 d_endprotoent_r='$d_endprotoent_r'
20614 d_endpwent='$d_endpwent'
20615 d_endpwent_r='$d_endpwent_r'
20616 d_endsent='$d_endsent'
20617 d_endservent_r='$d_endservent_r'
20618 d_eofnblk='$d_eofnblk'
20619 d_eunice='$d_eunice'
20620 d_faststdio='$d_faststdio'
20621 d_fchdir='$d_fchdir'
20622 d_fchmod='$d_fchmod'
20623 d_fchown='$d_fchown'
20624 d_fcntl='$d_fcntl'
20625 d_fcntl_can_lock='$d_fcntl_can_lock'
20626 d_fd_macros='$d_fd_macros'
20627 d_fd_set='$d_fd_set'
20628 d_fds_bits='$d_fds_bits'
20629 d_fgetpos='$d_fgetpos'
20630 d_finite='$d_finite'
20631 d_finitel='$d_finitel'
20632 d_flexfnam='$d_flexfnam'
20633 d_flock='$d_flock'
20634 d_flockproto='$d_flockproto'
20635 d_fork='$d_fork'
20636 d_fp_class='$d_fp_class'
20637 d_fpathconf='$d_fpathconf'
20638 d_fpclass='$d_fpclass'
20639 d_fpclassify='$d_fpclassify'
20640 d_fpclassl='$d_fpclassl'
20641 d_fpos64_t='$d_fpos64_t'
20642 d_frexpl='$d_frexpl'
20643 d_fs_data_s='$d_fs_data_s'
20644 d_fseeko='$d_fseeko'
20645 d_fsetpos='$d_fsetpos'
20646 d_fstatfs='$d_fstatfs'
20647 d_fstatvfs='$d_fstatvfs'
20648 d_fsync='$d_fsync'
20649 d_ftello='$d_ftello'
20650 d_ftime='$d_ftime'
20651 d_getcwd='$d_getcwd'
20652 d_getespwnam='$d_getespwnam'
20653 d_getfsstat='$d_getfsstat'
20654 d_getgrent='$d_getgrent'
20655 d_getgrent_r='$d_getgrent_r'
20656 d_getgrgid_r='$d_getgrgid_r'
20657 d_getgrnam_r='$d_getgrnam_r'
20658 d_getgrps='$d_getgrps'
20659 d_gethbyaddr='$d_gethbyaddr'
20660 d_gethbyname='$d_gethbyname'
20661 d_gethent='$d_gethent'
20662 d_gethname='$d_gethname'
20663 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20664 d_gethostbyname_r='$d_gethostbyname_r'
20665 d_gethostent_r='$d_gethostent_r'
20666 d_gethostprotos='$d_gethostprotos'
20667 d_getitimer='$d_getitimer'
20668 d_getlogin='$d_getlogin'
20669 d_getlogin_r='$d_getlogin_r'
20670 d_getmnt='$d_getmnt'
20671 d_getmntent='$d_getmntent'
20672 d_getnbyaddr='$d_getnbyaddr'
20673 d_getnbyname='$d_getnbyname'
20674 d_getnent='$d_getnent'
20675 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20676 d_getnetbyname_r='$d_getnetbyname_r'
20677 d_getnetent_r='$d_getnetent_r'
20678 d_getnetprotos='$d_getnetprotos'
20679 d_getpagsz='$d_getpagsz'
20680 d_getpbyname='$d_getpbyname'
20681 d_getpbynumber='$d_getpbynumber'
20682 d_getpent='$d_getpent'
20683 d_getpgid='$d_getpgid'
20684 d_getpgrp2='$d_getpgrp2'
20685 d_getpgrp='$d_getpgrp'
20686 d_getppid='$d_getppid'
20687 d_getprior='$d_getprior'
20688 d_getprotobyname_r='$d_getprotobyname_r'
20689 d_getprotobynumber_r='$d_getprotobynumber_r'
20690 d_getprotoent_r='$d_getprotoent_r'
20691 d_getprotoprotos='$d_getprotoprotos'
20692 d_getprpwnam='$d_getprpwnam'
20693 d_getpwent='$d_getpwent'
20694 d_getpwent_r='$d_getpwent_r'
20695 d_getpwnam_r='$d_getpwnam_r'
20696 d_getpwuid_r='$d_getpwuid_r'
20697 d_getsbyname='$d_getsbyname'
20698 d_getsbyport='$d_getsbyport'
20699 d_getsent='$d_getsent'
20700 d_getservbyname_r='$d_getservbyname_r'
20701 d_getservbyport_r='$d_getservbyport_r'
20702 d_getservent_r='$d_getservent_r'
20703 d_getservprotos='$d_getservprotos'
20704 d_getspnam='$d_getspnam'
20705 d_getspnam_r='$d_getspnam_r'
20706 d_gettimeod='$d_gettimeod'
20707 d_gmtime_r='$d_gmtime_r'
20708 d_gnulibc='$d_gnulibc'
20709 d_grpasswd='$d_grpasswd'
20710 d_hasmntopt='$d_hasmntopt'
20711 d_htonl='$d_htonl'
20712 d_ilogbl='$d_ilogbl'
20713 d_index='$d_index'
20714 d_inetaton='$d_inetaton'
20715 d_int64_t='$d_int64_t'
20716 d_isascii='$d_isascii'
20717 d_isfinite='$d_isfinite'
20718 d_isinf='$d_isinf'
20719 d_isnan='$d_isnan'
20720 d_isnanl='$d_isnanl'
20721 d_killpg='$d_killpg'
20722 d_lchown='$d_lchown'
20723 d_ldbl_dig='$d_ldbl_dig'
20724 d_link='$d_link'
20725 d_localtime_r='$d_localtime_r'
20726 d_locconv='$d_locconv'
20727 d_lockf='$d_lockf'
20728 d_longdbl='$d_longdbl'
20729 d_longlong='$d_longlong'
20730 d_lseekproto='$d_lseekproto'
20731 d_lstat='$d_lstat'
20732 d_madvise='$d_madvise'
20733 d_mblen='$d_mblen'
20734 d_mbstowcs='$d_mbstowcs'
20735 d_mbtowc='$d_mbtowc'
20736 d_memchr='$d_memchr'
20737 d_memcmp='$d_memcmp'
20738 d_memcpy='$d_memcpy'
20739 d_memmove='$d_memmove'
20740 d_memset='$d_memset'
20741 d_mkdir='$d_mkdir'
20742 d_mkdtemp='$d_mkdtemp'
20743 d_mkfifo='$d_mkfifo'
20744 d_mkstemp='$d_mkstemp'
20745 d_mkstemps='$d_mkstemps'
20746 d_mktime='$d_mktime'
20747 d_mmap='$d_mmap'
20748 d_modfl='$d_modfl'
20749 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20750 d_modflproto='$d_modflproto'
20751 d_mprotect='$d_mprotect'
20752 d_msg='$d_msg'
20753 d_msg_ctrunc='$d_msg_ctrunc'
20754 d_msg_dontroute='$d_msg_dontroute'
20755 d_msg_oob='$d_msg_oob'
20756 d_msg_peek='$d_msg_peek'
20757 d_msg_proxy='$d_msg_proxy'
20758 d_msgctl='$d_msgctl'
20759 d_msgget='$d_msgget'
20760 d_msghdr_s='$d_msghdr_s'
20761 d_msgrcv='$d_msgrcv'
20762 d_msgsnd='$d_msgsnd'
20763 d_msync='$d_msync'
20764 d_munmap='$d_munmap'
20765 d_mymalloc='$d_mymalloc'
20766 d_nice='$d_nice'
20767 d_nl_langinfo='$d_nl_langinfo'
20768 d_nv_preserves_uv='$d_nv_preserves_uv'
20769 d_off64_t='$d_off64_t'
20770 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20771 d_oldpthreads='$d_oldpthreads'
20772 d_oldsock='$d_oldsock'
20773 d_open3='$d_open3'
20774 d_pathconf='$d_pathconf'
20775 d_pause='$d_pause'
20776 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20777 d_phostname='$d_phostname'
20778 d_pipe='$d_pipe'
20779 d_poll='$d_poll'
20780 d_portable='$d_portable'
20781 d_procselfexe='$d_procselfexe'
20782 d_pthread_atfork='$d_pthread_atfork'
20783 d_pthread_attr_setscope='$d_pthread_attr_setscope'
20784 d_pthread_yield='$d_pthread_yield'
20785 d_pwage='$d_pwage'
20786 d_pwchange='$d_pwchange'
20787 d_pwclass='$d_pwclass'
20788 d_pwcomment='$d_pwcomment'
20789 d_pwexpire='$d_pwexpire'
20790 d_pwgecos='$d_pwgecos'
20791 d_pwpasswd='$d_pwpasswd'
20792 d_pwquota='$d_pwquota'
20793 d_qgcvt='$d_qgcvt'
20794 d_quad='$d_quad'
20795 d_random_r='$d_random_r'
20796 d_readdir64_r='$d_readdir64_r'
20797 d_readdir='$d_readdir'
20798 d_readdir_r='$d_readdir_r'
20799 d_readlink='$d_readlink'
20800 d_readv='$d_readv'
20801 d_recvmsg='$d_recvmsg'
20802 d_rename='$d_rename'
20803 d_rewinddir='$d_rewinddir'
20804 d_rmdir='$d_rmdir'
20805 d_safebcpy='$d_safebcpy'
20806 d_safemcpy='$d_safemcpy'
20807 d_sanemcmp='$d_sanemcmp'
20808 d_sbrkproto='$d_sbrkproto'
20809 d_scalbnl='$d_scalbnl'
20810 d_sched_yield='$d_sched_yield'
20811 d_scm_rights='$d_scm_rights'
20812 d_seekdir='$d_seekdir'
20813 d_select='$d_select'
20814 d_sem='$d_sem'
20815 d_semctl='$d_semctl'
20816 d_semctl_semid_ds='$d_semctl_semid_ds'
20817 d_semctl_semun='$d_semctl_semun'
20818 d_semget='$d_semget'
20819 d_semop='$d_semop'
20820 d_sendmsg='$d_sendmsg'
20821 d_setegid='$d_setegid'
20822 d_seteuid='$d_seteuid'
20823 d_setgrent='$d_setgrent'
20824 d_setgrent_r='$d_setgrent_r'
20825 d_setgrps='$d_setgrps'
20826 d_sethent='$d_sethent'
20827 d_sethostent_r='$d_sethostent_r'
20828 d_setitimer='$d_setitimer'
20829 d_setlinebuf='$d_setlinebuf'
20830 d_setlocale='$d_setlocale'
20831 d_setlocale_r='$d_setlocale_r'
20832 d_setnent='$d_setnent'
20833 d_setnetent_r='$d_setnetent_r'
20834 d_setpent='$d_setpent'
20835 d_setpgid='$d_setpgid'
20836 d_setpgrp2='$d_setpgrp2'
20837 d_setpgrp='$d_setpgrp'
20838 d_setprior='$d_setprior'
20839 d_setproctitle='$d_setproctitle'
20840 d_setprotoent_r='$d_setprotoent_r'
20841 d_setpwent='$d_setpwent'
20842 d_setpwent_r='$d_setpwent_r'
20843 d_setregid='$d_setregid'
20844 d_setresgid='$d_setresgid'
20845 d_setresuid='$d_setresuid'
20846 d_setreuid='$d_setreuid'
20847 d_setrgid='$d_setrgid'
20848 d_setruid='$d_setruid'
20849 d_setsent='$d_setsent'
20850 d_setservent_r='$d_setservent_r'
20851 d_setsid='$d_setsid'
20852 d_setvbuf='$d_setvbuf'
20853 d_sfio='$d_sfio'
20854 d_shm='$d_shm'
20855 d_shmat='$d_shmat'
20856 d_shmatprototype='$d_shmatprototype'
20857 d_shmctl='$d_shmctl'
20858 d_shmdt='$d_shmdt'
20859 d_shmget='$d_shmget'
20860 d_sigaction='$d_sigaction'
20861 d_sigprocmask='$d_sigprocmask'
20862 d_sigsetjmp='$d_sigsetjmp'
20863 d_sockatmark='$d_sockatmark'
20864 d_sockatmarkproto='$d_sockatmarkproto'
20865 d_socket='$d_socket'
20866 d_socklen_t='$d_socklen_t'
20867 d_sockpair='$d_sockpair'
20868 d_socks5_init='$d_socks5_init'
20869 d_sqrtl='$d_sqrtl'
20870 d_srand48_r='$d_srand48_r'
20871 d_srandom_r='$d_srandom_r'
20872 d_sresgproto='$d_sresgproto'
20873 d_sresuproto='$d_sresuproto'
20874 d_statblks='$d_statblks'
20875 d_statfs_f_flags='$d_statfs_f_flags'
20876 d_statfs_s='$d_statfs_s'
20877 d_statvfs='$d_statvfs'
20878 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20879 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20880 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20881 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20882 d_stdio_stream_array='$d_stdio_stream_array'
20883 d_stdiobase='$d_stdiobase'
20884 d_stdstdio='$d_stdstdio'
20885 d_strchr='$d_strchr'
20886 d_strcoll='$d_strcoll'
20887 d_strctcpy='$d_strctcpy'
20888 d_strerrm='$d_strerrm'
20889 d_strerror='$d_strerror'
20890 d_strerror_r='$d_strerror_r'
20891 d_strftime='$d_strftime'
20892 d_strlcat='$d_strlcat'
20893 d_strlcpy='$d_strlcpy'
20894 d_strtod='$d_strtod'
20895 d_strtol='$d_strtol'
20896 d_strtold='$d_strtold'
20897 d_strtoll='$d_strtoll'
20898 d_strtoq='$d_strtoq'
20899 d_strtoul='$d_strtoul'
20900 d_strtoull='$d_strtoull'
20901 d_strtouq='$d_strtouq'
20902 d_strxfrm='$d_strxfrm'
20903 d_suidsafe='$d_suidsafe'
20904 d_symlink='$d_symlink'
20905 d_syscall='$d_syscall'
20906 d_syscallproto='$d_syscallproto'
20907 d_sysconf='$d_sysconf'
20908 d_sysernlst='$d_sysernlst'
20909 d_syserrlst='$d_syserrlst'
20910 d_system='$d_system'
20911 d_tcgetpgrp='$d_tcgetpgrp'
20912 d_tcsetpgrp='$d_tcsetpgrp'
20913 d_telldir='$d_telldir'
20914 d_telldirproto='$d_telldirproto'
20915 d_time='$d_time'
20916 d_times='$d_times'
20917 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20918 d_tm_tm_zone='$d_tm_tm_zone'
20919 d_tmpnam_r='$d_tmpnam_r'
20920 d_truncate='$d_truncate'
20921 d_ttyname_r='$d_ttyname_r'
20922 d_tzname='$d_tzname'
20923 d_u32align='$d_u32align'
20924 d_ualarm='$d_ualarm'
20925 d_umask='$d_umask'
20926 d_uname='$d_uname'
20927 d_union_semun='$d_union_semun'
20928 d_unordered='$d_unordered'
20929 d_usleep='$d_usleep'
20930 d_usleepproto='$d_usleepproto'
20931 d_ustat='$d_ustat'
20932 d_vendorarch='$d_vendorarch'
20933 d_vendorbin='$d_vendorbin'
20934 d_vendorlib='$d_vendorlib'
20935 d_vendorscript='$d_vendorscript'
20936 d_vfork='$d_vfork'
20937 d_void_closedir='$d_void_closedir'
20938 d_voidsig='$d_voidsig'
20939 d_voidtty='$d_voidtty'
20940 d_volatile='$d_volatile'
20941 d_vprintf='$d_vprintf'
20942 d_wait4='$d_wait4'
20943 d_waitpid='$d_waitpid'
20944 d_wcstombs='$d_wcstombs'
20945 d_wctomb='$d_wctomb'
20946 d_writev='$d_writev'
20947 d_xenix='$d_xenix'
20948 date='$date'
20949 db_hashtype='$db_hashtype'
20950 db_prefixtype='$db_prefixtype'
20951 db_version_major='$db_version_major'
20952 db_version_minor='$db_version_minor'
20953 db_version_patch='$db_version_patch'
20954 defvoidused='$defvoidused'
20955 direntrytype='$direntrytype'
20956 dlext='$dlext'
20957 dlsrc='$dlsrc'
20958 doublesize='$doublesize'
20959 drand01='$drand01'
20960 drand48_r_proto='$drand48_r_proto'
20961 dynamic_ext='$dynamic_ext'
20962 eagain='$eagain'
20963 ebcdic='$ebcdic'
20964 echo='$echo'
20965 egrep='$egrep'
20966 emacs='$emacs'
20967 endgrent_r_proto='$endgrent_r_proto'
20968 endhostent_r_proto='$endhostent_r_proto'
20969 endnetent_r_proto='$endnetent_r_proto'
20970 endprotoent_r_proto='$endprotoent_r_proto'
20971 endpwent_r_proto='$endpwent_r_proto'
20972 endservent_r_proto='$endservent_r_proto'
20973 eunicefix='$eunicefix'
20974 exe_ext='$exe_ext'
20975 expr='$expr'
20976 extensions='$extensions'
20977 extras='$extras'
20978 fflushNULL='$fflushNULL'
20979 fflushall='$fflushall'
20980 find='$find'
20981 firstmakefile='$firstmakefile'
20982 flex='$flex'
20983 fpossize='$fpossize'
20984 fpostype='$fpostype'
20985 freetype='$freetype'
20986 from='$from'
20987 full_ar='$full_ar'
20988 full_csh='$full_csh'
20989 full_sed='$full_sed'
20990 gccansipedantic='$gccansipedantic'
20991 gccosandvers='$gccosandvers'
20992 gccversion='$gccversion'
20993 getgrent_r_proto='$getgrent_r_proto'
20994 getgrgid_r_proto='$getgrgid_r_proto'
20995 getgrnam_r_proto='$getgrnam_r_proto'
20996 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20997 gethostbyname_r_proto='$gethostbyname_r_proto'
20998 gethostent_r_proto='$gethostent_r_proto'
20999 getlogin_r_proto='$getlogin_r_proto'
21000 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21001 getnetbyname_r_proto='$getnetbyname_r_proto'
21002 getnetent_r_proto='$getnetent_r_proto'
21003 getprotobyname_r_proto='$getprotobyname_r_proto'
21004 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21005 getprotoent_r_proto='$getprotoent_r_proto'
21006 getpwent_r_proto='$getpwent_r_proto'
21007 getpwnam_r_proto='$getpwnam_r_proto'
21008 getpwuid_r_proto='$getpwuid_r_proto'
21009 getservbyname_r_proto='$getservbyname_r_proto'
21010 getservbyport_r_proto='$getservbyport_r_proto'
21011 getservent_r_proto='$getservent_r_proto'
21012 getspnam_r_proto='$getspnam_r_proto'
21013 gidformat='$gidformat'
21014 gidsign='$gidsign'
21015 gidsize='$gidsize'
21016 gidtype='$gidtype'
21017 glibpth='$glibpth'
21018 gmake='$gmake'
21019 gmtime_r_proto='$gmtime_r_proto'
21020 gnulibc_version='$gnulibc_version'
21021 grep='$grep'
21022 groupcat='$groupcat'
21023 groupstype='$groupstype'
21024 gzip='$gzip'
21025 h_fcntl='$h_fcntl'
21026 h_sysfile='$h_sysfile'
21027 hint='$hint'
21028 hostcat='$hostcat'
21029 html1dir='$html1dir'
21030 html1direxp='$html1direxp'
21031 html3dir='$html3dir'
21032 html3direxp='$html3direxp'
21033 i16size='$i16size'
21034 i16type='$i16type'
21035 i32size='$i32size'
21036 i32type='$i32type'
21037 i64size='$i64size'
21038 i64type='$i64type'
21039 i8size='$i8size'
21040 i8type='$i8type'
21041 i_arpainet='$i_arpainet'
21042 i_bsdioctl='$i_bsdioctl'
21043 i_crypt='$i_crypt'
21044 i_db='$i_db'
21045 i_dbm='$i_dbm'
21046 i_dirent='$i_dirent'
21047 i_dld='$i_dld'
21048 i_dlfcn='$i_dlfcn'
21049 i_fcntl='$i_fcntl'
21050 i_float='$i_float'
21051 i_fp='$i_fp'
21052 i_fp_class='$i_fp_class'
21053 i_gdbm='$i_gdbm'
21054 i_grp='$i_grp'
21055 i_ieeefp='$i_ieeefp'
21056 i_inttypes='$i_inttypes'
21057 i_langinfo='$i_langinfo'
21058 i_libutil='$i_libutil'
21059 i_limits='$i_limits'
21060 i_locale='$i_locale'
21061 i_machcthr='$i_machcthr'
21062 i_malloc='$i_malloc'
21063 i_math='$i_math'
21064 i_memory='$i_memory'
21065 i_mntent='$i_mntent'
21066 i_ndbm='$i_ndbm'
21067 i_netdb='$i_netdb'
21068 i_neterrno='$i_neterrno'
21069 i_netinettcp='$i_netinettcp'
21070 i_niin='$i_niin'
21071 i_poll='$i_poll'
21072 i_prot='$i_prot'
21073 i_pthread='$i_pthread'
21074 i_pwd='$i_pwd'
21075 i_rpcsvcdbm='$i_rpcsvcdbm'
21076 i_sfio='$i_sfio'
21077 i_sgtty='$i_sgtty'
21078 i_shadow='$i_shadow'
21079 i_socks='$i_socks'
21080 i_stdarg='$i_stdarg'
21081 i_stddef='$i_stddef'
21082 i_stdlib='$i_stdlib'
21083 i_string='$i_string'
21084 i_sunmath='$i_sunmath'
21085 i_sysaccess='$i_sysaccess'
21086 i_sysdir='$i_sysdir'
21087 i_sysfile='$i_sysfile'
21088 i_sysfilio='$i_sysfilio'
21089 i_sysin='$i_sysin'
21090 i_sysioctl='$i_sysioctl'
21091 i_syslog='$i_syslog'
21092 i_sysmman='$i_sysmman'
21093 i_sysmode='$i_sysmode'
21094 i_sysmount='$i_sysmount'
21095 i_sysndir='$i_sysndir'
21096 i_sysparam='$i_sysparam'
21097 i_sysresrc='$i_sysresrc'
21098 i_syssecrt='$i_syssecrt'
21099 i_sysselct='$i_sysselct'
21100 i_syssockio='$i_syssockio'
21101 i_sysstat='$i_sysstat'
21102 i_sysstatfs='$i_sysstatfs'
21103 i_sysstatvfs='$i_sysstatvfs'
21104 i_systime='$i_systime'
21105 i_systimek='$i_systimek'
21106 i_systimes='$i_systimes'
21107 i_systypes='$i_systypes'
21108 i_sysuio='$i_sysuio'
21109 i_sysun='$i_sysun'
21110 i_sysutsname='$i_sysutsname'
21111 i_sysvfs='$i_sysvfs'
21112 i_syswait='$i_syswait'
21113 i_termio='$i_termio'
21114 i_termios='$i_termios'
21115 i_time='$i_time'
21116 i_unistd='$i_unistd'
21117 i_ustat='$i_ustat'
21118 i_utime='$i_utime'
21119 i_values='$i_values'
21120 i_varargs='$i_varargs'
21121 i_varhdr='$i_varhdr'
21122 i_vfork='$i_vfork'
21123 ignore_versioned_solibs='$ignore_versioned_solibs'
21124 inc_version_list='$inc_version_list'
21125 inc_version_list_init='$inc_version_list_init'
21126 incpath='$incpath'
21127 inews='$inews'
21128 installarchlib='$installarchlib'
21129 installbin='$installbin'
21130 installhtml1dir='$installhtml1dir'
21131 installhtml3dir='$installhtml3dir'
21132 installman1dir='$installman1dir'
21133 installman3dir='$installman3dir'
21134 installprefix='$installprefix'
21135 installprefixexp='$installprefixexp'
21136 installprivlib='$installprivlib'
21137 installscript='$installscript'
21138 installsitearch='$installsitearch'
21139 installsitebin='$installsitebin'
21140 installsitehtml1dir='$installsitehtml1dir'
21141 installsitehtml3dir='$installsitehtml3dir'
21142 installsitelib='$installsitelib'
21143 installsiteman1dir='$installsiteman1dir'
21144 installsiteman3dir='$installsiteman3dir'
21145 installsitescript='$installsitescript'
21146 installstyle='$installstyle'
21147 installusrbinperl='$installusrbinperl'
21148 installvendorarch='$installvendorarch'
21149 installvendorbin='$installvendorbin'
21150 installvendorhtml1dir='$installvendorhtml1dir'
21151 installvendorhtml3dir='$installvendorhtml3dir'
21152 installvendorlib='$installvendorlib'
21153 installvendorman1dir='$installvendorman1dir'
21154 installvendorman3dir='$installvendorman3dir'
21155 installvendorscript='$installvendorscript'
21156 intsize='$intsize'
21157 issymlink='$issymlink'
21158 ivdformat='$ivdformat'
21159 ivsize='$ivsize'
21160 ivtype='$ivtype'
21161 known_extensions='$known_extensions'
21162 ksh='$ksh'
21163 ld='$ld'
21164 lddlflags='$lddlflags'
21165 ldflags='$ldflags'
21166 ldflags_uselargefiles='$ldflags_uselargefiles'
21167 ldlibpthname='$ldlibpthname'
21168 less='$less'
21169 lib_ext='$lib_ext'
21170 libc='$libc'
21171 libperl='$libperl'
21172 libpth='$libpth'
21173 libs='$libs'
21174 libsdirs='$libsdirs'
21175 libsfiles='$libsfiles'
21176 libsfound='$libsfound'
21177 libspath='$libspath'
21178 libswanted='$libswanted'
21179 libswanted_uselargefiles='$libswanted_uselargefiles'
21180 line='$line'
21181 lint='$lint'
21182 lkflags='$lkflags'
21183 ln='$ln'
21184 lns='$lns'
21185 localtime_r_proto='$localtime_r_proto'
21186 locincpth='$locincpth'
21187 loclibpth='$loclibpth'
21188 longdblsize='$longdblsize'
21189 longlongsize='$longlongsize'
21190 longsize='$longsize'
21191 lp='$lp'
21192 lpr='$lpr'
21193 ls='$ls'
21194 lseeksize='$lseeksize'
21195 lseektype='$lseektype'
21196 mail='$mail'
21197 mailx='$mailx'
21198 make='$make'
21199 make_set_make='$make_set_make'
21200 mallocobj='$mallocobj'
21201 mallocsrc='$mallocsrc'
21202 malloctype='$malloctype'
21203 man1dir='$man1dir'
21204 man1direxp='$man1direxp'
21205 man1ext='$man1ext'
21206 man3dir='$man3dir'
21207 man3direxp='$man3direxp'
21208 man3ext='$man3ext'
21209 mips_type='$mips_type'
21210 mistrustnm='$mistrustnm'
21211 mkdir='$mkdir'
21212 mmaptype='$mmaptype'
21213 modetype='$modetype'
21214 more='$more'
21215 multiarch='$multiarch'
21216 mv='$mv'
21217 myarchname='$myarchname'
21218 mydomain='$mydomain'
21219 myhostname='$myhostname'
21220 myuname='$myuname'
21221 n='$n'
21222 need_va_copy='$need_va_copy'
21223 netdb_hlen_type='$netdb_hlen_type'
21224 netdb_host_type='$netdb_host_type'
21225 netdb_name_type='$netdb_name_type'
21226 netdb_net_type='$netdb_net_type'
21227 nm='$nm'
21228 nm_opt='$nm_opt'
21229 nm_so_opt='$nm_so_opt'
21230 nonxs_ext='$nonxs_ext'
21231 nroff='$nroff'
21232 nvEUformat='$nvEUformat'
21233 nvFUformat='$nvFUformat'
21234 nvGUformat='$nvGUformat'
21235 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21236 nveformat='$nveformat'
21237 nvfformat='$nvfformat'
21238 nvgformat='$nvgformat'
21239 nvsize='$nvsize'
21240 nvtype='$nvtype'
21241 o_nonblock='$o_nonblock'
21242 obj_ext='$obj_ext'
21243 old_pthread_create_joinable='$old_pthread_create_joinable'
21244 optimize='$optimize'
21245 orderlib='$orderlib'
21246 osname='$osname'
21247 osvers='$osvers'
21248 otherlibdirs='$otherlibdirs'
21249 package='$package'
21250 pager='$pager'
21251 passcat='$passcat'
21252 patchlevel='$patchlevel'
21253 path_sep='$path_sep'
21254 perl5='$perl5'
21255 perl='$perl'
21256 perl_patchlevel='$perl_patchlevel'
21257 perladmin='$perladmin'
21258 perllibs='$perllibs'
21259 perlpath='$perlpath'
21260 pg='$pg'
21261 phostname='$phostname'
21262 pidtype='$pidtype'
21263 plibpth='$plibpth'
21264 pmake='$pmake'
21265 pr='$pr'
21266 prefix='$prefix'
21267 prefixexp='$prefixexp'
21268 privlib='$privlib'
21269 privlibexp='$privlibexp'
21270 procselfexe='$procselfexe'
21271 prototype='$prototype'
21272 ptrsize='$ptrsize'
21273 quadkind='$quadkind'
21274 quadtype='$quadtype'
21275 randbits='$randbits'
21276 randfunc='$randfunc'
21277 random_r_proto='$random_r_proto'
21278 randseedtype='$randseedtype'
21279 ranlib='$ranlib'
21280 rd_nodata='$rd_nodata'
21281 readdir64_r_proto='$readdir64_r_proto'
21282 readdir_r_proto='$readdir_r_proto'
21283 revision='$revision'
21284 rm='$rm'
21285 rmail='$rmail'
21286 run='$run'
21287 runnm='$runnm'
21288 sPRIEUldbl='$sPRIEUldbl'
21289 sPRIFUldbl='$sPRIFUldbl'
21290 sPRIGUldbl='$sPRIGUldbl'
21291 sPRIXU64='$sPRIXU64'
21292 sPRId64='$sPRId64'
21293 sPRIeldbl='$sPRIeldbl'
21294 sPRIfldbl='$sPRIfldbl'
21295 sPRIgldbl='$sPRIgldbl'
21296 sPRIi64='$sPRIi64'
21297 sPRIo64='$sPRIo64'
21298 sPRIu64='$sPRIu64'
21299 sPRIx64='$sPRIx64'
21300 sSCNfldbl='$sSCNfldbl'
21301 sched_yield='$sched_yield'
21302 scriptdir='$scriptdir'
21303 scriptdirexp='$scriptdirexp'
21304 sed='$sed'
21305 seedfunc='$seedfunc'
21306 selectminbits='$selectminbits'
21307 selecttype='$selecttype'
21308 sendmail='$sendmail'
21309 setgrent_r_proto='$setgrent_r_proto'
21310 sethostent_r_proto='$sethostent_r_proto'
21311 setlocale_r_proto='$setlocale_r_proto'
21312 setnetent_r_proto='$setnetent_r_proto'
21313 setprotoent_r_proto='$setprotoent_r_proto'
21314 setpwent_r_proto='$setpwent_r_proto'
21315 setservent_r_proto='$setservent_r_proto'
21316 sh='$sh'
21317 shar='$shar'
21318 sharpbang='$sharpbang'
21319 shmattype='$shmattype'
21320 shortsize='$shortsize'
21321 shrpenv='$shrpenv'
21322 shsharp='$shsharp'
21323 sig_count='$sig_count'
21324 sig_name='$sig_name'
21325 sig_name_init='$sig_name_init'
21326 sig_num='$sig_num'
21327 sig_num_init='$sig_num_init'
21328 sig_size='$sig_size'
21329 signal_t='$signal_t'
21330 sitearch='$sitearch'
21331 sitearchexp='$sitearchexp'
21332 sitebin='$sitebin'
21333 sitebinexp='$sitebinexp'
21334 sitehtml1dir='$sitehtml1dir'
21335 sitehtml1direxp='$sitehtml1direxp'
21336 sitehtml3dir='$sitehtml3dir'
21337 sitehtml3direxp='$sitehtml3direxp'
21338 sitelib='$sitelib'
21339 sitelib_stem='$sitelib_stem'
21340 sitelibexp='$sitelibexp'
21341 siteman1dir='$siteman1dir'
21342 siteman1direxp='$siteman1direxp'
21343 siteman3dir='$siteman3dir'
21344 siteman3direxp='$siteman3direxp'
21345 siteprefix='$siteprefix'
21346 siteprefixexp='$siteprefixexp'
21347 sitescript='$sitescript'
21348 sitescriptexp='$sitescriptexp'
21349 sizesize='$sizesize'
21350 sizetype='$sizetype'
21351 sleep='$sleep'
21352 smail='$smail'
21353 so='$so'
21354 sockethdr='$sockethdr'
21355 socketlib='$socketlib'
21356 socksizetype='$socksizetype'
21357 sort='$sort'
21358 spackage='$spackage'
21359 spitshell='$spitshell'
21360 srand48_r_proto='$srand48_r_proto'
21361 srandom_r_proto='$srandom_r_proto'
21362 src='$src'
21363 ssizetype='$ssizetype'
21364 startperl='$startperl'
21365 startsh='$startsh'
21366 static_ext='$static_ext'
21367 stdchar='$stdchar'
21368 stdio_base='$stdio_base'
21369 stdio_bufsiz='$stdio_bufsiz'
21370 stdio_cnt='$stdio_cnt'
21371 stdio_filbuf='$stdio_filbuf'
21372 stdio_ptr='$stdio_ptr'
21373 stdio_stream_array='$stdio_stream_array'
21374 strerror_r_proto='$strerror_r_proto'
21375 strings='$strings'
21376 submit='$submit'
21377 subversion='$subversion'
21378 sysman='$sysman'
21379 tail='$tail'
21380 tar='$tar'
21381 targetarch='$targetarch'
21382 tbl='$tbl'
21383 tee='$tee'
21384 test='$test'
21385 timeincl='$timeincl'
21386 timetype='$timetype'
21387 tmpnam_r_proto='$tmpnam_r_proto'
21388 to='$to'
21389 touch='$touch'
21390 tr='$tr'
21391 trnl='$trnl'
21392 troff='$troff'
21393 ttyname_r_proto='$ttyname_r_proto'
21394 u16size='$u16size'
21395 u16type='$u16type'
21396 u32size='$u32size'
21397 u32type='$u32type'
21398 u64size='$u64size'
21399 u64type='$u64type'
21400 u8size='$u8size'
21401 u8type='$u8type'
21402 uidformat='$uidformat'
21403 uidsign='$uidsign'
21404 uidsize='$uidsize'
21405 uidtype='$uidtype'
21406 uname='$uname'
21407 uniq='$uniq'
21408 uquadtype='$uquadtype'
21409 use5005threads='$use5005threads'
21410 use64bitall='$use64bitall'
21411 use64bitint='$use64bitint'
21412 usecrosscompile='$usecrosscompile'
21413 usedl='$usedl'
21414 usefaststdio='$usefaststdio'
21415 useithreads='$useithreads'
21416 uselargefiles='$uselargefiles'
21417 uselongdouble='$uselongdouble'
21418 usemallocwrap='$usemallocwrap'
21419 usemorebits='$usemorebits'
21420 usemultiplicity='$usemultiplicity'
21421 usemymalloc='$usemymalloc'
21422 usenm='$usenm'
21423 useopcode='$useopcode'
21424 useperlio='$useperlio'
21425 useposix='$useposix'
21426 usereentrant='$usereentrant'
21427 usesfio='$usesfio'
21428 useshrplib='$useshrplib'
21429 usesocks='$usesocks'
21430 usethreads='$usethreads'
21431 usevendorprefix='$usevendorprefix'
21432 usevfork='$usevfork'
21433 usrinc='$usrinc'
21434 uuname='$uuname'
21435 uvXUformat='$uvXUformat'
21436 uvoformat='$uvoformat'
21437 uvsize='$uvsize'
21438 uvtype='$uvtype'
21439 uvuformat='$uvuformat'
21440 uvxformat='$uvxformat'
21441 vendorarch='$vendorarch'
21442 vendorarchexp='$vendorarchexp'
21443 vendorbin='$vendorbin'
21444 vendorbinexp='$vendorbinexp'
21445 vendorhtml1dir='$vendorhtml1dir'
21446 vendorhtml1direxp='$vendorhtml1direxp'
21447 vendorhtml3dir='$vendorhtml3dir'
21448 vendorhtml3direxp='$vendorhtml3direxp'
21449 vendorlib='$vendorlib'
21450 vendorlib_stem='$vendorlib_stem'
21451 vendorlibexp='$vendorlibexp'
21452 vendorman1dir='$vendorman1dir'
21453 vendorman1direxp='$vendorman1direxp'
21454 vendorman3dir='$vendorman3dir'
21455 vendorman3direxp='$vendorman3direxp'
21456 vendorprefix='$vendorprefix'
21457 vendorprefixexp='$vendorprefixexp'
21458 vendorscript='$vendorscript'
21459 vendorscriptexp='$vendorscriptexp'
21460 version='$version'
21461 version_patchlevel_string='$version_patchlevel_string'
21462 versiononly='$versiononly'
21463 vi='$vi'
21464 voidflags='$voidflags'
21465 xlibpth='$xlibpth'
21466 yacc='$yacc'
21467 yaccflags='$yaccflags'
21468 zcat='$zcat'
21469 zip='$zip'
21470 EOT
21471
21472 : Add in command line options if available
21473 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21474
21475 : add special variables
21476 $test -f $src/patchlevel.h && \
21477 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21478 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21479 echo "PERL_CONFIG_SH=true" >>config.sh
21480
21481 : propagate old symbols
21482 if $test -f UU/config.sh; then
21483         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21484         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21485         $sort | $uniq -u >UU/oldsyms
21486         set X `cat UU/oldsyms`
21487         shift
21488         case $# in
21489         0) ;;
21490         *)
21491                 cat <<EOM
21492 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21493 EOM
21494                 echo "# Variables propagated from previous config.sh file." >>config.sh
21495                 for sym in `cat UU/oldsyms`; do
21496                         echo "    Propagating $hint variable "'$'"$sym..."
21497                         eval 'tmp="$'"${sym}"'"'
21498                         echo "$tmp" | \
21499                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21500                 done
21501                 ;;
21502         esac
21503 fi
21504
21505 : Finish up by extracting the .SH files
21506 case "$alldone" in
21507 exit)
21508         $rm -rf UU
21509         echo "Extraction done."
21510         exit 0
21511         ;;
21512 cont)
21513         ;;
21514 '')
21515         dflt=''
21516         nostick=true
21517         $cat <<EOM
21518
21519 If you'd like to make any changes to the config.sh file before I begin
21520 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21521
21522 EOM
21523         rp="Press return or use a shell escape to edit config.sh:"
21524         . UU/myread
21525         nostick=''
21526         case "$ans" in
21527         '') ;;
21528         *) : in case they cannot read
21529                 sh 1>&4 -c "$ans";;
21530         esac
21531         ;;
21532 esac
21533
21534 : if this fails, just run all the .SH files by hand
21535 . ./config.sh
21536
21537 echo " "
21538 exec 1>&4
21539 pwd=`pwd`
21540 . ./UU/extract
21541 cd "$pwd"
21542
21543 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21544         dflt=y
21545         case "$silent" in
21546         true) ;;
21547         *)
21548                 $cat <<EOM
21549
21550 Now you need to generate make dependencies by running "$make depend".
21551 You might prefer to run it in background: "$make depend > makedepend.out &"
21552 It can take a while, so you might not want to run it right now.
21553
21554 EOM
21555                 ;;
21556         esac
21557         rp="Run $make depend now?"
21558         . UU/myread
21559         case "$ans" in
21560         y*)
21561                 $make depend && echo "Now you must run '$make'."
21562                 ;;
21563         *)
21564                 echo "You must run '$make depend' then '$make'."
21565                 ;;
21566         esac
21567 elif test -f [Mm]akefile; then
21568         echo " "
21569         echo "Now you must run a $make."
21570 else
21571         echo "Configure done."
21572 fi
21573
21574 if $test -f Policy.sh; then
21575     $cat <<EOM
21576
21577 If you compile $package on a different machine or from a different object
21578 directory, copy the Policy.sh file from this object directory to the
21579 new one before you run Configure -- this will help you with most of
21580 the policy defaults.
21581
21582 EOM
21583 fi
21584 if $test -f config.msg; then
21585     echo "Hmm.  I also noted the following information while running:"
21586     echo " "
21587     $cat config.msg >&4
21588     $rm -f config.msg
21589 fi
21590 $rm -f kit*isdone ark*isdone
21591 $rm -rf UU
21592
21593 : End of Configure
21594