This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove leaks associated with version object change #23190
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Fri Jul 16 12:49:13 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_strtod=''
716 d_strtol=''
717 d_strtold=''
718 d_strtoll=''
719 d_strtoq=''
720 d_strtoul=''
721 d_strtoull=''
722 d_strtouq=''
723 d_strxfrm=''
724 d_symlink=''
725 d_syscall=''
726 d_syscallproto=''
727 d_sysconf=''
728 d_system=''
729 d_tcgetpgrp=''
730 d_tcsetpgrp=''
731 d_telldirproto=''
732 d_time=''
733 timetype=''
734 clocktype=''
735 d_times=''
736 d_tmpnam_r=''
737 tmpnam_r_proto=''
738 d_truncate=''
739 d_ttyname_r=''
740 ttyname_r_proto=''
741 d_tzname=''
742 d_u32align=''
743 d_ualarm=''
744 d_umask=''
745 d_semctl_semid_ds=''
746 d_semctl_semun=''
747 d_union_semun=''
748 d_unordered=''
749 d_usleep=''
750 d_usleepproto=''
751 d_ustat=''
752 d_vfork=''
753 usevfork=''
754 d_voidsig=''
755 signal_t=''
756 d_volatile=''
757 d_charvspr=''
758 d_vprintf=''
759 d_wait4=''
760 d_waitpid=''
761 d_wcstombs=''
762 d_wctomb=''
763 d_writev=''
764 dlext=''
765 cccdlflags=''
766 ccdlflags=''
767 dlsrc=''
768 ld=''
769 lddlflags=''
770 usedl=''
771 doublesize=''
772 ebcdic=''
773 fflushNULL=''
774 fflushall=''
775 fpossize=''
776 fpostype=''
777 gccansipedantic=''
778 gccosandvers=''
779 gccversion=''
780 gidformat=''
781 gidsign=''
782 gidsize=''
783 gidtype=''
784 groupstype=''
785 h_fcntl=''
786 h_sysfile=''
787 html1dir=''
788 html1direxp=''
789 installhtml1dir=''
790 html3dir=''
791 html3direxp=''
792 installhtml3dir=''
793 i_arpainet=''
794 i_crypt=''
795 db_hashtype=''
796 db_prefixtype=''
797 db_version_major=''
798 db_version_minor=''
799 db_version_patch=''
800 i_db=''
801 i_dbm=''
802 i_rpcsvcdbm=''
803 d_dirnamlen=''
804 direntrytype=''
805 i_dirent=''
806 i_dld=''
807 i_dlfcn=''
808 i_fcntl=''
809 i_float=''
810 i_fp=''
811 i_fp_class=''
812 i_gdbm=''
813 d_grpasswd=''
814 i_grp=''
815 i_ieeefp=''
816 i_inttypes=''
817 i_langinfo=''
818 i_libutil=''
819 i_limits=''
820 i_locale=''
821 i_machcthr=''
822 i_malloc=''
823 i_math=''
824 i_memory=''
825 i_mntent=''
826 i_ndbm=''
827 i_netdb=''
828 i_neterrno=''
829 i_netinettcp=''
830 i_niin=''
831 i_sysin=''
832 i_poll=''
833 i_prot=''
834 i_pthread=''
835 d_pwage=''
836 d_pwchange=''
837 d_pwclass=''
838 d_pwcomment=''
839 d_pwexpire=''
840 d_pwgecos=''
841 d_pwpasswd=''
842 d_pwquota=''
843 i_pwd=''
844 i_sfio=''
845 i_shadow=''
846 i_socks=''
847 i_stddef=''
848 i_stdlib=''
849 i_string=''
850 strings=''
851 i_sunmath=''
852 i_sysaccess=''
853 i_sysdir=''
854 i_sysfile=''
855 d_voidtty=''
856 i_bsdioctl=''
857 i_sysfilio=''
858 i_sysioctl=''
859 i_syssockio=''
860 i_syslog=''
861 i_sysmman=''
862 i_sysmode=''
863 i_sysmount=''
864 i_sysndir=''
865 i_sysparam=''
866 i_sysresrc=''
867 i_syssecrt=''
868 i_sysselct=''
869 i_sysstat=''
870 i_sysstatfs=''
871 i_sysstatvfs=''
872 i_systimes=''
873 i_systypes=''
874 i_sysuio=''
875 i_sysun=''
876 i_sysutsname=''
877 i_sysvfs=''
878 i_syswait=''
879 i_sgtty=''
880 i_termio=''
881 i_termios=''
882 d_tm_tm_gmtoff=''
883 d_tm_tm_zone=''
884 i_systime=''
885 i_systimek=''
886 i_time=''
887 timeincl=''
888 i_unistd=''
889 i_ustat=''
890 i_utime=''
891 i_values=''
892 i_stdarg=''
893 i_varargs=''
894 i_varhdr=''
895 i_vfork=''
896 inc_version_list=''
897 inc_version_list_init=''
898 installprefix=''
899 installprefixexp=''
900 installstyle=''
901 installusrbinperl=''
902 intsize=''
903 longsize=''
904 shortsize=''
905 issymlink=''
906 libc=''
907 ldlibpthname=''
908 libperl=''
909 shrpenv=''
910 useshrplib=''
911 glibpth=''
912 libpth=''
913 loclibpth=''
914 plibpth=''
915 xlibpth=''
916 ignore_versioned_solibs=''
917 libs=''
918 libsdirs=''
919 libsfiles=''
920 libsfound=''
921 libspath=''
922 lns=''
923 d_PRIEUldbl=''
924 d_PRIFUldbl=''
925 d_PRIGUldbl=''
926 d_PRIeldbl=''
927 d_PRIfldbl=''
928 d_PRIgldbl=''
929 d_SCNfldbl=''
930 sPRIEUldbl=''
931 sPRIFUldbl=''
932 sPRIGUldbl=''
933 sPRIeldbl=''
934 sPRIfldbl=''
935 sPRIgldbl=''
936 sSCNfldbl=''
937 lseeksize=''
938 lseektype=''
939 make_set_make=''
940 d_mymalloc=''
941 freetype=''
942 mallocobj=''
943 mallocsrc=''
944 malloctype=''
945 usemallocwrap=''
946 usemymalloc=''
947 installman1dir=''
948 man1dir=''
949 man1direxp=''
950 man1ext=''
951 installman3dir=''
952 man3dir=''
953 man3direxp=''
954 man3ext=''
955 modetype=''
956 multiarch=''
957 mydomain=''
958 myhostname=''
959 phostname=''
960 c=''
961 n=''
962 d_eofnblk=''
963 eagain=''
964 o_nonblock=''
965 rd_nodata=''
966 need_va_copy=''
967 netdb_hlen_type=''
968 netdb_host_type=''
969 netdb_name_type=''
970 netdb_net_type=''
971 groupcat=''
972 hostcat=''
973 passcat=''
974 orderlib=''
975 ranlib=''
976 d_perl_otherlibdirs=''
977 otherlibdirs=''
978 package=''
979 spackage=''
980 pager=''
981 api_revision=''
982 api_subversion=''
983 api_version=''
984 api_versionstring=''
985 patchlevel=''
986 perl_patchlevel=''
987 revision=''
988 subversion=''
989 version=''
990 version_patchlevel_string=''
991 perl5=''
992 perladmin=''
993 perlpath=''
994 d_nv_preserves_uv=''
995 i16size=''
996 i16type=''
997 i32size=''
998 i32type=''
999 i64size=''
1000 i64type=''
1001 i8size=''
1002 i8type=''
1003 ivsize=''
1004 ivtype=''
1005 nv_preserves_uv_bits=''
1006 nvsize=''
1007 nvtype=''
1008 u16size=''
1009 u16type=''
1010 u32size=''
1011 u32type=''
1012 u64size=''
1013 u64type=''
1014 u8size=''
1015 u8type=''
1016 uvsize=''
1017 uvtype=''
1018 ivdformat=''
1019 nvEUformat=''
1020 nvFUformat=''
1021 nvGUformat=''
1022 nveformat=''
1023 nvfformat=''
1024 nvgformat=''
1025 uvXUformat=''
1026 uvoformat=''
1027 uvuformat=''
1028 uvxformat=''
1029 pidtype=''
1030 prefix=''
1031 prefixexp=''
1032 installprivlib=''
1033 privlib=''
1034 privlibexp=''
1035 prototype=''
1036 ptrsize=''
1037 d_PRIXU64=''
1038 d_PRId64=''
1039 d_PRIi64=''
1040 d_PRIo64=''
1041 d_PRIu64=''
1042 d_PRIx64=''
1043 sPRIXU64=''
1044 sPRId64=''
1045 sPRIi64=''
1046 sPRIo64=''
1047 sPRIu64=''
1048 sPRIx64=''
1049 d_quad=''
1050 quadkind=''
1051 quadtype=''
1052 uquadtype=''
1053 drand01=''
1054 randbits=''
1055 randfunc=''
1056 randseedtype=''
1057 seedfunc=''
1058 installscript=''
1059 scriptdir=''
1060 scriptdirexp=''
1061 selectminbits=''
1062 selecttype=''
1063 sh=''
1064 sig_count=''
1065 sig_name=''
1066 sig_name_init=''
1067 sig_num=''
1068 sig_num_init=''
1069 sig_size=''
1070 installsitearch=''
1071 sitearch=''
1072 sitearchexp=''
1073 installsitebin=''
1074 sitebin=''
1075 sitebinexp=''
1076 installsitehtml1dir=''
1077 sitehtml1dir=''
1078 sitehtml1direxp=''
1079 installsitehtml3dir=''
1080 sitehtml3dir=''
1081 sitehtml3direxp=''
1082 installsitelib=''
1083 sitelib=''
1084 sitelib_stem=''
1085 sitelibexp=''
1086 installsiteman1dir=''
1087 siteman1dir=''
1088 siteman1direxp=''
1089 installsiteman3dir=''
1090 siteman3dir=''
1091 siteman3direxp=''
1092 siteprefix=''
1093 siteprefixexp=''
1094 installsitescript=''
1095 sitescript=''
1096 sitescriptexp=''
1097 sizesize=''
1098 sizetype=''
1099 so=''
1100 socksizetype=''
1101 sharpbang=''
1102 shsharp=''
1103 spitshell=''
1104 src=''
1105 ssizetype=''
1106 startperl=''
1107 startsh=''
1108 stdchar=''
1109 d_stdio_stream_array=''
1110 stdio_stream_array=''
1111 sysman=''
1112 trnl=''
1113 uidformat=''
1114 uidsign=''
1115 uidsize=''
1116 uidtype=''
1117 archname64=''
1118 use64bitall=''
1119 use64bitint=''
1120 usefaststdio=''
1121 ccflags_uselargefiles=''
1122 ldflags_uselargefiles=''
1123 libswanted_uselargefiles=''
1124 uselargefiles=''
1125 uselongdouble=''
1126 usemorebits=''
1127 usemultiplicity=''
1128 nm_opt=''
1129 nm_so_opt=''
1130 runnm=''
1131 usenm=''
1132 useperlio=''
1133 usesocks=''
1134 d_oldpthreads=''
1135 use5005threads=''
1136 useithreads=''
1137 usereentrant=''
1138 usethreads=''
1139 incpath=''
1140 mips_type=''
1141 usrinc=''
1142 d_vendorarch=''
1143 installvendorarch=''
1144 vendorarch=''
1145 vendorarchexp=''
1146 d_vendorbin=''
1147 installvendorbin=''
1148 vendorbin=''
1149 vendorbinexp=''
1150 installvendorhtml1dir=''
1151 vendorhtml1dir=''
1152 vendorhtml1direxp=''
1153 installvendorhtml3dir=''
1154 vendorhtml3dir=''
1155 vendorhtml3direxp=''
1156 d_vendorlib=''
1157 installvendorlib=''
1158 vendorlib=''
1159 vendorlib_stem=''
1160 vendorlibexp=''
1161 installvendorman1dir=''
1162 vendorman1dir=''
1163 vendorman1direxp=''
1164 installvendorman3dir=''
1165 vendorman3dir=''
1166 vendorman3direxp=''
1167 usevendorprefix=''
1168 vendorprefix=''
1169 vendorprefixexp=''
1170 d_vendorscript=''
1171 installvendorscript=''
1172 vendorscript=''
1173 vendorscriptexp=''
1174 versiononly=''
1175 defvoidused=''
1176 voidflags=''
1177 yacc=''
1178 yaccflags=''
1179 CONFIG=''
1180
1181 define='define'
1182 undef='undef'
1183 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1184 rmlist=''
1185
1186 : We must find out about Eunice early
1187 eunicefix=':'
1188 if test -f /etc/unixtovms; then
1189         eunicefix=/etc/unixtovms
1190 fi
1191 if test -f /etc/unixtovms.exe; then
1192         eunicefix=/etc/unixtovms.exe
1193 fi
1194
1195 : Set executable suffix now -- needed before hints available
1196 if test -f "/libs/version.library"; then
1197 : Amiga OS
1198     _exe=""
1199 elif test -f "/system/gnu_library/bin/ar.pm"; then
1200 : Stratus VOS
1201     _exe=".pm"
1202 elif test -n "$DJGPP"; then
1203 : DOS DJGPP
1204     _exe=".exe"
1205 elif test -d c:/. -o -n "$is_os2" ; then
1206 : OS/2 or cygwin
1207     _exe=".exe"
1208 fi
1209
1210 i_whoami=''
1211 ccname=''
1212 ccversion=''
1213 perllibs=''
1214 : set useposix=false in your hint file to disable the POSIX extension.
1215 useposix=true
1216 : set useopcode=false in your hint file to disable the Opcode extension.
1217 useopcode=true
1218 : Trailing extension.  Override this in a hint file, if needed.
1219 : Extra object files, if any, needed on this platform.
1220 archobjs=''
1221 archname=''
1222 : Possible local include directories to search.
1223 : Set locincpth to "" in a hint file to defeat local include searches.
1224 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1225 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1226 :
1227 : no include file wanted by default
1228 inclwanted=''
1229
1230 groupstype=''
1231 libnames=''
1232 : change the next line if compiling for Xenix/286 on Xenix/386
1233 xlibpth='/usr/lib/386 /lib/386'
1234 : Possible local library directories to search.
1235 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1236 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1237
1238 : general looking path for locating libraries
1239 glibpth="/lib /usr/lib $xlibpth"
1240 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1241 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1242 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1243
1244 : Private path used by Configure to find libraries.  Its value
1245 : is prepended to libpth. This variable takes care of special
1246 : machines, like the mips.  Usually, it should be empty.
1247 plibpth=''
1248
1249 : default library list
1250 libswanted=''
1251 : some systems want to use only the non-versioned libso:s
1252 ignore_versioned_solibs=''
1253 siteman1dir=''
1254 siteman3dir=''
1255 sitescript=''
1256 archname64=''
1257 ccflags_uselargefiles=''
1258 ldflags_uselargefiles=''
1259 libswanted_uselargefiles=''
1260 : set usemultiplicity on the Configure command line to enable multiplicity.
1261 : set usesocks on the Configure command line to enable socks.
1262 : set usethreads on the Configure command line to enable threads.
1263 usereentrant='undef'
1264 : full support for void wanted by default
1265 defvoidused=15
1266
1267 : List of libraries we want.
1268 : If anyone needs extra -lxxx, put those in a hint file.
1269 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1270 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1271 : We probably want to search /usr/shlib before most other libraries.
1272 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1273 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1274 glibpth="/usr/shlib $glibpth"
1275 : Do not use vfork unless overridden by a hint file.
1276 usevfork=false
1277
1278 : Find the basic shell for Bourne shell scripts
1279 case "$sh" in
1280 '')
1281         case "$SYSTYPE" in
1282         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1283         *) xxx='/bin/sh';;
1284         esac
1285         if test -f "$xxx"; then
1286                 sh="$xxx"
1287         else
1288                 : Build up a list and do a single loop so we can 'break' out.
1289                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1290                 for xxx in sh bash ksh pdksh ash; do
1291                         for p in $pth; do
1292                                 try="$try ${p}/${xxx}"
1293                         done
1294                 done
1295                 for xxx in $try; do
1296                         if test -f "$xxx"; then
1297                                 sh="$xxx";
1298                                 break
1299                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1300                                 sh="$xxx";
1301                                 break
1302                         elif test -f "$xxx.exe"; then
1303                                 sh="$xxx";
1304                                 break
1305                         fi
1306                 done
1307         fi
1308         ;;
1309 esac
1310
1311 case "$sh" in
1312 '')     cat >&2 <<EOM
1313 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1314
1315 Usually it's in /bin/sh.  How did you even get this far?
1316 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1317 we'll try to straighten this all out.
1318 EOM
1319         exit 1
1320         ;;
1321 esac
1322
1323 : see if sh knows # comments
1324 if `$sh -c '#' >/dev/null 2>&1`; then
1325         shsharp=true
1326         spitshell=cat
1327         xcat=/bin/cat
1328         test -f $xcat$_exe || xcat=/usr/bin/cat
1329         if test ! -f $xcat$_exe; then
1330                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1331                         if test -f $p/cat$_exe; then
1332                                 xcat=$p/cat
1333                                 break
1334                         fi
1335                 done
1336                 if test ! -f $xcat$_exe; then
1337                         echo "Can't find cat anywhere!"
1338                         exit 1
1339                 fi
1340         fi
1341         echo "#!$xcat" >sharp
1342         $eunicefix sharp
1343         chmod +x sharp
1344         ./sharp > today
1345         if test -s today; then
1346                 sharpbang='#!'
1347         else
1348                 echo "#! $xcat" > sharp
1349                 $eunicefix sharp
1350                 chmod +x sharp
1351                 ./sharp > today
1352                 if test -s today; then
1353                         sharpbang='#! '
1354                 else
1355                         sharpbang=': use '
1356                 fi
1357         fi
1358 else
1359         echo " "
1360         echo "Your $sh doesn't grok # comments--I will strip them later on."
1361         shsharp=false
1362         cd ..
1363         echo "exec grep -v '^[  ]*#'" >spitshell
1364         chmod +x spitshell
1365         $eunicefix spitshell
1366         spitshell=`pwd`/spitshell
1367         cd UU
1368         echo "I presume that if # doesn't work, #! won't work either!"
1369         sharpbang=': use '
1370 fi
1371 rm -f sharp today
1372
1373 : figure out how to guarantee sh startup
1374 case "$startsh" in
1375 '') startsh=${sharpbang}${sh} ;;
1376 *)
1377 esac
1378 cat >sharp <<EOSS
1379 $startsh
1380 set abc
1381 test "$?abc" != 1
1382 EOSS
1383
1384 chmod +x sharp
1385 $eunicefix sharp
1386 if ./sharp; then
1387         : echo "Yup, it does."
1388 else
1389         echo "Hmm... '$startsh' does not guarantee sh startup..."
1390         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1391 fi
1392 rm -f sharp
1393
1394
1395 : Save command line options in file UU/cmdline.opt for later use in
1396 : generating config.sh.
1397 cat > cmdline.opt <<EOSH
1398 # Configure command line arguments.
1399 config_arg0='$0'
1400 config_args='$*'
1401 config_argc=$#
1402 EOSH
1403 argn=1
1404 args_exp=''
1405 args_sep=''
1406 for arg in "$@"; do
1407         cat >>cmdline.opt <<EOSH
1408 config_arg$argn='$arg'
1409 EOSH
1410         # Extreme backslashitis: replace each ' by '"'"'
1411         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1412 $arg
1413 EOC
1414         arg_exp=`cat cmdl.opt`
1415         args_exp="$args_exp$args_sep'$arg_exp'"
1416         argn=`expr $argn + 1`
1417         args_sep=' '
1418 done
1419 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1420 # used by ./hints/os2.sh
1421 rm -f cmdl.opt
1422
1423 : produce awk script to parse command line options
1424 cat >options.awk <<'EOF'
1425 BEGIN {
1426         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1427
1428         len = length(optstr);
1429         for (i = 1; i <= len; i++) {
1430                 c = substr(optstr, i, 1);
1431                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1432                 if (a == ":") {
1433                         arg[c] = 1;
1434                         i++;
1435                 }
1436                 opt[c] = 1;
1437         }
1438 }
1439 {
1440         expect = 0;
1441         str = $0;
1442         if (substr(str, 1, 1) != "-") {
1443                 printf("'%s'\n", str);
1444                 next;
1445         }
1446         len = length($0);
1447         for (i = 2; i <= len; i++) {
1448                 c = substr(str, i, 1);
1449                 if (!opt[c]) {
1450                         printf("-%s\n", substr(str, i));
1451                         next;
1452                 }
1453                 printf("-%s\n", c);
1454                 if (arg[c]) {
1455                         if (i < len)
1456                                 printf("'%s'\n", substr(str, i + 1));
1457                         else
1458                                 expect = 1;
1459                         next;
1460                 }
1461         }
1462 }
1463 END {
1464         if (expect)
1465                 print "?";
1466 }
1467 EOF
1468
1469 : process the command line options
1470 set X `for arg in "$@"; do echo "X$arg"; done |
1471         sed -e s/X// | awk -f options.awk`
1472 eval "set $*"
1473 shift
1474 rm -f options.awk
1475
1476 : set up default values
1477 fastread=''
1478 reuseval=false
1479 config_sh=''
1480 alldone=''
1481 error=''
1482 silent=''
1483 extractsh=''
1484 override=''
1485 knowitall=''
1486 rm -f optdef.sh posthint.sh
1487 cat >optdef.sh <<EOS
1488 $startsh
1489 EOS
1490
1491
1492 : option parsing
1493 while test $# -gt 0; do
1494         case "$1" in
1495         -d) shift; fastread=yes;;
1496         -e) shift; alldone=cont;;
1497         -f)
1498                 shift
1499                 cd ..
1500                 if test -r "$1"; then
1501                         config_sh="$1"
1502                 else
1503                         echo "$me: cannot read config file $1." >&2
1504                         error=true
1505                 fi
1506                 cd UU
1507                 shift;;
1508         -h) shift; error=true;;
1509         -r) shift; reuseval=true;;
1510         -s) shift; silent=true; realsilent=true;;
1511         -E) shift; alldone=exit;;
1512         -K) shift; knowitall=true;;
1513         -O) shift; override=true;;
1514         -S) shift; silent=true; extractsh=true;;
1515         -D)
1516                 shift
1517                 case "$1" in
1518                 *=)
1519                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1520                         echo "$me: ignoring -D $1" >&2
1521                         ;;
1522                 *=*) echo "$1" | \
1523                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1524                 *) echo "$1='define'" >> optdef.sh;;
1525                 esac
1526                 shift
1527                 ;;
1528         -U)
1529                 shift
1530                 case "$1" in
1531                 *=) echo "$1" >> optdef.sh;;
1532                 *=*)
1533                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1534                         echo "$me: ignoring -U $1" >&2
1535                         ;;
1536                 *) echo "$1='undef'" >> optdef.sh;;
1537                 esac
1538                 shift
1539                 ;;
1540         -A)
1541             shift
1542             xxx=''
1543             yyy="$1"
1544             zzz=''
1545             uuu=undef
1546             case "$yyy" in
1547             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1548                  case "$zzz" in
1549                  *:*) zzz='' ;;
1550                  *)   xxx=append
1551                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1552                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1553                  esac
1554                  ;;
1555             esac
1556             case "$xxx" in
1557             '')  case "$yyy" in
1558                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1559                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1560                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1561                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1562                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1563                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1564                  esac
1565                  ;;       
1566             esac
1567             case "$xxx" in
1568             append)
1569                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1570             clear)
1571                 echo "$yyy=''"                  >> posthint.sh ;;
1572             define)
1573                 case "$zzz" in
1574                 '') zzz=define ;;
1575                 esac
1576                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1577             eval)
1578                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1579             prepend)
1580                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1581             undef)
1582                 case "$zzz" in
1583                 '') zzz="$uuu" ;;
1584                 esac
1585                 echo "$yyy=$zzz"                >> posthint.sh ;;
1586             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1587             esac
1588             shift
1589             ;;
1590         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1591             exit 0;;
1592         --) break;;
1593         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1594         *) break;;
1595         esac
1596 done
1597
1598 case "$error" in
1599 true)
1600         cat >&2 <<EOM
1601 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1602                  [-U symbol] [-U symbol=] [-A command:symbol...]
1603   -d : use defaults for all answers.
1604   -e : go on without questioning past the production of config.sh.
1605   -f : specify an alternate default configuration file.
1606   -h : print this help message and exit (with an error status).
1607   -r : reuse C symbols value if possible (skips costly nm extraction).
1608   -s : silent mode, only echoes questions and essential information.
1609   -D : define symbol to have some value:
1610          -D symbol         symbol gets the value 'define'
1611          -D symbol=value   symbol gets the value 'value'
1612   -E : stop at the end of questions, after having produced config.sh.
1613   -K : do not use unless you know what you are doing.
1614   -O : let -D and -U override definitions from loaded configuration file.
1615   -S : perform variable substitutions on all .SH files (can mix with -f)
1616   -U : undefine symbol:
1617          -U symbol    symbol gets the value 'undef'
1618          -U symbol=   symbol gets completely empty
1619   -A : manipulate symbol after the platform specific hints have been applied:
1620          -A symbol=value                append " "value to symbol
1621          -A append:symbol=value         append value to symbol
1622          -A define:symbol=value         define symbol to have value
1623          -A clear:symbol                define symbol to be ''
1624          -A define:symbol               define symbol to be 'define'
1625          -A eval:symbol=value           define symbol to be eval of value
1626          -A prepend:symbol=value        prepend value to symbol
1627          -A undef:symbol                define symbol to be 'undef'
1628          -A undef:symbol=               define symbol to be ''
1629   -V : print version number and exit (with a zero status).
1630 EOM
1631         exit 1
1632         ;;
1633 esac
1634
1635 : Sanity checks
1636 case "$fastread$alldone" in
1637 yescont|yesexit) ;;
1638 *)
1639         case "$extractsh" in
1640         true) ;;
1641         *)
1642                 if test ! -t 0; then
1643                         echo "Say 'sh Configure', not 'sh <Configure'"
1644                         exit 1
1645                 fi
1646                 ;;
1647         esac
1648         ;;
1649 esac
1650
1651 exec 4>&1
1652 case "$silent" in
1653 true) exec 1>/dev/null;;
1654 esac
1655
1656 : run the defines and the undefines, if any, but leave the file out there...
1657 touch optdef.sh
1658 . ./optdef.sh
1659 : create the posthint manipulation script and leave the file out there...
1660 touch posthint.sh
1661
1662 : set package name
1663 package=perl5
1664 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1665 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1666 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1667 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1668 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1669 esac
1670
1671 : Some greps do not return status, grrr.
1672 echo "grimblepritz" >grimble
1673 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1674         contains=contains
1675 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1676         contains=grep
1677 else
1678         contains=contains
1679 fi
1680 rm -f grimble
1681 : the following should work in any shell
1682 case "$contains" in
1683 contains*)
1684         echo " "
1685         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1686         cat >contains <<'EOSS'
1687 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1688 EOSS
1689 chmod +x contains
1690 esac
1691
1692 : Find the path to the source tree
1693 case "$src" in
1694 '') case "$0" in
1695     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1696          case "$src" in
1697          /*)    ;;
1698          .)     ;;
1699          *)     src=`cd ../$src && pwd` ;;
1700          esac
1701          ;;
1702     *)   src='.';;
1703     esac;;
1704 esac
1705 case "$src" in
1706 '')     src=/
1707         rsrc=/
1708         ;;
1709 /*) rsrc="$src";;
1710 *) rsrc="../$src";;
1711 esac
1712 if test -f $rsrc/Configure && \
1713         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1714 then
1715    : found it, so we are ok.
1716 else
1717         rsrc=''
1718         for src in . .. ../.. ../../.. ../../../..; do
1719                 if test -f ../$src/Configure && \
1720                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1721                 then
1722                         rsrc=../$src
1723                         break
1724                 fi
1725         done
1726 fi
1727 case "$rsrc" in
1728 '')
1729         cat <<EOM >&4
1730
1731 Sorry, I can't seem to locate the source dir for $package.  Please start
1732 Configure with an explicit path -- i.e. /some/path/Configure.
1733
1734 EOM
1735         exit 1
1736         ;;
1737 ../.)   rsrc='..';;
1738 *)
1739         echo " "
1740         echo "Sources for $package found in \"$src\"." >&4
1741         ;;
1742 esac
1743
1744 : script used to extract .SH files with variable substitutions
1745 cat >extract <<'EOS'
1746 PERL_CONFIG_SH=true
1747 echo "Doing variable substitutions on .SH files..."
1748 if test -f MANIFEST; then
1749         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1750 else
1751         echo "(Looking for .SH files under the source directory.)"
1752         set x `(cd "$src"; find . -name "*.SH" -print)`
1753 fi
1754 shift
1755 case $# in
1756 0) set x `(cd "$src"; echo *.SH)`; shift;;
1757 esac
1758 if test ! -f "$src/$1"; then
1759         shift
1760 fi
1761 mkdir_p='
1762 name=$1;
1763 create="";
1764 while test $name; do
1765         if test ! -d "$name"; then
1766                 create="$name $create";
1767                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1768                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1769         else
1770                 name="";
1771         fi;
1772 done;
1773 for file in $create; do
1774         mkdir $file;
1775 done
1776 '
1777 for file in $*; do
1778         case "$src" in
1779         ".")
1780                 case "$file" in
1781                 */*)
1782                         dir=`expr X$file : 'X\(.*\)/'`
1783                         file=`expr X$file : 'X.*/\(.*\)'`
1784                         (cd "$dir" && . ./$file)
1785                         ;;
1786                 *)
1787                         . ./$file
1788                         ;;
1789                 esac
1790                 ;;
1791         *)
1792                 case "$file" in
1793                 */*)
1794                         dir=`expr X$file : 'X\(.*\)/'`
1795                         file=`expr X$file : 'X.*/\(.*\)'`
1796                         (set x $dir; shift; eval $mkdir_p)
1797                         sh <"$src/$dir/$file"
1798                         ;;
1799                 *)
1800                         sh <"$src/$file"
1801                         ;;
1802                 esac
1803                 ;;
1804         esac
1805 done
1806 if test -f "$src/config_h.SH"; then
1807         if test ! -f config.h; then
1808         : oops, they left it out of MANIFEST, probably, so do it anyway.
1809         . "$src/config_h.SH"
1810         fi
1811 fi
1812 EOS
1813
1814 : extract files and exit if asked to do so
1815 case "$extractsh" in
1816 true)
1817         case "$realsilent" in
1818         true) ;;
1819         *) exec 1>&4;;
1820         esac
1821         case "$config_sh" in
1822         '') config_sh='config.sh';;
1823         esac
1824         echo " "
1825         echo "Fetching answers from $config_sh..."
1826         cd ..
1827         . $config_sh
1828         test "$override" && . ./optdef.sh
1829         echo " "
1830         . UU/extract
1831         rm -rf UU
1832         echo "Extraction done."
1833         exit 0
1834         ;;
1835 esac
1836
1837 : Eunice requires " " instead of "", can you believe it
1838 echo " "
1839 : Here we go...
1840 echo "Beginning of configuration questions for $package."
1841
1842 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1843
1844 : first determine how to suppress newline on echo command
1845 echo " "
1846 echo "Checking echo to see how to suppress newlines..."
1847 (echo "hi there\c" ; echo " ") >.echotmp
1848 if $contains c .echotmp >/dev/null 2>&1 ; then
1849         echo "...using -n."
1850         n='-n'
1851         c=''
1852 else
1853         cat <<'EOM'
1854 ...using \c
1855 EOM
1856         n=''
1857         c='\c'
1858 fi
1859 echo $n "The star should be here-->$c"
1860 echo '*'
1861 rm -f .echotmp
1862
1863 : Now test for existence of everything in MANIFEST
1864 echo " "
1865 if test -f "$rsrc/MANIFEST"; then
1866         echo "First let's make sure your kit is complete.  Checking..." >&4
1867         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1868         rm -f missing
1869         tmppwd=`pwd`
1870         for filelist in x??; do
1871                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1872         done
1873         if test -s missing; then
1874                 cat missing >&4
1875                 cat >&4 <<'EOM'
1876
1877 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1878
1879 You have the option of continuing the configuration process, despite the
1880 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1881 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1882 and contact the author (perlbug@perl.org).
1883
1884 EOM
1885                 echo $n "Continue? [n] $c" >&4
1886                 read ans
1887                 case "$ans" in
1888                 y*)
1889                         echo "Continuing..." >&4
1890                         rm -f missing
1891                         ;;
1892                 *)
1893                         echo "ABORTING..." >&4
1894                         kill $$
1895                         ;;
1896                 esac
1897         else
1898                 echo "Looks good..."
1899         fi
1900 else
1901         echo "There is no MANIFEST file.  I hope your kit is complete !"
1902 fi
1903 rm -f missing x??
1904
1905 echo " "
1906 : Find the appropriate value for a newline for tr
1907 if test -n "$DJGPP"; then
1908        trnl='\012'
1909 fi
1910 if test X"$trnl" = X; then
1911         case "`echo foo|tr '\n' x 2>/dev/null`" in
1912         foox) trnl='\n' ;;
1913         esac
1914 fi
1915 if test X"$trnl" = X; then
1916         case "`echo foo|tr '\012' x 2>/dev/null`" in
1917         foox) trnl='\012' ;;
1918         esac
1919 fi
1920 if test X"$trnl" = X; then
1921        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1922        fooxy) trnl='\n\r' ;;
1923        esac
1924 fi
1925 if test X"$trnl" = X; then
1926         cat <<EOM >&2
1927
1928 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1929
1930 EOM
1931         exit 1
1932 fi
1933
1934 : compute the number of columns on the terminal for proper question formatting
1935 case "$COLUMNS" in
1936 '') COLUMNS='80';;
1937 esac
1938
1939 : set up the echo used in my read
1940 myecho="case \"\$xxxm\" in
1941 '') echo $n \"\$rp $c\" >&4;;
1942 *) case \"\$rp\" in
1943         '') echo $n \"[\$xxxm] $c\";;
1944         *)
1945                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1946                         echo \"\$rp\" >&4
1947                         echo $n \"[\$xxxm] $c\" >&4
1948                 else
1949                         echo $n \"\$rp [\$xxxm] $c\" >&4
1950                 fi
1951                 ;;
1952         esac;;
1953 esac"
1954
1955 : now set up to do reads with possible shell escape and default assignment
1956 cat <<EOSC >myread
1957 $startsh
1958 xxxm=\$dflt
1959 $myecho
1960 ans='!'
1961 case "\$fastread" in
1962 yes) case "\$dflt" in
1963         '') ;;
1964         *) ans='';
1965                 case "\$silent-\$rp" in
1966                 true-) ;;
1967                 *) echo " " >&4;;
1968                 esac;;
1969         esac;;
1970 *) case "\$silent" in
1971         true) case "\$rp" in
1972                 '') ans='';;
1973                 esac;;
1974         esac;;
1975 esac
1976 while expr "X\$ans" : "X!" >/dev/null; do
1977         read answ
1978         set x \$xxxm
1979         shift
1980         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1981         case  "\$answ" in
1982         "!")
1983                 sh 1>&4
1984                 echo " "
1985                 $myecho
1986                 ;;
1987         !*)
1988                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1989                 shift
1990                 sh 1>&4 -c "\$*"
1991                 echo " "
1992                 $myecho
1993                 ;;
1994         "\$ans")
1995                 case "\$ans" in
1996                 \\&*)
1997                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1998                         shift
1999                         case "\$1" in
2000                         -d)
2001                                 fastread=yes
2002                                 echo "(OK, I'll run with -d after this question.)" >&4
2003                                 ;;
2004                         -*)
2005                                 echo "*** Sorry, \$1 not supported yet." >&4
2006                                 ;;
2007                         esac
2008                         $myecho
2009                         ans=!
2010                         ;;
2011                 esac;;
2012         *)
2013                 case "\$aok" in
2014                 y)
2015                         echo "*** Substitution done -- please confirm."
2016                         xxxm="\$ans"
2017                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2018                         xxxm="\$ans"
2019                         ans=!
2020                         ;;
2021                 *)
2022                         echo "*** Error -- try again."
2023                         ans=!
2024                         ;;
2025                 esac
2026                 $myecho
2027                 ;;
2028         esac
2029         case "\$ans\$xxxm\$nostick" in
2030         '')
2031                 ans=!
2032                 $myecho
2033                 ;;
2034         esac
2035 done
2036 case "\$ans" in
2037 '') ans="\$xxxm";;
2038 esac
2039 EOSC
2040
2041 : create .config dir to save info across Configure sessions
2042 test -d ../.config || mkdir ../.config
2043 cat >../.config/README <<EOF
2044 This directory created by Configure to save information that should
2045 persist across sessions for $package.
2046
2047 You may safely delete it if you wish.
2048 EOF
2049
2050 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2051 case "$usedevel" in
2052 $define|true|[yY]*) ;;
2053 *) case "$xversion" in
2054    *[13579])
2055         cat >&4 <<EOH
2056 *** WHOA THERE!!! ***
2057
2058     This is an UNSTABLE DEVELOPMENT release.
2059     The version of this $package distribution is $xversion, that is, odd,
2060     (as opposed to even) and that signifies a development release.
2061     If you want a maintenance release, you want an even-numbered version.
2062
2063     Do ***NOT*** install this into production use.
2064     Data corruption and crashes are possible.
2065
2066     It is most seriously suggested that you do not continue any further
2067     unless you want to help in developing and debugging Perl.
2068
2069     If you *still* want to build perl, you can answer 'y' now,
2070     or pass -Dusedevel to Configure.
2071
2072 EOH
2073         rp='Do you really want to continue?'
2074         dflt='n'
2075         . ./myread
2076         case "$ans" in
2077         [yY]) echo >&4 "Okay, continuing."
2078               usedevel="$define" ;;
2079         *) echo >&4 "Okay, bye."
2080            exit 1
2081            ;;
2082         esac
2083         ;;
2084     esac
2085     ;;
2086 esac
2087 case "$usedevel" in
2088 $define|true|[yY]*)
2089         case "$versiononly" in
2090         '') versiononly="$define" ;;
2091         esac
2092         case "$installusrbinperl" in
2093         '') installusrbinperl="$undef" ;;
2094         esac
2095         ;;
2096 esac
2097
2098 : general instructions
2099 needman=true
2100 firsttime=true
2101 user=`(logname) 2>/dev/null`
2102 case "$user" in
2103 '') user=`whoami 2>&1`;;
2104 esac
2105 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2106         firsttime=false
2107         echo " "
2108         rp='Would you like to see the instructions?'
2109         dflt=n
2110         . ./myread
2111         case "$ans" in
2112         [yY]*) ;;
2113         *) needman=false;;
2114         esac
2115 fi
2116 if $needman; then
2117         cat <<EOH
2118
2119 This installation shell script will examine your system and ask you questions
2120 to determine how the perl5 package should be installed. If you get
2121 stuck on a question, you may use a ! shell escape to start a subshell or
2122 execute a command.  Many of the questions will have default answers in square
2123 brackets; typing carriage return will give you the default.
2124
2125 On some of the questions which ask for file or directory names you are allowed
2126 to use the ~name construct to specify the login directory belonging to "name",
2127 even if you don't have a shell which knows about that.  Questions where this is
2128 allowed will be marked "(~name ok)".
2129
2130 EOH
2131         rp=''
2132         dflt='Type carriage return to continue'
2133         . ./myread
2134         cat <<'EOH'
2135
2136 The prompter used in this script allows you to use shell variables and
2137 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2138 in the default answer, as if the default line was a set of arguments given to a
2139 script shell.  This means you may also use $* to repeat the whole default line,
2140 so you do not have to re-type everything to add something to the default.
2141
2142 Everytime there is a substitution, you will have to confirm.  If there is an
2143 error (e.g. an unmatched backtick), the default answer will remain unchanged
2144 and you will be prompted again.
2145
2146 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2147 the questions and use the computed defaults (or the previous answers if there
2148 was already a config.sh file). Type 'Configure -h' for a list of options.
2149 You may also start interactively and then answer '& -d' at any prompt to turn
2150 on the non-interactive behaviour for the remainder of the execution.
2151
2152 EOH
2153         . ./myread
2154         cat <<EOH
2155
2156 Much effort has been expended to ensure that this shell script will run on any
2157 Unix system.  If despite that it blows up on yours, your best bet is to edit
2158 Configure and run it again.  If you can't run Configure for some reason,
2159 you'll have to generate a config.sh file by hand.  Whatever problems you
2160 have, let me (perlbug@perl.org) know how I blew it.
2161
2162 This installation script affects things in two ways:
2163
2164 1) it may do direct variable substitutions on some of the files included
2165    in this kit.
2166 2) it builds a config.h file for inclusion in C programs.  You may edit
2167    any of these files as the need arises after running this script.
2168
2169 If you make a mistake on a question, there is no easy way to back up to it
2170 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2171 files.  Configure will offer to let you do this before it runs the SH files.
2172
2173 EOH
2174         dflt='Type carriage return to continue'
2175         . ./myread
2176         case "$firsttime" in
2177         true) echo $user >>../.config/instruct;;
2178         esac
2179 fi
2180
2181 : find out where common programs are
2182 echo " "
2183 echo "Locating common programs..." >&4
2184 cat <<EOSC >loc
2185 $startsh
2186 case \$# in
2187 0) exit 1;;
2188 esac
2189 thing=\$1
2190 shift
2191 dflt=\$1
2192 shift
2193 for dir in \$*; do
2194         case "\$thing" in
2195         .)
2196         if test -d \$dir/\$thing; then
2197                 echo \$dir
2198                 exit 0
2199         fi
2200         ;;
2201         *)
2202         for thisthing in \$dir/\$thing; do
2203                 : just loop through to pick last item
2204         done
2205         if test -f \$thisthing; then
2206                 echo \$thisthing
2207                 exit 0
2208         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2209                 echo \$thisthing
2210                 exit 0
2211         elif test -f \$dir/\$thing.exe; then
2212                 if test -n "$DJGPP"; then
2213                         echo \$dir/\$thing.exe
2214                 elif test "$eunicefix" != ":"; then
2215                         : on Eunice apparently
2216                         echo \$dir/\$thing
2217                         exit 0
2218                 fi
2219                 exit 0
2220         fi
2221         ;;
2222         esac
2223 done
2224 echo \$dflt
2225 exit 1
2226 EOSC
2227 chmod +x loc
2228 $eunicefix loc
2229 loclist="
2230 awk
2231 cat
2232 chmod
2233 comm
2234 cp
2235 echo
2236 expr
2237 grep
2238 ls
2239 mkdir
2240 rm
2241 sed
2242 sort
2243 touch
2244 tr
2245 uniq
2246 "
2247 trylist="
2248 Mcc
2249 ar
2250 bison
2251 byacc
2252 cpp
2253 csh
2254 date
2255 egrep
2256 gmake
2257 gzip
2258 less
2259 ln
2260 make
2261 more
2262 nm
2263 nroff
2264 pg
2265 test
2266 uname
2267 zip
2268 "
2269 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2270 pth="$pth /lib /usr/lib"
2271 for file in $loclist; do
2272         eval xxx=\$$file
2273         case "$xxx" in
2274         /*|?:[\\/]*)
2275                 if test -f "$xxx"; then
2276                         : ok
2277                 else
2278                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2279                         xxx=`./loc $file $file $pth`
2280                 fi
2281                 ;;
2282         '') xxx=`./loc $file $file $pth`;;
2283         *) xxx=`./loc $xxx $xxx $pth`;;
2284         esac
2285         eval $file=$xxx$_exe
2286         eval _$file=$xxx
2287         case "$xxx" in
2288         /*)
2289                 echo $file is in $xxx.
2290                 ;;
2291         ?:[\\/]*)
2292                 echo $file is in $xxx.
2293                 ;;
2294         *)
2295                 echo "I don't know where '$file' is, and my life depends on it." >&4
2296                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2297                 exit 1
2298                 ;;
2299         esac
2300 done
2301 echo " "
2302 echo "Don't worry if any of the following aren't found..."
2303 say=offhand
2304 for file in $trylist; do
2305         eval xxx=\$$file
2306         case "$xxx" in
2307         /*|?:[\\/]*)
2308                 if test -f "$xxx"; then
2309                         : ok
2310                 else
2311                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2312                         xxx=`./loc $file $file $pth`
2313                 fi
2314                 ;;
2315         '') xxx=`./loc $file $file $pth`;;
2316         *) xxx=`./loc $xxx $xxx $pth`;;
2317         esac
2318         eval $file=$xxx$_exe
2319         eval _$file=$xxx
2320         case "$xxx" in
2321         /*)
2322                 echo $file is in $xxx.
2323                 ;;
2324         ?:[\\/]*)
2325                 echo $file is in $xxx.
2326                 ;;
2327         *)
2328                 echo "I don't see $file out there, $say."
2329                 say=either
2330                 ;;
2331         esac
2332 done
2333 case "$egrep" in
2334 egrep)
2335         echo "Substituting grep for egrep."
2336         egrep=$grep
2337         _egrep=$grep
2338         ;;
2339 esac
2340 case "$ln" in
2341 ln)
2342         echo "Substituting cp for ln."
2343         ln=$cp
2344         _ln=$cp
2345         ;;
2346 esac
2347 case "$make" in
2348 make)   
2349         case "$gmake" in
2350         gmake)
2351         echo "I can't find make or gmake, and my life depends on it." >&4
2352         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2353         exit 1
2354         ;;
2355         esac
2356         ;;
2357 esac    
2358 case "$gmake" in
2359 gmake)  ;;
2360 *)      # We can't have osname yet.
2361         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2362                 # Assume that gmake, if found, is definitely GNU make
2363                 # and prefer it over the system make.
2364                 echo "Substituting gmake for make."
2365                 make=$gmake
2366                 _make=$gmake
2367         fi
2368         ;;
2369 esac
2370 case "$test" in
2371 test)
2372         echo "Hopefully test is built into your sh."
2373         ;;
2374 *)
2375         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2376                 echo "Using the test built into your sh."
2377                 test=test
2378                 _test=test
2379         fi
2380         ;;
2381 esac
2382 case "$echo" in
2383 echo)
2384         echo "Hopefully echo is built into your sh."
2385         ;;
2386 '') ;;
2387 *)
2388         echo " "
2389 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2390         $echo $n "hi there$c" >foo1
2391         echo $n "hi there$c" >foo2
2392         if cmp foo1 foo2 >/dev/null 2>&1; then
2393                 echo "They are compatible.  In fact, they may be identical."
2394         else
2395                 case "$n" in
2396                 '-n') n='' c='\c';;
2397                 *) n='-n' c='';;
2398                 esac
2399                 cat <<FOO
2400 They are not compatible!  You are probably running ksh on a non-USG system.
2401 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2402 have echo built in and we may have to run some Bourne shell scripts.  That
2403 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2404
2405 FOO
2406                 $echo $n "The star should be here-->$c"
2407                 $echo "*"
2408         fi
2409         $rm -f foo1 foo2
2410         ;;
2411 esac
2412
2413 cat <<EOS >trygcc
2414 $startsh
2415 EOS
2416 cat <<'EOSC' >>trygcc
2417 case "$cc" in
2418 '') ;;
2419 *)  $rm -f try try.*
2420     $cat >try.c <<EOM
2421 int main(int argc, char *argv[]) {
2422   return 0;
2423 }
2424 EOM
2425     if $cc -o try $ccflags $ldflags try.c; then
2426        :
2427     else
2428         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2429         despair=yes
2430         trygcc=yes
2431         case "$cc" in
2432         *gcc*) trygcc=no ;;
2433         esac
2434         case "`$cc -v -c try.c 2>&1`" in
2435         *gcc*) trygcc=no ;;
2436         esac
2437         if $test X"$trygcc" = Xyes; then
2438             if gcc -o try -c try.c; then
2439                 echo " "
2440                 echo "You seem to have a working gcc, though." >&4
2441                 rp="Would you like to use it?"
2442                 dflt=y
2443                 if $test -f myread; then
2444                     . ./myread
2445                 else
2446                     if $test -f UU/myread; then
2447                         . ./UU/myread
2448                     else
2449                         echo "Cannot find myread, sorry.  Aborting." >&2
2450                         exit 1
2451                     fi
2452                 fi  
2453                 case "$ans" in
2454                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2455                        if $test -f usethreads.cbu; then
2456                            $cat >&4 <<EOM 
2457
2458 *** However, any setting of the C compiler flags (e.g. for thread support)
2459 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2460 *** (together with e.g. -Dusethreads).
2461
2462 EOM
2463                        fi;;
2464                 esac
2465             fi
2466         fi
2467     fi
2468     $rm -f try try.*
2469     ;;
2470 esac
2471 EOSC
2472
2473 cat <<EOS >checkcc
2474 $startsh
2475 EOS
2476 cat <<'EOSC' >>checkcc
2477 case "$cc" in        
2478 '') ;;
2479 *)  $rm -f try try.*              
2480     $cat >try.c <<EOM
2481 int main(int argc, char *argv[]) {
2482   return 0;
2483 }
2484 EOM
2485     if $cc -o try $ccflags $ldflags try.c; then
2486        :
2487     else
2488         if $test X"$despair" = Xyes; then
2489            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2490         fi
2491         $cat >&4 <<EOM         
2492 You need to find a working C compiler.
2493 Either (purchase and) install the C compiler supplied by your OS vendor,
2494 or for a free C compiler try http://gcc.gnu.org/
2495 I cannot continue any further, aborting.
2496 EOM
2497         exit 1
2498     fi
2499     $rm -f try try.*
2500     ;;
2501 esac
2502 EOSC
2503
2504 : determine whether symbolic links are supported
2505 echo " "
2506 $touch blurfl
2507 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2508         echo "Symbolic links are supported." >&4
2509         lns="$ln -s"
2510 else
2511         echo "Symbolic links are NOT supported." >&4
2512         lns="$ln"
2513 fi
2514 $rm -f blurfl sym
2515
2516 : determine whether symbolic links are supported
2517 echo " "
2518 case "$lns" in
2519 *"ln"*" -s")
2520         echo "Checking how to test for symbolic links..." >&4
2521         $lns blurfl sym
2522         if $test "X$issymlink" = X; then
2523                 case "$newsh" in
2524                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2525                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2526                 esac
2527                 if test $? = 0; then
2528                         issymlink="test -h"
2529                 else
2530                         echo "Your builtin 'test -h' may be broken." >&4
2531                         case "$test" in
2532                         /*)     ;;
2533                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2534                                 for p in $pth
2535                                 do
2536                                         if test -f "$p/$test"; then
2537                                                 test="$p/$test"
2538                                                 break
2539                                         fi
2540                                 done
2541                                 ;;
2542                         esac
2543                         case "$test" in
2544                         /*)
2545                                 echo "Trying external '$test -h'." >&4
2546                                 issymlink="$test -h"
2547                                 if $test ! -h sym >/dev/null 2>&1; then
2548                                         echo "External '$test -h' is broken, too." >&4
2549                                         issymlink=''
2550                                 fi
2551                                 ;;
2552                         *)      issymlink='' ;;
2553                         esac
2554                 fi              
2555         fi
2556         if $test "X$issymlink" = X; then
2557                 if $test -L sym 2>/dev/null; then
2558                         issymlink="$test -L"
2559                         echo "The builtin '$test -L' worked." >&4
2560                 fi
2561         fi
2562         if $test "X$issymlink" != X; then
2563                 echo "You can test for symbolic links with '$issymlink'." >&4
2564         else
2565                 echo "I do not know how you can test for symbolic links." >&4
2566         fi
2567         $rm -f blurfl sym
2568         ;;
2569 *)      echo "No symbolic links, so not testing for their testing..." >&4
2570         ;;
2571 esac
2572 echo " "
2573
2574
2575 case "$mksymlinks" in
2576 $define|true|[yY]*)
2577         case "$src" in
2578         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2579                 exit 1
2580                 ;;
2581         *)      case "$lns:$issymlink" in
2582                 *"ln"*" -s:"*"test -"?)
2583                         echo "Creating the symbolic links..." >&4
2584                         echo "(First creating the subdirectories...)" >&4
2585                         cd ..
2586                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2587                                 read directory
2588                                 test -z "$directory" && break
2589                                 mkdir -p $directory
2590                         done
2591                         # Sanity check 1.
2592                         if test ! -d t/base; then
2593                                 echo "Failed to create the subdirectories.  Aborting." >&4
2594                                 exit 1
2595                         fi
2596                         echo "(Then creating the symlinks...)" >&4
2597                         awk '{print $1}' $src/MANIFEST | while true; do
2598                                 read filename
2599                                 test -z "$filename" && break
2600                                 if test -f $filename; then
2601                                         if $issymlink $filename; then
2602                                                 rm -f $filename
2603                                         fi
2604                                 fi
2605                                 if test -f $filename; then
2606                                         echo "$filename already exists, not symlinking."
2607                                 else
2608                                         ln -s $src/$filename $filename
2609                                 fi
2610                         done
2611                         # Sanity check 2.
2612                         if test ! -f t/base/lex.t; then
2613                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2614                                 exit 1
2615                         fi
2616                         cd UU
2617                         ;;
2618                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2619                         ;;
2620                 esac
2621                 ;;
2622         esac
2623         ;;
2624 esac
2625
2626
2627 case "$usecrosscompile" in
2628 $define|true|[yY]*)
2629         $echo "Cross-compiling..."
2630         croak=''
2631         case "$cc" in
2632         *-*-gcc) # A cross-compiling gcc, probably.
2633             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2634             ar=$targetarch-ar
2635             # leave out ld, choosing it is more complex
2636             nm=$targetarch-nm
2637             ranlib=$targetarch-ranlib
2638             $echo 'extern int foo;' > try.c
2639             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2640             shift
2641             if $test $# -gt 0; then
2642                 incpth="$incpth $*"
2643                 incpth="`$echo $incpth|$sed 's/^ //'`"
2644                 echo "Guessing incpth '$incpth'." >&4
2645                 for i in $*; do
2646                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2647                     if $test -d $j; then
2648                         libpth="$libpth $j"
2649                     fi
2650                 done   
2651                 libpth="`$echo $libpth|$sed 's/^ //'`"
2652                 echo "Guessing libpth '$libpth'." >&4
2653             fi
2654             $rm -f try.c
2655             ;;
2656         esac
2657         case "$targetarch" in
2658         '') echo "Targetarch not defined." >&4; croak=y ;;
2659         *)  echo "Using targetarch $targetarch." >&4 ;;
2660         esac
2661         case "$incpth" in
2662         '') echo "Incpth not defined." >&4; croak=y ;;
2663         *)  echo "Using incpth '$incpth'." >&4 ;;
2664         esac
2665         case "$libpth" in
2666         '') echo "Libpth not defined." >&4; croak=y ;;
2667         *)  echo "Using libpth '$libpth'." >&4 ;;
2668         esac
2669         case "$usrinc" in
2670         '') for i in $incpth; do
2671                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2672                     usrinc=$i
2673                     echo "Guessing usrinc $usrinc." >&4
2674                     break
2675                 fi
2676             done
2677             case "$usrinc" in
2678             '') echo "Usrinc not defined." >&4; croak=y ;;
2679             esac
2680             ;;
2681         *)  echo "Using usrinc $usrinc." >&4 ;;
2682         esac
2683         case "$targethost" in
2684         '') echo "Targethost not defined." >&4; croak=y ;;
2685         *)  echo "Using targethost $targethost." >&4
2686         esac
2687         locincpth=' '
2688         loclibpth=' '
2689         case "$croak" in
2690         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2691         esac
2692         case "$src" in
2693         /*) run=$src/Cross/run
2694             targetmkdir=$src/Cross/mkdir
2695             to=$src/Cross/to
2696             from=$src/Cross/from
2697             ;;
2698         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2699             run=$pwd/Cross/run
2700             targetmkdir=$pwd/Cross/mkdir
2701             to=$pwd/Cross/to
2702             from=$pwd/Cross/from
2703             ;;
2704         esac
2705         case "$targetrun" in
2706         '') targetrun=ssh ;;
2707         esac
2708         case "$targetto" in
2709         '') targetto=scp ;;
2710         esac
2711         case "$targetfrom" in
2712         '') targetfrom=scp ;;
2713         esac
2714         run=$run-$targetrun
2715         to=$to-$targetto
2716         from=$from-$targetfrom
2717         case "$targetdir" in
2718         '')  targetdir=/tmp
2719              echo "Guessing targetdir $targetdir." >&4
2720              ;;
2721         esac
2722         case "$targetuser" in
2723         '')  targetuser=root
2724              echo "Guessing targetuser $targetuser." >&4
2725              ;;
2726         esac
2727         case "$targetfrom" in
2728         scp)    q=-q ;;
2729         *)      q='' ;;
2730         esac
2731         case "$targetrun" in
2732         ssh|rsh)
2733             cat >$run <<EOF
2734 #!/bin/sh
2735 case "\$1" in
2736 -cwd)
2737   shift
2738   cwd=\$1
2739   shift
2740   ;;
2741 esac
2742 case "\$cwd" in
2743 '') cwd=$targetdir ;;
2744 esac
2745 exe=\$1
2746 shift
2747 if $test ! -f \$exe.xok; then
2748   $to \$exe
2749   $touch \$exe.xok
2750 fi
2751 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2752 EOF
2753             ;;
2754         *)  echo "Unknown targetrun '$targetrun'" >&4
2755             exit 1
2756             ;;
2757         esac
2758         case "$targetmkdir" in
2759         */Cross/mkdir)
2760             cat >$targetmkdir <<EOF
2761 #!/bin/sh
2762 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2763 EOF
2764             $chmod a+rx $targetmkdir
2765             ;;
2766         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2767             exit 1
2768             ;;
2769         esac
2770         case "$targetto" in
2771         scp|rcp)
2772             cat >$to <<EOF
2773 #!/bin/sh
2774 for f in \$@
2775 do
2776   case "\$f" in
2777   /*)
2778     $targetmkdir \`dirname \$f\`
2779     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2780     ;;
2781   *)
2782     $targetmkdir $targetdir/\`dirname \$f\`
2783     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2784     ;;
2785   esac
2786 done
2787 exit 0
2788 EOF
2789             ;;
2790         cp) cat >$to <<EOF
2791 #!/bin/sh
2792 for f in \$@
2793 do
2794   case "\$f" in
2795   /*)
2796     $mkdir -p $targetdir/\`dirname \$f\`
2797     $cp \$f $targetdir/\$f || exit 1
2798     ;;
2799   *)
2800     $targetmkdir $targetdir/\`dirname \$f\`
2801     $cp \$f $targetdir/\$f || exit 1
2802     ;;
2803   esac
2804 done
2805 exit 0
2806 EOF
2807             ;;
2808         *)  echo "Unknown targetto '$targetto'" >&4
2809             exit 1
2810             ;;
2811         esac
2812         case "$targetfrom" in
2813         scp|rcp)
2814           cat >$from <<EOF
2815 #!/bin/sh
2816 for f in \$@
2817 do
2818   $rm -f \$f
2819   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2820 done
2821 exit 0
2822 EOF
2823             ;;
2824         cp) cat >$from <<EOF
2825 #!/bin/sh
2826 for f in \$@
2827 do
2828   $rm -f \$f
2829   cp $targetdir/\$f . || exit 1
2830 done
2831 exit 0
2832 EOF
2833             ;;
2834         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2835             exit 1
2836             ;;
2837         esac
2838         if $test ! -f $run; then
2839             echo "Target 'run' script '$run' not found." >&4
2840         else
2841             $chmod a+rx $run
2842         fi
2843         if $test ! -f $to; then
2844             echo "Target 'to' script '$to' not found." >&4
2845         else
2846             $chmod a+rx $to
2847         fi
2848         if $test ! -f $from; then
2849             echo "Target 'from' script '$from' not found." >&4
2850         else
2851             $chmod a+rx $from
2852         fi
2853         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2854             exit 1
2855         fi
2856         cat >&4 <<EOF
2857 Using '$run' for remote execution,
2858 and '$from' and '$to'
2859 for remote file transfer.
2860 EOF
2861         ;;
2862 *)      run=''
2863         to=:
2864         from=:
2865         usecrosscompile='undef'
2866         targetarch=''
2867         ;;
2868 esac
2869
2870 : see whether [:lower:] and [:upper:] are supported character classes
2871 echo " "
2872 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2873 ABYZ)
2874         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2875         up='[:upper:]'
2876         low='[:lower:]'
2877         ;;
2878 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2879         # (0xd9 and 0xe2), therefore that is a nice testing point.
2880         if test "X$up" = X -o "X$low" = X; then
2881             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2882             rs) up='[A-Z]'
2883                 low='[a-z]'
2884                 ;;
2885             esac
2886         fi
2887         if test "X$up" = X -o "X$low" = X; then
2888             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2889             rs) up='A-Z'
2890                 low='a-z'
2891                 ;;
2892             esac
2893         fi
2894         if test "X$up" = X -o "X$low" = X; then
2895             case "`echo RS | od -x 2>/dev/null`" in
2896             *D9E2*|*d9e2*)
2897                 echo "Hey, this might be EBCDIC." >&4
2898                 if test "X$up" = X -o "X$low" = X; then
2899                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2900                     rs) up='[A-IJ-RS-Z]'
2901                         low='[a-ij-rs-z]'
2902                         ;;
2903                     esac
2904                 fi
2905                 if test "X$up" = X -o "X$low" = X; then
2906                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2907                     rs) up='A-IJ-RS-Z'
2908                         low='a-ij-rs-z'
2909                         ;;
2910                     esac
2911                 fi
2912                 ;;
2913             esac
2914         fi
2915 esac
2916 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2917 rs)
2918     echo "Using $up and $low to convert case." >&4
2919     ;;
2920 *)
2921     echo "I don't know how to translate letters from upper to lower case." >&4
2922     echo "Your tr is not acting any way I know of." >&4
2923     exit 1
2924     ;;
2925 esac
2926 : set up the translation script tr, must be called with ./tr of course
2927 cat >tr <<EOSC
2928 $startsh
2929 case "\$1\$2" in
2930 '[A-Z][a-z]') exec $tr '$up' '$low';;
2931 '[a-z][A-Z]') exec $tr '$low' '$up';;
2932 esac
2933 exec $tr "\$@"
2934 EOSC
2935 chmod +x tr
2936 $eunicefix tr
2937
2938 : Try to determine whether config.sh was made on this system
2939 case "$config_sh" in
2940 '')
2941 myuname=`$uname -a 2>/dev/null`
2942 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2943 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2944 # because the A-Z/a-z are not consecutive.
2945 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2946         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2947 newmyuname="$myuname"
2948 dflt=n
2949 case "$knowitall" in
2950 '')
2951         if test -f ../config.sh; then
2952                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2953                         eval "`grep myuname= ../config.sh`"
2954                 fi
2955                 if test "X$myuname" = "X$newmyuname"; then
2956                         dflt=y
2957                 fi
2958         fi
2959         ;;
2960 *) dflt=y;;
2961 esac
2962
2963 : Get old answers from old config file if Configure was run on the
2964 : same system, otherwise use the hints.
2965 hint=default
2966 cd ..
2967 if test -f config.sh; then
2968         echo " "
2969         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2970         . UU/myread
2971         case "$ans" in
2972         n*|N*) echo "OK, I'll ignore it."
2973                 mv config.sh config.sh.old
2974                 myuname="$newmyuname"
2975                 ;;
2976         *)  echo "Fetching default answers from your old config.sh file..." >&4
2977                 tmp_n="$n"
2978                 tmp_c="$c"
2979                 tmp_sh="$sh"
2980                 . ./config.sh
2981                 cp config.sh UU
2982                 n="$tmp_n"
2983                 c="$tmp_c"
2984                 : Older versions did not always set $sh.  Catch re-use of such
2985                 : an old config.sh.
2986                 case "$sh" in
2987                 '') sh="$tmp_sh" ;;
2988                 esac
2989                 hint=previous
2990                 ;;
2991         esac
2992 fi
2993 . ./UU/checkcc
2994 if test ! -f config.sh; then
2995         $cat <<EOM
2996
2997 First time through, eh?  I have some defaults handy for some systems
2998 that need some extra help getting the Configure answers right:
2999
3000 EOM
3001         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3002         dflt=''
3003         : Half the following guesses are probably wrong... If you have better
3004         : tests or hints, please send them to perlbug@perl.org
3005         : The metaconfig authors would also appreciate a copy...
3006         $test -f /irix && osname=irix
3007         $test -f /xenix && osname=sco_xenix
3008         $test -f /dynix && osname=dynix
3009         $test -f /dnix && osname=dnix
3010         $test -f /lynx.os && osname=lynxos
3011         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3012         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3013         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3014         $test -f /bin/mips && /bin/mips && osname=mips
3015         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3016                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3017         $test -d /usr/apollo/bin && osname=apollo
3018         $test -f /etc/saf/_sactab && osname=svr4
3019         $test -d /usr/include/minix && osname=minix
3020         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3021         if $test -d /MachTen -o -d /MachTen_Folder; then
3022                 osname=machten
3023                 if $test -x /sbin/version; then
3024                         osvers=`/sbin/version | $awk '{print $2}' |
3025                         $sed -e 's/[A-Za-z]$//'`
3026                 elif $test -x /usr/etc/version; then
3027                         osvers=`/usr/etc/version | $awk '{print $2}' |
3028                         $sed -e 's/[A-Za-z]$//'`
3029                 else
3030                         osvers="$2.$3"
3031                 fi
3032         fi
3033
3034         $test -f /sys/posix.dll &&
3035                 $test -f /usr/bin/what &&
3036                 set X `/usr/bin/what /sys/posix.dll` &&
3037                 $test "$3" = UWIN &&
3038                 osname=uwin &&
3039                 osvers="$5"
3040
3041         if $test -f $uname; then
3042                 set X $myuname
3043                 shift
3044
3045                 case "$5" in
3046                 fps*) osname=fps ;;
3047                 mips*)
3048                         case "$4" in
3049                         umips) osname=umips ;;
3050                         *) osname=mips ;;
3051                         esac;;
3052                 [23]100) osname=mips ;;
3053                 next*) osname=next ;;
3054                 i386*)
3055                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3056                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3057                                 osname='sco'
3058                                 osvers=$tmp
3059                         elif $test -f /etc/kconfig; then
3060                                 osname=isc
3061                                 if test "$lns" = "$ln -s"; then
3062                                         osvers=4
3063                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3064                                         osvers=3
3065                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3066                                         osvers=2
3067                                 fi
3068                         fi
3069                         tmp=''
3070                         ;;
3071                 pc*)
3072                         if test -n "$DJGPP"; then
3073                                 osname=dos
3074                                 osvers=djgpp
3075                         fi
3076                         ;;
3077                 esac
3078
3079                 case "$1" in
3080                 aix) osname=aix
3081                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3082                         case "$tmp" in
3083                         # oslevel can fail with:
3084                         # oslevel: Unable to acquire lock.
3085                         *not\ found) osvers="$4"."$3" ;;
3086                         '<3240'|'<>3240') osvers=3.2.0 ;;
3087                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3088                         '=3250'|'>3250') osvers=3.2.5 ;;
3089                         *) osvers=$tmp;;
3090                         esac
3091                         ;;
3092                 bsd386) osname=bsd386
3093                         osvers=`$uname -r`
3094                         ;;
3095                 cygwin*) osname=cygwin
3096                         osvers="$3"
3097                         ;;
3098                 *dc.osx) osname=dcosx
3099                         osvers="$3"
3100                         ;;
3101                 dnix) osname=dnix
3102                         osvers="$3"
3103                         ;;
3104                 domainos) osname=apollo
3105                         osvers="$3"
3106                         ;;
3107                 dgux)   osname=dgux 
3108                         osvers="$3"
3109                         ;;
3110                 dynixptx*) osname=dynixptx
3111                         osvers=`echo "$4"|sed 's/^v//'`
3112                         ;;
3113                 freebsd) osname=freebsd 
3114                         osvers="$3" ;;
3115                 genix)  osname=genix ;;
3116                 gnu)    osname=gnu
3117                         osvers="$3" ;;
3118                 hp*)    osname=hpux 
3119                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3120                         ;;
3121                 irix*)  osname=irix
3122                         case "$3" in
3123                         4*) osvers=4 ;;
3124                         5*) osvers=5 ;;
3125                         *)      osvers="$3" ;;
3126                         esac
3127                         ;;
3128                 linux)  osname=linux
3129                         case "$3" in
3130                         *)      osvers="$3" ;;
3131                         esac
3132                         ;;
3133                 MiNT)   osname=mint
3134                         ;;
3135                 netbsd*) osname=netbsd
3136                         osvers="$3"
3137                         ;;
3138                 news-os) osvers="$3"
3139                         case "$3" in
3140                         4*) osname=newsos4 ;;
3141                         *) osname=newsos ;;
3142                         esac
3143                         ;;
3144                 next*) osname=next ;;
3145                 nonstop-ux) osname=nonstopux ;;
3146                 openbsd) osname=openbsd
3147                         osvers="$3"
3148                         ;;
3149                 os2)    osname=os2
3150                         osvers="$4"
3151                         ;;
3152                 POSIX-BC | posix-bc ) osname=posix-bc
3153                         osvers="$3"
3154                         ;;
3155                 powerux | power_ux | powermax_os | powermaxos | \
3156                 powerunix | power_unix) osname=powerux
3157                         osvers="$3"
3158                         ;;
3159                 qnx) osname=qnx
3160                         osvers="$4"
3161                         ;;
3162                 solaris) osname=solaris
3163                         case "$3" in
3164                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3165                         *)      osvers="$3" ;;
3166                         esac
3167                         ;;
3168                 sunos) osname=sunos
3169                         case "$3" in
3170                         5*) osname=solaris
3171                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3172                         *)      osvers="$3" ;;
3173                         esac
3174                         ;;
3175                 titanos) osname=titanos
3176                         case "$3" in
3177                         1*) osvers=1 ;;
3178                         2*) osvers=2 ;;
3179                         3*) osvers=3 ;;
3180                         4*) osvers=4 ;;
3181                         *)      osvers="$3" ;;
3182                         esac
3183                         ;;
3184                 ultrix) osname=ultrix
3185                         osvers="$3"
3186                         ;;
3187                 osf1|mls+)      case "$5" in
3188                                 alpha)
3189                                         osname=dec_osf
3190                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3191                                         case "$osvers" in
3192                                         [1-9].[0-9]*) ;;
3193                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3194                                         esac
3195                                         ;;
3196                         hp*)    osname=hp_osf1  ;;
3197                         mips)   osname=mips_osf1 ;;
3198                         esac
3199                         ;;
3200                 # UnixWare 7.1.2 is known as Open UNIX 8
3201                 openunix|unixware) osname=svr5
3202                         osvers="$4"
3203                         ;;
3204                 uts)    osname=uts
3205                         osvers="$3"
3206                         ;;
3207                 vos) osvers="$3"
3208                         ;;
3209                 $2) case "$osname" in
3210                         *isc*) ;;
3211                         *freebsd*) ;;
3212                         svr*)
3213                                 : svr4.x or possibly later
3214                                 case "svr$3" in 
3215                                 ${osname}*)
3216                                         osname=svr$3
3217                                         osvers=$4
3218                                         ;;
3219                                 esac
3220                                 case "$osname" in
3221                                 svr4.0)
3222                                         : Check for ESIX
3223                                         if test -f /stand/boot ; then
3224                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3225                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3226                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3227                                                         if test -n "$isesix"; then
3228                                                                 osname=esix4
3229                                                         fi
3230                                                 fi
3231                                         fi
3232                                         ;;
3233                                 esac
3234                                 ;;
3235                         *)      if test -f /etc/systemid; then
3236                                         osname=sco
3237                                         set `echo $3 | $sed 's/\./ /g'` $4
3238                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3239                                                 osvers=$1.$2.$3
3240                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3241                                                 osvers=$1.$2
3242                                         elif $test -f $src/hints/sco_$1.sh; then
3243                                                 osvers=$1
3244                                         fi
3245                                 else
3246                                         case "$osname" in
3247                                         '') : Still unknown.  Probably a generic Sys V.
3248                                                 osname="sysv"
3249                                                 osvers="$3"
3250                                                 ;;
3251                                         esac
3252                                 fi
3253                                 ;;
3254                         esac
3255                         ;;
3256                 *)      case "$osname" in
3257                         '') : Still unknown.  Probably a generic BSD.
3258                                 osname="$1"
3259                                 osvers="$3"
3260                                 ;;
3261                         esac
3262                         ;;
3263                 esac
3264         else
3265                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3266                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3267                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3268                                 osname=news_os
3269                         fi
3270                         $rm -f UU/kernel.what
3271                 elif test -d c:/. -o -n "$is_os2" ; then
3272                         set X $myuname
3273                         osname=os2
3274                         osvers="$5"
3275                 fi
3276         fi
3277         
3278         case "$targetarch" in
3279         '') ;;
3280         *)  hostarch=$osname
3281             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3282             osvers=''
3283             ;;
3284         esac
3285
3286         : Now look for a hint file osname_osvers, unless one has been
3287         : specified already.
3288         case "$hintfile" in
3289         ''|' ')
3290                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3291                 : Also try without trailing minor version numbers.
3292                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3293                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3294                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3295                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3296                 case "$file" in
3297                 '') dflt=none ;;
3298                 *)  case "$osvers" in
3299                         '') dflt=$file
3300                                 ;;
3301                         *)  if $test -f $src/hints/$file.sh ; then
3302                                         dflt=$file
3303                                 elif $test -f $src/hints/$xfile.sh ; then
3304                                         dflt=$xfile
3305                                 elif $test -f $src/hints/$xxfile.sh ; then
3306                                         dflt=$xxfile
3307                                 elif $test -f $src/hints/$xxxfile.sh ; then
3308                                         dflt=$xxxfile
3309                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3310                                         dflt=$xxxxfile
3311                                 elif $test -f "$src/hints/${osname}.sh" ; then
3312                                         dflt="${osname}"
3313                                 else
3314                                         dflt=none
3315                                 fi
3316                                 ;;
3317                         esac
3318                         ;;
3319                 esac
3320                 if $test -f Policy.sh ; then
3321                         case "$dflt" in
3322                         *Policy*) ;;
3323                         none) dflt="Policy" ;;
3324                         *) dflt="Policy $dflt" ;;
3325                         esac
3326                 fi
3327                 ;;
3328         *)
3329                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3330                 ;;
3331         esac
3332
3333         if $test -f Policy.sh ; then
3334                 $cat <<EOM
3335
3336 There's also a Policy hint file available, which should make the
3337 site-specific (policy) questions easier to answer.
3338 EOM
3339
3340         fi
3341
3342         $cat <<EOM
3343
3344 You may give one or more space-separated answers, or "none" if appropriate.
3345 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3346 is a good thing.  DO NOT give a wrong version or a wrong OS.
3347
3348 EOM
3349
3350         rp="Which of these apply, if any?"
3351         . UU/myread
3352         tans=$ans
3353         for file in $tans; do
3354                 if $test X$file = XPolicy -a -f Policy.sh; then
3355                         . Policy.sh
3356                         $cat Policy.sh >> UU/config.sh
3357                 elif $test -f $src/hints/$file.sh; then
3358                         . $src/hints/$file.sh
3359                         $cat $src/hints/$file.sh >> UU/config.sh
3360                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3361                         : nothing
3362                 else
3363                         : Give one chance to correct a possible typo.
3364                         echo "$file.sh does not exist"
3365                         dflt=$file
3366                         rp="hint to use instead?"
3367                         . UU/myread
3368                         for file in $ans; do
3369                                 if $test -f "$src/hints/$file.sh"; then
3370                                         . $src/hints/$file.sh
3371                                         $cat $src/hints/$file.sh >> UU/config.sh
3372                                 elif $test X$ans = X -o X$ans = Xnone ; then
3373                                         : nothing
3374                                 else
3375                                         echo "$file.sh does not exist -- ignored."
3376                                 fi
3377                         done
3378                 fi
3379         done
3380
3381         hint=recommended
3382         : Remember our hint file for later.
3383         if $test -f "$src/hints/$file.sh" ; then
3384                 hintfile="$file"
3385         else
3386                 hintfile=''
3387         fi
3388 fi
3389 cd UU
3390 ;;
3391 *)
3392         echo " "
3393         echo "Fetching default answers from $config_sh..." >&4
3394         tmp_n="$n"
3395         tmp_c="$c"
3396         cd ..
3397         cp $config_sh config.sh 2>/dev/null
3398         chmod +w config.sh
3399         . ./config.sh
3400         cd UU
3401         cp ../config.sh .
3402         n="$tmp_n"
3403         c="$tmp_c"
3404         hint=previous
3405         ;;
3406 esac
3407 test "$override" && . ./optdef.sh
3408
3409 : Restore computed paths
3410 for file in $loclist $trylist; do
3411         eval $file="\$_$file"
3412 done
3413
3414 cat << EOM
3415
3416 Configure uses the operating system name and version to set some defaults.
3417 The default value is probably right if the name rings a bell. Otherwise,
3418 since spelling matters for me, either accept the default or answer "none"
3419 to leave it blank.
3420
3421 EOM
3422 case "$osname" in
3423         ''|' ')
3424                 case "$hintfile" in
3425                 ''|' '|none) dflt=none ;;
3426                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3427                 esac
3428                 ;;
3429         *) dflt="$osname" ;;
3430 esac
3431 rp="Operating system name?"
3432 . ./myread
3433 case "$ans" in
3434 none)  osname='' ;;
3435 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3436 esac
3437 echo " "
3438 case "$osvers" in
3439         ''|' ')
3440                 case "$hintfile" in
3441                 ''|' '|none) dflt=none ;;
3442                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3443                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3444                         case "$dflt" in
3445                         ''|' ') dflt=none ;;
3446                         esac
3447                         ;;
3448                 esac
3449                 ;;
3450         *) dflt="$osvers" ;;
3451 esac
3452 rp="Operating system version?"
3453 . ./myread
3454 case "$ans" in
3455 none)  osvers='' ;;
3456 *) osvers="$ans" ;;
3457 esac
3458
3459
3460 . ./posthint.sh
3461
3462 : who configured the system
3463 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3464 case "$cf_by" in
3465 "")
3466         cf_by=`(logname) 2>/dev/null`
3467         case "$cf_by" in
3468         "")
3469                 cf_by=`(whoami) 2>/dev/null`
3470                 case "$cf_by" in
3471                 "") cf_by=unknown ;;
3472                 esac ;;
3473         esac ;;
3474 esac
3475
3476 : set up the script used to warn in case of inconsistency
3477 cat <<EOS >whoa
3478 $startsh
3479 EOS
3480 cat <<'EOSC' >>whoa
3481 dflt=y
3482 echo " "
3483 echo "*** WHOA THERE!!! ***" >&4
3484 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3485 rp="    Keep the $hint value?"
3486 . ./myread
3487 case "$ans" in
3488 y) td=$was; tu=$was;;
3489 esac
3490 EOSC
3491
3492 : function used to set $1 to $val
3493 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3494 case "$val$was" in
3495 $define$undef) . ./whoa; eval "$var=\$td";;
3496 $undef$define) . ./whoa; eval "$var=\$tu";;
3497 *) eval "$var=$val";;
3498 esac'
3499
3500 case "$usesocks" in
3501 $define|true|[yY]*)     dflt='y';;
3502 *) dflt='n';;
3503 esac
3504 cat <<EOM
3505
3506 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3507 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3508 to use the PerlIO abstraction layer, this will be implicitly selected.
3509
3510 If this doesn't make any sense to you, just accept the default '$dflt'.
3511 EOM
3512 rp='Build Perl for SOCKS?'
3513 . ./myread
3514 case "$ans" in
3515 y|Y)    val="$define" ;;     
3516 *)      val="$undef" ;;
3517 esac
3518 set usesocks
3519 eval $setvar
3520
3521 case "$usesocks" in
3522 $define|true|[yY]*) useperlio="$define";;
3523 esac
3524
3525 case "$useperlio" in
3526 $define|true|[yY]*|'')  dflt='y';;
3527 *) dflt='n';;
3528 esac
3529 cat <<EOM
3530
3531 Previous version of $package used the standard IO mechanisms as
3532 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3533 alternate IO mechanisms via the PerlIO abstraction layer, but the
3534 stdio mechanism is still available if needed.  The abstraction layer
3535 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3536 Using PerlIO with sfio may cause problems with some extension modules.
3537
3538 If this doesn't make any sense to you, just accept the default '$dflt'.
3539 EOM
3540 rp='Use the PerlIO abstraction layer?'
3541 . ./myread
3542 case "$ans" in
3543 y|Y) 
3544         val="$define"
3545         ;;
3546 *)      
3547         echo "Ok, doing things the stdio way."
3548         val="$undef"
3549         ;;
3550 esac
3551 set useperlio
3552 eval $setvar 
3553
3554 case "$usesocks" in
3555 $define|true|[yY]*)
3556         case "$useperlio" in
3557         $define|true|[yY]*) ;;
3558         *)      cat >&4 <<EOM
3559
3560 You are using the SOCKS proxy protocol library which means that you
3561 should also use the PerlIO layer.  You may be headed for trouble.
3562
3563 EOM
3564                 ;;
3565         esac
3566         ;;
3567 esac
3568
3569         
3570 case "$usethreads" in
3571 $define|true|[yY]*)     dflt='y';;
3572 *)     # Catch case where user specified ithreads or 5005threads but
3573        # forgot -Dusethreads (A.D. 4/2002)
3574        case "$useithreads$use5005threads" in
3575        *$define*)      
3576                 case "$useperlio" in
3577                 "$define")      dflt='y' ;;
3578                 *)              dflt='n' ;;
3579                 esac
3580                 ;;
3581        *)       dflt='n';;
3582        esac
3583        ;;
3584 esac
3585 cat <<EOM
3586
3587 Perl can be built to take advantage of threads on some systems.
3588 To do so, Configure can be run with -Dusethreads.
3589
3590 Note that Perl built with threading support runs slightly slower
3591 and uses more memory than plain Perl. The current implementation
3592 is believed to be stable, but it is fairly new, and so should be
3593 treated with caution.
3594
3595 If this doesn't make any sense to you, just accept the default '$dflt'.
3596 EOM
3597 rp='Build a threading Perl?'
3598 . ./myread
3599 case "$ans" in
3600 y|Y)    val="$define" ;;
3601 *)      val="$undef" ;;
3602 esac
3603 set usethreads
3604 eval $setvar
3605
3606 case "$usethreads" in
3607 $define)
3608         $cat <<EOM
3609
3610 Since release 5.6, Perl has had two different threading implementations,
3611 the newer interpreter-based version (ithreads) with one interpreter per
3612 thread, and the older 5.005 version (5005threads).
3613 The 5005threads version is effectively unmaintained and will probably be
3614 removed in Perl 5.10, so there should be no need to build a Perl using it
3615 unless needed for backwards compatibility with some existing 5.005threads
3616 code.
3617
3618 EOM
3619         : Default to ithreads unless overridden on command line or with
3620         : old config.sh
3621         dflt='y'
3622         case "$use5005threads" in
3623                 $define|true|[yY]*) dflt='n';;
3624         esac
3625         case "$useithreads" in
3626                 $undef|false|[nN]*) dflt='n';;
3627         esac
3628         rp='Use the newer interpreter-based ithreads?'
3629         . ./myread
3630         case "$ans" in
3631         y|Y)    val="$define" ;;
3632         *)      val="$undef" ;;
3633         esac
3634         set useithreads
3635         eval $setvar
3636         : Now set use5005threads to the opposite value.
3637         case "$useithreads" in
3638         $define) val="$undef" ;;
3639         *) val="$define" ;;
3640         esac
3641         set use5005threads
3642         eval $setvar
3643         ;;
3644 *)
3645         useithreads="$undef"
3646         use5005threads="$undef"
3647         ;;
3648 esac
3649
3650 case "$useithreads$use5005threads" in
3651 "$define$define")
3652         $cat >&4 <<EOM
3653
3654 You cannot have both the ithreads and the 5.005 threads enabled
3655 at the same time.  Disabling the 5.005 threads since they are
3656 much less stable than the ithreads.
3657
3658 EOM
3659         use5005threads="$undef"
3660         ;;
3661 esac
3662
3663 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3664         cat >&4 <<EOF
3665 ***
3666 *** To build with ithreads you must also use the PerlIO layer.
3667 *** Cannot continue, aborting.
3668 ***
3669 EOF
3670         exit 1
3671 fi
3672
3673 case "$d_oldpthreads" in
3674 '')     : Configure tests would be welcome here.  For now, assume undef.
3675         val="$undef" ;;
3676 *)      val="$d_oldpthreads" ;;
3677 esac
3678 set d_oldpthreads
3679 eval $setvar
3680
3681
3682 : Look for a hint-file generated 'call-back-unit'.  If the
3683 : user has specified that a threading perl is to be built,
3684 : we may need to set or change some other defaults.
3685 if $test -f usethreads.cbu; then
3686     echo "Your platform has some specific hints regarding threaded builds, using them..."
3687     . ./usethreads.cbu
3688 else
3689     case "$usethreads" in
3690         "$define"|true|[yY]*)
3691                 $cat <<EOM
3692 (Your platform does not have any specific hints for threaded builds.
3693  Assuming POSIX threads, then.)
3694 EOM
3695         ;;
3696     esac
3697 fi
3698
3699 cat <<EOM
3700
3701 Perl can be built so that multiple Perl interpreters can coexist
3702 within the same Perl executable.
3703 EOM
3704
3705 case "$useithreads" in
3706 $define)
3707         cat <<EOM
3708 This multiple interpreter support is required for interpreter-based threads.
3709 EOM
3710         val="$define"
3711         ;;
3712 *)      case "$usemultiplicity" in
3713         $define|true|[yY]*)     dflt='y';;
3714         *) dflt='n';;
3715         esac
3716         echo " "
3717         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3718         rp='Build Perl for multiplicity?'
3719         . ./myread
3720         case "$ans" in
3721         y|Y)    val="$define" ;;
3722         *)      val="$undef" ;;
3723         esac
3724         ;;
3725 esac
3726 set usemultiplicity
3727 eval $setvar
3728
3729
3730 case "$usemorebits" in
3731 "$define"|true|[yY]*)
3732         use64bitint="$define"
3733         uselongdouble="$define"
3734         usemorebits="$define"
3735         ;;
3736 *)      usemorebits="$undef"
3737         ;;
3738 esac
3739
3740 : make some quick guesses about what we are up against
3741 echo " "
3742 $echo $n "Hmm...  $c"
3743 echo exit 1 >bsd
3744 echo exit 1 >usg
3745 echo exit 1 >v7
3746 echo exit 1 >osf1
3747 echo exit 1 >eunice
3748 echo exit 1 >xenix
3749 echo exit 1 >venix
3750 echo exit 1 >os2
3751 d_bsd="$undef"
3752 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3753 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3754 then
3755         echo "Looks kind of like an OSF/1 system, but we'll see..."
3756         echo exit 0 >osf1
3757 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3758         xxx=`./loc addbib blurfl $pth`
3759         if $test -f $xxx; then
3760         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3761                 echo exit 0 >bsd
3762                 echo exit 0 >usg
3763         else
3764                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3765                         echo "Looks kind of like an extended USG system, but we'll see..."
3766                 else
3767                         echo "Looks kind of like a USG system, but we'll see..."
3768                 fi
3769                 echo exit 0 >usg
3770         fi
3771 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3772         echo "Looks kind of like a BSD system, but we'll see..."
3773         d_bsd="$define"
3774         echo exit 0 >bsd
3775 else
3776         echo "Looks kind of like a Version 7 system, but we'll see..."
3777         echo exit 0 >v7
3778 fi
3779 case "$eunicefix" in
3780 *unixtovms*)
3781         $cat <<'EOI'
3782 There is, however, a strange, musty smell in the air that reminds me of
3783 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3784 EOI
3785         echo exit 0 >eunice
3786         d_eunice="$define"
3787 : it so happens the Eunice I know will not run shell scripts in Unix format
3788         ;;
3789 *)
3790         echo " "
3791         echo "Congratulations.  You aren't running Eunice."
3792         d_eunice="$undef"
3793         ;;
3794 esac
3795 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3796 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3797 : semicolon as a patch separator
3798 case "$p_" in
3799 :) ;;
3800 *)
3801         $cat <<'EOI'
3802 I have the feeling something is not exactly right, however...don't tell me...
3803 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3804 (Or you may be running DOS with DJGPP.)
3805 EOI
3806         echo exit 0 >os2
3807         ;;
3808 esac
3809 if test -f /xenix; then
3810         echo "Actually, this looks more like a XENIX system..."
3811         echo exit 0 >xenix
3812         d_xenix="$define"
3813 else
3814         echo " "
3815         echo "It's not Xenix..."
3816         d_xenix="$undef"
3817 fi
3818 chmod +x xenix
3819 $eunicefix xenix
3820 if test -f /venix; then
3821         echo "Actually, this looks more like a VENIX system..."
3822         echo exit 0 >venix
3823 else
3824         echo " "
3825         if ./xenix; then
3826                 : null
3827         else
3828                 echo "Nor is it Venix..."
3829         fi
3830 fi
3831 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3832 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3833 $rm -f foo
3834
3835 case "$cc" in
3836 '') dflt=cc;;
3837 *) dflt="$cc";;
3838 esac
3839 rp="Use which C compiler?"
3840 . ./myread
3841 cc="$ans"
3842
3843 : See if they have not cc but they do have gcc
3844 . ./trygcc
3845 : Look for a hint-file generated 'call-back-unit'.  Now that the
3846 : user has specified the compiler, we may need to set or change some
3847 : other defaults.
3848 if $test -f cc.cbu; then
3849     . ./cc.cbu
3850 fi
3851 . ./checkcc
3852
3853 echo " "
3854 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3855 $cat >try.c <<EOM
3856 #include <stdio.h>
3857 int main() {
3858 #ifdef __GNUC__
3859 #ifdef __VERSION__
3860         printf("%s\n", __VERSION__);
3861 #else
3862         printf("%s\n", "1");
3863 #endif
3864 #endif
3865         return(0);
3866 }
3867 EOM
3868 if $cc -o try $ccflags $ldflags try.c; then
3869         gccversion=`$run ./try`
3870         case "$gccversion" in
3871         '') echo "You are not using GNU cc." ;;
3872         *)  echo "You are using GNU cc $gccversion."
3873             ccname=gcc
3874             ;;
3875         esac
3876 else
3877         echo " "
3878         echo "*** WHOA THERE!!! ***" >&4
3879         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3880         case "$knowitall" in
3881         '')
3882         echo "    You'd better start hunting for one and let me know about it." >&4
3883                 exit 1
3884                 ;;
3885         esac
3886 fi
3887 $rm -f try try.*
3888 case "$gccversion" in
3889 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3890 esac
3891 case "$gccversion" in
3892 '') gccosandvers='' ;;
3893 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3894    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3895    gccshortvers=''
3896    case "$gccosandvers" in
3897    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3898    $osname$osvers) ;; # looking good
3899    $osname*) cat <<EOM >&4
3900
3901 *** WHOA THERE!!! ***
3902
3903     Your gcc has not been compiled for the exact release of
3904     your operating system ($gccosandvers versus $osname$osvers).
3905
3906     In general it is a good idea to keep gcc synchronized with
3907     the operating system because otherwise serious problems
3908     may ensue when trying to compile software, like Perl.
3909
3910     I'm trying to be optimistic here, though, and will continue.
3911     If later during the configuration and build icky compilation
3912     problems appear (headerfile conflicts being the most common
3913     manifestation), I suggest reinstalling the gcc to match
3914     your operating system release.
3915
3916 EOM
3917       ;;
3918    *) gccosandvers='' ;; # failed to parse, better be silent
3919    esac
3920    ;;
3921 esac
3922 case "$ccname" in
3923 '') ccname="$cc" ;;
3924 esac
3925
3926 # gcc 3.* complain about adding -Idirectories that they already know about,
3927 # so we will take those off from locincpth.
3928 case "$gccversion" in
3929 3*)
3930     echo "main(){}">try.c
3931     for incdir in $locincpth; do
3932        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3933              grep '^c[cp]p*[01]: warning: changing search order '`
3934        if test "X$warn" != X; then
3935            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3936        fi
3937     done
3938     $rm -f try try.*
3939 esac
3940
3941 : decide how portable to be.  Allow command line overrides.
3942 case "$d_portable" in
3943 "$undef") ;;
3944 *)      d_portable="$define" ;;
3945 esac
3946
3947 : set up shell script to do ~ expansion
3948 cat >filexp <<EOSS
3949 $startsh
3950 : expand filename
3951 case "\$1" in
3952  ~/*|~)
3953         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3954         ;;
3955  ~*)
3956         if $test -f /bin/csh; then
3957                 /bin/csh -f -c "glob \$1"
3958                 failed=\$?
3959                 echo ""
3960                 exit \$failed
3961         else
3962                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3963                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3964                 if $test ! -d "\$dir"; then
3965                         me=\`basename \$0\`
3966                         echo "\$me: can't locate home directory for: \$name" >&2
3967                         exit 1
3968                 fi
3969                 case "\$1" in
3970                 */*)
3971                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3972                         ;;
3973                 *)
3974                         echo \$dir
3975                         ;;
3976                 esac
3977         fi
3978         ;;
3979 *)
3980         echo \$1
3981         ;;
3982 esac
3983 EOSS
3984 chmod +x filexp
3985 $eunicefix filexp
3986
3987 : now set up to get a file name
3988 cat <<EOS >getfile
3989 $startsh
3990 EOS
3991 cat <<'EOSC' >>getfile
3992 tilde=''
3993 fullpath=''
3994 already=''
3995 skip=''
3996 none_ok=''
3997 exp_file=''
3998 nopath_ok=''
3999 orig_rp="$rp"
4000 orig_dflt="$dflt"
4001 case "$gfpth" in
4002 '') gfpth='.' ;;
4003 esac
4004
4005 case "$fn" in
4006 *\(*)
4007         : getfile will accept an answer from the comma-separated list
4008         : enclosed in parentheses even if it does not meet other criteria.
4009         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4010         fn=`echo $fn | sed 's/(.*)//'`
4011         ;;
4012 esac
4013
4014 case "$fn" in
4015 *:*)
4016         loc_file=`expr $fn : '.*:\(.*\)'`
4017         fn=`expr $fn : '\(.*\):.*'`
4018         ;;
4019 esac
4020
4021 case "$fn" in
4022 *~*) tilde=true;;
4023 esac
4024 case "$fn" in
4025 */*) fullpath=true;;
4026 esac
4027 case "$fn" in
4028 *+*) skip=true;;
4029 esac
4030 case "$fn" in
4031 *n*) none_ok=true;;
4032 esac
4033 case "$fn" in
4034 *e*) exp_file=true;;
4035 esac
4036 case "$fn" in
4037 *p*) nopath_ok=true;;
4038 esac
4039
4040 case "$fn" in
4041 *f*) type='File';;
4042 *d*) type='Directory';;
4043 *l*) type='Locate';;
4044 esac
4045
4046 what="$type"
4047 case "$what" in
4048 Locate) what='File';;
4049 esac
4050
4051 case "$exp_file" in
4052 '')
4053         case "$d_portable" in
4054         "$define") ;;
4055         *) exp_file=true;;
4056         esac
4057         ;;
4058 esac
4059
4060 cd ..
4061 while test "$type"; do
4062         redo=''
4063         rp="$orig_rp"
4064         dflt="$orig_dflt"
4065         case "$tilde" in
4066         true) rp="$rp (~name ok)";;
4067         esac
4068         . UU/myread
4069         if test -f UU/getfile.ok && \
4070                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4071         then
4072                 value="$ans"
4073                 ansexp="$ans"
4074                 break
4075         fi
4076         case "$ans" in
4077         none)
4078                 value=''
4079                 ansexp=''
4080                 case "$none_ok" in
4081                 true) type='';;
4082                 esac
4083                 ;;
4084         *)
4085                 case "$tilde" in
4086                 '') value="$ans"
4087                         ansexp="$ans";;
4088                 *)
4089                         value=`UU/filexp $ans`
4090                         case $? in
4091                         0)
4092                                 if test "$ans" != "$value"; then
4093                                         echo "(That expands to $value on this system.)"
4094                                 fi
4095                                 ;;
4096                         *) value="$ans";;
4097                         esac
4098                         ansexp="$value"
4099                         case "$exp_file" in
4100                         '') value="$ans";;
4101                         esac
4102                         ;;
4103                 esac
4104                 case "$fullpath" in
4105                 true)
4106                         case "$ansexp" in
4107                         /*) value="$ansexp" ;;
4108                         [a-zA-Z]:/*) value="$ansexp" ;;
4109                         *)
4110                                 redo=true
4111                                 case "$already" in
4112                                 true)
4113                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4114                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4115                                         ;;
4116                                 *)
4117                                 echo "Please give a full path name, starting with slash." >&4
4118                                         case "$tilde" in
4119                                         true)
4120                                 echo "Note that using ~name is ok provided it expands well." >&4
4121                                                 already=true
4122                                                 ;;
4123                                         esac
4124                                 esac
4125                                 ;;
4126                         esac
4127                         ;;
4128                 esac
4129                 case "$redo" in
4130                 '')
4131                         case "$type" in
4132                         File)
4133                                 for fp in $gfpth; do
4134                                         if test "X$fp" = X.; then
4135                                             pf="$ansexp"
4136                                         else    
4137                                             pf="$fp/$ansexp"
4138                                         fi
4139                                         if test -f "$pf"; then
4140                                                 type=''
4141                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4142                                         then
4143                                                 echo "($value is not a plain file, but that's ok.)"
4144                                                 type=''
4145                                         fi
4146                                         if test X"$type" = X; then
4147                                             value="$pf"
4148                                             break
4149                                         fi
4150                                 done
4151                                 ;;
4152                         Directory)
4153                                 for fp in $gfpth; do
4154                                         if test "X$fp" = X.; then
4155                                             dir="$ans"
4156                                             direxp="$ansexp"
4157                                         else    
4158                                             dir="$fp/$ansexp"
4159                                             direxp="$fp/$ansexp"
4160                                         fi
4161                                         if test -d "$direxp"; then
4162                                                 type=''
4163                                                 value="$dir"
4164                                                 break
4165                                         fi
4166                                 done
4167                                 ;;
4168                         Locate)
4169                                 if test -d "$ansexp"; then
4170                                         echo "(Looking for $loc_file in directory $value.)"
4171                                         value="$value/$loc_file"
4172                                         ansexp="$ansexp/$loc_file"
4173                                 fi
4174                                 if test -f "$ansexp"; then
4175                                         type=''
4176                                 fi
4177                                 case "$nopath_ok" in
4178                                 true)   case "$value" in
4179                                         */*) ;;
4180                                         *)      echo "Assuming $value will be in people's path."
4181                                                 type=''
4182                                                 ;;
4183                                         esac
4184                                         ;;
4185                                 esac
4186                                 ;;
4187                         esac
4188
4189                         case "$skip" in
4190                         true) type='';
4191                         esac
4192
4193                         case "$type" in
4194                         '') ;;
4195                         *)
4196                                 if test "$fastread" = yes; then
4197                                         dflt=y
4198                                 else
4199                                         dflt=n
4200                                 fi
4201                                 rp="$what $value doesn't exist.  Use that name anyway?"
4202                                 . UU/myread
4203                                 dflt=''
4204                                 case "$ans" in
4205                                 y*) type='';;
4206                                 *) echo " ";;
4207                                 esac
4208                                 ;;
4209                         esac
4210                         ;;
4211                 esac
4212                 ;;
4213         esac
4214 done
4215 cd UU
4216 ans="$value"
4217 rp="$orig_rp"
4218 dflt="$orig_dflt"
4219 rm -f getfile.ok
4220 test "X$gfpthkeep" != Xy && gfpth=""
4221 EOSC
4222
4223 : What should the include directory be ?
4224 echo " "
4225 $echo $n "Hmm...  $c"
4226 dflt='/usr/include'
4227 incpath=''
4228 mips_type=''
4229 if $test -f /bin/mips && /bin/mips; then
4230         echo "Looks like a MIPS system..."
4231         $cat >usr.c <<'EOCP'
4232 #ifdef SYSTYPE_BSD43
4233 /bsd43
4234 #endif
4235 EOCP
4236         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4237                 dflt='/bsd43/usr/include'
4238                 incpath='/bsd43'
4239                 mips_type='BSD 4.3'
4240         else
4241                 mips_type='System V'
4242         fi
4243         $rm -f usr.c usr.out
4244         echo "and you're compiling with the $mips_type compiler and libraries."
4245         xxx_prompt=y
4246         echo "exit 0" >mips
4247 else
4248         echo "Doesn't look like a MIPS system."
4249         xxx_prompt=n
4250         echo "exit 1" >mips
4251 fi
4252 chmod +x mips
4253 $eunicefix mips
4254 case "$usrinc" in
4255 '') ;;
4256 *) dflt="$usrinc";;
4257 esac
4258 case "$xxx_prompt" in
4259 y)      fn=d/
4260         echo " "
4261         rp='Where are the include files you want to use?'
4262         . ./getfile
4263         usrinc="$ans"
4264         ;;
4265 *)      usrinc="$dflt"
4266         ;;
4267 esac
4268
4269 : see how we invoke the C preprocessor
4270 echo " "
4271 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4272 cat <<'EOT' >testcpp.c
4273 #define ABC abc
4274 #define XYZ xyz
4275 ABC.XYZ
4276 EOT
4277 cd ..
4278 if test ! -f cppstdin; then
4279         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4280                 # AIX cc -E doesn't show the absolute headerfile
4281                 # locations but we'll cheat by using the -M flag.
4282                 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
4283         else
4284                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4285         fi
4286 else
4287         echo "Keeping your $hint cppstdin wrapper."
4288 fi
4289 chmod 755 cppstdin
4290 wrapper=`pwd`/cppstdin
4291 ok='false'
4292 cd UU
4293
4294 if $test "X$cppstdin" != "X" && \
4295         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4296         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4297 then
4298         echo "You used to use $cppstdin $cppminus so we'll use that again."
4299         case "$cpprun" in
4300         '') echo "But let's see if we can live without a wrapper..." ;;
4301         *)
4302                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4303                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4304                 then
4305                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4306                         ok='true'
4307                 else
4308                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4309                 fi
4310                 ;;
4311         esac
4312 else
4313         case "$cppstdin" in
4314         '') ;;
4315         *)
4316                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4317                 ;;
4318         esac
4319 fi
4320
4321 if $ok; then
4322         : nothing
4323 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4324         $cc -E <testcpp.c >testcpp.out 2>&1; \
4325         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4326         echo "Yup, it does."
4327         x_cpp="$cc -E"
4328         x_minus='';
4329 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4330         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4331         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4332         echo "Yup, it does."
4333         x_cpp="$cc -E"
4334         x_minus='-';
4335 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4336         $cc -P <testcpp.c >testcpp.out 2>&1; \
4337         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4338         echo "Yipee, that works!"
4339         x_cpp="$cc -P"
4340         x_minus='';
4341 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4342         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4343         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4344         echo "At long last!"
4345         x_cpp="$cc -P"
4346         x_minus='-';
4347 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4348         $cpp <testcpp.c >testcpp.out 2>&1; \
4349         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350         echo "It works!"
4351         x_cpp="$cpp"
4352         x_minus='';
4353 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4354         $cpp - <testcpp.c >testcpp.out 2>&1; \
4355         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4356         echo "Hooray, it works!  I was beginning to wonder."
4357         x_cpp="$cpp"
4358         x_minus='-';
4359 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4360         $wrapper <testcpp.c >testcpp.out 2>&1; \
4361         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4362         x_cpp="$wrapper"
4363         x_minus=''
4364         echo "Eureka!"
4365 else
4366         dflt=''
4367         rp="No dice.  I can't find a C preprocessor.  Name one:"
4368         . ./myread
4369         x_cpp="$ans"
4370         x_minus=''
4371         $x_cpp <testcpp.c >testcpp.out 2>&1
4372         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4373                 echo "OK, that will do." >&4
4374         else
4375 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4376                 exit 1
4377         fi
4378 fi
4379
4380 case "$ok" in
4381 false)
4382         cppstdin="$x_cpp"
4383         cppminus="$x_minus"
4384         cpprun="$x_cpp"
4385         cpplast="$x_minus"
4386         set X $x_cpp
4387         shift
4388         case "$1" in
4389         "$cpp")
4390                 echo "Perhaps can we force $cc -E using a wrapper..."
4391                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4392                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4393                 then
4394                         echo "Yup, we can."
4395                         cppstdin="$wrapper"
4396                         cppminus='';
4397                 else
4398                         echo "Nope, we'll have to live without it..."
4399                 fi
4400                 ;;
4401         esac
4402         case "$cpprun" in
4403         "$wrapper")
4404                 cpprun=''
4405                 cpplast=''
4406                 ;;
4407         esac
4408         ;;
4409 esac
4410
4411 case "$cppstdin" in
4412 "$wrapper"|'cppstdin') ;;
4413 *) $rm -f $wrapper;;
4414 esac
4415 $rm -f testcpp.c testcpp.out
4416
4417 : Set private lib path
4418 case "$plibpth" in
4419 '') if ./mips; then
4420                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4421         fi;;
4422 esac
4423 case "$libpth" in
4424 ' ') dlist='';;
4425 '') dlist="$loclibpth $plibpth $glibpth";;
4426 *) dlist="$libpth";;
4427 esac
4428
4429 : Now check and see which directories actually exist, avoiding duplicates
4430 libpth=''
4431 for xxx in $dlist
4432 do
4433     if $test -d $xxx; then
4434                 case " $libpth " in
4435                 *" $xxx "*) ;;
4436                 *) libpth="$libpth $xxx";;
4437                 esac
4438     fi
4439 done
4440 $cat <<'EOM'
4441
4442 Some systems have incompatible or broken versions of libraries.  Among
4443 the directories listed in the question below, please remove any you
4444 know not to be holding relevant libraries, and add any that are needed.
4445 Say "none" for none.
4446
4447 EOM
4448 case "$libpth" in
4449 '') dflt='none';;
4450 *)
4451         set X $libpth
4452         shift
4453         dflt=${1+"$@"}
4454         ;;
4455 esac
4456 rp="Directories to use for library searches?"
4457 . ./myread
4458 case "$ans" in
4459 none) libpth=' ';;
4460 *) libpth="$ans";;
4461 esac
4462
4463 : compute shared library extension
4464 case "$so" in
4465 '')
4466         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4467                 dflt='sl'
4468         else
4469                 dflt='so'
4470         fi
4471         ;;
4472 *) dflt="$so";;
4473 esac
4474 $cat <<EOM
4475
4476 On some systems, shared libraries may be available.  Answer 'none' if
4477 you want to suppress searching of shared libraries for the remainder
4478 of this configuration.
4479
4480 EOM
4481 rp='What is the file extension used for shared libraries?'
4482 . ./myread
4483 so="$ans"
4484
4485 : Define several unixisms.
4486 : Hints files or command line option can be used to override them.
4487 : The convoluted testing is in case hints files set either the old
4488 : or the new name.
4489 case "$_exe" in
4490 '')     case "$exe_ext" in
4491         '')     ;;
4492         *)      _exe="$exe_ext" ;;
4493         esac
4494         ;;
4495 esac
4496 case "$_a" in
4497 '')     case "$lib_ext" in
4498     '') _a='.a';;
4499         *)      _a="$lib_ext" ;;
4500         esac
4501         ;;
4502 esac
4503 case "$_o" in
4504 '') case "$obj_ext" in
4505         '')     _o='.o';;
4506         *)      _o="$obj_ext";;
4507         esac
4508         ;;
4509 esac
4510 case "$p_" in
4511 '') case "$path_sep" in
4512         '')     p_=':';;
4513         *)      p_="$path_sep";;
4514         esac
4515         ;;
4516 esac
4517 exe_ext=$_exe
4518 lib_ext=$_a
4519 obj_ext=$_o
4520 path_sep=$p_
4521
4522 : Which makefile gets called first.  This is used by make depend.
4523 case "$firstmakefile" in
4524 '') firstmakefile='makefile';;
4525 esac
4526
4527 case "$ccflags" in
4528 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4529 esac
4530
4531 case "$uselongdouble" in
4532 $define|true|[yY]*)     dflt='y';;
4533 *) dflt='n';;
4534 esac
4535 cat <<EOM
4536
4537 Perl can be built to take advantage of long doubles which
4538 (if available) may give more accuracy and range for floating point numbers.
4539
4540 If this doesn't make any sense to you, just accept the default '$dflt'.
4541 EOM
4542 rp='Try to use long doubles if available?'
4543 . ./myread
4544 case "$ans" in
4545 y|Y)    val="$define"   ;;
4546 *)      val="$undef"    ;;
4547 esac
4548 set uselongdouble
4549 eval $setvar
4550
4551 case "$uselongdouble" in
4552 true|[yY]*) uselongdouble="$define" ;;
4553 esac
4554
4555 : Look for a hint-file generated 'call-back-unit'.  If the
4556 : user has specified that long doubles should be used,
4557 : we may need to set or change some other defaults.
4558 if $test -f uselongdouble.cbu; then
4559     echo "Your platform has some specific hints regarding long doubles, using them..."
4560     . ./uselongdouble.cbu
4561 else
4562     case "$uselongdouble" in
4563         $define)
4564                 $cat <<EOM
4565 (Your platform does not have any specific hints for long doubles.)
4566 EOM
4567         ;;
4568     esac
4569 fi
4570
4571 : Looking for optional libraries
4572 echo " "
4573 echo "Checking for optional libraries..." >&4
4574 case "$libs" in
4575 ' '|'') dflt='';;
4576 *) dflt="$libs";;
4577 esac
4578 case "$libswanted" in
4579 '') libswanted='c_s';;
4580 esac
4581 case "$usesocks" in
4582 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4583 esac
4584 libsfound=''
4585 libsfiles=''
4586 libsdirs=''
4587 libspath=''
4588 for thisdir in $libpth $xlibpth; do
4589   test -d $thisdir && libspath="$libspath $thisdir"
4590 done
4591 for thislib in $libswanted; do
4592         for thisdir in $libspath; do
4593             xxx=''
4594             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4595                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4596                 $test -f "$xxx" && eval $libscheck
4597                 $test -f "$xxx" && libstyle=shared
4598             fi
4599             if test ! -f "$xxx"; then
4600                 xxx=$thisdir/lib$thislib.$so
4601                 $test -f "$xxx" && eval $libscheck
4602                 $test -f "$xxx" && libstyle=shared
4603             fi  
4604             if test ! -f "$xxx"; then
4605                 xxx=$thisdir/lib$thislib$_a
4606                 $test -f "$xxx" && eval $libscheck
4607                 $test -f "$xxx" && libstyle=static
4608             fi
4609             if test ! -f "$xxx"; then
4610                 xxx=$thisdir/$thislib$_a
4611                 $test -f "$xxx" && eval $libscheck
4612                 $test -f "$xxx" && libstyle=static
4613             fi
4614             if test ! -f "$xxx"; then
4615                 xxx=$thisdir/lib${thislib}_s$_a
4616                 $test -f "$xxx" && eval $libscheck
4617                 $test -f "$xxx" && libstyle=static
4618                 $test -f "$xxx" && thislib=${thislib}_s
4619             fi
4620             if test ! -f "$xxx"; then
4621                 xxx=$thisdir/Slib$thislib$_a
4622                 $test -f "$xxx" && eval $libscheck
4623                 $test -f "$xxx" && libstyle=static
4624             fi
4625             if $test -f "$xxx"; then
4626                 case "$libstyle" in
4627                 shared) echo "Found -l$thislib (shared)." ;;
4628                 static) echo "Found -l$thislib." ;;
4629                 *)      echo "Found -l$thislib ($libstyle)." ;;
4630                 esac
4631                 case " $dflt " in
4632                 *"-l$thislib "*);;
4633                 *) dflt="$dflt -l$thislib"
4634                    libsfound="$libsfound $xxx"
4635                    yyy=`basename $xxx`
4636                    libsfiles="$libsfiles $yyy"
4637                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4638                    case " $libsdirs " in
4639                    *" $yyy "*) ;;
4640                    *) libsdirs="$libsdirs $yyy" ;;
4641                    esac
4642                    ;;
4643                 esac
4644                 break
4645             fi  
4646         done
4647         if $test ! -f "$xxx"; then
4648             echo "No -l$thislib."
4649         fi
4650 done
4651 set X $dflt
4652 shift
4653 dflt="$*"
4654 case "$libs" in
4655 '') dflt="$dflt";;
4656 *) dflt="$libs";;
4657 esac
4658 case "$dflt" in
4659 ' '|'') dflt='none';;
4660 esac
4661
4662 $cat <<EOM
4663
4664 In order to compile $package on your machine, a number of libraries
4665 are usually needed.  Include any other special libraries here as well.
4666 Say "none" for none.  The default list is almost always right.
4667 EOM
4668
4669 echo " "
4670 rp="What libraries to use?"
4671 . ./myread
4672 case "$ans" in
4673 none) libs=' ';;
4674 *) libs="$ans";;
4675 esac
4676
4677 : determine optimization, if desired, or use for debug flag also
4678 case "$optimize" in
4679 ' '|$undef) dflt='none';;
4680 '') dflt='-O';;
4681 *) dflt="$optimize";;
4682 esac
4683 $cat <<EOH
4684
4685 By default, $package compiles with the -O flag to use the optimizer.
4686 Alternately, you might want to use the symbolic debugger, which uses
4687 the -g flag (on traditional Unix systems).  Either flag can be
4688 specified here.  To use neither flag, specify the word "none".
4689
4690 EOH
4691 rp="What optimizer/debugger flag should be used?"
4692 . ./myread
4693 optimize="$ans"
4694 case "$optimize" in
4695 'none') optimize=" ";;
4696 esac
4697
4698 dflt=''
4699 : We will not override a previous value, but we might want to
4700 : augment a hint file
4701 case "$hint" in
4702 default|recommended)
4703         case "$gccversion" in
4704         1*) dflt='-fpcc-struct-return' ;;
4705         esac
4706         case "$optimize" in
4707         *-g*) dflt="$dflt -DDEBUGGING";;
4708         esac
4709         case "$gccversion" in
4710         2*) if test -d /etc/conf/kconfig.d &&
4711                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4712                 then
4713                         # Interactive Systems (ISC) POSIX mode.
4714                         dflt="$dflt -posix"
4715                 fi
4716                 ;;
4717         esac
4718         case "$gccversion" in
4719         1*) ;;
4720         2.[0-8]*) ;;
4721         ?*)     echo " "
4722                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4723                 echo 'int main(void) { return 0; }' > gcctest.c
4724                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4725                         echo "Yes, it does." 2>&1
4726                         case "$ccflags" in
4727                         *strict-aliasing*)
4728                                 echo "Leaving current flags $ccflags alone." 2>&1
4729                                 ;;
4730                         *) dflt="$dflt -fno-strict-aliasing" ;;
4731                         esac
4732                 else
4733                         echo "Nope, it doesn't, but that's ok." 2>&1
4734                 fi
4735                 ;;
4736         esac
4737         # For gcc, adding -pipe speeds up compilations for some, but apparently
4738         # some assemblers can't read from stdin.  (It also slows down compilations
4739         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4740         case "$gccversion" in
4741         ?*)     echo " "
4742                 echo "Checking if your compiler accepts -pipe" 2>&1
4743                 echo 'int main(void) { return 0; }' > gcctest.c
4744                 if $cc -O2 -pipe -o gcctest gcctest.c; then
4745                         echo "Yes, it does." 2>&1
4746                         case "$ccflags" in
4747                         *-pipe*)
4748                                 echo "Leaving current flags $ccflags alone." 2>&1
4749                                 ;;
4750                         *) dflt="$dflt -pipe" ;;
4751                         esac
4752                 else
4753                         echo "Nope, it doesn't, but that's ok." 2>&1
4754                 fi
4755                 ;;
4756         esac
4757         ;;
4758 esac
4759
4760 case "$mips_type" in
4761 *BSD*|'') inclwanted="$locincpth $usrinc";;
4762 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4763 esac
4764 for thisincl in $inclwanted; do
4765         if $test -d $thisincl; then
4766                 if $test x$thisincl != x$usrinc; then
4767                         case "$dflt" in
4768                         *" -I$thisincl "*);;
4769                         *) dflt="$dflt -I$thisincl ";;
4770                         esac
4771                 fi
4772         fi
4773 done
4774
4775 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4776         xxx=true;
4777 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4778         xxx=true;
4779 else
4780         xxx=false;
4781 fi;
4782 if $xxx; then
4783         case "$dflt" in
4784         *$2*);;
4785         *) dflt="$dflt -D$2";;
4786         esac;
4787 fi'
4788
4789 set signal.h LANGUAGE_C; eval $inctest
4790
4791 case "$usesocks" in
4792 $define)
4793         ccflags="$ccflags -DSOCKS"
4794         ;;
4795 esac
4796
4797 case "$hint" in
4798 default|recommended) dflt="$ccflags $dflt" ;;
4799 *) dflt="$ccflags";;
4800 esac
4801
4802 case "$dflt" in
4803 ''|' ') dflt=none;;
4804 esac
4805
4806 $cat <<EOH
4807
4808 Your C compiler may want other flags.  For this question you should include
4809 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4810 but you should NOT include libraries or ld flags like -lwhatever.  If you
4811 want $package to honor its debug switch, you should include -DDEBUGGING here.
4812 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4813
4814 To use no flags, specify the word "none".
4815
4816 EOH
4817 set X $dflt
4818 shift
4819 dflt=${1+"$@"}
4820 rp="Any additional cc flags?"
4821 . ./myread
4822 case "$ans" in
4823 none) ccflags='';;
4824 *) ccflags="$ans";;
4825 esac
4826
4827 : the following weeds options from ccflags that are of no interest to cpp
4828 case "$cppflags" in
4829 '') cppflags="$ccflags" ;;
4830 *)  cppflags="$cppflags $ccflags" ;;
4831 esac
4832 case "$gccversion" in
4833 1*) cppflags="$cppflags -D__GNUC__"
4834 esac
4835 case "$mips_type" in
4836 '');;
4837 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4838 esac
4839 case "$cppflags" in
4840 '');;
4841 *)
4842         echo " "
4843         echo "Let me guess what the preprocessor flags are..." >&4
4844         set X $cppflags
4845         shift
4846         cppflags=''
4847         $cat >cpp.c <<'EOM'
4848 #define BLURFL foo
4849
4850 BLURFL xx LFRULB
4851 EOM
4852         previous=''
4853         for flag in $*
4854         do
4855                 case "$flag" in
4856                 -*) ftry="$flag";;
4857                 *) ftry="$previous $flag";;
4858                 esac
4859                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4860                         >cpp1.out 2>/dev/null && \
4861                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4862                         >cpp2.out 2>/dev/null && \
4863                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4864                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4865                 then
4866                         cppflags="$cppflags $ftry"
4867                         previous=''
4868                 else
4869                         previous="$flag"
4870                 fi
4871         done
4872         set X $cppflags
4873         shift
4874         cppflags=${1+"$@"}
4875         case "$cppflags" in
4876         *-*)  echo "They appear to be: $cppflags";;
4877         esac
4878         $rm -f cpp.c cpp?.out
4879         ;;
4880 esac
4881
4882 : flags used in final linking phase
4883 case "$ldflags" in
4884 '') if ./venix; then
4885                 dflt='-i -z'
4886         else
4887                 dflt=''
4888         fi
4889         case "$ccflags" in
4890         *-posix*) dflt="$dflt -posix" ;;
4891         esac
4892         ;;
4893 *) dflt="$ldflags";;
4894 esac
4895
4896 : Try to guess additional flags to pick up local libraries.
4897 for thislibdir in $libpth; do
4898         case " $loclibpth " in
4899         *" $thislibdir "*)
4900                 case "$dflt " in
4901                 *"-L$thislibdir "*) ;;
4902                 *)  dflt="$dflt -L$thislibdir" ;;
4903                 esac
4904                 ;;
4905         esac
4906 done
4907
4908 case "$dflt" in
4909 '') dflt='none' ;;
4910 esac
4911
4912 $cat <<EOH
4913
4914 Your C linker may need flags.  For this question you should
4915 include -L/whatever and any other flags used by the C linker, but you
4916 should NOT include libraries like -lwhatever.
4917
4918 Make sure you include the appropriate -L/path flags if your C linker
4919 does not normally search all of the directories you specified above,
4920 namely
4921         $libpth
4922 To use no flags, specify the word "none".
4923
4924 EOH
4925
4926 rp="Any additional ld flags (NOT including libraries)?"
4927 . ./myread
4928 case "$ans" in
4929 none) ldflags='';;
4930 *) ldflags="$ans";;
4931 esac
4932 rmlist="$rmlist pdp11"
4933
4934 : coherency check
4935 echo " "
4936 echo "Checking your choice of C compiler and flags for coherency..." >&4
4937 $cat > try.c <<'EOF'
4938 #include <stdio.h>
4939 int main() { printf("Ok\n"); return(0); }
4940 EOF
4941 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4942 shift
4943 $cat >try.msg <<'EOM'
4944 I've tried to compile and run the following simple program:
4945
4946 EOM
4947 $cat try.c >> try.msg
4948
4949 $cat >> try.msg <<EOM
4950
4951 I used the command:
4952
4953         $*
4954         $run ./try
4955
4956 and I got the following output:
4957
4958 EOM
4959 dflt=y
4960 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4961         if $sh -c "$run ./try" >>try.msg 2>&1; then
4962                 xxx=`$run ./try`
4963                 case "$xxx" in
4964                 "Ok") dflt=n ;;
4965                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4966                         case " $libs " in
4967                         *" -lsfio "*)
4968                                 cat >> try.msg <<'EOQS'
4969 If $libs contains -lsfio, and sfio is mis-configured, then it
4970 sometimes (apparently) runs and exits with a 0 status, but with no
4971 output!  It may have to do with sfio's use of _exit vs. exit.
4972
4973 EOQS
4974                                 rp="You have a big problem.  Shall I abort Configure"
4975                                 dflt=y
4976                                 ;;
4977                         esac
4978                         ;;
4979                 esac
4980         else
4981                 echo "The program compiled OK, but exited with status $?." >>try.msg
4982                 rp="You have a problem.  Shall I abort Configure"
4983                 dflt=y
4984         fi
4985 else
4986         echo "I can't compile the test program." >>try.msg
4987         rp="You have a BIG problem.  Shall I abort Configure"
4988         dflt=y
4989 fi
4990 case "$dflt" in
4991 y)
4992         $cat try.msg >&4
4993         case "$knowitall" in
4994         '')
4995                 echo "(The supplied flags or libraries might be incorrect.)"
4996                 ;;
4997         *) dflt=n;;
4998         esac
4999         echo " "
5000         . ./myread
5001         case "$ans" in
5002         n*|N*) ;;
5003         *)      echo "Ok.  Stopping Configure." >&4
5004                 exit 1
5005                 ;;
5006         esac
5007         ;;
5008 n) echo "OK, that should do.";;
5009 esac
5010 $rm -f try try.* core
5011
5012 : define a shorthand compile call
5013 compile='
5014 mc_file=$1;
5015 shift;
5016 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5017 : define a shorthand compile call for compilations that should be ok.
5018 compile_ok='
5019 mc_file=$1;
5020 shift;
5021 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5022
5023 : determine filename position in cpp output
5024 echo " "
5025 echo "Computing filename position in cpp output for #include directives..." >&4
5026 case "$osname" in
5027 vos) testaccess=-e ;;
5028 *)   testaccess=-r ;;
5029 esac
5030 echo '#include <stdio.h>' > foo.c
5031 $cat >fieldn <<EOF
5032 $startsh
5033 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5034 $grep '^[       ]*#.*stdio\.h' | \
5035 while read cline; do
5036         pos=1
5037         set \$cline
5038         while $test \$# -gt 0; do
5039                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5040                         echo "\$pos"
5041                         exit 0
5042                 fi
5043                 shift
5044                 pos=\`expr \$pos + 1\`
5045         done
5046 done
5047 EOF
5048 chmod +x fieldn
5049 fieldn=`./fieldn`
5050 $rm -f foo.c fieldn
5051 case $fieldn in
5052 '') pos='???';;
5053 1) pos=first;;
5054 2) pos=second;;
5055 3) pos=third;;
5056 *) pos="${fieldn}th";;
5057 esac
5058 echo "Your cpp writes the filename in the $pos field of the line."
5059
5060 case "$osname" in
5061 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5062 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5063 *)   cppfilter='' ;;
5064 esac
5065 : locate header file
5066 $cat >findhdr <<EOF
5067 $startsh
5068 wanted=\$1
5069 name=''
5070 for usrincdir in $usrinc
5071 do
5072         if test -f \$usrincdir/\$wanted; then
5073                 echo "\$usrincdir/\$wanted"
5074                 exit 0
5075         fi
5076 done
5077 awkprg='{ print \$$fieldn }'
5078 echo "#include <\$wanted>" > foo\$\$.c
5079 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5080 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5081 while read cline; do
5082         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5083         case "\$name" in
5084         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5085         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5086         *) exit 2;;
5087         esac;
5088 done;
5089 #
5090 # status = 0: grep returned 0 lines, case statement not executed
5091 # status = 1: headerfile found
5092 # status = 2: while loop executed, no headerfile found
5093 #
5094 status=\$?
5095 $rm -f foo\$\$.c;
5096 if test \$status -eq 1; then
5097         exit 0;
5098 fi
5099 exit 1
5100 EOF
5101 chmod +x findhdr
5102
5103 : define an alternate in-header-list? function
5104 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5105 cont=true; xxf="echo \"<\$1> found.\" >&4";
5106 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5107 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5108 esac;
5109 case $# in 4) instead=instead;; *) instead="at last";; esac;
5110 while $test "$cont"; do
5111         xxx=`./findhdr $1`
5112         var=$2; eval "was=\$$2";
5113         if $test "$xxx" && $test -r "$xxx";
5114         then eval $xxf;
5115         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5116                 cont="";
5117         else eval $xxnf;
5118         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5119         set $yyy; shift; shift; yyy=$@;
5120         case $# in 0) cont="";;
5121         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5122                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5123         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5124                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5125         esac;
5126 done;
5127 while $test "$yyy";
5128 do set $yyy; var=$2; eval "was=\$$2";
5129         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5130         set $yyy; shift; shift; yyy=$@;
5131 done'
5132
5133 : see if stdlib is available
5134 set stdlib.h i_stdlib
5135 eval $inhdr
5136
5137 : check for lengths of integral types
5138 echo " "
5139 case "$intsize" in
5140 '')
5141         echo "Checking to see how big your integers are..." >&4
5142         $cat >try.c <<EOCP
5143 #include <stdio.h>
5144 #$i_stdlib I_STDLIB
5145 #ifdef I_STDLIB
5146 #include <stdlib.h>
5147 #endif
5148 int main()
5149 {
5150         printf("intsize=%d;\n", (int)sizeof(int));
5151         printf("longsize=%d;\n", (int)sizeof(long));
5152         printf("shortsize=%d;\n", (int)sizeof(short));
5153         exit(0);
5154 }
5155 EOCP
5156         set try
5157         if eval $compile_ok && $run ./try > /dev/null; then
5158                 eval `$run ./try`
5159                 echo "Your integers are $intsize bytes long."
5160                 echo "Your long integers are $longsize bytes long."
5161                 echo "Your short integers are $shortsize bytes long."
5162         else
5163                 $cat >&4 <<EOM
5164 !
5165 Help! I can't compile and run the intsize test program: please enlighten me!
5166 (This is probably a misconfiguration in your system or libraries, and
5167 you really ought to fix it.  Still, I'll try anyway.)
5168 !
5169 EOM
5170                 dflt=4
5171                 rp="What is the size of an integer (in bytes)?"
5172                 . ./myread
5173                 intsize="$ans"
5174                 dflt=$intsize
5175                 rp="What is the size of a long integer (in bytes)?"
5176                 . ./myread
5177                 longsize="$ans"
5178                 dflt=2
5179                 rp="What is the size of a short integer (in bytes)?"
5180                 . ./myread
5181                 shortsize="$ans"
5182         fi
5183         ;;
5184 esac
5185 $rm -f try try.*
5186
5187 : check for long long
5188 echo " "
5189 echo "Checking to see if you have long long..." >&4
5190 echo 'int main() { long long x = 7; return 0; }' > try.c
5191 set try
5192 if eval $compile; then
5193         val="$define"
5194         echo "You have long long."
5195 else
5196         val="$undef"
5197         echo "You do not have long long."
5198 fi
5199 $rm try.*
5200 set d_longlong
5201 eval $setvar
5202
5203 : check for length of long long
5204 case "${d_longlong}${longlongsize}" in
5205 $define)
5206         echo " "
5207         echo "Checking to see how big your long longs are..." >&4
5208         $cat >try.c <<'EOCP'
5209 #include <stdio.h>
5210 int main()
5211 {
5212     printf("%d\n", (int)sizeof(long long));
5213     return(0);
5214 }
5215 EOCP
5216         set try
5217         if eval $compile_ok; then
5218                 longlongsize=`$run ./try`
5219                 echo "Your long longs are $longlongsize bytes long."
5220         else
5221                 dflt='8'
5222                 echo " "
5223                 echo "(I can't seem to compile the test program.  Guessing...)"
5224                 rp="What is the size of a long long (in bytes)?"
5225                 . ./myread
5226                 longlongsize="$ans"
5227         fi
5228         if $test "X$longsize" = "X$longlongsize"; then
5229                 echo "(That isn't any different from an ordinary long.)"
5230         fi      
5231         ;;
5232 esac
5233 $rm -f try.* try
5234
5235 : see if inttypes.h is available
5236 : we want a real compile instead of Inhdr because some systems
5237 : have an inttypes.h which includes non-existent headers
5238 echo " "
5239 $cat >try.c <<EOCP
5240 #include <inttypes.h>
5241 int main() {
5242         static int32_t foo32 = 0x12345678;
5243 }
5244 EOCP
5245 set try
5246 if eval $compile; then
5247         echo "<inttypes.h> found." >&4
5248         val="$define"
5249 else
5250         echo "<inttypes.h> NOT found." >&4
5251         val="$undef"
5252 fi
5253 $rm -f try.c try
5254 set i_inttypes
5255 eval $setvar
5256
5257 : check for int64_t
5258 echo " "
5259 echo "Checking to see if you have int64_t..." >&4
5260 $cat >try.c <<EOCP
5261 #include <sys/types.h>
5262 #$i_inttypes I_INTTYPES
5263 #ifdef I_INTTYPES
5264 #include <inttypes.h>
5265 #endif
5266 int main() { int64_t x = 7; }
5267 EOCP
5268 set try
5269 if eval $compile; then
5270         val="$define"
5271         echo "You have int64_t."
5272 else
5273         val="$undef"
5274         echo "You do not have int64_t."
5275 fi
5276 $rm -f try try.*
5277 set d_int64_t
5278 eval $setvar
5279
5280
5281 echo " "
5282 echo "Checking which 64-bit integer type we could use..." >&4
5283
5284 case "$intsize" in
5285 8) val=int
5286    set quadtype
5287    eval $setvar
5288    val='"unsigned int"'
5289    set uquadtype
5290    eval $setvar
5291    quadkind=1
5292    ;;
5293 *) case "$longsize" in
5294    8) val=long
5295       set quadtype
5296       eval $setvar
5297       val='"unsigned long"'
5298       set uquadtype
5299       eval $setvar
5300       quadkind=2
5301       ;;
5302    *) case "$d_longlong:$longlongsize" in
5303       define:8)
5304         val='"long long"'
5305         set quadtype
5306         eval $setvar
5307         val='"unsigned long long"'
5308         set uquadtype
5309         eval $setvar
5310         quadkind=3
5311         ;;
5312       *) case "$d_int64_t" in
5313          define)
5314            val=int64_t
5315            set quadtype
5316            eval $setvar
5317            val=uint64_t
5318            set uquadtype
5319            eval $setvar
5320            quadkind=4
5321            ;;
5322          esac
5323          ;;
5324       esac
5325       ;;
5326    esac
5327    ;;
5328 esac
5329
5330 case "$quadtype" in
5331 '')     echo "Alas, no 64-bit integer types in sight." >&4
5332         d_quad="$undef"
5333         ;;
5334 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5335         d_quad="$define"
5336         ;;
5337 esac
5338
5339
5340 case "$uselonglong" in
5341 "$define"|true|[yY]*)
5342         cat <<EOM >&4
5343
5344 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5345 EOM
5346         use64bitint="$define"
5347         ;;
5348 esac                          
5349 case "$use64bits" in
5350 "$define"|true|[yY]*)
5351         cat <<EOM >&4
5352
5353 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5354 EOM
5355         use64bitint="$define"
5356         ;;
5357 esac                          
5358 case "$use64bitints" in
5359 "$define"|true|[yY]*)
5360         cat <<EOM >&4
5361
5362 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5363 EOM
5364         use64bitint="$define"
5365         ;;
5366 esac                          
5367 case "$use64bitsint" in
5368 "$define"|true|[yY]*)
5369         cat <<EOM >&4
5370
5371 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5372 EOM
5373         use64bitint="$define"
5374         ;;
5375 esac                          
5376 case "$uselonglongs" in
5377 "$define"|true|[yY]*)
5378         cat <<EOM >&4
5379
5380 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5381 EOM
5382         use64bitint="$define"
5383         ;;
5384 esac                          
5385 case "$use64bitsall" in
5386 "$define"|true|[yY]*)
5387         cat <<EOM >&4
5388
5389 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5390 EOM
5391         use64bitall="$define"
5392         ;;
5393 esac                          
5394
5395 case "$ccflags" in
5396 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5397 esac
5398 case "$use64bitall" in
5399 "$define"|true|[yY]*) use64bitint="$define" ;;
5400 esac
5401
5402 case "$longsize" in
5403 8) cat <<EOM
5404
5405 You have natively 64-bit long integers.
5406 EOM
5407    val="$define"
5408    ;;
5409 *) case "$use64bitint" in
5410    "$define"|true|[yY]*) dflt='y';;
5411    *) dflt='n';;
5412    esac
5413    case "$d_quad" in
5414    "$define") ;;
5415    *) dflt='n' ;;
5416    esac
5417    cat <<EOM
5418
5419 Perl can be built to take advantage of 64-bit integer types
5420 on some systems.  To do so, Configure can be run with -Duse64bitint.
5421 Choosing this option will most probably introduce binary incompatibilities.
5422
5423 If this doesn't make any sense to you, just accept the default '$dflt'.
5424 (The default has been chosen based on your configuration.)
5425 EOM
5426    rp='Try to use 64-bit integers, if available?'
5427    . ./myread
5428    case "$ans" in
5429    [yY]*) val="$define" ;;
5430    *)     val="$undef"  ;;
5431    esac
5432    ;;
5433 esac
5434 set use64bitint
5435 eval $setvar
5436
5437 case "$use64bitall" in
5438 "$define"|true|[yY]*) dflt='y' ;;
5439 *) case "$longsize" in
5440    8) dflt='y' ;;
5441    *) dflt='n' ;;
5442    esac
5443    ;;
5444 esac    
5445 cat <<EOM
5446
5447 You may also choose to try maximal 64-bitness.  It means using as much
5448 64-bitness as possible on the platform.  This in turn means even more
5449 binary incompatibilities.  On the other hand, your platform may not
5450 have any more 64-bitness available than what you already have chosen.
5451
5452 If this doesn't make any sense to you, just accept the default '$dflt'.
5453 (The default has been chosen based on your configuration.)
5454 EOM
5455 rp='Try to use maximal 64-bit support, if available?'
5456 . ./myread
5457 case "$ans" in
5458 [yY]*) val="$define" ;;
5459 *)     val="$undef"  ;;
5460 esac
5461 set use64bitall
5462 eval $setvar
5463 case "$use64bitall" in
5464 "$define")
5465         case "$use64bitint" in
5466         "$undef")
5467                 cat <<EOM
5468
5469 Since you have chosen a maximally 64-bit build, I'm also turning on
5470 the use of 64-bit integers.
5471 EOM
5472                 use64bitint="$define" ;;
5473         esac
5474         ;;
5475 esac
5476
5477 : Look for a hint-file generated 'call-back-unit'.  If the
5478 : user has specified that a 64-bit perl is to be built,
5479 : we may need to set or change some other defaults.
5480 if $test -f use64bitint.cbu; then
5481         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5482         . ./use64bitint.cbu
5483 fi
5484 case "$use64bitint" in
5485 "$define"|true|[yY]*)
5486         case "$longsize" in
5487         4) case "$archname64" in
5488            '') archname64=64int ;;
5489            esac
5490            ;;
5491         esac
5492         ;;
5493 esac
5494
5495 : Look for a hint-file generated 'call-back-unit'.  If the
5496 : user has specified that a maximally 64-bit perl is to be built,
5497 : we may need to set or change some other defaults.
5498 if $test -f use64bitall.cbu; then
5499         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5500         . ./use64bitall.cbu
5501 fi
5502 case "$use64bitall" in
5503 "$define"|true|[yY]*)
5504         case "$longsize" in
5505         4) case "$archname64" in
5506            ''|64int) archname64=64all ;;
5507            esac
5508            ;;
5509         esac
5510         ;;
5511 esac
5512
5513 case "$d_quad:$use64bitint" in
5514 $undef:$define)
5515         cat >&4 <<EOF
5516
5517 *** You have chosen to use 64-bit integers,
5518 *** but none can be found.
5519 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5520 *** Cannot continue, aborting.
5521
5522 EOF
5523         exit 1
5524         ;;
5525 esac
5526
5527 : check for length of double
5528 echo " "
5529 case "$doublesize" in
5530 '')
5531         echo "Checking to see how big your double precision numbers are..." >&4
5532         $cat >try.c <<EOCP
5533 #include <stdio.h>
5534 #$i_stdlib I_STDLIB
5535 #ifdef I_STDLIB
5536 #include <stdlib.h>
5537 #endif
5538 int main()
5539 {
5540     printf("%d\n", (int)sizeof(double));
5541     exit(0);
5542 }
5543 EOCP
5544         set try
5545         if eval $compile_ok; then
5546                 doublesize=`$run ./try`
5547                 echo "Your double is $doublesize bytes long."
5548         else
5549                 dflt='8'
5550                 echo "(I can't seem to compile the test program.  Guessing...)"
5551                 rp="What is the size of a double precision number (in bytes)?"
5552                 . ./myread
5553                 doublesize="$ans"
5554         fi
5555         ;;
5556 esac
5557 $rm -f try.c try
5558
5559 : check for long doubles
5560 echo " "
5561 echo "Checking to see if you have long double..." >&4
5562 echo 'int main() { long double x = 7.0; }' > try.c
5563 set try
5564 if eval $compile; then
5565         val="$define"
5566         echo "You have long double."
5567 else
5568         val="$undef"
5569         echo "You do not have long double."
5570 fi
5571 $rm try.*
5572 set d_longdbl
5573 eval $setvar
5574
5575 : check for length of long double
5576 case "${d_longdbl}${longdblsize}" in
5577 $define)
5578         echo " "
5579         echo "Checking to see how big your long doubles are..." >&4
5580         $cat >try.c <<'EOCP'
5581 #include <stdio.h>
5582 int main()
5583 {
5584         printf("%d\n", sizeof(long double));
5585 }
5586 EOCP
5587         set try
5588         set try
5589         if eval $compile; then
5590                 longdblsize=`$run ./try`
5591                 echo "Your long doubles are $longdblsize bytes long."
5592         else
5593                 dflt='8'
5594                 echo " "
5595                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5596                 rp="What is the size of a long double (in bytes)?"
5597                 . ./myread
5598                 longdblsize="$ans"
5599         fi
5600         if $test "X$doublesize" = "X$longdblsize"; then
5601                 echo "That isn't any different from an ordinary double."
5602                 echo "I'll keep your setting anyway, but you may see some"
5603                 echo "harmless compilation warnings."
5604         fi      
5605         ;;
5606 esac
5607 $rm -f try.* try
5608
5609 : determine the architecture name
5610 echo " "
5611 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5612         tarch=`arch`"-$osname"
5613 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5614         if uname -m > tmparch 2>&1 ; then
5615                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5616                         -e 's/$/'"-$osname/" tmparch`
5617         else
5618                 tarch="$osname"
5619         fi
5620         $rm -f tmparch
5621 else
5622         tarch="$osname"
5623 fi
5624 case "$myarchname" in
5625 ''|"$tarch") ;;
5626 *)
5627         echo "(Your architecture name used to be $myarchname.)"
5628         archname=''
5629         ;;
5630 esac
5631 case "$targetarch" in
5632 '') ;;
5633 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5634 esac
5635 myarchname="$tarch"
5636 case "$archname" in
5637 '') dflt="$tarch";;
5638 *) dflt="$archname";;
5639 esac
5640 rp='What is your architecture name'
5641 . ./myread
5642 archname="$ans"
5643 case "$usethreads" in
5644 $define)
5645         echo "Threads selected." >&4
5646         case "$archname" in
5647         *-thread*) echo "...and architecture name already has -thread." >&4
5648                 ;;
5649         *)      archname="$archname-thread"
5650                 echo "...setting architecture name to $archname." >&4
5651                 ;;
5652         esac
5653         ;;
5654 esac
5655 case "$usemultiplicity" in
5656 $define)
5657         echo "Multiplicity selected." >&4
5658         case "$archname" in
5659         *-multi*) echo "...and architecture name already has -multi." >&4
5660                 ;;
5661         *)      archname="$archname-multi"
5662                 echo "...setting architecture name to $archname." >&4
5663                 ;;
5664         esac
5665         ;;
5666 esac
5667 case "$use64bitint$use64bitall" in
5668 *"$define"*)
5669         case "$archname64" in
5670         '')
5671                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5672                 ;;
5673         *)
5674                 case "$use64bitint" in
5675                 "$define") echo "64 bit integers selected." >&4 ;;
5676                 esac
5677                 case "$use64bitall" in
5678                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5679                 esac
5680                 case "$archname" in
5681                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5682                         ;;
5683                 *)      archname="$archname-$archname64"
5684                         echo "...setting architecture name to $archname." >&4
5685                         ;;
5686                 esac
5687                 ;;
5688         esac
5689 esac
5690 case "$uselongdouble" in
5691 $define)
5692         echo "Long doubles selected." >&4
5693         case "$longdblsize" in
5694         $doublesize)
5695                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5696                 ;;
5697         *)
5698                 case "$archname" in
5699                 *-ld*) echo "...and architecture name already has -ld." >&4
5700                         ;;
5701                 *)      archname="$archname-ld"
5702                         echo "...setting architecture name to $archname." >&4
5703                         ;;
5704                 esac
5705                 ;;
5706         esac
5707         ;;
5708 esac
5709 case "$useperlio" in
5710 $define)
5711         echo "Perlio selected." >&4
5712         ;;
5713 *)
5714         echo "Perlio not selected, using stdio." >&4
5715         case "$archname" in
5716         *-stdio*) echo "...and architecture name already has -stdio." >&4
5717                 ;;
5718         *)      archname="$archname-stdio"
5719                 echo "...setting architecture name to $archname." >&4
5720                 ;;
5721         esac
5722         ;;
5723 esac
5724 if $test -f archname.cbu; then
5725         echo "Your platform has some specific hints for architecture name, using them..."
5726         . ./archname.cbu
5727 fi
5728
5729 : determine root of directory hierarchy where package will be installed.
5730 case "$prefix" in
5731 '')
5732         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5733         ;;
5734 *?/)
5735         dflt=`echo "$prefix" | sed 's/.$//'`
5736         ;;
5737 *)
5738         dflt="$prefix"
5739         ;;
5740 esac
5741 $cat <<EOM
5742
5743 By default, $package will be installed in $dflt/bin, manual pages
5744 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5745 installation directories. Typically this is something like /usr/local.
5746 If you wish to have binaries under /usr/bin but other parts of the
5747 installation under /usr/local, that's ok: you will be prompted
5748 separately for each of the installation directories, the prefix being
5749 only used to set the defaults.
5750
5751 EOM
5752 fn=d~
5753 rp='Installation prefix to use?'
5754 . ./getfile
5755 oldprefix=''
5756 case "$prefix" in
5757 '') ;;
5758 *)
5759         case "$ans" in
5760         "$prefix") ;;
5761         *) oldprefix="$prefix";;
5762         esac
5763         ;;
5764 esac
5765 prefix="$ans"
5766 prefixexp="$ansexp"
5767
5768 case "$afsroot" in
5769 '')     afsroot=/afs ;;
5770 *)      afsroot=$afsroot ;;
5771 esac
5772
5773 : is AFS running?
5774 echo " "
5775 case "$afs" in
5776 $define|true)   afs=true ;;
5777 $undef|false)   afs=false ;;
5778 *)      if test -d $afsroot; then
5779                 afs=true
5780         else
5781                 afs=false
5782         fi
5783         ;;
5784 esac
5785 if $afs; then
5786         echo "AFS may be running... I'll be extra cautious then..." >&4
5787 else
5788         echo "AFS does not seem to be running..." >&4
5789 fi
5790
5791 : determine installation prefix for where package is to be installed.
5792 if $afs; then 
5793 $cat <<EOM
5794
5795 Since you are running AFS, I need to distinguish the directory in which
5796 files will reside from the directory in which they are installed (and from
5797 which they are presumably copied to the former directory by occult means).
5798
5799 EOM
5800         case "$installprefix" in
5801         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5802         *) dflt="$installprefix";;
5803         esac
5804 else
5805 $cat <<EOM
5806
5807 In some special cases, particularly when building $package for distribution,
5808 it is convenient to distinguish the directory in which files should be
5809 installed from the directory ($prefix) in which they will
5810 eventually reside.  For most users, these two directories are the same.
5811
5812 EOM
5813         case "$installprefix" in
5814         '') dflt=$prefix ;;
5815         *) dflt=$installprefix;;
5816         esac
5817 fi
5818 fn=d~
5819 rp='What installation prefix should I use for installing files?'
5820 . ./getfile
5821 installprefix="$ans"
5822 installprefixexp="$ansexp"
5823
5824 : set the prefixit variable, to compute a suitable default value
5825 prefixit='case "$3" in
5826 ""|none)
5827         case "$oldprefix" in
5828         "") eval "$1=\"\$$2\"";;
5829         *)
5830                 case "$3" in
5831                 "") eval "$1=";;
5832                 none)
5833                         eval "tp=\"\$$2\"";
5834                         case "$tp" in
5835                         ""|" ") eval "$1=\"\$$2\"";;
5836                         *) eval "$1=";;
5837                         esac;;
5838                 esac;;
5839         esac;;
5840 *)
5841         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5842         case "$tp" in
5843         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5844         /*-$oldprefix/*|\~*-$oldprefix/*)
5845                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5846         *) eval "$1=\"\$$2\"";;
5847         esac;;
5848 esac'
5849
5850 : get the patchlevel
5851 echo " "
5852 echo "Getting the current patchlevel..." >&4
5853 if $test -r $rsrc/patchlevel.h;then
5854         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5855         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5856         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5857         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5858         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5859         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5860        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5861 else
5862         revision=0
5863         patchlevel=0
5864         subversion=0
5865         api_revision=0
5866         api_version=0
5867         api_subversion=0
5868         perl_patchlevel=0
5869         $echo "(You do not have patchlevel.h.  Eek.)"
5870 fi
5871 if $test -r $rsrc/.patch ; then  
5872         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5873                 perl_patchlevel=`cat $rsrc/.patch`
5874         fi
5875 fi
5876 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5877 version_patchlevel_string="version $patchlevel subversion $subversion"
5878 case "$perl_patchlevel" in
5879 0|'') ;;
5880 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5881 esac
5882
5883 $echo "(You have $package $version_patchlevel_string.)"
5884
5885 case "$osname" in
5886 dos|vms)
5887         : XXX Should be a Configure test for double-dots in filenames.
5888         version=`echo $revision $patchlevel $subversion | \
5889                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5890         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5891                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5892         ;;
5893 *)
5894         version=`echo $revision $patchlevel $subversion | \
5895                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5896         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5897                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5898         ;;
5899 esac
5900 : Special case the 5.005_xx maintenance series, which used 5.005
5901 : without any subversion label as a subdirectory in $sitelib
5902 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5903         api_versionstring='5.005'
5904 fi
5905
5906 : determine installation style
5907 : For now, try to deduce it from prefix unless it is already set.
5908 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5909 case "$installstyle" in
5910 '')     case "$prefix" in
5911                 *perl*) dflt='lib';;
5912                 *) dflt='lib/perl5' ;;
5913         esac
5914         ;;
5915 *)      dflt="$installstyle" ;;
5916 esac
5917 : Probably not worth prompting for this since we prompt for all
5918 : the directories individually, and the prompt would be too long and
5919 : confusing anyway.
5920 installstyle=$dflt
5921
5922 : determine where private library files go
5923 : Usual default is /usr/local/lib/perl5/$version.
5924 : Also allow things like /opt/perl/lib/$version, since 
5925 : /opt/perl/lib/perl5... would be redundant.
5926 : The default "style" setting is made in installstyle.U
5927 case "$installstyle" in
5928 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5929 *)       set dflt privlib lib/$version ;;
5930 esac
5931 eval $prefixit
5932 $cat <<EOM
5933
5934 There are some auxiliary files for $package that need to be put into a
5935 private library directory that is accessible by everyone.
5936
5937 EOM
5938 fn=d~+
5939 rp='Pathname where the private library files will reside?'
5940 . ./getfile
5941 privlib="$ans"
5942 privlibexp="$ansexp"
5943 : Change installation prefix, if necessary.
5944 if $test X"$prefix" != X"$installprefix"; then
5945         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5946 else
5947         installprivlib="$privlibexp"
5948 fi
5949
5950 : set the prefixup variable, to restore leading tilda escape
5951 prefixup='case "$prefixexp" in
5952 "$prefix") ;;
5953 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5954 esac'
5955
5956 : determine where public architecture dependent libraries go
5957 set archlib archlib
5958 eval $prefixit
5959 : privlib default is /usr/local/lib/$package/$version
5960 : archlib default is /usr/local/lib/$package/$version/$archname
5961 : privlib may have an optional trailing /share.
5962 tdflt=`echo $privlib | $sed 's,/share$,,'`
5963 tdflt=$tdflt/$archname
5964 case "$archlib" in
5965 '')     dflt=$tdflt
5966         ;;
5967 *)      dflt="$archlib"
5968     ;;
5969 esac
5970 $cat <<EOM
5971
5972 $spackage contains architecture-dependent library files.  If you are
5973 sharing libraries in a heterogeneous environment, you might store
5974 these files in a separate location.  Otherwise, you can just include
5975 them with the rest of the public library files.
5976
5977 EOM
5978 fn=d+~
5979 rp='Where do you want to put the public architecture-dependent libraries?'
5980 . ./getfile
5981 archlib="$ans"
5982 archlibexp="$ansexp"
5983 if $test X"$archlib" = X"$privlib"; then
5984         d_archlib="$undef"
5985 else
5986         d_archlib="$define"
5987 fi
5988 : Change installation prefix, if necessary.
5989 if $test X"$prefix" != X"$installprefix"; then
5990         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5991 else
5992         installarchlib="$archlibexp"
5993 fi
5994
5995 : see if setuid scripts can be secure
5996 $cat <<EOM
5997
5998 Some kernels have a bug that prevents setuid #! scripts from being
5999 secure.  Some sites have disabled setuid #! scripts because of this.
6000
6001 First let's decide if your kernel supports secure setuid #! scripts.
6002 (If setuid #! scripts would be secure but have been disabled anyway,
6003 don't say that they are secure if asked.)
6004
6005 EOM
6006
6007 val="$undef"
6008 if $test -d /dev/fd; then
6009         echo "#!$ls" >reflect
6010         chmod +x,u+s reflect
6011         ./reflect >flect 2>&1
6012         if $contains "/dev/fd" flect >/dev/null; then
6013                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6014                 val="$define"
6015         else
6016                 $cat <<EOM
6017 If you are not sure if they are secure, I can check but I'll need a
6018 username and password different from the one you are using right now.
6019 If you don't have such a username or don't want me to test, simply
6020 enter 'none'.
6021
6022 EOM
6023                 rp='Other username to test security of setuid scripts with?'
6024                 dflt='none'
6025                 . ./myread
6026                 case "$ans" in
6027                 n|none)
6028                         case "$d_suidsafe" in
6029                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6030                                 dflt=n;;
6031                         "$undef")
6032                                 echo "Well, the $hint value is *not* secure." >&4
6033                                 dflt=n;;
6034                         *)      echo "Well, the $hint value *is* secure." >&4
6035                                 dflt=y;;
6036                         esac
6037                         ;;
6038                 *)
6039                         $rm -f reflect flect
6040                         echo "#!$ls" >reflect
6041                         chmod +x,u+s reflect
6042                         echo >flect
6043                         chmod a+w flect
6044                         echo '"su" will (probably) prompt you for '"$ans's password."
6045                         su $ans -c './reflect >flect'
6046                         if $contains "/dev/fd" flect >/dev/null; then
6047                                 echo "Okay, it looks like setuid scripts are secure." >&4
6048                                 dflt=y
6049                         else
6050                                 echo "I don't think setuid scripts are secure." >&4
6051                                 dflt=n
6052                         fi
6053                         ;;
6054                 esac
6055                 rp='Does your kernel have *secure* setuid scripts?'
6056                 . ./myread
6057                 case "$ans" in
6058                 [yY]*)  val="$define";;
6059                 *)      val="$undef";;
6060                 esac
6061         fi
6062 else
6063         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6064         echo "(That's for file descriptors, not floppy disks.)"
6065         val="$undef"
6066 fi
6067 set d_suidsafe
6068 eval $setvar
6069
6070 $rm -f reflect flect
6071
6072 : now see if they want to do setuid emulation
6073 echo " "
6074 val="$undef"
6075 case "$d_suidsafe" in
6076 "$define")
6077         val="$undef"
6078         echo "No need to emulate SUID scripts since they are secure here." >&4
6079         ;;
6080 *)
6081         $cat <<EOM
6082 Some systems have disabled setuid scripts, especially systems where
6083 setuid scripts cannot be secure.  On systems where setuid scripts have
6084 been disabled, the setuid/setgid bits on scripts are currently
6085 useless.  It is possible for $package to detect those bits and emulate
6086 setuid/setgid in a secure fashion.  This emulation will only work if
6087 setuid scripts have been disabled in your kernel.
6088
6089 EOM
6090         case "$d_dosuid" in
6091         "$define") dflt=y ;;
6092         *) dflt=n ;;
6093         esac
6094         rp="Do you want to do setuid/setgid emulation?"
6095         . ./myread
6096         case "$ans" in
6097         [yY]*)  val="$define";;
6098         *)      val="$undef";;
6099         esac
6100         ;;
6101 esac
6102 set d_dosuid
6103 eval $setvar
6104
6105 : see if this is a malloc.h system
6106 : we want a real compile instead of Inhdr because some systems have a
6107 : malloc.h that just gives a compile error saying to use stdlib.h instead
6108 echo " "
6109 $cat >try.c <<EOCP
6110 #include <stdlib.h>
6111 #include <malloc.h>
6112 int main () { return 0; }
6113 EOCP
6114 set try
6115 if eval $compile; then
6116     echo "<malloc.h> found." >&4
6117     val="$define"
6118 else
6119     echo "<malloc.h> NOT found." >&4
6120     val="$undef"
6121 fi
6122 $rm -f try.c try
6123 set i_malloc
6124 eval $setvar
6125
6126 : check for void type
6127 echo " "
6128 echo "Checking to see how well your C compiler groks the void type..." >&4
6129 case "$voidflags" in
6130 '')
6131         $cat >try.c <<EOCP
6132 #$i_stdlib I_STDLIB
6133 #ifdef I_STDLIB
6134 #include <stdlib.h>
6135 #endif
6136 #if TRY & 1
6137 void sub() {
6138 #else
6139 sub() {
6140 #endif
6141         extern void moo();      /* function returning void */
6142         void (*goo)();          /* ptr to func returning void */
6143 #if TRY & 8
6144         void *hue;              /* generic ptr */
6145 #endif
6146 #if TRY & 2
6147         void (*foo[10])();
6148 #endif
6149
6150 #if TRY & 4
6151         if(goo == moo) {
6152                 exit(0);
6153         }
6154 #endif
6155         exit(0);
6156 }
6157 int main() { sub(); }
6158 EOCP
6159         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6160                 voidflags=$defvoidused
6161         echo "Good.  It appears to support void to the level $package wants.">&4
6162                 if $contains warning .out >/dev/null 2>&1; then
6163                         echo "However, you might get some warnings that look like this:"
6164                         $cat .out
6165                 fi
6166         else
6167 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6168                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6169                         echo "It supports 1..."
6170                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6171                                 echo "It also supports 2..."
6172                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6173                                         voidflags=7
6174                                         echo "And it supports 4 but not 8 definitely."
6175                                 else
6176                                         echo "It doesn't support 4..."
6177                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6178                                                 voidflags=11
6179                                                 echo "But it supports 8."
6180                                         else
6181                                                 voidflags=3
6182                                                 echo "Neither does it support 8."
6183                                         fi
6184                                 fi
6185                         else
6186                                 echo "It does not support 2..."
6187                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6188                                         voidflags=13
6189                                         echo "But it supports 4 and 8."
6190                                 else
6191                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6192                                                 voidflags=5
6193                                                 echo "And it supports 4 but has not heard about 8."
6194                                         else
6195                                                 echo "However it supports 8 but not 4."
6196                                         fi
6197                                 fi
6198                         fi
6199                 else
6200                         echo "There is no support at all for void."
6201                         voidflags=0
6202                 fi
6203         fi
6204 esac
6205 case "$voidflags" in
6206 "$defvoidused") ;;
6207 *)      $cat >&4 <<'EOM'
6208   Support flag bits are:
6209     1: basic void declarations.
6210     2: arrays of pointers to functions returning void.
6211     4: operations between pointers to and addresses of void functions.
6212     8: generic void pointers.
6213 EOM
6214         dflt="$voidflags";
6215         rp="Your void support flags add up to what?"
6216         . ./myread
6217         voidflags="$ans"
6218         ;;
6219 esac
6220 $rm -f try.* .out
6221
6222 : check for length of pointer
6223 echo " "
6224 case "$ptrsize" in
6225 '')
6226         echo "Checking to see how big your pointers are..." >&4
6227         if test "$voidflags" -gt 7; then
6228                 echo '#define VOID_PTR char *' > try.c
6229         else
6230                 echo '#define VOID_PTR void *' > try.c
6231         fi
6232         $cat >>try.c <<EOCP
6233 #include <stdio.h>
6234 #$i_stdlib I_STDLIB
6235 #ifdef I_STDLIB
6236 #include <stdlib.h>
6237 #endif
6238 int main()
6239 {
6240     printf("%d\n", (int)sizeof(VOID_PTR));
6241     exit(0);
6242 }
6243 EOCP
6244         set try
6245         if eval $compile_ok; then
6246                 ptrsize=`$run ./try`
6247                 echo "Your pointers are $ptrsize bytes long."
6248         else
6249                 dflt='4'
6250                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6251                 rp="What is the size of a pointer (in bytes)?"
6252                 . ./myread
6253                 ptrsize="$ans"
6254         fi
6255         ;;
6256 esac
6257 $rm -f try.c try
6258 case "$use64bitall" in
6259 "$define"|true|[yY]*)
6260         case "$ptrsize" in
6261         4)      cat <<EOM >&4
6262
6263 *** You have chosen a maximally 64-bit build,
6264 *** but your pointers are only 4 bytes wide.
6265 *** Please rerun Configure without -Duse64bitall.
6266 EOM
6267                 case "$d_quad" in
6268                 define)
6269                         cat <<EOM >&4
6270 *** Since you have quads, you could possibly try with -Duse64bitint.
6271 EOM
6272                         ;;
6273                 esac
6274                 cat <<EOM >&4
6275 *** Cannot continue, aborting.
6276
6277 EOM
6278
6279                 exit 1
6280                 ;;
6281         esac
6282         ;;
6283 esac
6284
6285
6286 : determine whether to use malloc wrapping
6287 echo " "
6288 case "$usemallocwrap" in
6289 [yY]*|true|$define)     dflt='y' ;;
6290 [nN]*|false|$undef)     dflt='n' ;;
6291 *)      case "$usedevel" in
6292         [yY]*|true|$define)     dflt='y' ;;
6293         *) dflt='n' ;;
6294         esac
6295         ;;
6296 esac
6297 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6298 . ./myread
6299 usemallocwrap="$ans"
6300 case "$ans" in
6301 y*|true)
6302         usemallocwrap="$define" ;;
6303 *)
6304         usemallocwrap="$undef" ;;
6305 esac
6306
6307 : determine which malloc to compile in
6308 echo " "
6309 case "$usemymalloc" in
6310 [yY]*|true|$define)     dflt='y' ;;
6311 [nN]*|false|$undef)     dflt='n' ;;
6312 *)      case "$ptrsize" in
6313         4) dflt='y' ;;
6314         *) dflt='n' ;;
6315         esac
6316         ;;
6317 esac
6318 rp="Do you wish to attempt to use the malloc that comes with $package?"
6319 . ./myread
6320 usemymalloc="$ans"
6321 case "$ans" in
6322 y*|true)
6323         usemymalloc='y'
6324         mallocsrc='malloc.c'
6325         mallocobj="malloc$_o"
6326         d_mymalloc="$define"
6327         case "$libs" in
6328         *-lmalloc*)
6329                 : Remove malloc from list of libraries to use
6330                 echo "Removing unneeded -lmalloc from library list" >&4
6331                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6332                 shift
6333                 libs="$*"
6334                 echo "libs = $libs" >&4
6335                 ;;
6336         esac
6337         ;;
6338 *)
6339         usemymalloc='n'
6340         mallocsrc=''
6341         mallocobj=''
6342         d_mymalloc="$undef"
6343         ;;
6344 esac
6345
6346 : compute the return types of malloc and free
6347 echo " "
6348 $cat >malloc.c <<END
6349 #$i_malloc I_MALLOC
6350 #$i_stdlib I_STDLIB
6351 #include <stdio.h>
6352 #include <sys/types.h>
6353 #ifdef I_MALLOC
6354 #include <malloc.h>
6355 #endif
6356 #ifdef I_STDLIB
6357 #include <stdlib.h>
6358 #endif
6359 #ifdef TRY_MALLOC
6360 void *malloc();
6361 #endif
6362 #ifdef TRY_FREE
6363 void free();
6364 #endif
6365 END
6366 case "$malloctype" in
6367 '')
6368         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6369                 malloctype='void *'
6370         else
6371                 malloctype='char *'
6372         fi
6373         ;;
6374 esac
6375 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6376
6377 case "$freetype" in
6378 '')
6379         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6380                 freetype='void'
6381         else
6382                 freetype='int'
6383         fi
6384         ;;
6385 esac
6386 echo "Your system uses $freetype free(), it would seem." >&4
6387 $rm -f malloc.[co]
6388 $cat <<EOM
6389
6390 After $package is installed, you may wish to install various
6391 add-on modules and utilities.  Typically, these add-ons will
6392 be installed under $prefix with the rest
6393 of this package.  However, you may wish to install such add-ons
6394 elsewhere under a different prefix.
6395
6396 If you do not wish to put everything under a single prefix, that's
6397 ok.  You will be prompted for the individual locations; this siteprefix
6398 is only used to suggest the defaults.
6399
6400 The default should be fine for most people.
6401
6402 EOM
6403 fn=d~+
6404 rp='Installation prefix to use for add-on modules and utilities?'
6405 : XXX Here might be another good place for an installstyle setting.
6406 case "$siteprefix" in
6407 '') dflt=$prefix ;;
6408 *)  dflt=$siteprefix ;;
6409 esac
6410 . ./getfile
6411 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6412 oldsiteprefix=''
6413 case "$siteprefix" in
6414 '') ;;
6415 *)      case "$ans" in
6416         "$prefix") ;;
6417         *) oldsiteprefix="$prefix";;
6418         esac
6419         ;;
6420 esac
6421 siteprefix="$ans"
6422 siteprefixexp="$ansexp"
6423
6424 : determine where site specific libraries go.
6425 : Usual default is /usr/local/lib/perl5/site_perl/$version
6426 : The default "style" setting is made in installstyle.U
6427 : XXX No longer works with Prefixit stuff.
6428 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6429 case "$sitelib" in
6430 '') case "$installstyle" in
6431         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6432         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6433         esac
6434         ;;
6435 *)      dflt="$sitelib"
6436         ;;
6437 esac
6438 $cat <<EOM
6439
6440 The installation process will create a directory for
6441 site-specific extensions and modules.  Most users find it convenient
6442 to place all site-specific files in this directory rather than in the
6443 main distribution directory.
6444
6445 EOM
6446 fn=d~+
6447 rp='Pathname for the site-specific library files?'
6448 . ./getfile
6449 sitelib="$ans"
6450 sitelibexp="$ansexp"
6451 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6452 : Change installation prefix, if necessary.
6453 if $test X"$prefix" != X"$installprefix"; then
6454         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6455 else
6456         installsitelib="$sitelibexp"
6457 fi
6458
6459 : determine where site specific architecture-dependent libraries go.
6460 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6461 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6462 : sitelib may have an optional trailing /share.
6463 case "$sitearch" in
6464 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6465         dflt="$dflt/$archname"
6466         ;;
6467 *)      dflt="$sitearch"
6468         ;;
6469 esac
6470 set sitearch sitearch none
6471 eval $prefixit
6472 $cat <<EOM
6473
6474 The installation process will also create a directory for
6475 architecture-dependent site-specific extensions and modules.
6476
6477 EOM
6478 fn=d~+
6479 rp='Pathname for the site-specific architecture-dependent library files?'
6480 . ./getfile
6481 sitearch="$ans"
6482 sitearchexp="$ansexp"
6483 : Change installation prefix, if necessary.
6484 if $test X"$prefix" != X"$installprefix"; then
6485         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6486 else
6487         installsitearch="$sitearchexp"
6488 fi
6489
6490 $cat <<EOM
6491
6492 The installation process will also create a directory for
6493 vendor-supplied add-ons.  Vendors who supply perl with their system
6494 may find it convenient to place all vendor-supplied files in this
6495 directory rather than in the main distribution directory.  This will
6496 ease upgrades between binary-compatible maintenance versions of perl.
6497
6498 Of course you may also use these directories in whatever way you see
6499 fit.  For example, you might use them to access modules shared over a
6500 company-wide network.
6501
6502 The default answer should be fine for most people.
6503 This causes further questions about vendor add-ons to be skipped
6504 and no vendor-specific directories will be configured for perl.
6505
6506 EOM
6507 rp='Do you want to configure vendor-specific add-on directories?'
6508 case "$usevendorprefix" in
6509 define|true|[yY]*) dflt=y ;;
6510 *)      : User may have set vendorprefix directly on Configure command line.
6511         case "$vendorprefix" in
6512         ''|' ') dflt=n ;;
6513         *)      dflt=y ;;
6514         esac
6515         ;;
6516 esac
6517 . ./myread
6518 case "$ans" in
6519 [yY]*)  fn=d~+
6520         rp='Installation prefix to use for vendor-supplied add-ons?'
6521         case "$vendorprefix" in
6522         '') dflt='' ;;
6523         *)  dflt=$vendorprefix ;;
6524         esac
6525         . ./getfile
6526         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6527         oldvendorprefix=''
6528         case "$vendorprefix" in
6529         '') ;;
6530         *)      case "$ans" in
6531                 "$prefix") ;;
6532                 *) oldvendorprefix="$prefix";;
6533                 esac
6534                 ;;
6535         esac
6536         usevendorprefix="$define"
6537         vendorprefix="$ans"
6538         vendorprefixexp="$ansexp"
6539         ;;
6540 *)      usevendorprefix="$undef"
6541         vendorprefix=''
6542         vendorprefixexp=''
6543         ;;
6544 esac
6545
6546 case "$vendorprefix" in
6547 '')     d_vendorlib="$undef"
6548         vendorlib=''
6549         vendorlibexp=''
6550         ;;
6551 *)      d_vendorlib="$define"
6552         : determine where vendor-supplied modules go.
6553         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6554         case "$vendorlib" in
6555         '')
6556                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6557                 case "$installstyle" in
6558                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6559                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6560                 esac
6561                 ;;
6562         *)      dflt="$vendorlib"
6563                 ;;
6564         esac
6565         fn=d~+
6566         rp='Pathname for the vendor-supplied library files?'
6567         . ./getfile
6568         vendorlib="$ans"
6569         vendorlibexp="$ansexp"
6570         ;;
6571 esac
6572 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6573 : Change installation prefix, if necessary.
6574 if $test X"$prefix" != X"$installprefix"; then
6575         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6576 else
6577         installvendorlib="$vendorlibexp"
6578 fi
6579
6580 case "$vendorprefix" in
6581 '')     d_vendorarch="$undef"
6582         vendorarch=''
6583         vendorarchexp=''
6584         ;;
6585 *)      d_vendorarch="$define"
6586         : determine where vendor-supplied architecture-dependent libraries go.
6587         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6588         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6589         : vendorlib may have an optional trailing /share.
6590         case "$vendorarch" in
6591         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6592                 dflt="$dflt/$archname"
6593                 ;;
6594         *)      dflt="$vendorarch" ;;
6595         esac
6596         fn=d~+
6597         rp='Pathname for vendor-supplied architecture-dependent files?'
6598         . ./getfile
6599         vendorarch="$ans"
6600         vendorarchexp="$ansexp"
6601         ;;
6602 esac
6603 : Change installation prefix, if necessary.
6604 if $test X"$prefix" != X"$installprefix"; then
6605         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6606 else
6607         installvendorarch="$vendorarchexp"
6608 fi
6609
6610 : Final catch-all directories to search
6611 $cat <<EOM
6612
6613 Lastly, you can have perl look in other directories for extensions and
6614 modules in addition to those already specified.
6615 These directories will be searched after 
6616         $sitearch 
6617         $sitelib 
6618 EOM
6619 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6620 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6621 echo ' '
6622 case "$otherlibdirs" in
6623 ''|' ') dflt='none' ;;
6624 *)      dflt="$otherlibdirs" ;;
6625 esac
6626 $cat <<EOM
6627 Enter a colon-separated set of extra paths to include in perl's @INC
6628 search path, or enter 'none' for no extra paths.
6629
6630 EOM
6631
6632 rp='Colon-separated list of additional directories for perl to search?'
6633 . ./myread
6634 case "$ans" in
6635 ' '|''|none)    otherlibdirs=' ' ;;     
6636 *)      otherlibdirs="$ans" ;;
6637 esac
6638 case "$otherlibdirs" in
6639 ' ') val=$undef ;;
6640 *)      val=$define ;;
6641 esac
6642 set d_perl_otherlibdirs
6643 eval $setvar
6644
6645 : Cruising for prototypes
6646 echo " "
6647 echo "Checking out function prototypes..." >&4
6648 $cat >prototype.c <<EOCP
6649 #$i_stdlib I_STDLIB
6650 #ifdef I_STDLIB
6651 #include <stdlib.h>
6652 #endif
6653 int main(int argc, char *argv[]) {
6654         exit(0);}
6655 EOCP
6656 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6657         echo "Your C compiler appears to support function prototypes."
6658         val="$define"
6659 else
6660         echo "Your C compiler doesn't seem to understand function prototypes."
6661         val="$undef"
6662 fi
6663 set prototype
6664 eval $setvar
6665 $rm -f prototype*
6666
6667 case "$prototype" in
6668 "$define") ;;
6669 *)      ansi2knr='ansi2knr'
6670         echo " "
6671         cat <<EOM >&4
6672
6673 $me:  FATAL ERROR:
6674 This version of $package can only be compiled by a compiler that 
6675 understands function prototypes.  Unfortunately, your C compiler 
6676         $cc $ccflags
6677 doesn't seem to understand them.  Sorry about that.
6678
6679 If GNU cc is available for your system, perhaps you could try that instead.  
6680
6681 Eventually, we hope to support building Perl with pre-ANSI compilers.
6682 If you would like to help in that effort, please contact <perlbug@perl.org>.
6683
6684 Aborting Configure now.
6685 EOM
6686         exit 2
6687         ;;
6688 esac
6689
6690 : determine where public executables go
6691 echo " "
6692 set dflt bin bin
6693 eval $prefixit
6694 fn=d~
6695 rp='Pathname where the public executables will reside?'
6696 . ./getfile
6697 if $test "X$ansexp" != "X$binexp"; then
6698         installbin=''
6699 fi
6700 bin="$ans"
6701 binexp="$ansexp"
6702 : Change installation prefix, if necessary.
6703 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6704 if $test X"$prefix" != X"$installprefix"; then
6705         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6706 else
6707         installbin="$binexp"
6708 fi
6709
6710 echo " "
6711 case "$extras" in
6712 '') dflt='n';;
6713 *) dflt='y';;
6714 esac
6715 cat <<EOM
6716 Perl can be built with extra modules or bundles of modules which
6717 will be fetched from the CPAN and installed alongside Perl.
6718
6719 Notice that you will need access to the CPAN; either via the Internet,
6720 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6721 be asked later to configure the CPAN.pm module which will in turn do
6722 the installation of the rest of the extra modules or bundles.)
6723
6724 Notice also that if the modules require any external software such as
6725 libraries and headers (the libz library and the zlib.h header for the
6726 Compress::Zlib module, for example) you MUST have any such software
6727 already installed, this configuration process will NOT install such
6728 things for you.
6729
6730 If this doesn't make any sense to you, just accept the default '$dflt'.
6731 EOM
6732 rp='Install any extra modules (y or n)?'
6733 . ./myread
6734 case "$ans" in
6735 y|Y)
6736         cat <<EOM
6737
6738 Please list any extra modules or bundles to be installed from CPAN,
6739 with spaces between the names.  The names can be in any format the
6740 'install' command of CPAN.pm will understand.  (Answer 'none',
6741 without the quotes, to install no extra modules or bundles.)
6742 EOM
6743         rp='Extras?'
6744         dflt="$extras"
6745         . ./myread
6746         extras="$ans"
6747 esac
6748 case "$extras" in
6749 ''|'none')
6750         val=''
6751         $rm -f ../extras.lst
6752         ;;
6753 *)      echo "(Saving the list of extras for later...)"
6754         echo "$extras" > ../extras.lst
6755         val="'$extras'"
6756         ;;
6757 esac
6758 set extras
6759 eval $setvar
6760 echo " "
6761
6762 : determine where html pages for programs go
6763 set html1dir html1dir none
6764 eval $prefixit
6765 $cat <<EOM
6766
6767 If you wish to install html files for programs in $spackage, indicate 
6768 the appropriate directory here.  To skip installing html files,
6769 answer "none".
6770 EOM
6771 case "$html1dir" in
6772 ''|none|$undef|' ') dflt=none ;;
6773 *) dflt=$html1dir ;;
6774 esac
6775 fn=dn+~
6776 rp="Directory for the main $spackage html pages?"
6777 . ./getfile
6778 html1dir="$ans"
6779 html1direxp="$ansexp"
6780 : Use ' ' for none so value is preserved next time through Configure
6781 $test X"$html1dir" = "X" && html1dir=' '
6782 : Change installation prefix, if necessary.
6783 if $test X"$prefix" != X"$installprefix"; then
6784         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6785 else
6786         installhtml1dir="$html1direxp"
6787 fi
6788
6789 : determine where html pages for libraries and modules go
6790 set html3dir html3dir none
6791 eval $prefixit
6792 $cat <<EOM
6793
6794 If you wish to install html files for modules associated with $spackage,
6795 indicate the appropriate directory here.  To skip installing html files,
6796 answer "none".
6797 EOM
6798 : There is no obvious default.  If they have specified html1dir, then
6799 : try to key off that, possibly changing .../html1 into .../html3.
6800 case "$html3dir" in
6801 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6802 *) dflt=$html3dir ;;
6803 esac
6804 fn=dn+~
6805 rp="Directory for the $spackage module html pages?"
6806 . ./getfile
6807 html3dir="$ans"
6808 html3direxp="$ansexp"
6809 : Use ' ' for none so value is preserved next time through Configure
6810 $test X"$html3dir" = "X" && html3dir=' '
6811 : Change installation prefix, if necessary.
6812 if $test X"$prefix" != X"$installprefix"; then
6813         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6814 else
6815         installhtml3dir="$html3direxp"
6816 fi
6817
6818 : Find perl5.005 or later.
6819 echo "Looking for a previously installed perl5.005 or later... "
6820 case "$perl5" in
6821 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6822                 : Check if this perl is recent and can load a simple module
6823                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6824                         perl5=$tdir/perl
6825                         break;
6826                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6827                         perl5=$tdir/perl5
6828                         break;
6829                 fi
6830         done
6831         ;;
6832 *)      perl5="$perl5"
6833         ;;
6834 esac
6835 case "$perl5" in
6836 '')     echo "None found.  That's ok.";;
6837 *)      echo "Using $perl5." ;;
6838 esac
6839
6840 : Determine list of previous versions to include in @INC
6841 $cat > getverlist <<EOPL
6842 #!$perl5 -w
6843 use File::Basename;
6844 \$api_versionstring = "$api_versionstring";
6845 \$version = "$version";
6846 \$stem = "$sitelib_stem";
6847 \$archname = "$archname";
6848 EOPL
6849         $cat >> getverlist <<'EOPL'
6850 # Can't have leading @ because metaconfig interprets it as a command!
6851 ;@inc_version_list=();
6852 # XXX Redo to do opendir/readdir? 
6853 if (-d $stem) {
6854     chdir($stem);
6855     ;@candidates = glob("5.*");
6856 }
6857 else {
6858     ;@candidates = ();
6859 }
6860
6861 # XXX ToDo:  These comparisons must be reworked when two-digit
6862 # subversions come along, so that 5.7.10 compares as greater than
6863 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6864 # widespread that we can use the built-in version vectors rather
6865 # than reinventing them here.  For 5.6.0, however, we must
6866 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6867 foreach $d (@candidates) {
6868     if ($d lt $version) {
6869         if ($d ge $api_versionstring) {
6870             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6871         }
6872         elsif ($d ge "5.005") {
6873             unshift(@inc_version_list, grep { -d } $d);
6874         }
6875     }
6876     else {
6877         # Skip newer version.  I.e. don't look in
6878         # 5.7.0 if we're installing 5.6.1.
6879     }
6880 }
6881
6882 if (@inc_version_list) {
6883     print join(' ', @inc_version_list);
6884 }
6885 else {
6886     # Blank space to preserve value for next Configure run.
6887     print " ";
6888 }
6889 EOPL
6890 chmod +x getverlist
6891 case "$inc_version_list" in
6892 '')     if test -x "$perl5$exe_ext"; then
6893                 dflt=`$perl5 getverlist`
6894         else
6895                 dflt='none'
6896         fi
6897         ;;
6898 $undef) dflt='none' ;;
6899 *)  eval dflt=\"$inc_version_list\" ;;
6900 esac
6901 case "$dflt" in
6902 ''|' ') dflt=none ;;
6903 esac
6904 case "$dflt" in
6905 5.005) dflt=none ;;
6906 esac
6907 $cat <<EOM
6908
6909 In order to ease the process of upgrading, this version of perl 
6910 can be configured to use modules built and installed with earlier 
6911 versions of perl that were installed under $prefix.  Specify here
6912 the list of earlier versions that this version of perl should check.
6913 If Configure detected no earlier versions of perl installed under
6914 $prefix, then the list will be empty.  Answer 'none' to tell perl
6915 to not search earlier versions.
6916
6917 The default should almost always be sensible, so if you're not sure,
6918 just accept the default.
6919 EOM
6920
6921 rp='List of earlier versions to include in @INC?'
6922 . ./myread
6923 case "$ans" in
6924 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6925 *) inc_version_list="$ans" ;;
6926 esac
6927 case "$inc_version_list" in
6928 ''|' ') 
6929         inc_version_list_init='0';;
6930 *)      inc_version_list_init=`echo $inc_version_list |
6931                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6932         ;;
6933 esac
6934 $rm -f getverlist
6935
6936 : determine whether to install perl also as /usr/bin/perl
6937
6938 echo " "
6939 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6940         $cat <<EOM
6941 Many scripts expect perl to be installed as /usr/bin/perl.
6942
6943 If you want to, I can install the perl you are about to compile
6944 as /usr/bin/perl (in addition to $bin/perl).
6945 EOM
6946         if test -f /usr/bin/perl; then
6947             $cat <<EOM
6948
6949 However, please note that because you already have a /usr/bin/perl,
6950 overwriting that with a new Perl would very probably cause problems.
6951 Therefore I'm assuming you don't want to do that (unless you insist).
6952
6953 EOM
6954             case "$installusrbinperl" in
6955             "$define"|[yY]*)    dflt='y';;
6956             *)                  dflt='n';;
6957             esac
6958         else
6959             $cat <<EOM
6960
6961 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6962
6963 EOM
6964             case "$installusrbinperl" in
6965             "$undef"|[nN]*)     dflt='n';;
6966             *)                  dflt='y';;
6967             esac
6968         fi
6969         rp="Do you want to install perl as /usr/bin/perl?"
6970         . ./myread
6971         case "$ans" in
6972         [yY]*)  val="$define";;
6973         *)      val="$undef" ;;
6974         esac
6975 else
6976         val="$undef"
6977 fi
6978 set installusrbinperl
6979 eval $setvar
6980
6981 echo " "
6982 echo "Checking for GNU C Library..." >&4
6983 cat >try.c <<'EOCP'
6984 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6985    alone are insufficient to distinguish different versions, such as
6986    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6987    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6988 */
6989 #include <stdio.h>
6990 int main(void)
6991 {
6992 #ifdef __GLIBC__
6993 #   ifdef __GLIBC_MINOR__
6994 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
6995 #           include <gnu/libc-version.h>
6996             printf("%s\n",  gnu_get_libc_version());
6997 #       else
6998             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6999 #       endif
7000 #   else
7001         printf("%d\n",  __GLIBC__);
7002 #   endif
7003     return 0;
7004 #else
7005     return 1;
7006 #endif
7007 }
7008 EOCP
7009 set try
7010 if eval $compile_ok && $run ./try > glibc.ver; then
7011         val="$define"
7012         gnulibc_version=`$cat glibc.ver`
7013         echo "You are using the GNU C Library version $gnulibc_version"
7014 else
7015         val="$undef"
7016         gnulibc_version=''
7017         echo "You are not using the GNU C Library"
7018 fi
7019 $rm -f try try.* glibc.ver
7020 set d_gnulibc
7021 eval $setvar
7022
7023 : see if nm is to be used to determine whether a symbol is defined or not
7024 case "$usenm" in
7025 '')
7026         dflt=''
7027         case "$d_gnulibc" in
7028         "$define")
7029                 echo " "
7030                 echo "nm probably won't work on the GNU C Library." >&4
7031                 dflt=n
7032                 ;;
7033         esac
7034         case "$dflt" in
7035         '') 
7036                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7037                         echo " "
7038                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7039                         echo "'nm' won't be sufficient on this sytem." >&4
7040                         dflt=n
7041                 fi
7042                 ;;
7043         esac
7044         case "$dflt" in
7045         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7046                 if $test $dflt -gt 20; then
7047                         dflt=y
7048                 else
7049                         dflt=n
7050                 fi
7051                 ;;
7052         esac
7053         ;;
7054 *)
7055         case "$usenm" in
7056         true|$define) dflt=y;;
7057         *) dflt=n;;
7058         esac
7059         ;;
7060 esac
7061 $cat <<EOM
7062
7063 I can use $nm to extract the symbols from your C libraries. This
7064 is a time consuming task which may generate huge output on the disk (up
7065 to 3 megabytes) but that should make the symbols extraction faster. The
7066 alternative is to skip the 'nm' extraction part and to compile a small
7067 test program instead to determine whether each symbol is present. If
7068 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7069 this may be the best solution.
7070
7071 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7072
7073 EOM
7074 rp="Shall I use $nm to extract C symbols from the libraries?"
7075 . ./myread
7076 case "$ans" in
7077 [Nn]*) usenm=false;;
7078 *) usenm=true;;
7079 esac
7080
7081 runnm=$usenm
7082 case "$reuseval" in
7083 true) runnm=false;;
7084 esac
7085
7086 : nm options which may be necessary
7087 case "$nm_opt" in
7088 '') if $test -f /mach_boot; then
7089                 nm_opt=''       # Mach
7090         elif $test -d /usr/ccs/lib; then
7091                 nm_opt='-p'     # Solaris (and SunOS?)
7092         elif $test -f /dgux; then
7093                 nm_opt='-p'     # DG-UX
7094         elif $test -f /lib64/rld; then
7095                 nm_opt='-p'     # 64-bit Irix
7096         else
7097                 nm_opt=''
7098         fi;;
7099 esac
7100
7101 : nm options which may be necessary for shared libraries but illegal
7102 : for archive libraries.  Thank you, Linux.
7103 case "$nm_so_opt" in
7104 '')     case "$myuname" in
7105         *linux*)
7106                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7107                         nm_so_opt='--dynamic'
7108                 fi
7109                 ;;
7110         esac
7111         ;;
7112 esac
7113
7114 case "$runnm" in
7115 true)
7116 : get list of predefined functions in a handy place
7117 echo " "
7118 case "$libc" in
7119 '') libc=unknown
7120         case "$libs" in
7121         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7122         esac
7123         ;;
7124 esac
7125 case "$libs" in
7126 '') ;;
7127 *)  for thislib in $libs; do
7128         case "$thislib" in
7129         -lc|-lc_s)
7130                 : Handle C library specially below.
7131                 ;;
7132         -l*)
7133                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7134                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7135                         :
7136                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7137                         :
7138                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7139                         :
7140                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7141                         :
7142                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7143                         :
7144                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7145                         :
7146                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7147                         :
7148                 else
7149                         try=''
7150                 fi
7151                 libnames="$libnames $try"
7152                 ;;
7153         *) libnames="$libnames $thislib" ;;
7154         esac
7155         done
7156         ;;
7157 esac
7158 xxx=normal
7159 case "$libc" in
7160 unknown)
7161         set /lib/libc.$so
7162         for xxx in $libpth; do
7163                 $test -r $1 || set $xxx/libc.$so
7164                 : The messy sed command sorts on library version numbers.
7165                 $test -r $1 || \
7166                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7167                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7168                                 h
7169                                 s/[0-9][0-9]*/0000&/g
7170                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7171                                 G
7172                                 s/\n/ /' | \
7173                          $sort | $sed -e 's/^.* //'`
7174                 eval set \$$#
7175         done
7176         $test -r $1 || set /usr/ccs/lib/libc.$so
7177         $test -r $1 || set /lib/libsys_s$_a
7178         ;;
7179 *)
7180         set blurfl
7181         ;;
7182 esac
7183 if $test -r "$1"; then
7184         echo "Your (shared) C library seems to be in $1."
7185         libc="$1"
7186 elif $test -r /lib/libc && $test -r /lib/clib; then
7187         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7188         xxx=apollo
7189         libc='/lib/clib /lib/libc'
7190         if $test -r /lib/syslib; then
7191                 echo "(Your math library is in /lib/syslib.)"
7192                 libc="$libc /lib/syslib"
7193         fi
7194 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7195         echo "Your C library seems to be in $libc, as you said before."
7196 elif $test -r $incpath/usr/lib/libc$_a; then
7197         libc=$incpath/usr/lib/libc$_a;
7198         echo "Your C library seems to be in $libc.  That's fine."
7199 elif $test -r /lib/libc$_a; then
7200         libc=/lib/libc$_a;
7201         echo "Your C library seems to be in $libc.  You're normal."
7202 else
7203         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7204                 :
7205         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7206                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7207         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7208                 :
7209         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7210                 :
7211         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7212                 :
7213         else
7214                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7215         fi
7216         if $test -r "$tans"; then
7217                 echo "Your C library seems to be in $tans, of all places."
7218                 libc=$tans
7219         else
7220                 libc='blurfl'
7221         fi
7222 fi
7223 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7224         dflt="$libc"
7225         cat <<EOM
7226
7227 If the guess above is wrong (which it might be if you're using a strange
7228 compiler, or your machine supports multiple models), you can override it here.
7229
7230 EOM
7231 else
7232         dflt=''
7233         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7234         cat >&4 <<EOM
7235 I can't seem to find your C library.  I've looked in the following places:
7236
7237 EOM
7238         $sed 's/^/      /' libpath
7239         cat <<EOM
7240
7241 None of these seems to contain your C library. I need to get its name...
7242
7243 EOM
7244 fi
7245 fn=f
7246 rp='Where is your C library?'
7247 . ./getfile
7248 libc="$ans"
7249
7250 echo " "
7251 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7252 set X `cat libnames`
7253 shift
7254 xxx=files
7255 case $# in 1) xxx=file; esac
7256 echo "Extracting names from the following $xxx for later perusal:" >&4
7257 echo " "
7258 $sed 's/^/      /' libnames >&4
7259 echo " "
7260 $echo $n "This may take a while...$c" >&4
7261
7262 for file in $*; do
7263         case $file in
7264         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7265         *) $nm $nm_opt $file 2>/dev/null;;
7266         esac
7267 done >libc.tmp
7268
7269 $echo $n ".$c"
7270 $grep fprintf libc.tmp > libc.ptf
7271 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7272 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7273 xxx='[ADTSIW]'
7274 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7275         eval $xscan;\
7276         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7277                 eval $xrun
7278 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7279         eval $xscan;\
7280         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7281                 eval $xrun
7282 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7283         eval $xscan;\
7284         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7285                 eval $xrun
7286 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7287         eval $xscan;\
7288         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7289                 eval $xrun
7290 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7291         eval $xscan;\
7292         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7293                 eval $xrun
7294 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7295         eval $xscan;\
7296         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7297                 eval $xrun
7298 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7299                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7300         eval $xscan;\
7301         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7302                 eval $xrun
7303 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7304         eval $xscan;\
7305         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7306                 eval $xrun
7307 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7308         eval $xscan;\
7309         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7310                 eval $xrun
7311 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7312         eval $xscan;\
7313         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7314                 eval $xrun
7315 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7316         eval $xscan;\
7317         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7318                 eval $xrun
7319 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7320         eval $xscan;\
7321         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7322                 eval $xrun
7323 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7324         eval $xscan;\
7325         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7326                 eval $xrun
7327 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7328         eval $xscan;\
7329         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7330                 eval $xrun
7331 else
7332         $nm -p $* 2>/dev/null >libc.tmp
7333         $grep fprintf libc.tmp > libc.ptf
7334         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7335                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7336         then
7337                 nm_opt='-p'
7338                 eval $xrun
7339         else
7340                 echo " "
7341                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7342                 com=''
7343                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7344                         for thisname in $libnames $libc; do
7345                                 $ar t $thisname >>libc.tmp
7346                         done
7347                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7348                         echo "Ok." >&4
7349                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7350                         # Repeat libc to extract forwarders to DLL entries too
7351                         for thisname in $libnames $libc; do
7352                                 $ar tv $thisname >>libc.tmp
7353                                 # Revision 50 of EMX has bug in $ar.
7354                                 # it will not extract forwarders to DLL entries
7355                                 # Use emximp which will extract exactly them.
7356                                 emximp -o tmp.imp $thisname \
7357                                     2>/dev/null && \
7358                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7359                                     < tmp.imp >>libc.tmp
7360                                 $rm tmp.imp
7361                         done
7362                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7363                         echo "Ok." >&4
7364                 else
7365                         echo "$ar didn't seem to work right." >&4
7366                         echo "Maybe this is a Cray...trying bld instead..." >&4
7367                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7368                         then
7369                                 for thisname in $libnames; do
7370                                         bld t $libnames | \
7371                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7372                                         $ar t $thisname >>libc.tmp
7373                                 done
7374                                 echo "Ok." >&4
7375                         else
7376                                 echo "That didn't work either.  Giving up." >&4
7377                                 exit 1
7378                         fi
7379                 fi
7380         fi
7381 fi
7382 nm_extract="$com"
7383 case "$PASE" in
7384 define)
7385     echo " "
7386     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7387     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7388     ;;
7389 *)  if $test -f /lib/syscalls.exp; then
7390         echo " "
7391         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7392         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7393     fi
7394     ;;
7395 esac
7396 ;;
7397 esac
7398 $rm -f libnames libpath
7399
7400 : see if dld is available
7401 set dld.h i_dld
7402 eval $inhdr
7403
7404 : is a C symbol defined?
7405 csym='tlook=$1;
7406 case "$3" in
7407 -v) tf=libc.tmp; tdc="";;
7408 -a) tf=libc.tmp; tdc="[]";;
7409 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7410 esac;
7411 tx=yes;
7412 case "$reuseval-$4" in
7413 true-) ;;
7414 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7415 esac;
7416 case "$tx" in
7417 yes)
7418         tval=false;
7419         if $test "$runnm" = true; then
7420                 if $contains $tlook $tf >/dev/null 2>&1; then
7421                         tval=true;
7422                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7423                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7424                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7425                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7426                         $rm -f try$_exe try.c core core.* try.core;
7427                 fi;
7428         else
7429                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7430                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7431                 $rm -f try$_exe try.c;
7432         fi;
7433         ;;
7434 *)
7435         case "$tval" in
7436         $define) tval=true;;
7437         *) tval=false;;
7438         esac;
7439         ;;
7440 esac;
7441 eval "$2=$tval"'
7442
7443 : define an is-in-libc? function
7444 inlibc='echo " "; td=$define; tu=$undef;
7445 sym=$1; var=$2; eval "was=\$$2";
7446 tx=yes;
7447 case "$reuseval$was" in
7448 true) ;;
7449 true*) tx=no;;
7450 esac;
7451 case "$tx" in
7452 yes)
7453         set $sym tres -f;
7454         eval $csym;
7455         case "$tres" in
7456         true)
7457                 echo "$sym() found." >&4;
7458                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7459         *)
7460                 echo "$sym() NOT found." >&4;
7461                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7462         esac;;
7463 *)
7464         case "$was" in
7465         $define) echo "$sym() found." >&4;;
7466         *) echo "$sym() NOT found." >&4;;
7467         esac;;
7468 esac'
7469
7470 : see if dlopen exists
7471 xxx_runnm="$runnm"
7472 runnm=false
7473 set dlopen d_dlopen
7474 eval $inlibc
7475 runnm="$xxx_runnm"
7476
7477 : determine which dynamic loading, if any, to compile in
7478 echo " "
7479 dldir="ext/DynaLoader"
7480 case "$usedl" in
7481 $define|y|true)
7482         dflt='y'
7483         usedl="$define"
7484         ;;
7485 $undef|n|false)
7486         dflt='n'
7487         usedl="$undef"
7488         ;;
7489 *) 
7490         dflt='n'
7491         case "$d_dlopen" in
7492             $define) dflt='y' ;;
7493         esac
7494         case "$i_dld" in
7495             $define) dflt='y' ;;
7496         esac
7497         : Does a dl_xxx.xs file exist for this operating system
7498         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7499         ;;
7500 esac
7501 rp="Do you wish to use dynamic loading?"
7502 . ./myread
7503 usedl="$ans"
7504 case "$ans" in
7505 y*) usedl="$define"
7506         case "$dlsrc" in
7507         '')
7508                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7509                         dflt="$dldir/dl_${osname}.xs"
7510                 elif $test "$d_dlopen" = "$define" ; then
7511                         dflt="$dldir/dl_dlopen.xs"
7512                 elif $test "$i_dld" = "$define" ; then
7513                         dflt="$dldir/dl_dld.xs"
7514                 else
7515                         dflt=''
7516                 fi
7517                 ;;
7518         *)      dflt="$dldir/$dlsrc"
7519                 ;;
7520         esac
7521     echo "The following dynamic loading files are available:"
7522         : Can not go over to $dldir because getfile has path hard-coded in.
7523         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7524         rp="Source file to use for dynamic loading"
7525         fn="fne"
7526         gfpth="$src"
7527         . ./getfile
7528         usedl="$define"
7529         : emulate basename
7530         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7531
7532         $cat << EOM
7533
7534 Some systems may require passing special flags to $cc -c to
7535 compile modules that will be used to create a shared library.
7536 To use no flags, say "none".
7537
7538 EOM
7539     case "$cccdlflags" in
7540     '') case "$gccversion" in
7541                 '') case "$osname" in
7542                         hpux)   dflt='+z' ;;
7543                         next)   dflt='none' ;;
7544                         irix*)  dflt='-KPIC' ;;
7545                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7546                         sunos)  dflt='-pic' ;;
7547                         *)      dflt='none' ;;
7548                     esac
7549                         ;;
7550                 *)  case "$osname" in
7551                         darwin) dflt='none' ;;
7552                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7553                         *)      dflt='-fpic' ;;
7554                     esac ;;
7555             esac ;;
7556         ' ') dflt='none' ;;
7557     *)  dflt="$cccdlflags" ;;
7558     esac
7559     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7560     . ./myread
7561     case "$ans" in
7562     none) cccdlflags=' ' ;;
7563     *) cccdlflags="$ans" ;;
7564     esac
7565
7566     cat << EOM
7567
7568 Some systems use ld to create libraries that can be dynamically loaded,
7569 while other systems (such as those using ELF) use $cc.
7570
7571 EOM
7572         case "$ld" in
7573         '')     $cat >try.c <<EOM
7574 /* Test for whether ELF binaries are produced */
7575 #include <fcntl.h>
7576 #$i_stdlib I_STDLIB
7577 #ifdef I_STDLIB
7578 #include <stdlib.h>
7579 #endif
7580 int main() {
7581         char b[4];
7582         int i = open("a.out",O_RDONLY);
7583         if(i == -1) 
7584                 exit(1); /* fail */
7585         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7586                 exit(0); /* succeed (yes, it's ELF) */
7587         else
7588                 exit(1); /* fail */
7589 }
7590 EOM
7591                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7592                         cat <<EOM
7593 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7594 EOM
7595                         dflt="$cc"
7596                 else
7597                         echo "I'll use ld to build dynamic libraries."
7598                         dflt='ld'
7599                 fi
7600                 rm -f try.c a.out
7601                 ;;
7602         *)      dflt="$ld"
7603                 ;;
7604         esac
7605
7606     rp="What command should be used to create dynamic libraries?"
7607     . ./myread
7608         ld="$ans"
7609
7610     cat << EOM
7611
7612 Some systems may require passing special flags to $ld to create a
7613 library that can be dynamically loaded.  If your ld flags include
7614 -L/other/path options to locate libraries outside your loader's normal
7615 search path, you may need to specify those -L options here as well.  To
7616 use no flags, say "none".
7617
7618 EOM
7619     case "$lddlflags" in
7620     '') case "$osname" in
7621                         beos) dflt='-nostart' ;;
7622                         hpux) dflt='-b';
7623                               case "$gccversion" in
7624                               '') dflt="$dflt +vnocompatwarnings" ;;
7625                               esac
7626                               ;;        
7627                         linux|irix*)    dflt='-shared' ;;
7628                         next)  dflt='none' ;;
7629                         solaris) dflt='-G' ;;
7630                         sunos) dflt='-assert nodefinitions' ;;
7631                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7632                 *)     dflt='none' ;;
7633                         esac
7634                         ;;
7635     *) dflt="$lddlflags" ;;
7636     esac
7637
7638         : Try to guess additional flags to pick up local libraries.
7639         : Be careful not to append to a plain 'none'
7640         case "$dflt" in
7641         none) dflt='' ;;
7642         esac
7643         for thisflag in $ldflags; do
7644                 case "$thisflag" in
7645                 -L*|-R*|-Wl,-R*)
7646                         case " $dflt " in
7647                         *" $thisflag "*) ;;
7648                         *) dflt="$dflt $thisflag" ;;
7649                         esac
7650                         ;;
7651                 esac
7652         done
7653
7654         case "$dflt" in
7655         ''|' ') dflt='none' ;;
7656         esac
7657
7658     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7659     . ./myread
7660     case "$ans" in
7661     none) lddlflags=' ' ;;
7662     *) lddlflags="$ans" ;;
7663     esac
7664
7665         cat <<EOM
7666
7667 Some systems may require passing special flags to $cc to indicate that
7668 the resulting executable will use dynamic linking.  To use no flags,
7669 say "none".
7670
7671 EOM
7672     case "$ccdlflags" in
7673     '') case "$osname" in
7674             linux|hpux) dflt='-Wl,-E' ;;
7675             next|sunos) dflt='none' ;;
7676             *)          dflt='none' ;;
7677             esac ;;
7678     ' ')  dflt='none' ;;
7679     *)  dflt="$ccdlflags" ;;
7680     esac
7681     rp="Any special flags to pass to $cc to use dynamic linking?"
7682     . ./myread
7683     case "$ans" in
7684     none) ccdlflags=' ' ;;
7685     *) ccdlflags="$ans" ;;
7686     esac
7687     ;;
7688 *)  usedl="$undef"
7689         ld='ld'
7690     dlsrc='dl_none.xs'
7691     lddlflags=''
7692     ccdlflags=''
7693     ;;
7694 esac
7695
7696 also=''
7697 case "$usedl" in
7698 $undef)
7699         # No dynamic loading being used, so don't bother even to prompt.
7700         useshrplib='false'
7701         ;;
7702 *)      case "$useshrplib" in
7703         '')     case "$osname" in
7704                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7705                         dflt=y
7706                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7707                         ;;
7708                 next*)
7709                         case "$osvers" in
7710                         4*)     dflt=y
7711                                 also='Building a shared libperl is needed for MAB support.'
7712                                 ;;
7713                         *)      dflt=n
7714                                 ;;
7715                         esac
7716                         ;;
7717                 *)      dflt=n
7718                         ;;
7719                 esac
7720                 ;;
7721         $define|true|[Yy]*)
7722                 dflt=y
7723                 ;;
7724         *)      dflt=n
7725                 ;;
7726         esac
7727         $cat << EOM
7728
7729 The perl executable is normally obtained by linking perlmain.c with
7730 libperl${_a}, any static extensions (usually just DynaLoader), and
7731 any other libraries needed on this system (such as -lm, etc.).  Since
7732 your system supports dynamic loading, it is probably possible to build
7733 a shared libperl.$so.  If you will have more than one executable linked
7734 to libperl.$so, this will significantly reduce the size of each
7735 executable, but it may have a noticeable affect on performance.  The
7736 default is probably sensible for your system.
7737 $also
7738
7739 EOM
7740         rp="Build a shared libperl.$so (y/n)"
7741         . ./myread
7742         case "$ans" in
7743         true|$define|[Yy]*)
7744                 useshrplib='true'  ;;
7745         *)      useshrplib='false' ;;
7746         esac
7747         ;;
7748 esac
7749
7750 case "$useshrplib" in
7751 true)
7752         case "$libperl" in
7753         '')
7754                 # Figure out a good name for libperl.so.  Since it gets stored in
7755                 # a version-specific architecture-dependent library, the version
7756                 # number isn't really that important, except for making cc/ld happy.
7757                 #
7758                 # A name such as libperl.so.3.1
7759                 majmin="libperl.$so.$patchlevel.$subversion"
7760                 # A name such as libperl.so.301
7761                 majonly=`echo $patchlevel $subversion |
7762                         $awk '{printf "%d%02d", $1, $2}'`
7763                 majonly=libperl.$so.$majonly
7764                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7765                 # rely on figuring it out from the naming of libc.
7766                 case "${osname}${osvers}" in
7767                 next4*)
7768                         dflt=libperl.5.$so
7769                         # XXX How handle the --version stuff for MAB?
7770                         ;;
7771                 linux*)  # ld won't link with a bare -lperl otherwise.
7772                         dflt=libperl.$so
7773                         ;;
7774                 cygwin*) # ld links against an importlib
7775                         dflt=libperl$lib_ext
7776                         ;;
7777                 *)      # Try to guess based on whether libc has major.minor.
7778                         case "$libc" in
7779                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7780                         *libc.$so.[0-9]*) dflt=$majonly ;;
7781                         *)      dflt=libperl.$so ;;
7782                         esac
7783                         ;;
7784                 esac
7785                 ;;
7786         *)      dflt=$libperl
7787                 ;;
7788         esac
7789         cat << EOM
7790
7791 I need to select a good name for the shared libperl.  If your system uses
7792 library names with major and minor numbers, then you might want something
7793 like $majmin.  Alternatively, if your system uses a single version
7794 number for shared libraries, then you might want to use $majonly.
7795 Or, your system might be quite happy with a simple libperl.$so.
7796
7797 Since the shared libperl will get installed into a version-specific
7798 architecture-dependent directory, the version number of the shared perl
7799 library probably isn't important, so the default should be o.k.
7800
7801 EOM
7802         rp='What name do you want to give to the shared libperl?'
7803         . ./myread
7804         libperl=$ans
7805         echo "Ok, I'll use $libperl"
7806         ;;
7807 *)
7808         libperl="libperl${_a}"
7809         ;;
7810 esac
7811
7812 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7813 case "$shrpdir" in
7814 '') ;;
7815 *)      $cat >&4 <<EOM
7816 WARNING:  Use of the shrpdir variable for the installation location of
7817 the shared $libperl is not supported.  It was never documented and
7818 will not work in this version.  Let me (perlbug@perl.org)
7819 know of any problems this may cause.
7820
7821 EOM
7822         case "$shrpdir" in
7823         "$archlibexp/CORE")
7824                 $cat >&4 <<EOM
7825 But your current setting of $shrpdir is
7826 the default anyway, so it's harmless.
7827 EOM
7828                 ;;
7829         *)
7830                 $cat >&4 <<EOM
7831 Further, your current attempted setting of $shrpdir
7832 conflicts with the value of $archlibexp/CORE
7833 that installperl will use.
7834 EOM
7835                 ;;
7836         esac
7837         ;;
7838 esac
7839
7840 # How will the perl executable find the installed shared $libperl?
7841 # Add $xxx to ccdlflags.
7842 # If we can't figure out a command-line option, use $shrpenv to
7843 # set env LD_RUN_PATH.  The main perl makefile uses this.
7844 shrpdir=$archlibexp/CORE
7845 xxx=''
7846 tmp_shrpenv=''
7847 if "$useshrplib"; then
7848     case "$osname" in 
7849         aix)
7850                 # We'll set it in Makefile.SH...
7851                 ;;
7852         solaris)
7853                 xxx="-R $shrpdir"
7854                 ;;
7855         freebsd|netbsd|openbsd)
7856                 xxx="-Wl,-R$shrpdir"
7857                 ;;
7858         bsdos|linux|irix*|dec_osf)
7859                 xxx="-Wl,-rpath,$shrpdir"
7860                 ;;
7861         next)
7862                 # next doesn't like the default...
7863                 ;;
7864         beos)
7865                 # beos doesn't like the default, either.
7866                 ;;
7867         hpux*)
7868                 # hpux doesn't like the default, either.
7869                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7870                 ;;
7871         *)
7872                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7873                 ;;
7874         esac
7875         case "$xxx" in
7876         '') ;;
7877         *)      
7878                 # Only add $xxx if it isn't already in ccdlflags.
7879                 case " $ccdlflags " in
7880                 *" $xxx "*)     ;;
7881                 *)      ccdlflags="$ccdlflags $xxx"
7882                         cat <<EOM >&4
7883
7884 Adding $xxx to the flags
7885 passed to $ld so that the perl executable will find the 
7886 installed shared $libperl.
7887
7888 EOM
7889                         ;;
7890                 esac
7891                 ;;
7892         esac
7893 fi
7894 # Fix ccdlflags in AIX for building external extensions.
7895 # (For building Perl itself bare -bE:perl.exp is needed,
7896 #  Makefile.SH takes care of this.)
7897 case "$osname" in
7898 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7899 esac
7900 # Respect a hint or command-line value.
7901 case "$shrpenv" in
7902 '') shrpenv="$tmp_shrpenv" ;;
7903 esac
7904 case "$ldlibpthname" in
7905 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7906 none)   ldlibpthname='' ;;
7907 esac
7908
7909 : determine where manual pages are on this system
7910 echo " "
7911 case "$sysman" in
7912 '') 
7913         syspath='/usr/share/man/man1 /usr/man/man1'
7914         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7915         syspath="$syspath /usr/man/u_man/man1"
7916         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7917         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7918         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7919         sysman=`./loc . /usr/man/man1 $syspath`
7920         ;;
7921 esac
7922 if $test -d "$sysman"; then
7923         echo "System manual is in $sysman." >&4
7924 else
7925         echo "Could not find manual pages in source form." >&4
7926 fi
7927
7928 : determine where manual pages go
7929 set man1dir man1dir none
7930 eval $prefixit
7931 $cat <<EOM
7932
7933 $spackage has manual pages available in source form.
7934 EOM
7935 case "$nroff" in
7936 nroff)
7937         echo "However, you don't have nroff, so they're probably useless to you."
7938         case "$man1dir" in
7939         '') man1dir="none";;
7940         esac;;
7941 esac
7942 echo "If you don't want the manual sources installed, answer 'none'."
7943 case "$man1dir" in
7944 ' ') dflt=none
7945         ;;
7946 '')
7947         lookpath="$prefixexp/share/man/man1"
7948         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7949         lookpath="$lookpath $prefixexp/man/p_man/man1"
7950         lookpath="$lookpath $prefixexp/man/u_man/man1"
7951         lookpath="$lookpath $prefixexp/man/man.1"
7952         case "$sysman" in
7953         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7954         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7955         esac
7956         set dflt
7957         eval $prefixup
7958         ;;
7959 *)  dflt="$man1dir"
7960         ;;
7961 esac
7962 echo " "
7963 fn=dn+~
7964 rp="Where do the main $spackage manual pages (source) go?"
7965 . ./getfile
7966 if $test "X$man1direxp" != "X$ansexp"; then
7967         installman1dir=''
7968 fi
7969 man1dir="$ans"
7970 man1direxp="$ansexp"
7971 case "$man1dir" in
7972 '')     man1dir=' '
7973         installman1dir='';;
7974 esac
7975
7976 : Change installation prefix, if necessary.
7977 if $test X"$prefix" != X"$installprefix"; then
7978         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7979 else
7980         installman1dir="$man1direxp"
7981 fi
7982
7983 : What suffix to use on installed man pages
7984
7985 case "$man1dir" in
7986 ' ')
7987         man1ext='0'
7988         ;;
7989 *)
7990         rp="What suffix should be used for the main $spackage man pages?"
7991         case "$man1ext" in
7992         '')     case "$man1dir" in
7993                 *1)  dflt=1 ;;
7994                 *1p) dflt=1p ;;
7995                 *1pm) dflt=1pm ;;
7996                 *l) dflt=l;;
7997                 *n) dflt=n;;
7998                 *o) dflt=o;;
7999                 *p) dflt=p;;
8000                 *C) dflt=C;;
8001                 *L) dflt=L;;
8002                 *L1) dflt=L1;;
8003                 *) dflt=1;;
8004                 esac
8005                 ;;
8006         *)      dflt="$man1ext";;
8007         esac
8008         . ./myread
8009         man1ext="$ans"
8010         ;;
8011 esac
8012
8013 : see if we can have long filenames
8014 echo " "
8015 first=123456789abcdef
8016 $rm -f $first
8017 if (echo hi >$first) 2>/dev/null; then
8018         if $test -f 123456789abcde; then
8019                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8020                 val="$undef"
8021         else
8022                 echo 'You can have filenames longer than 14 characters.'>&4
8023                 val="$define"
8024         fi
8025 else
8026         $cat <<'EOM'
8027 You can't have filenames longer than 14 chars.
8028 You can't even think about them!
8029 EOM
8030         val="$undef"
8031 fi 
8032 set d_flexfnam
8033 eval $setvar
8034 $rm -rf 123456789abcde*
8035
8036 : determine where library module manual pages go
8037 set man3dir man3dir none
8038 eval $prefixit
8039 $cat <<EOM
8040
8041 $spackage has manual pages for many of the library modules.
8042 EOM
8043
8044 case "$nroff" in
8045 nroff)
8046         $cat <<'EOM'
8047 However, you don't have nroff, so they're probably useless to you.
8048 EOM
8049         case "$man3dir" in
8050         '') man3dir="none";;
8051         esac;;
8052 esac
8053
8054 case "$d_flexfnam" in
8055 undef)
8056         $cat <<'EOM'
8057 However, your system can't handle the long file names like File::Basename.3. 
8058 EOM
8059         case "$man3dir" in
8060         '') man3dir="none";;
8061         esac;;
8062 esac
8063
8064 echo "If you don't want the manual sources installed, answer 'none'."
8065 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8066 case "$man3dir" in
8067 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8068         if $test -d "$privlib/man/man3"; then
8069                 cat <<EOM >&4
8070
8071 WARNING:  Previous versions of perl installed man3 pages into
8072 $privlib/man/man3.  This version will suggest a 
8073 new default of $dflt.  
8074 EOM
8075                 tdflt=$dflt
8076                 dflt='n'
8077                 rp='Do you wish to preserve the old behavior?(y/n)'
8078                 . ./myread
8079                 case "$ans" in
8080                 y*) dflt="$privlib/man/man3" ;;
8081                 *)  dflt=$tdflt ;;
8082                 esac
8083     fi
8084         ;;
8085 *)      dflt="$man3dir" ;;
8086 esac
8087 case "$dflt" in
8088 ' ') dflt=none ;;
8089 esac
8090 echo " "
8091 fn=dn+~
8092 rp="Where do the $package library man pages (source) go?"
8093 . ./getfile
8094 man3dir="$ans"
8095 man3direxp="$ansexp"
8096 case "$man3dir" in
8097 '')     man3dir=' '
8098         installman3dir='';;
8099 esac
8100
8101 : Change installation prefix, if necessary.
8102 if $test X"$prefix" != X"$installprefix"; then
8103         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8104 else
8105         installman3dir="$man3direxp"
8106 fi
8107
8108 : What suffix to use on installed man pages
8109 case "$man3dir" in
8110 ' ')
8111         man3ext='0'
8112         ;;
8113 *)
8114         rp="What suffix should be used for the $package library man pages?"
8115         case "$man3ext" in
8116         '')     case "$man3dir" in
8117                 *3)  dflt=3 ;;
8118                 *3p) dflt=3p ;;
8119                 *3pm) dflt=3pm ;;
8120                 *l) dflt=l;;
8121                 *n) dflt=n;;
8122                 *o) dflt=o;;
8123                 *p) dflt=p;;
8124                 *C) dflt=C;;
8125                 *L) dflt=L;;
8126                 *L3) dflt=L3;;
8127                 *) dflt=3;;
8128                 esac
8129                 ;;
8130         *)      dflt="$man3ext";;
8131         esac
8132         . ./myread
8133         man3ext="$ans"
8134         ;;
8135 esac
8136
8137 : see if we have to deal with yellow pages, now NIS.
8138 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8139         if $test -f /usr/etc/nibindd; then
8140                 echo " "
8141                 echo "I'm fairly confident you're on a NeXT."
8142                 echo " "
8143                 rp='Do you get the hosts file via NetInfo?'
8144                 dflt=y
8145                 case "$hostcat" in
8146                 nidump*) ;;
8147                 '') ;;
8148                 *) dflt=n;;
8149                 esac
8150                 . ./myread
8151                 case "$ans" in
8152                 y*) hostcat='nidump hosts .';;
8153                 *)      case "$hostcat" in
8154                         nidump*) hostcat='';;
8155                         esac
8156                         ;;
8157                 esac
8158         fi
8159         case "$hostcat" in
8160         nidump*) ;;
8161         *)
8162                 case "$hostcat" in
8163                 *ypcat*) dflt=y;;
8164                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8165                                 dflt=y
8166                         else
8167                                 dflt=n
8168                         fi;;
8169                 *) dflt=n;;
8170                 esac
8171                 echo " "
8172                 rp='Are you getting the hosts file via yellow pages?'
8173                 . ./myread
8174                 case "$ans" in
8175                 y*) hostcat='ypcat hosts';;
8176                 *) hostcat='cat /etc/hosts';;
8177                 esac
8178                 ;;
8179         esac
8180 fi
8181 case "$hostcat" in
8182 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8183 esac
8184 case "$groupcat" in
8185 '') test -f /etc/group && groupcat='cat /etc/group';;
8186 esac
8187 case "$passcat" in
8188 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8189 esac
8190
8191 : now get the host name
8192 echo " "
8193 echo "Figuring out host name..." >&4
8194 case "$myhostname" in
8195 '') cont=true
8196         echo 'Maybe "hostname" will work...'
8197         if tans=`sh -c hostname 2>&1` ; then
8198                 myhostname=$tans
8199                 phostname=hostname
8200                 cont=''
8201         fi
8202         ;;
8203 *) cont='';;
8204 esac
8205 if $test "$cont"; then
8206         if ./xenix; then
8207                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8208                 if tans=`cat /etc/systemid 2>&1` ; then
8209                         myhostname=$tans
8210                         phostname='cat /etc/systemid'
8211                         echo "Whadyaknow.  Xenix always was a bit strange..."
8212                         cont=''
8213                 fi
8214         elif $test -r /etc/systemid; then
8215                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8216         fi
8217 fi
8218 if $test "$cont"; then
8219         echo 'No, maybe "uuname -l" will work...'
8220         if tans=`sh -c 'uuname -l' 2>&1` ; then
8221                 myhostname=$tans
8222                 phostname='uuname -l'
8223         else
8224                 echo 'Strange.  Maybe "uname -n" will work...'
8225                 if tans=`sh -c 'uname -n' 2>&1` ; then
8226                         myhostname=$tans
8227                         phostname='uname -n'
8228                 else
8229                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8230                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8231                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8232                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8233                         else
8234                                 case "$myhostname" in
8235                                 '') echo "Does this machine have an identity crisis or something?"
8236                                         phostname='';;
8237                                 *)
8238                                         echo "Well, you said $myhostname before..."
8239                                         phostname='echo $myhostname';;
8240                                 esac
8241                         fi
8242                 fi
8243         fi
8244 fi
8245 case "$myhostname" in
8246 '') myhostname=noname ;;
8247 esac
8248 : you do not want to know about this
8249 set $myhostname
8250 myhostname=$1
8251
8252 : verify guess
8253 if $test "$myhostname" ; then
8254         dflt=y
8255         rp='Your host name appears to be "'$myhostname'".'" Right?"
8256         . ./myread
8257         case "$ans" in
8258         y*) ;;
8259         *) myhostname='';;
8260         esac
8261 fi
8262
8263 : bad guess or no guess
8264 while $test "X$myhostname" = X ; do
8265         dflt=''
8266         rp="Please type the (one word) name of your host:"
8267         . ./myread
8268         myhostname="$ans"
8269 done
8270
8271 : translate upper to lower if necessary
8272 case "$myhostname" in
8273 *[A-Z]*)
8274         echo "(Normalizing case in your host name)"
8275         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8276         ;;
8277 esac
8278
8279 case "$myhostname" in
8280 *.*)
8281         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8282         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8283         echo "(Trimming domain name from host name--host name is now $myhostname)"
8284         ;;
8285 *) case "$mydomain" in
8286         '')
8287                 {
8288                         test "X$hostcat" = "Xypcat hosts" &&
8289                         ypmatch "$myhostname" hosts 2>/dev/null |\
8290                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8291                         $test -s hosts
8292                 } || {
8293                         test "X$hostcat" != "X" &&
8294                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8295                                         /[       ]$myhostname[  . ]/p" > hosts
8296                 }
8297                 tmp_re="[       . ]"
8298                 if $test -f hosts; then
8299                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8300                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8301                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8302                                 hosts | $sort | $uniq | \
8303                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8304                         case `$echo X$dflt` in
8305                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8306                                 dflt=.
8307                                 ;;
8308                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8309                                 ;;
8310                         esac
8311                 else
8312                         echo "(I cannot locate a hosts database anywhere)"
8313                         dflt=.
8314                 fi
8315                 case "$dflt" in
8316                 .)
8317                         tans=`./loc resolv.conf X /etc /usr/etc`
8318                         if $test -f "$tans"; then
8319                                 echo "(Attempting domain name extraction from $tans)"
8320                                 dflt=.`$sed -n -e 's/   / /g' \
8321                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8322                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8323                                 case "$dflt" in
8324                                 .) dflt=.`$sed -n -e 's/        / /g' \
8325                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8326                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8327                                         ;;
8328                                 esac
8329                         fi
8330                         ;;
8331                 esac
8332                 case "$dflt" in
8333                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8334                         dflt=.`sh -c domainname 2>/dev/null`
8335                         case "$dflt" in
8336                         '') dflt='.';;
8337                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8338                         esac
8339                         ;;
8340                 esac
8341                 case "$dflt$osname" in
8342                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8343                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8344                         ;;
8345                 esac
8346                 case "$dflt" in
8347                 .) echo "(Lost all hope -- silly guess then)"
8348                         dflt='.nonet'
8349                         ;;
8350                 esac
8351                 $rm -f hosts
8352                 ;;
8353         *) dflt="$mydomain";;
8354         esac;;
8355 esac
8356 echo " "
8357 rp="What is your domain name?"
8358 . ./myread
8359 tans="$ans"
8360 case "$ans" in
8361 '') ;;
8362 .*) ;;
8363 *) tans=".$tans";;
8364 esac
8365 mydomain="$tans"
8366
8367 : translate upper to lower if necessary
8368 case "$mydomain" in
8369 *[A-Z]*)
8370         echo "(Normalizing case in your domain name)"
8371         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8372         ;;
8373 esac
8374
8375 : a little sanity check here
8376 case "$phostname" in
8377 '') ;;
8378 *)
8379         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8380         $myhostname$mydomain|$myhostname) ;;
8381         *)
8382                 case "$phostname" in
8383                 sed*)
8384                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8385                         ;;
8386                 *)
8387                         echo "(That doesn't agree with your $phostname command, by the way.)"
8388                         ;;
8389                 esac
8390         ;;
8391         esac
8392         ;;
8393 esac
8394
8395 $cat <<EOM
8396
8397 I need to get your e-mail address in Internet format if possible, i.e.
8398 something like user@host.domain. Please answer accurately since I have
8399 no easy means to double check it. The default value provided below
8400 is most probably close to reality but may not be valid from outside
8401 your organization...
8402
8403 EOM
8404 cont=x
8405 while test "$cont"; do
8406         case "$cf_email" in
8407         '') dflt="$cf_by@$myhostname$mydomain";;
8408         *) dflt="$cf_email";;
8409         esac
8410         rp='What is your e-mail address?'
8411         . ./myread
8412         cf_email="$ans"
8413         case "$cf_email" in
8414         *@*.*) cont='' ;;
8415         *)
8416                 rp='Address does not look like an Internet one.  Use it anyway?'
8417                 case "$fastread" in
8418                 yes) dflt=y ;;
8419                 *) dflt=n ;;
8420                 esac
8421                 . ./myread
8422                 case "$ans" in
8423                 y*) cont='' ;;
8424                 *) echo " " ;;
8425                 esac
8426                 ;;
8427         esac
8428 done
8429
8430 $cat <<EOM
8431
8432 If you or somebody else will be maintaining perl at your site, please
8433 fill in the correct e-mail address here so that they may be contacted
8434 if necessary. Currently, the "perlbug" program included with perl
8435 will send mail to this address in addition to perlbug@perl.org. You may
8436 enter "none" for no administrator.
8437
8438 EOM
8439 case "$perladmin" in
8440 '') dflt="$cf_email";;
8441 *) dflt="$perladmin";;
8442 esac
8443 rp='Perl administrator e-mail address'
8444 . ./myread
8445 perladmin="$ans"
8446
8447 : determine whether to only install version-specific parts.
8448 echo " "
8449 $cat <<EOM
8450 Do you want to install only the version-specific parts of the perl
8451 distribution?  Usually you do *not* want to do this.
8452 EOM
8453 case "$versiononly" in
8454 "$define"|[Yy]*|true) dflt='y' ;;
8455 *) dflt='n';
8456 esac
8457 rp="Do you want to install only the version-specific parts of perl?"
8458 . ./myread
8459 case "$ans" in
8460 [yY]*)  val="$define";;
8461 *)      val="$undef" ;;
8462 esac
8463 set versiononly
8464 eval $setvar
8465
8466 case "$versiononly" in
8467 "$define") inc_version_list=''
8468            inc_version_list_init=0
8469            ;;
8470 esac
8471
8472 : figure out how to guarantee perl startup
8473 case "$startperl" in
8474 '')
8475         case "$sharpbang" in
8476         *!)
8477                 $cat <<EOH
8478
8479 I can use the #! construct to start perl on your system. This will
8480 make startup of perl scripts faster, but may cause problems if you
8481 want to share those scripts and perl is not in a standard place
8482 ($binexp/perl) on all your platforms. The alternative is to force
8483 a shell by starting the script with a single ':' character.
8484
8485 EOH
8486                 case "$versiononly" in
8487                 "$define")      dflt="$binexp/perl$version";;  
8488                 *)              dflt="$binexp/perl";;
8489                 esac
8490                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8491                 . ./myread
8492                 case "$ans" in
8493                 none)   startperl=": # use perl";;
8494                 *)      startperl="#!$ans"
8495                         if $test 30 -lt `echo "$ans" | wc -c`; then
8496                                 $cat >&4 <<EOM
8497
8498 WARNING:  Some systems limit the #! command to 32 characters.
8499 If you experience difficulty running Perl scripts with #!, try
8500 installing Perl in a directory with a shorter pathname.
8501
8502 EOM
8503                         fi ;;
8504                 esac
8505                 ;;
8506         *) startperl=": # use perl"
8507                 ;;
8508         esac
8509         ;;
8510 esac
8511 echo "I'll use $startperl to start perl scripts."
8512
8513 : figure best path for perl in scripts
8514 case "$perlpath" in
8515 '')
8516         case "$versiononly" in
8517         "$define")      perlpath="$binexp/perl$version";;
8518         *)              perlpath="$binexp/perl";;
8519         esac
8520         case "$startperl" in
8521         *!*) ;;
8522         *)
8523                 $cat <<EOH
8524
8525 I will use the "eval 'exec'" idiom to start Perl on your system.
8526 I can use the full path of your Perl binary for this purpose, but
8527 doing so may cause problems if you want to share those scripts and
8528 Perl is not always in a standard place ($binexp/perl).
8529
8530 EOH
8531                 dflt="$binexp/perl"
8532                 rp="What path shall I use in \"eval 'exec'\"?"
8533                 . ./myread
8534                 perlpath="$ans"
8535                 ;;
8536         esac
8537         ;;
8538 esac
8539 case "$startperl" in
8540 *!*)    ;;
8541 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8542 esac
8543
8544 : determine where public executable scripts go
8545 set scriptdir scriptdir
8546 eval $prefixit
8547 case "$scriptdir" in
8548 '')
8549         dflt="$bin"
8550         : guess some guesses
8551         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8552         $test -d /usr/share/bin     && dflt=/usr/share/bin
8553         $test -d /usr/local/script  && dflt=/usr/local/script
8554         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8555         $test -d $prefixexp/script  && dflt=$prefixexp/script
8556         set dflt
8557         eval $prefixup
8558         ;;
8559 *)  dflt="$scriptdir"
8560         ;;
8561 esac
8562 $cat <<EOM
8563  
8564 Some installations have a separate directory just for executable scripts so
8565 that they can mount it across multiple architectures but keep the scripts in
8566 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8567 Or you might just lump your scripts in with all your other executables.
8568  
8569 EOM
8570 fn=d~
8571 rp='Where do you keep publicly executable scripts?'
8572 . ./getfile
8573 if $test "X$ansexp" != "X$scriptdirexp"; then
8574         installscript=''
8575 fi
8576 scriptdir="$ans"
8577 scriptdirexp="$ansexp"
8578 : Change installation prefix, if necessary.
8579 if $test X"$prefix" != X"$installprefix"; then
8580         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8581 else
8582         installscript="$scriptdirexp"
8583 fi
8584
8585 : determine where add-on public executables go
8586 case "$sitebin" in
8587 '')     dflt=$siteprefix/bin ;;
8588 *)      dflt=$sitebin ;;
8589 esac
8590 fn=d~
8591 rp='Pathname where the add-on public executables should be installed?'
8592 . ./getfile
8593 sitebin="$ans"
8594 sitebinexp="$ansexp"
8595 : Change installation prefix, if necessary.
8596 if $test X"$prefix" != X"$installprefix"; then
8597         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8598 else
8599         installsitebin="$sitebinexp"
8600 fi
8601
8602 : determine where add-on html pages go
8603 : There is no standard location, so try to copy the previously-selected
8604 : directory structure for the core html pages.
8605 case "$sitehtml1dir" in
8606 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8607 *)     dflt=$sitehtml1dir ;;
8608 esac
8609 case "$dflt" in
8610 ''|' ') dflt=none ;;
8611 esac
8612 fn=dn+~
8613 rp='Pathname where the site-specific html pages should be installed?'
8614 . ./getfile
8615 sitehtml1dir="$ans"
8616 sitehtml1direxp="$ansexp"
8617 : Change installation prefix, if necessary.
8618 if $test X"$prefix" != X"$installprefix"; then
8619         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8620 else
8621         installsitehtml1dir="$sitehtml1direxp"
8622 fi
8623
8624 : determine where add-on library html pages go
8625 : There is no standard location, so try to copy the previously-selected
8626 : directory structure for the core html pages.
8627 case "$sitehtml3dir" in
8628 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8629 *)     dflt=$sitehtml3dir ;;
8630 esac
8631 case "$dflt" in
8632 ''|' ') dflt=none ;;
8633 esac
8634 fn=dn+~
8635 rp='Pathname where the site-specific library html pages should be installed?'
8636 . ./getfile
8637 sitehtml3dir="$ans"
8638 sitehtml3direxp="$ansexp"
8639 : Change installation prefix, if necessary.
8640 if $test X"$prefix" != X"$installprefix"; then
8641         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8642 else
8643         installsitehtml3dir="$sitehtml3direxp"
8644 fi
8645
8646 : determine where add-on manual pages go
8647 case "$siteman1dir" in
8648 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8649 *)      dflt=$siteman1dir ;;
8650 esac
8651 case "$dflt" in
8652 ''|' ') dflt=none ;;
8653 esac
8654 fn=dn+~
8655 rp='Pathname where the site-specific manual pages should be installed?'
8656 . ./getfile
8657 siteman1dir="$ans"
8658 siteman1direxp="$ansexp"
8659 : Change installation prefix, if necessary.
8660 if $test X"$prefix" != X"$installprefix"; then
8661         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8662 else
8663         installsiteman1dir="$siteman1direxp"
8664 fi
8665
8666 : determine where add-on library man pages go
8667 case "$siteman3dir" in
8668 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8669 *)      dflt=$siteman3dir ;;
8670 esac
8671 case "$dflt" in
8672 ''|' ') dflt=none ;;
8673 esac
8674 fn=dn+~
8675 rp='Pathname where the site-specific library manual pages should be installed?'
8676 . ./getfile
8677 siteman3dir="$ans"
8678 siteman3direxp="$ansexp"
8679 : Change installation prefix, if necessary.
8680 if $test X"$prefix" != X"$installprefix"; then
8681         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8682 else
8683         installsiteman3dir="$siteman3direxp"
8684 fi
8685
8686 : determine where add-on public executable scripts go
8687 case "$sitescript" in
8688 '')     dflt=$siteprefix/script
8689         $test -d $dflt || dflt=$sitebin ;;
8690 *)  dflt="$sitescript" ;;
8691 esac
8692 fn=d~+
8693 rp='Pathname where add-on public executable scripts should be installed?'
8694 . ./getfile
8695 sitescript="$ans"
8696 sitescriptexp="$ansexp"
8697 : Change installation prefix, if necessary.
8698 if $test X"$prefix" != X"$installprefix"; then
8699         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8700 else
8701         installsitescript="$sitescriptexp"
8702 fi
8703
8704 case "$usefaststdio" in
8705 $define|true|[yY]*|'')
8706         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8707         case "$xversion" in
8708         [68])   dflt='y' ;;
8709         *)      dflt='n' ;;
8710         esac
8711         ;;
8712 *) dflt='n';;
8713 esac
8714 cat <<EOM
8715
8716 Perl can be built to use 'fast stdio', which means using the stdio
8717 library but also directly manipulating the stdio buffers to enable
8718 faster I/O.  Using stdio is better for backward compatibility (especially
8719 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8720 interface has been preferred instead of stdio.
8721
8722 If this doesn't make any sense to you, just accept the default '$dflt'.
8723 EOM
8724 rp='Use the "fast stdio" if available?'
8725 . ./myread
8726 case "$ans" in
8727 y|Y)    val="$define" ;;     
8728 *)      val="$undef" ;;
8729 esac
8730 set usefaststdio
8731 eval $setvar
8732
8733
8734 : define an is-a-typedef? function
8735 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8736 case "$inclist" in
8737 "") inclist="sys/types.h";;
8738 esac;
8739 eval "varval=\$$var";
8740 case "$varval" in
8741 "")
8742         $rm -f temp.c;
8743         for inc in $inclist; do
8744                 echo "#include <$inc>" >>temp.c;
8745         done;
8746         echo "#ifdef $type" >> temp.c;
8747         echo "printf(\"We have $type\");" >> temp.c;
8748         echo "#endif" >> temp.c;
8749         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8750         if $contains $type temp.E >/dev/null 2>&1; then
8751                 eval "$var=\$type";
8752         else
8753                 eval "$var=\$def";
8754         fi;
8755         $rm -f temp.?;;
8756 *) eval "$var=\$varval";;
8757 esac'
8758
8759 : define an is-a-typedef? function that prompts if the type is not available.
8760 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8761 case "$inclist" in
8762 "") inclist="sys/types.h";;
8763 esac;
8764 eval "varval=\$$var";
8765 case "$varval" in
8766 "")
8767         $rm -f temp.c;
8768         for inc in $inclist; do
8769                 echo "#include <$inc>" >>temp.c;
8770         done;
8771         echo "#ifdef $type" >> temp.c;
8772         echo "printf(\"We have $type\");" >> temp.c;
8773         echo "#endif" >> temp.c;
8774         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8775         echo " " ;
8776         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8777         if $contains $type temp.E >/dev/null 2>&1; then
8778                 echo "$type found." >&4;
8779                 eval "$var=\$type";
8780         else
8781                 echo "$type NOT found." >&4;
8782                 dflt="$def";
8783                 . ./myread ;
8784                 eval "$var=\$ans";
8785         fi;
8786         $rm -f temp.?;;
8787 *) eval "$var=\$varval";;
8788 esac'
8789
8790 : see what type lseek is declared as in the kernel
8791 rp="What is the type used for lseek's offset on this system?"
8792 set off_t lseektype long stdio.h sys/types.h
8793 eval $typedef_ask
8794
8795 echo " "
8796 echo "Checking to see how big your file offsets are..." >&4
8797 $cat >try.c <<EOCP
8798 #include <sys/types.h>
8799 #include <stdio.h>
8800 int main()
8801 {
8802     printf("%d\n", (int)sizeof($lseektype));
8803     return(0); 
8804 }
8805 EOCP
8806 set try
8807 if eval $compile_ok; then
8808         lseeksize=`$run ./try`
8809         echo "Your file offsets are $lseeksize bytes long."
8810 else
8811         dflt=$longsize
8812         echo " "
8813         echo "(I can't seem to compile the test program.  Guessing...)"
8814         rp="What is the size of your file offsets (in bytes)?"
8815         . ./myread
8816         lseeksize="$ans"
8817 fi
8818 $rm -f try.c try
8819
8820 : see what type file positions are declared as in the library
8821 rp="What is the type for file position used by fsetpos()?"
8822 set fpos_t fpostype long stdio.h sys/types.h
8823 eval $typedef_ask
8824
8825 echo " "
8826 case "$fpostype" in
8827 *_t) zzz="$fpostype"    ;;
8828 *)   zzz="fpos_t"       ;;
8829 esac
8830 echo "Checking the size of $zzz..." >&4 
8831 cat > try.c <<EOCP
8832 #include <sys/types.h>
8833 #include <stdio.h>
8834 #$i_stdlib I_STDLIB
8835 #ifdef I_STDLIB
8836 #include <stdlib.h>
8837 #endif
8838 int main() {
8839     printf("%d\n", (int)sizeof($fpostype));
8840     exit(0);
8841 }
8842 EOCP
8843 set try
8844 if eval $compile_ok; then
8845         yyy=`$run ./try`
8846         case "$yyy" in
8847         '')     fpossize=4
8848                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8849                 ;;
8850         *)      fpossize=$yyy
8851                 echo "Your $zzz is $fpossize bytes long."
8852                 ;;
8853         esac
8854 else
8855         dflt="$longsize"
8856         echo " " >&4
8857         echo "(I can't compile the test program.  Guessing...)" >&4
8858         rp="What is the size of your file positions (in bytes)?"
8859         . ./myread
8860         fpossize="$ans"
8861 fi
8862
8863 # Backward compatibility (uselfs is deprecated).
8864 case "$uselfs" in
8865 "$define"|true|[yY]*)
8866         cat <<EOM >&4
8867
8868 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8869 EOM
8870         uselargefiles="$define"
8871         ;;
8872 esac                          
8873
8874 case "$lseeksize:$fpossize" in
8875 8:8) cat <<EOM
8876
8877 You can have files larger than 2 gigabytes.
8878 EOM
8879    val="$define" ;;
8880 *)    case "$uselargefiles" in
8881    "$undef"|false|[nN]*) dflt='n' ;;
8882    *)   dflt='y' ;;
8883    esac
8884    cat <<EOM
8885
8886 Perl can be built to understand large files (files larger than 2 gigabytes)
8887 on some systems.  To do so, Configure can be run with -Duselargefiles.
8888
8889 If this doesn't make any sense to you, just accept the default '$dflt'.
8890 EOM
8891    rp='Try to understand large files, if available?'
8892    . ./myread
8893    case "$ans" in
8894    y|Y)         val="$define" ;;
8895    *)           val="$undef"  ;;
8896    esac
8897    ;;
8898 esac
8899 set uselargefiles
8900 eval $setvar
8901 : Look for a hint-file generated 'call-back-unit'.  If the
8902 : user has specified that a large files perl is to be built,
8903 : we may need to set or change some other defaults.
8904 if $test -f uselargefiles.cbu; then
8905         echo "Your platform has some specific hints regarding large file builds, using them..."
8906         . ./uselargefiles.cbu
8907 fi
8908 case "$uselargefiles" in
8909 "$define")
8910         if $test -f uselargefiles.cbu; then
8911                 echo " "
8912                 echo "Rechecking to see how big your file offsets are..." >&4
8913                 $cat >try.c <<EOCP
8914 #include <sys/types.h>
8915 #include <stdio.h>
8916 int main()
8917 {
8918     printf("%d\n", (int)sizeof($lseektype));
8919     return(0); 
8920 }
8921 EOCP
8922                 set try
8923                 if eval $compile_ok; then
8924                         lseeksize=`$run ./try`
8925                         $echo "Your file offsets are now $lseeksize bytes long."
8926                 else
8927                         dflt="$lseeksize"
8928                         echo " "
8929                         echo "(I can't seem to compile the test program.  Guessing...)"
8930                         rp="What is the size of your file offsets (in bytes)?"
8931                         . ./myread
8932                         lseeksize="$ans"
8933                 fi
8934                 case "$fpostype" in
8935                 *_t) zzz="$fpostype"    ;;
8936                 *)   zzz="fpos_t"       ;;
8937                 esac
8938                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8939                 $cat > try.c <<EOCP
8940 #include <sys/types.h>
8941 #include <stdio.h>
8942 #$i_stdlib I_STDLIB
8943 #ifdef I_STDLIB
8944 #include <stdlib.h>
8945 #endif
8946 int main() {
8947     printf("%d\n", (int)sizeof($fpostype));
8948     return(0);
8949 }
8950 EOCP
8951                 set try
8952                 if eval $compile_ok; then
8953                         yyy=`$run ./try`
8954                         dflt="$lseeksize"
8955                         case "$yyy" in
8956                         '')     echo " "
8957                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8958                                 ;;
8959                         *)      fpossize=$yyy
8960                                 echo " $fpossize bytes." >&4
8961                                 ;;
8962                         esac
8963                 else
8964                         dflt="$fpossize"
8965                         echo " "
8966                         echo "(I can't compile the test program.  Guessing...)" >&4
8967                         rp="What is the size of your file positions (in bytes)?"
8968                         . ./myread
8969                         fpossize="$ans"
8970                 fi
8971                 $rm -f try.c try
8972         fi
8973         ;;
8974 esac
8975
8976 case "$vendorprefix" in
8977 '')     d_vendorbin="$undef"
8978         vendorbin=''
8979         vendorbinexp=''
8980         ;;
8981 *)      d_vendorbin="$define"
8982         : determine where vendor-supplied executables go.
8983         case "$vendorbin" in
8984         '') dflt=$vendorprefix/bin ;;
8985         *)      dflt="$vendorbin" ;;
8986         esac
8987         fn=d~+
8988         rp='Pathname for the vendor-supplied executables directory?'
8989         . ./getfile
8990         vendorbin="$ans"
8991         vendorbinexp="$ansexp"
8992         ;;
8993 esac
8994 : Change installation prefix, if necessary.
8995 if $test X"$prefix" != X"$installprefix"; then
8996         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8997 else
8998         installvendorbin="$vendorbinexp"
8999 fi
9000
9001 case "$vendorprefix" in
9002 '')     vendorhtml1dir=''
9003         vendorhtml1direxp=''
9004         ;;
9005 *)      : determine where vendor-supplied html pages go.
9006         : There is no standard location, so try to copy the previously-selected
9007         : directory structure for the core html pages.
9008         : XXX Better default suggestions would be welcome.
9009         case "$vendorhtml1dir" in
9010         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9011         *)      dflt=$vendorhtml1dir ;;
9012         esac
9013         case "$dflt" in
9014         ''|' ') dflt=none ;;
9015         esac
9016         fn=dn+~
9017         rp='Pathname for the vendor-supplied html pages?'
9018         . ./getfile
9019         vendorhtml1dir="$ans"
9020         vendorhtml1direxp="$ansexp"
9021         ;;
9022 esac
9023 : Use ' ' for none so value is preserved next time through Configure
9024 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9025 : Change installation prefix, if necessary.
9026 if $test X"$prefix" != X"$installprefix"; then
9027         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9028 else
9029         installvendorhtml1dir="$vendorhtml1direxp"
9030 fi
9031
9032 case "$vendorprefix" in
9033 '')     vendorhtml3dir=''
9034         vendorhtml3direxp=''
9035         ;;
9036 *)      : determine where vendor-supplied module html pages go.
9037         : There is no standard location, so try to copy the previously-selected
9038         : directory structure for the core html pages.
9039         : XXX Better default suggestions would be welcome.
9040         case "$vendorhtml3dir" in
9041         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9042         *)      dflt=$vendorhtml3dir ;;
9043         esac
9044         case "$dflt" in
9045         ''|' ') dflt=none ;;
9046         esac
9047         fn=dn+~
9048         rp='Pathname for the vendor-supplied html pages?'
9049         . ./getfile
9050         vendorhtml3dir="$ans"
9051         vendorhtml3direxp="$ansexp"
9052         ;;
9053 esac
9054 : Use ' ' for none so value is preserved next time through Configure
9055 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9056 : Change installation prefix, if necessary.
9057 if $test X"$prefix" != X"$installprefix"; then
9058         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9059 else
9060         installvendorhtml3dir="$vendorhtml3direxp"
9061 fi
9062
9063 case "$vendorprefix" in
9064 '')     vendorman1dir=''
9065         vendorman1direxp=''
9066         ;;
9067 *)      : determine where vendor-supplied manual pages go.
9068         case "$vendorman1dir" in
9069         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9070         *)      dflt=$vendorman1dir ;;
9071         esac
9072         case "$dflt" in
9073         ''|' ') dflt=none ;;
9074         esac
9075         fn=nd~+
9076         rp='Pathname for the vendor-supplied manual section 1 pages?'
9077         . ./getfile
9078         vendorman1dir="$ans"
9079         vendorman1direxp="$ansexp"
9080         ;;
9081 esac
9082 : Use ' ' for none so value is preserved next time through Configure
9083 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9084 : Change installation prefix, if necessary.
9085 if $test X"$prefix" != X"$installprefix"; then
9086         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9087 else
9088         installvendorman1dir="$vendorman1direxp"
9089 fi
9090
9091 case "$vendorprefix" in
9092 '')     vendorman3dir=''
9093         vendorman3direxp=''
9094         ;;
9095 *)      : determine where vendor-supplied module manual pages go.
9096         case "$vendorman3dir" in
9097         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9098         *)      dflt=$vendorman3dir ;;
9099         esac
9100         case "$dflt" in
9101         ''|' ') dflt=none ;;
9102         esac
9103         fn=nd~+
9104         rp='Pathname for the vendor-supplied manual section 3 pages?'
9105         . ./getfile
9106         vendorman3dir="$ans"
9107         vendorman3direxp="$ansexp"
9108         ;;
9109 esac
9110 : Use ' ' for none so value is preserved next time through Configure
9111 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9112 : Change installation prefix, if necessary.
9113 if $test X"$prefix" != X"$installprefix"; then
9114         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9115 else
9116         installvendorman3dir="$vendorman3direxp"
9117 fi
9118
9119 case "$vendorprefix" in
9120 '')     d_vendorscript="$undef"
9121         vendorscript=''
9122         vendorscriptexp=''
9123         ;;
9124 *)      d_vendorscript="$define"
9125         : determine where vendor-supplied scripts go.
9126         case "$vendorscript" in
9127         '')     dflt=$vendorprefix/script
9128                 $test -d $dflt || dflt=$vendorbin ;;
9129         *)  dflt="$vendorscript" ;;
9130         esac
9131         $cat <<EOM
9132
9133 The installation process will create a directory for 
9134 vendor-supplied scripts.
9135
9136 EOM
9137         fn=d~+
9138         rp='Pathname for the vendor-supplied scripts directory?'
9139         . ./getfile
9140         vendorscript="$ans"
9141         vendorscriptexp="$ansexp"
9142         ;;
9143 esac
9144 : Change installation prefix, if necessary.
9145 if $test X"$prefix" != X"$installprefix"; then
9146         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9147 else
9148         installvendorscript="$vendorscriptexp"
9149 fi
9150
9151 : see if qgcvt exists
9152 set qgcvt d_qgcvt
9153 eval $inlibc
9154
9155 echo " "
9156
9157 if $test X"$d_longdbl" = X"$define"; then
9158
9159 echo "Checking how to print long doubles..." >&4
9160
9161 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9162         $cat >try.c <<'EOCP'
9163 #include <sys/types.h>
9164 #include <stdio.h>
9165 int main() {
9166   double d = 123.456;
9167   printf("%.3f\n", d);
9168 }
9169 EOCP
9170         set try
9171         if eval $compile; then
9172                 yyy=`$run ./try`
9173                 case "$yyy" in
9174                 123.456)
9175                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9176                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9177                         echo "We will use %f."
9178                         ;;
9179                 esac
9180         fi
9181 fi
9182
9183 if $test X"$sPRIfldbl" = X; then
9184         $cat >try.c <<'EOCP'
9185 #include <sys/types.h>
9186 #include <stdio.h>
9187 int main() {
9188   long double d = 123.456;
9189   printf("%.3Lf\n", d);
9190 }
9191 EOCP
9192         set try
9193         if eval $compile; then
9194                 yyy=`$run ./try`
9195                 case "$yyy" in
9196                 123.456)
9197                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9198                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9199                         echo "We will use %Lf."
9200                         ;;
9201                 esac
9202         fi
9203 fi
9204
9205 if $test X"$sPRIfldbl" = X; then
9206         $cat >try.c <<'EOCP'
9207 #include <sys/types.h>
9208 #include <stdio.h>
9209 int main() {
9210   long double d = 123.456;
9211   printf("%.3llf\n", d);
9212 }
9213 EOCP
9214         set try
9215         if eval $compile; then
9216                 yyy=`$run ./try`
9217                 case "$yyy" in
9218                 123.456)
9219                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9220                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9221                         echo "We will use %llf."
9222                         ;;
9223                 esac
9224         fi
9225 fi
9226
9227 if $test X"$sPRIfldbl" = X; then
9228         $cat >try.c <<'EOCP'
9229 #include <sys/types.h>
9230 #include <stdio.h>
9231 int main() {
9232   long double d = 123.456;
9233   printf("%.3lf\n", d);
9234 }
9235 EOCP
9236         set try
9237         if eval $compile; then
9238                 yyy=`$run ./try`
9239                 case "$yyy" in
9240                 123.456)
9241                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9242                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9243                         echo "We will use %lf."
9244                         ;;
9245                 esac
9246         fi
9247 fi
9248
9249 if $test X"$sPRIfldbl" = X; then
9250         echo "Cannot figure out how to print long doubles." >&4
9251 else
9252         sSCNfldbl=$sPRIfldbl    # expect consistency
9253 fi
9254
9255 $rm -f try try.*
9256
9257 fi # d_longdbl
9258
9259 case "$sPRIfldbl" in
9260 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9261         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9262         d_SCNfldbl="$undef";
9263         ;;
9264 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9265         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9266         d_SCNfldbl="$define";
9267         ;;
9268 esac
9269
9270 : Check how to convert floats to strings.
9271
9272 if test "X$d_Gconvert" = X; then
9273
9274 echo " "
9275 echo "Checking for an efficient way to convert floats to strings."
9276 echo " " > try.c
9277 case "$uselongdouble" in
9278 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9279 esac
9280 case "$d_longdbl" in
9281 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9282 esac
9283 case "$d_PRIgldbl" in
9284 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9285 esac
9286 $cat >>try.c <<EOP
9287 #ifdef TRY_gconvert
9288 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9289 char *myname = "gconvert";
9290 #endif
9291 #ifdef TRY_gcvt
9292 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9293 char *myname = "gcvt";
9294 #endif
9295 #ifdef TRY_qgcvt
9296 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9297 char *myname = "qgcvt";
9298 #define DOUBLETYPE long double
9299 #endif
9300 #ifdef TRY_sprintf
9301 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9302 #ifdef HAS_PRIgldbl
9303 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9304 #else
9305 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9306 #endif
9307 #else
9308 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9309 #endif
9310 char *myname = "sprintf";
9311 #endif
9312
9313 #ifndef DOUBLETYPE
9314 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9315 #define DOUBLETYPE long double
9316 #else
9317 #define DOUBLETYPE double
9318 #endif
9319 #endif
9320
9321 #include <stdio.h>
9322
9323 #define I_STDLIB $i_stdlib
9324 #ifdef I_STDLIB
9325 #include <stdlib.h>
9326 #endif
9327
9328 int
9329 checkit(expect, got)
9330 char *expect;
9331 char *got;
9332 {
9333     if (strcmp(expect, got)) {
9334                 printf("%s oddity:  Expected %s, got %s\n",
9335                         myname, expect, got);
9336                 exit(1);
9337         }
9338 }
9339
9340 int main()
9341
9342         char buf[64]; 
9343         buf[63] = '\0';
9344
9345         /* This must be 1st test on (which?) platform */
9346         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9347         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9348         checkit("0.1", buf);
9349
9350         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9351         checkit("0.01", buf);
9352
9353         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9354         checkit("0.001", buf);
9355
9356         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9357         checkit("0.0001", buf);
9358
9359         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9360         if (strlen(buf) > 5)
9361             checkit("9e-005", buf); /* for Microsoft ?? */
9362         else
9363             checkit("9e-05", buf);
9364
9365         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9366         checkit("1", buf);
9367
9368         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9369         checkit("1.1", buf);
9370
9371         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9372         checkit("1.01", buf);
9373
9374         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9375         checkit("1.001", buf);
9376
9377         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9378         checkit("1.0001", buf);
9379
9380         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9381         checkit("1.00001", buf);
9382
9383         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9384         checkit("1.000001", buf);
9385
9386         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9387         checkit("0", buf);
9388
9389         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9390         checkit("-1", buf);
9391
9392         /* Some Linux gcvt's give 1.e+5 here. */
9393         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9394         checkit("100000", buf);
9395         
9396         /* Some Linux gcvt's give -1.e+5 here. */
9397         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9398         checkit("-100000", buf);
9399
9400         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9401         checkit("123.456", buf);
9402
9403         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9404         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9405         /* 34 should be enough to scare even long double
9406          * places into using the e notation. */
9407         if (strlen(buf) > 5)
9408             checkit("1e+034", buf); /* for Microsoft */
9409         else
9410             checkit("1e+34", buf);
9411
9412         /* For Perl, if you add additional tests here, also add them to
9413          * t/base/num.t for benefit of platforms not using Configure or
9414          * overriding d_Gconvert */
9415
9416         exit(0);
9417 }
9418 EOP
9419 : first add preferred functions to our list
9420 xxx_list=""
9421 for xxx_convert in $gconvert_preference; do
9422     case $xxx_convert in
9423     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9424     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9425     esac 
9426 done
9427 : then add any others
9428 for xxx_convert in gconvert gcvt sprintf; do
9429     case "$xxx_list" in
9430     *$xxx_convert*) ;;
9431     *) xxx_list="$xxx_list $xxx_convert" ;;
9432     esac 
9433 done
9434
9435 case "$d_longdbl$uselongdouble" in
9436 "$define$define")
9437     : again, add prefered functions to our list first
9438     xxx_ld_list=""
9439     for xxx_convert in $gconvert_ld_preference; do
9440         case $xxx_convert in
9441         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9442         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9443         esac
9444     done
9445     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9446     for xxx_convert in qgcvt sprintf $xxx_list; do
9447         case "$xxx_ld_list" in
9448         $xxx_convert*|*" $xxx_convert"*) ;;
9449         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9450         esac
9451     done
9452     : if sprintf cannot do long doubles, move it to the end
9453     if test "$d_PRIgldbl" != "$define"; then
9454         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9455     fi
9456     : if no qgcvt, remove it
9457     if test "$d_qgcvt" != "$define"; then
9458         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9459     fi
9460     : use the ld_list
9461     xxx_list="$xxx_ld_list"
9462     ;;
9463 esac
9464
9465 for xxx_convert in $xxx_list; do
9466         echo "Trying $xxx_convert..."
9467         $rm -f try try$_o
9468         set try -DTRY_$xxx_convert
9469         if eval $compile; then
9470                 echo "$xxx_convert() found." >&4
9471                 if $run ./try; then
9472                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9473                         break;
9474                 else
9475                         echo "...But $xxx_convert didn't work as I expected."
9476                         xxx_convert=''
9477                 fi
9478         else
9479                 echo "$xxx_convert NOT found." >&4
9480         fi
9481 done
9482
9483 if test X$xxx_convert = X; then
9484     echo "*** WHOA THERE!!! ***" >&4
9485     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9486     xxx_convert=sprintf
9487 fi
9488
9489 case "$xxx_convert" in
9490 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9491 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9492 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9493 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9494    "$define$define$define")
9495       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9496    "$define$define$undef")
9497       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9498    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9499    esac
9500    ;;  
9501 esac
9502
9503 fi
9504
9505 : see if _fwalk exists
9506 set fwalk d__fwalk
9507 eval $inlibc
9508
9509 : Initialize h_fcntl
9510 h_fcntl=false
9511
9512 : Initialize h_sysfile
9513 h_sysfile=false
9514
9515 : access call always available on UNIX
9516 set access d_access
9517 eval $inlibc
9518
9519 : locate the flags for 'access()'
9520 case "$d_access" in
9521 "$define")
9522         echo " "
9523         $cat >access.c <<EOCP
9524 #include <sys/types.h>
9525 #ifdef I_FCNTL
9526 #include <fcntl.h>
9527 #endif
9528 #ifdef I_SYS_FILE
9529 #include <sys/file.h>
9530 #endif
9531 #ifdef I_UNISTD
9532 #include <unistd.h>
9533 #endif
9534 #$i_stdlib I_STDLIB
9535 #ifdef I_STDLIB
9536 #include <stdlib.h>
9537 #endif
9538 int main() {
9539         exit(R_OK);
9540 }
9541 EOCP
9542         : check sys/file.h first, no particular reason here
9543         if $test `./findhdr sys/file.h` && \
9544                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9545                 h_sysfile=true;
9546                 echo "<sys/file.h> defines the *_OK access constants." >&4
9547         elif $test `./findhdr fcntl.h` && \
9548                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9549                 h_fcntl=true;
9550                 echo "<fcntl.h> defines the *_OK access constants." >&4
9551         elif $test `./findhdr unistd.h` && \
9552                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9553                 echo "<unistd.h> defines the *_OK access constants." >&4
9554         else
9555                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9556         fi
9557         ;;
9558 esac
9559 $rm -f access*
9560
9561 : see if accessx exists
9562 set accessx d_accessx
9563 eval $inlibc
9564
9565 : see if aintl exists
9566 set aintl d_aintl
9567 eval $inlibc
9568
9569 : see if alarm exists
9570 set alarm d_alarm
9571 eval $inlibc
9572
9573 : see if POSIX threads are available
9574 set pthread.h i_pthread
9575 eval $inhdr
9576
9577 : define a fucntion to check prototypes
9578 $cat > protochk <<EOSH
9579 $startsh
9580 cc="$cc"
9581 optimize="$optimize"
9582 ccflags="$ccflags"
9583 prototype="$prototype"
9584 define="$define"
9585 rm=$rm
9586 usethreads=$usethreads
9587 i_pthread=$i_pthread
9588 pthread_h_first=$pthread_h_first
9589 EOSH
9590
9591 $cat >> protochk <<'EOSH'
9592
9593 $rm -f try.c
9594 foo="$1"
9595 shift
9596 while test $# -ge 2; do
9597         case "$1" in
9598                 $define) echo "#include <$2>" >> try.c ;;
9599                 literal) echo "$2" >> try.c ;;
9600         esac
9601     # Extra magic for the benefit of systems that need pthread.h
9602     # to be included early to correctly detect threadsafe functions.
9603     # Such functions must guarantee themselves, though, that the usethreads
9604     # and i_pthread have been defined, before calling protochk.
9605     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9606         echo "#include <pthread.h>" >> try.c
9607         pthread_h_done=yes
9608     fi
9609     shift 2
9610 done
9611 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9612 cat >> try.c <<'EOCP'
9613 #ifdef CAN_PROTOTYPE
9614 #define _(args) args
9615 #else
9616 #define _(args) ()
9617 #endif
9618 EOCP
9619 echo "$foo" >> try.c
9620 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9621 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9622 status=$?
9623 $rm -f try.[co]
9624 exit $status
9625 EOSH
9626 chmod +x protochk
9627 $eunicefix protochk
9628
9629 hasproto='varname=$1; func=$2; shift; shift;
9630 while $test $# -ge 2; do
9631         case "$1" in
9632         $define) echo "#include <$2>";;
9633         esac ;
9634     shift 2;
9635 done > try.c;
9636 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9637 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9638         echo "$func() prototype found.";
9639         val="$define";
9640 else
9641         echo "$func() prototype NOT found.";
9642         val="$undef";
9643 fi;
9644 set $varname;
9645 eval $setvar;
9646 $rm -f try.c tryout.c'
9647
9648 : see if sys/types.h has to be included
9649 set sys/types.h i_systypes
9650 eval $inhdr
9651
9652 : see if sys/select.h has to be included
9653 set sys/select.h i_sysselct
9654 eval $inhdr
9655
9656 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9657 while $test $# -ge 2; do
9658         case "$1" in
9659         $define) echo "#include <$2>";;
9660         esac ;
9661     shift 2;
9662 done > try.c;
9663 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9664 set try;
9665 if eval $compile; then
9666         val="$define";
9667 else
9668         val="$undef";
9669 fi;
9670 set $varname;
9671 eval $setvar;
9672 $rm -f try.c try.o'
9673
9674 : see if we should include time.h, sys/time.h, or both
9675 echo " "
9676 if test "X$timeincl" = X; then
9677         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9678         $echo $n "I'm now running the test program...$c"
9679         $cat >try.c <<EOCP
9680 #include <sys/types.h>
9681 #ifdef I_TIME
9682 #include <time.h>
9683 #endif
9684 #ifdef I_SYSTIME
9685 #ifdef SYSTIMEKERNEL
9686 #define KERNEL
9687 #endif
9688 #include <sys/time.h>
9689 #endif
9690 #ifdef I_SYSSELECT
9691 #include <sys/select.h>
9692 #endif
9693 #$i_stdlib I_STDLIB
9694 #ifdef I_STDLIB
9695 #include <stdlib.h>
9696 #endif
9697 int main()
9698 {
9699         struct tm foo;
9700 #ifdef S_TIMEVAL
9701         struct timeval bar;
9702 #endif
9703 #ifdef S_TIMEZONE
9704         struct timezone tzp;
9705 #endif
9706         if (foo.tm_sec == foo.tm_sec)
9707                 exit(0);
9708 #ifdef S_TIMEVAL
9709         if (bar.tv_sec == bar.tv_sec)
9710                 exit(0);
9711 #endif
9712         exit(1);
9713 }
9714 EOCP
9715         flags=''
9716         for s_timezone in '-DS_TIMEZONE' ''; do
9717         sysselect=''
9718         for s_timeval in '-DS_TIMEVAL' ''; do
9719         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9720         for i_time in '' '-DI_TIME'; do
9721         for i_systime in '-DI_SYSTIME' ''; do
9722                 case "$flags" in
9723                 '') $echo $n ".$c"
9724                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9725                         if eval $compile; then
9726                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9727                                 shift
9728                                 flags="$*"
9729                                 echo " "
9730                                 $echo $n "Succeeded with $flags$c"
9731                         fi
9732                         ;;
9733                 esac
9734         done
9735         done
9736         done
9737         done
9738         done
9739         timeincl=''
9740         echo " "
9741         case "$flags" in
9742         *SYSTIMEKERNEL*) i_systimek="$define"
9743                 timeincl=`./findhdr sys/time.h`
9744                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9745         *) i_systimek="$undef";;
9746         esac
9747         case "$flags" in
9748         *I_TIME*) i_time="$define"
9749                 timeincl=`./findhdr time.h`" $timeincl"
9750                 echo "We'll include <time.h>." >&4;;
9751         *) i_time="$undef";;
9752         esac
9753         case "$flags" in
9754         *I_SYSTIME*) i_systime="$define"
9755                 timeincl=`./findhdr sys/time.h`" $timeincl"
9756                 echo "We'll include <sys/time.h>." >&4;;
9757         *) i_systime="$undef";;
9758         esac
9759         $rm -f try.c try
9760 fi
9761 : see if struct tm knows about tm_zone
9762 case "$i_systime$i_time" in
9763 *$define*) 
9764         echo " "
9765         echo "Checking to see if your struct tm has tm_zone field..." >&4
9766         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9767         eval $hasfield
9768         ;;
9769 *)      val="$undef"
9770         set d_tm_tm_zone
9771         eval $setvar
9772         ;;
9773 esac
9774 case "$d_tm_tm_zone" in
9775 "$define")      echo "Yes, it does."   ;;
9776 *)              echo "No, it doesn't." ;;
9777 esac
9778 : see if struct tm knows about tm_gmtoff
9779 case "$i_systime$i_time" in
9780 *$define*) 
9781         echo " "
9782         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9783         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9784         eval $hasfield
9785         ;;
9786 *)      val="$undef"
9787         set d_tm_tm_gmtoff
9788         eval $setvar
9789         ;;
9790 esac
9791 case "$d_tm_tm_gmtoff" in
9792 "$define")      echo "Yes, it does."   ;;
9793 *)              echo "No, it doesn't." ;;
9794 esac
9795
9796 : see if asctime_r exists
9797 set asctime_r d_asctime_r
9798 eval $inlibc
9799 case "$d_asctime_r" in
9800 "$define")
9801         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9802         case "$d_asctime_r_proto:$usethreads" in
9803         ":define")      d_asctime_r_proto=define
9804                 set d_asctime_r_proto asctime_r $hdrs
9805                 eval $hasproto ;;
9806         *)      ;;
9807         esac
9808         case "$d_asctime_r_proto" in
9809         define)
9810         case "$asctime_r_proto" in
9811         ''|0) try='char* asctime_r(const struct tm*, char*);'
9812         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9813         esac
9814         case "$asctime_r_proto" in
9815         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9816         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9817         esac
9818         case "$asctime_r_proto" in
9819         ''|0) try='int asctime_r(const struct tm*, char*);'
9820         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9821         esac
9822         case "$asctime_r_proto" in
9823         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9824         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9825         esac
9826         case "$asctime_r_proto" in
9827         ''|0)   d_asctime_r=undef
9828                 asctime_r_proto=0
9829                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9830         * )     case "$asctime_r_proto" in
9831                 REENTRANT_PROTO*) ;;
9832                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9833                 esac
9834                 echo "Prototype: $try" ;;
9835         esac
9836         ;;
9837         *)      case "$usethreads" in
9838                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9839                 esac
9840                 d_asctime_r=undef
9841                 asctime_r_proto=0
9842                 ;;
9843         esac
9844         ;;
9845 *)      asctime_r_proto=0
9846         ;;
9847 esac
9848
9849 : see if atolf exists
9850 set atolf d_atolf
9851 eval $inlibc
9852
9853 : see if atoll exists
9854 set atoll d_atoll
9855 eval $inlibc
9856
9857 : Look for GNU-cc style attribute checking
9858 echo " "
9859 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9860 $cat >attrib.c <<'EOCP'
9861 #include <stdio.h>
9862 void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
9863 EOCP
9864 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9865         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9866                 echo "Your C compiler doesn't fully support __attribute__."
9867                 val="$undef"
9868         else
9869                 echo "Your C compiler supports __attribute__."
9870                 val="$define"
9871         fi
9872 else
9873         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9874         val="$undef"
9875 fi
9876 set d_attribut
9877 eval $setvar
9878 $rm -f attrib*
9879
9880 : see if bcmp exists
9881 set bcmp d_bcmp
9882 eval $inlibc
9883
9884 : see if bcopy exists
9885 set bcopy d_bcopy
9886 eval $inlibc
9887
9888 : see if this is a unistd.h system
9889 set unistd.h i_unistd
9890 eval $inhdr
9891
9892 : see if getpgrp exists
9893 set getpgrp d_getpgrp
9894 eval $inlibc
9895
9896 case "$d_getpgrp" in
9897 "$define")
9898         echo " "
9899         echo "Checking to see which flavor of getpgrp is in use..."
9900         $cat >try.c <<EOP
9901 #$i_unistd I_UNISTD
9902 #include <sys/types.h>
9903 #ifdef I_UNISTD
9904 #  include <unistd.h>
9905 #endif
9906 #$i_stdlib I_STDLIB
9907 #ifdef I_STDLIB
9908 #include <stdlib.h>
9909 #endif
9910 int main()
9911 {
9912         if (getuid() == 0) {
9913                 printf("(I see you are running Configure as super-user...)\n");
9914                 setuid(1);
9915         }
9916 #ifdef TRY_BSD_PGRP
9917         if (getpgrp(1) == 0)
9918                 exit(0);
9919 #else
9920         if (getpgrp() > 0)
9921                 exit(0);
9922 #endif
9923         exit(1);
9924 }
9925 EOP
9926         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9927                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9928                 val="$define"
9929         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9930                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9931                 val="$undef"
9932         else
9933                 echo "I can't seem to compile and run the test program."
9934                 if ./usg; then
9935                         xxx="a USG one, i.e. you use getpgrp()."
9936                 else
9937                         # SVR4 systems can appear rather BSD-ish.
9938                         case "$i_unistd" in
9939                         $undef)
9940                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9941                                 val="$define"
9942                                 ;;
9943                         $define)
9944                                 xxx="probably a USG one, i.e. you use getpgrp()."
9945                                 val="$undef"
9946                                 ;;
9947                         esac
9948                 fi
9949                 echo "Assuming your getpgrp is $xxx" >&4
9950         fi
9951         ;;
9952 *) val="$undef";;
9953 esac
9954 set d_bsdgetpgrp
9955 eval $setvar
9956 $rm -f try try.*
9957
9958 : see if setpgrp exists
9959 set setpgrp d_setpgrp
9960 eval $inlibc
9961
9962 case "$d_setpgrp" in
9963 "$define")
9964         echo " "
9965         echo "Checking to see which flavor of setpgrp is in use..."
9966         $cat >try.c <<EOP
9967 #$i_unistd I_UNISTD
9968 #include <sys/types.h>
9969 #ifdef I_UNISTD
9970 #  include <unistd.h>
9971 #endif
9972 #$i_stdlib I_STDLIB
9973 #ifdef I_STDLIB
9974 #include <stdlib.h>
9975 #endif
9976 int main()
9977 {
9978         if (getuid() == 0) {
9979                 printf("(I see you are running Configure as super-user...)\n");
9980                 setuid(1);
9981         }
9982 #ifdef TRY_BSD_PGRP
9983         if (-1 == setpgrp(1, 1))
9984                 exit(0);
9985 #else
9986         if (setpgrp() != -1)
9987                 exit(0);
9988 #endif
9989         exit(1);
9990 }
9991 EOP
9992         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9993                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9994                 val="$define"
9995         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9996                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9997                 val="$undef"
9998         else
9999                 echo "(I can't seem to compile and run the test program.)"
10000                 if ./usg; then
10001                         xxx="a USG one, i.e. you use setpgrp()."
10002                 else
10003                         # SVR4 systems can appear rather BSD-ish.
10004                         case "$i_unistd" in
10005                         $undef)
10006                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10007                                 val="$define"
10008                                 ;;
10009                         $define)
10010                                 xxx="probably a USG one, i.e. you use setpgrp()."
10011                                 val="$undef"
10012                                 ;;
10013                         esac
10014                 fi
10015                 echo "Assuming your setpgrp is $xxx" >&4
10016         fi
10017         ;;
10018 *) val="$undef";;
10019 esac
10020 set d_bsdsetpgrp
10021 eval $setvar
10022 $rm -f try try.*
10023 : see if bzero exists
10024 set bzero d_bzero
10025 eval $inlibc
10026
10027 : see if signal is declared as pointer to function returning int or void
10028 echo " "
10029 xxx=`./findhdr signal.h`
10030 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10031 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10032         echo "You have int (*signal())() instead of void." >&4
10033         val="$undef"
10034 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10035         echo "You have void (*signal())()." >&4
10036         val="$define"
10037 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10038         echo "You have int (*signal())() instead of void." >&4
10039         val="$undef"
10040 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10041         echo "You have void (*signal())()." >&4
10042         val="$define"
10043 else
10044         case "$d_voidsig" in
10045         '')
10046         echo "I can't determine whether signal handler returns void or int..." >&4
10047                 dflt=void
10048                 rp="What type does your signal handler return?"
10049                 . ./myread
10050                 case "$ans" in
10051                 v*) val="$define";;
10052                 *) val="$undef";;
10053                 esac;;
10054         "$define")
10055                 echo "As you already told me, signal handler returns void." >&4
10056                 val="$define"
10057                 ;;
10058         *)      echo "As you already told me, signal handler returns int." >&4
10059                 val="$undef"
10060                 ;;
10061         esac
10062 fi
10063 set d_voidsig
10064 eval $setvar
10065 case "$d_voidsig" in
10066 "$define") signal_t="void";;
10067 *) signal_t="int";;
10068 esac
10069 $rm -f $$.tmp
10070
10071 : check for ability to cast large floats to 32-bit ints.
10072 echo " "
10073 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10074 if $test "$intsize" -ge 4; then
10075         xxx=int
10076 else
10077         xxx=long
10078 fi
10079 $cat >try.c <<EOCP
10080 #include <stdio.h>
10081 #$i_stdlib I_STDLIB
10082 #ifdef I_STDLIB
10083 #include <stdlib.h>
10084 #endif
10085 #include <sys/types.h>
10086 #include <signal.h>
10087 $signal_t blech(s) int s; { exit(3); }
10088 int main()
10089 {
10090         $xxx i32;
10091         double f, g;
10092         int result = 0;
10093         char str[16];
10094         signal(SIGFPE, blech);
10095
10096         /* Don't let compiler optimize the test away.  Store the number 
10097            in a writable string for gcc to pass to sscanf under HP/UX.
10098         */
10099         sprintf(str, "2147483647");
10100         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10101         g = 10 * f;
10102         i32  = ($xxx) g;
10103
10104         /* x86 processors will probably give 0x8000 0000, which is a
10105            sign change.  We don't want that.  We want to mimic SPARC
10106            behavior here, which is to preserve the sign and give
10107            back 0x7fff ffff.
10108         */
10109         if (i32 != ($xxx) f)
10110                 result |= 1;
10111         exit(result);
10112 }
10113 EOCP
10114 set try
10115 if eval $compile_ok; then
10116         $run ./try
10117         yyy=$?
10118 else
10119         echo "(I can't seem to compile the test program--assuming it can't)"
10120         yyy=1
10121 fi
10122 case "$yyy" in
10123 0)      val="$define"
10124         echo "Yup, it can."
10125         ;;
10126 *)      val="$undef"
10127         echo "Nope, it can't."
10128         ;;
10129 esac
10130 set d_casti32
10131 eval $setvar
10132 $rm -f try try.*
10133
10134 : check for ability to cast negative floats to unsigned
10135 echo " "
10136 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10137 $cat >try.c <<EOCP
10138 #include <stdio.h>
10139 #$i_stdlib I_STDLIB
10140 #ifdef I_STDLIB
10141 #include <stdlib.h>
10142 #endif
10143 #include <sys/types.h>
10144 #include <signal.h>
10145 $signal_t blech(s) int s; { exit(7); }
10146 $signal_t blech_in_list(s) int s; { exit(4); }
10147 unsigned long dummy_long(p) unsigned long p; { return p; }
10148 unsigned int dummy_int(p) unsigned int p; { return p; }
10149 unsigned short dummy_short(p) unsigned short p; { return p; }
10150 int main()
10151 {
10152         double f;
10153         unsigned long along;
10154         unsigned int aint;
10155         unsigned short ashort;
10156         int result = 0;
10157         char str[16];
10158         
10159         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10160            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10161            optimized the whole file away
10162         */
10163         /* Store the number in a writable string for gcc to pass to 
10164            sscanf under HP/UX.
10165         */
10166         sprintf(str, "-123");
10167         sscanf(str, "%lf", &f);  /* f = -123.; */
10168
10169         signal(SIGFPE, blech);
10170         along = (unsigned long)f;
10171         aint = (unsigned int)f;
10172         ashort = (unsigned short)f;
10173         if (along != (unsigned long)-123)
10174                 result |= 1;
10175         if (aint != (unsigned int)-123)
10176                 result |= 1;
10177         if (ashort != (unsigned short)-123)
10178                 result |= 1;
10179         sprintf(str, "1073741824.");
10180         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10181         f = f + f;
10182         along = 0;
10183         along = (unsigned long)f;
10184         if (along != 0x80000000)
10185                 result |= 2;
10186         f -= 1.;
10187         along = 0;
10188         along = (unsigned long)f;
10189         if (along != 0x7fffffff)
10190                 result |= 1;
10191         f += 2.;
10192         along = 0;
10193         along = (unsigned long)f;
10194         if (along != 0x80000001)
10195                 result |= 2;
10196         if (result)
10197                 exit(result);
10198         signal(SIGFPE, blech_in_list);
10199         sprintf(str, "123.");
10200         sscanf(str, "%lf", &f);  /* f = 123.; */
10201         along = dummy_long((unsigned long)f);
10202         aint = dummy_int((unsigned int)f);
10203         ashort = dummy_short((unsigned short)f);
10204         if (along != (unsigned long)123)
10205                 result |= 4;
10206         if (aint != (unsigned int)123)
10207                 result |= 4;
10208         if (ashort != (unsigned short)123)
10209                 result |= 4;
10210         exit(result);
10211
10212 }
10213 EOCP
10214 set try
10215 if eval $compile_ok; then
10216         $run ./try
10217         castflags=$?
10218 else
10219         echo "(I can't seem to compile the test program--assuming it can't)"
10220         castflags=7
10221 fi
10222 case "$castflags" in
10223 0)      val="$define"
10224         echo "Yup, it can."
10225         ;;
10226 *)      val="$undef"
10227         echo "Nope, it can't."
10228         ;;
10229 esac
10230 set d_castneg
10231 eval $setvar
10232 $rm -f try.*
10233
10234 : see if vprintf exists
10235 echo " "
10236 if set vprintf val -f d_vprintf; eval $csym; $val; then
10237         echo 'vprintf() found.' >&4
10238         val="$define"
10239         $cat >try.c <<EOF
10240 #include <varargs.h>
10241 #$i_stdlib I_STDLIB
10242 #ifdef I_STDLIB
10243 #include <stdlib.h>
10244 #endif
10245
10246 int main() { xxx("foo"); }
10247
10248 xxx(va_alist)
10249 va_dcl
10250 {
10251         va_list args;
10252         char buf[10];
10253
10254         va_start(args);
10255         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10256 }
10257 EOF
10258         set try
10259         if eval $compile && $run ./try; then
10260                 echo "Your vsprintf() returns (int)." >&4
10261                 val2="$undef"
10262         else
10263                 echo "Your vsprintf() returns (char*)." >&4
10264                 val2="$define"
10265         fi
10266 else
10267         echo 'vprintf() NOT found.' >&4
10268                 val="$undef"
10269                 val2="$undef"
10270 fi
10271 $rm -f try try.*
10272 set d_vprintf
10273 eval $setvar
10274 val=$val2
10275 set d_charvspr
10276 eval $setvar
10277
10278 : see if chown exists
10279 set chown d_chown
10280 eval $inlibc
10281
10282 : see if chroot exists
10283 set chroot d_chroot
10284 eval $inlibc
10285
10286 : see if chsize exists
10287 set chsize d_chsize
10288 eval $inlibc
10289
10290 : see if class exists
10291 set class d_class
10292 eval $inlibc
10293
10294 hasstruct='varname=$1; struct=$2; shift; shift;
10295 while $test $# -ge 2; do
10296         case "$1" in
10297         $define) echo "#include <$2>";;
10298         esac ;
10299     shift 2;
10300 done > try.c;
10301 echo "int main () { struct $struct foo; }" >> try.c;
10302 set try;
10303 if eval $compile; then
10304         val="$define";
10305 else
10306         val="$undef";
10307 fi;
10308 set $varname;
10309 eval $setvar;
10310 $rm -f try.c try.o'
10311
10312 socketlib=''
10313 sockethdr=''
10314 : see whether socket exists
10315 echo " "
10316 $echo $n "Hmm... $c" >&4
10317 if set socket val -f d_socket; eval $csym; $val; then
10318         echo "Looks like you have Berkeley networking support." >&4
10319         d_socket="$define"
10320         if set setsockopt val -f; eval $csym; $val; then
10321                 d_oldsock="$undef"
10322         else
10323                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10324                 d_oldsock="$define"
10325         fi
10326 else
10327         if $contains socklib libc.list >/dev/null 2>&1; then
10328                 echo "Looks like you have Berkeley networking support." >&4
10329                 d_socket="$define"
10330                 : we will have to assume that it supports the 4.2 BSD interface
10331                 d_oldsock="$undef"
10332         else
10333                 echo "You don't have Berkeley networking in libc$_a..." >&4
10334                 if test "X$d_socket" = "X$define"; then
10335                    echo "...but you seem to believe that you have sockets." >&4
10336                 else
10337                         for net in net socket
10338                         do
10339                                 if test -f /usr/lib/lib$net$_a; then
10340                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10341                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10342                                         if $contains socket libc.list >/dev/null 2>&1; then
10343                                                 d_socket="$define"
10344                                                 socketlib="-l$net"
10345                                                 case "$net" in
10346                                                 net)
10347                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10348                                                         sockethdr="-I/usr/netinclude"
10349                                                         ;;
10350                                                 esac
10351                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10352                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10353                                                         d_oldsock="$undef"
10354                                                 else
10355                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10356                                                         d_oldsock="$define"
10357                                                 fi
10358                                                 break
10359                                         fi
10360                                 fi
10361                         done
10362                         if test "X$d_socket" != "X$define"; then
10363                            echo "or anywhere else I see." >&4
10364                            d_socket="$undef"
10365                            d_oldsock="$undef"
10366                         fi
10367                 fi
10368         fi
10369 fi
10370
10371 : see if socketpair exists
10372 set socketpair d_sockpair
10373 eval $inlibc
10374
10375
10376 echo " "
10377 echo "Checking the availability of certain socket constants..." >&4
10378 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10379         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10380         $cat >try.c <<EOF
10381 #include <sys/types.h>
10382 #include <sys/socket.h>
10383 int main() {
10384     int i = $ENUM;
10385 }
10386 EOF
10387         val="$undef"
10388         set try; if eval $compile; then
10389                 val="$define"
10390         fi
10391         set d_${enum}; eval $setvar
10392         $rm -f try.c try
10393 done
10394
10395 : see if this is a sys/uio.h system
10396 set sys/uio.h i_sysuio
10397 eval $inhdr
10398
10399
10400 echo " "
10401 echo "Checking to see if your system supports struct cmsghdr..." >&4
10402 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10403 eval $hasstruct
10404 case "$d_cmsghdr_s" in
10405 "$define")      echo "Yes, it does."   ;;
10406 *)              echo "No, it doesn't." ;;
10407 esac
10408
10409
10410 : check for const keyword
10411 echo " "
10412 echo 'Checking to see if your C compiler knows about "const"...' >&4
10413 $cat >const.c <<'EOCP'
10414 typedef struct spug { int drokk; } spug;
10415 int main()
10416 {
10417         const char *foo;
10418         const spug y;
10419 }
10420 EOCP
10421 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10422         val="$define"
10423         echo "Yup, it does."
10424 else
10425         val="$undef"
10426         echo "Nope, it doesn't."
10427 fi
10428 set d_const
10429 eval $setvar
10430
10431 : see if copysignl exists
10432 set copysignl d_copysignl
10433 eval $inlibc
10434
10435 : see if crypt exists
10436 echo " "
10437 set crypt d_crypt
10438 eval $inlibc
10439 case "$d_crypt" in
10440 $define) cryptlib='' ;;
10441 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10442                 echo 'crypt() found.' >&4
10443                 val="$define"
10444                 cryptlib=''
10445         else
10446                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10447                 if $test -z "$cryptlib"; then
10448                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10449                 else
10450                         cryptlib=-lcrypt
10451                 fi
10452                 if $test -z "$cryptlib"; then
10453                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10454                 else
10455                         cryptlib=-lcrypt
10456                 fi
10457                 if $test -z "$cryptlib"; then
10458                         cryptlib=`./loc libcrypt$_a "" $libpth`
10459                 else
10460                         cryptlib=-lcrypt
10461                 fi
10462                 if $test -z "$cryptlib"; then
10463                         echo 'crypt() NOT found.' >&4
10464                         val="$undef"
10465                 else
10466                         val="$define"
10467                 fi
10468         fi
10469         set d_crypt
10470         eval $setvar
10471         ;;
10472 esac
10473
10474 : see if this is a crypt.h system
10475 set crypt.h i_crypt
10476 eval $inhdr
10477
10478 : see if crypt_r exists
10479 set crypt_r d_crypt_r
10480 eval $inlibc
10481 case "$d_crypt_r" in
10482 "$define")
10483         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10484         case "$d_crypt_r_proto:$usethreads" in
10485         ":define")      d_crypt_r_proto=define
10486                 set d_crypt_r_proto crypt_r $hdrs
10487                 eval $hasproto ;;
10488         *)      ;;
10489         esac
10490         case "$d_crypt_r_proto" in
10491         define)
10492         case "$crypt_r_proto" in
10493         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10494         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10495         esac
10496         case "$crypt_r_proto" in
10497         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10498         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10499         esac
10500         case "$crypt_r_proto" in
10501         ''|0)   d_crypt_r=undef
10502                 crypt_r_proto=0
10503                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10504         * )     case "$crypt_r_proto" in
10505                 REENTRANT_PROTO*) ;;
10506                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10507                 esac
10508                 echo "Prototype: $try" ;;
10509         esac
10510         ;;
10511         *)      case "$usethreads" in
10512                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10513                 esac
10514                 d_crypt_r=undef
10515                 crypt_r_proto=0
10516                 ;;
10517         esac
10518         ;;
10519 *)      crypt_r_proto=0
10520         ;;
10521 esac
10522
10523 : get csh whereabouts
10524 case "$csh" in
10525 'csh') val="$undef" ;;
10526 *) val="$define" ;;
10527 esac
10528 set d_csh
10529 eval $setvar
10530 : Respect a hint or command line value for full_csh.
10531 case "$full_csh" in
10532 '') full_csh=$csh ;;
10533 esac
10534
10535 : see if ctermid_r exists
10536 set ctermid_r d_ctermid_r
10537 eval $inlibc
10538 case "$d_ctermid_r" in
10539 "$define")
10540         hdrs="$i_systypes sys/types.h define stdio.h "
10541         case "$d_ctermid_r_proto:$usethreads" in
10542         ":define")      d_ctermid_r_proto=define
10543                 set d_ctermid_r_proto ctermid_r $hdrs
10544                 eval $hasproto ;;
10545         *)      ;;
10546         esac
10547         case "$d_ctermid_r_proto" in
10548         define)
10549         case "$ctermid_r_proto" in
10550         ''|0) try='char* ctermid_r(char*);'
10551         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10552         esac
10553         case "$ctermid_r_proto" in
10554         ''|0)   d_ctermid_r=undef
10555                 ctermid_r_proto=0
10556                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10557         * )     case "$ctermid_r_proto" in
10558                 REENTRANT_PROTO*) ;;
10559                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10560                 esac
10561                 echo "Prototype: $try" ;;
10562         esac
10563         ;;
10564         *)      case "$usethreads" in
10565                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10566                 esac
10567                 d_ctermid_r=undef
10568                 ctermid_r_proto=0
10569                 ;;
10570         esac
10571         ;;
10572 *)      ctermid_r_proto=0
10573         ;;
10574 esac
10575
10576 : see if ctime_r exists
10577 set ctime_r d_ctime_r
10578 eval $inlibc
10579 case "$d_ctime_r" in
10580 "$define")
10581         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10582         case "$d_ctime_r_proto:$usethreads" in
10583         ":define")      d_ctime_r_proto=define
10584                 set d_ctime_r_proto ctime_r $hdrs
10585                 eval $hasproto ;;
10586         *)      ;;
10587         esac
10588         case "$d_ctime_r_proto" in
10589         define)
10590         case "$ctime_r_proto" in
10591         ''|0) try='char* ctime_r(const time_t*, char*);'
10592         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10593         esac
10594         case "$ctime_r_proto" in
10595         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10596         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10597         esac
10598         case "$ctime_r_proto" in
10599         ''|0) try='int ctime_r(const time_t*, char*);'
10600         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10601         esac
10602         case "$ctime_r_proto" in
10603         ''|0) try='int ctime_r(const time_t*, char*, int);'
10604         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10605         esac
10606         case "$ctime_r_proto" in
10607         ''|0)   d_ctime_r=undef
10608                 ctime_r_proto=0
10609                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10610         * )     case "$ctime_r_proto" in
10611                 REENTRANT_PROTO*) ;;
10612                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10613                 esac
10614                 echo "Prototype: $try" ;;
10615         esac
10616         ;;
10617         *)      case "$usethreads" in
10618                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10619                 esac
10620                 d_ctime_r=undef
10621                 ctime_r_proto=0
10622                 ;;
10623         esac
10624         ;;
10625 *)      ctime_r_proto=0
10626         ;;
10627 esac
10628
10629 : see if cuserid exists
10630 set cuserid d_cuserid
10631 eval $inlibc
10632
10633 : see if this is a limits.h system
10634 set limits.h i_limits
10635 eval $inhdr
10636
10637 : see if this is a float.h system
10638 set float.h i_float
10639 eval $inhdr
10640
10641 : See if number of significant digits in a double precision number is known
10642 echo " "
10643 $cat >dbl_dig.c <<EOM
10644 #$i_limits I_LIMITS
10645 #$i_float I_FLOAT
10646 #ifdef I_LIMITS
10647 #include <limits.h>
10648 #endif
10649 #ifdef I_FLOAT
10650 #include <float.h>
10651 #endif
10652 #ifdef DBL_DIG
10653 printf("Contains DBL_DIG");
10654 #endif
10655 EOM
10656 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10657 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10658         echo "DBL_DIG found." >&4
10659         val="$define"
10660 else
10661         echo "DBL_DIG NOT found." >&4
10662         val="$undef"
10663 fi
10664 $rm -f dbl_dig.?
10665 set d_dbl_dig
10666 eval $setvar
10667
10668 : see if dbm.h is available
10669 : see if dbmclose exists
10670 set dbmclose d_dbmclose
10671 eval $inlibc
10672
10673 case "$d_dbmclose" in
10674 $define)
10675         set dbm.h i_dbm
10676         eval $inhdr
10677         case "$i_dbm" in
10678         $define)
10679                 val="$undef"
10680                 set i_rpcsvcdbm
10681                 eval $setvar
10682                 ;;
10683         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10684                 eval $inhdr
10685                 ;;
10686         esac
10687         ;;
10688 *)      echo "We won't be including <dbm.h>"
10689         val="$undef"
10690         set i_dbm
10691         eval $setvar
10692         val="$undef"
10693         set i_rpcsvcdbm
10694         eval $setvar
10695         ;;
10696 esac
10697
10698 : see if prototype for dbminit is available
10699 echo " "
10700 set d_dbminitproto dbminit $i_dbm dbm.h
10701 eval $hasproto
10702
10703 : see if difftime exists
10704 set difftime d_difftime
10705 eval $inlibc
10706
10707 : see if this is a dirent system
10708 echo " "
10709 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10710         val="$define"
10711         echo "<dirent.h> found." >&4
10712 else
10713         val="$undef"
10714         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10715                 echo "<sys/dir.h> found." >&4
10716                 echo " "
10717         else
10718                 xinc=`./findhdr sys/ndir.h`
10719         fi
10720         echo "<dirent.h> NOT found." >&4
10721 fi
10722 set i_dirent
10723 eval $setvar
10724
10725 : Look for type of directory structure.
10726 echo " "
10727 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10728
10729 case "$direntrytype" in
10730 ''|' ')
10731         case "$i_dirent" in
10732         $define) guess1='struct dirent' ;;
10733         *) guess1='struct direct'  ;;
10734         esac
10735         ;;
10736 *)      guess1="$direntrytype"
10737         ;;
10738 esac
10739
10740 case "$guess1" in
10741 'struct dirent') guess2='struct direct' ;;
10742 *) guess2='struct dirent' ;;
10743 esac
10744                 
10745 if $contains "$guess1" try.c >/dev/null 2>&1; then
10746         direntrytype="$guess1"
10747         echo "Your directory entries are $direntrytype." >&4
10748 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10749         direntrytype="$guess2"
10750         echo "Your directory entries seem to be $direntrytype." >&4
10751 else
10752         echo "I don't recognize your system's directory entries." >&4
10753         rp="What type is used for directory entries on this system?"
10754         dflt="$guess1"
10755         . ./myread
10756         direntrytype="$ans"
10757 fi
10758 $rm -f try.c
10759
10760
10761 : see if the directory entry stores field length
10762 echo " "
10763 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10764 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10765         echo "Good, your directory entry keeps length information in d_namlen." >&4
10766         val="$define"
10767 else
10768         echo "Your directory entry does not know about the d_namlen field." >&4
10769         val="$undef"
10770 fi
10771 set d_dirnamlen
10772 eval $setvar
10773 $rm -f try.c
10774
10775 : see if this is an sysdir system
10776 set sys/dir.h i_sysdir
10777 eval $inhdr
10778
10779 : see if this is an sysndir system
10780 set sys/ndir.h i_sysndir
10781 eval $inhdr
10782
10783 : Look for dirfd
10784 echo " "
10785 $cat >dirfd.c <<EOM
10786 #include <stdio.h>
10787 #$i_stdlib I_STDLIB
10788 #ifdef I_STDLIB
10789 #include <stdlib.h>
10790 #endif
10791 #$i_dirent I_DIRENT             /**/
10792 #$i_sysdir I_SYS_DIR            /**/
10793 #$i_sysndir I_SYS_NDIR          /**/
10794 #$i_systypes I_SYS_TYPES        /**/
10795 #if defined(I_SYS_TYPES)
10796 #include <sys/types.h>
10797 #endif
10798 #if defined(I_DIRENT)
10799 #include <dirent.h>
10800 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10801 #include <sys/dir.h>
10802 #endif
10803 #else
10804 #ifdef I_SYS_NDIR
10805 #include <sys/ndir.h>
10806 #else
10807 #ifdef I_SYS_DIR
10808 #ifdef hp9000s500
10809 #include <ndir.h>       /* may be wrong in the future */
10810 #else
10811 #include <sys/dir.h>
10812 #endif
10813 #endif
10814 #endif
10815 #endif 
10816 int main() {
10817         DIR *dirp = opendir(".");
10818         if (dirfd(dirp) >= 0)
10819                 exit(0);
10820         else
10821                 exit(1);
10822 }
10823 EOM
10824 set dirfd
10825 if eval $compile; then
10826         val="$define"
10827 fi
10828 case "$val" in
10829 $define)        echo "dirfd() found." >&4       ;;
10830 *)              echo "dirfd() NOT found." >&4   ;;
10831 esac
10832 set d_dirfd
10833 eval $setvar
10834 $rm -f dirfd*
10835
10836 : see if dlerror exists
10837 xxx_runnm="$runnm"
10838 runnm=false
10839 set dlerror d_dlerror
10840 eval $inlibc
10841 runnm="$xxx_runnm"
10842
10843 : see if dlfcn is available
10844 set dlfcn.h i_dlfcn
10845 eval $inhdr
10846
10847 case "$usedl" in
10848 $define|y|true)
10849         $cat << EOM
10850
10851 On a few systems, the dynamically loaded modules that perl generates and uses
10852 will need a different extension than shared libs. The default will probably
10853 be appropriate.
10854
10855 EOM
10856         case "$dlext" in
10857         '')     dflt="$so" ;;
10858         *)      dflt="$dlext" ;;
10859         esac
10860         rp='What is the extension of dynamically loaded modules'
10861         . ./myread
10862         dlext="$ans"
10863         ;;
10864 *)
10865         dlext="none"
10866         ;;
10867 esac
10868
10869 : Check if dlsym need a leading underscore
10870 echo " "
10871 val="$undef"
10872
10873 case "$dlsrc" in
10874 dl_dlopen.xs)
10875         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10876         $cat >dyna.c <<'EOM'
10877 fred () { }
10878 EOM
10879
10880 $cat >fred.c<<EOM
10881
10882 #include <stdio.h>
10883 #$i_stdlib I_STDLIB
10884 #ifdef I_STDLIB
10885 #include <stdlib.h>
10886 #endif
10887 #$i_dlfcn I_DLFCN
10888 #ifdef I_DLFCN
10889 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10890 #else
10891 #include <sys/types.h>
10892 #include <nlist.h>
10893 #include <link.h>
10894 #endif
10895
10896 extern int fred() ;
10897
10898 int main()
10899 {
10900     void * handle ;
10901     void * symbol ;
10902 #ifndef RTLD_LAZY
10903     int mode = 1 ;
10904 #else
10905     int mode = RTLD_LAZY ;
10906 #endif
10907     handle = dlopen("./dyna.$dlext", mode) ;
10908     if (handle == NULL) {
10909         printf ("1\n") ;
10910         fflush (stdout) ;
10911         exit(0);
10912     }
10913     symbol = dlsym(handle, "fred") ;
10914     if (symbol == NULL) {
10915         /* try putting a leading underscore */
10916         symbol = dlsym(handle, "_fred") ;
10917         if (symbol == NULL) {
10918             printf ("2\n") ;
10919             fflush (stdout) ;
10920             exit(0);
10921         }
10922         printf ("3\n") ;
10923     }
10924     else
10925         printf ("4\n") ;
10926     fflush (stdout) ;
10927     exit(0);
10928 }
10929 EOM
10930         : Call the object file tmp-dyna.o in case dlext=o.
10931         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10932                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10933                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10934                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10935                 xxx=`$run ./fred`
10936                 case $xxx in
10937                 1)      echo "Test program failed using dlopen." >&4
10938                         echo "Perhaps you should not use dynamic loading." >&4;;
10939                 2)      echo "Test program failed using dlsym." >&4
10940                         echo "Perhaps you should not use dynamic loading." >&4;;
10941                 3)      echo "dlsym needs a leading underscore" >&4
10942                         val="$define" ;;
10943                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10944                 esac
10945         else
10946                 echo "I can't compile and run the test program." >&4
10947                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10948         fi
10949         ;;
10950 esac
10951                 
10952 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10953
10954 set d_dlsymun
10955 eval $setvar
10956
10957 : see if drand48_r exists
10958 set drand48_r d_drand48_r
10959 eval $inlibc
10960 case "$d_drand48_r" in
10961 "$define")
10962         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10963         case "$d_drand48_r_proto:$usethreads" in
10964         ":define")      d_drand48_r_proto=define
10965                 set d_drand48_r_proto drand48_r $hdrs
10966                 eval $hasproto ;;
10967         *)      ;;
10968         esac
10969         case "$d_drand48_r_proto" in
10970         define)
10971         case "$drand48_r_proto" in
10972         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10973         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10974         esac
10975         case "$drand48_r_proto" in
10976         ''|0)   d_drand48_r=undef
10977                 drand48_r_proto=0
10978                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10979         * )     case "$drand48_r_proto" in
10980                 REENTRANT_PROTO*) ;;
10981                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10982                 esac
10983                 echo "Prototype: $try" ;;
10984         esac
10985         ;;
10986         *)      case "$usethreads" in
10987                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10988                 esac
10989                 d_drand48_r=undef
10990                 drand48_r_proto=0
10991                 ;;
10992         esac
10993         ;;
10994 *)      drand48_r_proto=0
10995         ;;
10996 esac
10997
10998 : see if prototype for drand48 is available
10999 echo " "
11000 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11001 eval $hasproto
11002
11003 : see if dup2 exists
11004 set dup2 d_dup2
11005 eval $inlibc
11006
11007 : see if eaccess exists
11008 set eaccess d_eaccess
11009 eval $inlibc
11010
11011 : see if endgrent exists
11012 set endgrent d_endgrent
11013 eval $inlibc
11014
11015 : see if this is an grp system
11016 set grp.h i_grp
11017 eval $inhdr
11018
11019 case "$i_grp" in
11020 $define)
11021         xxx=`./findhdr grp.h`
11022         $cppstdin $cppflags $cppminus < $xxx >$$.h
11023
11024         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11025                 val="$define"
11026         else
11027                 val="$undef"
11028         fi
11029         set d_grpasswd
11030         eval $setvar
11031
11032         $rm -f $$.h
11033         ;;
11034 *)
11035         val="$undef";
11036         set d_grpasswd; eval $setvar
11037         ;;
11038 esac
11039
11040 : see if endgrent_r exists
11041 set endgrent_r d_endgrent_r
11042 eval $inlibc
11043 case "$d_endgrent_r" in
11044 "$define")
11045         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11046         case "$d_endgrent_r_proto:$usethreads" in
11047         ":define")      d_endgrent_r_proto=define
11048                 set d_endgrent_r_proto endgrent_r $hdrs
11049                 eval $hasproto ;;
11050         *)      ;;
11051         esac
11052         case "$d_endgrent_r_proto" in
11053         define)
11054         case "$endgrent_r_proto" in
11055         ''|0) try='int endgrent_r(FILE**);'
11056         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11057         esac
11058         case "$endgrent_r_proto" in
11059         ''|0) try='void endgrent_r(FILE**);'
11060         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11061         esac
11062         case "$endgrent_r_proto" in
11063         ''|0)   d_endgrent_r=undef
11064                 endgrent_r_proto=0
11065                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11066         * )     case "$endgrent_r_proto" in
11067                 REENTRANT_PROTO*) ;;
11068                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11069                 esac
11070                 echo "Prototype: $try" ;;
11071         esac
11072         ;;
11073         *)      case "$usethreads" in
11074                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11075                 esac
11076                 d_endgrent_r=undef
11077                 endgrent_r_proto=0
11078                 ;;
11079         esac
11080         ;;
11081 *)      endgrent_r_proto=0
11082         ;;
11083 esac
11084
11085 : see if endhostent exists
11086 set endhostent d_endhent
11087 eval $inlibc
11088
11089 : see if this is a netdb.h system
11090 set netdb.h i_netdb
11091 eval $inhdr
11092
11093 : see if endhostent_r exists
11094 set endhostent_r d_endhostent_r
11095 eval $inlibc
11096 case "$d_endhostent_r" in
11097 "$define")
11098         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11099         case "$d_endhostent_r_proto:$usethreads" in
11100         ":define")      d_endhostent_r_proto=define
11101                 set d_endhostent_r_proto endhostent_r $hdrs
11102                 eval $hasproto ;;
11103         *)      ;;
11104         esac
11105         case "$d_endhostent_r_proto" in
11106         define)
11107         case "$endhostent_r_proto" in
11108         ''|0) try='int endhostent_r(struct hostent_data*);'
11109         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11110         esac
11111         case "$endhostent_r_proto" in
11112         ''|0) try='void endhostent_r(struct hostent_data*);'
11113         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11114         esac
11115         case "$endhostent_r_proto" in
11116         ''|0)   d_endhostent_r=undef
11117                 endhostent_r_proto=0
11118                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11119         * )     case "$endhostent_r_proto" in
11120                 REENTRANT_PROTO*) ;;
11121                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11122                 esac
11123                 echo "Prototype: $try" ;;
11124         esac
11125         ;;
11126         *)      case "$usethreads" in
11127                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11128                 esac
11129                 d_endhostent_r=undef
11130                 endhostent_r_proto=0
11131                 ;;
11132         esac
11133         ;;
11134 *)      endhostent_r_proto=0
11135         ;;
11136 esac
11137
11138 : see if endnetent exists
11139 set endnetent d_endnent
11140 eval $inlibc
11141
11142 : see if endnetent_r exists
11143 set endnetent_r d_endnetent_r
11144 eval $inlibc
11145 case "$d_endnetent_r" in
11146 "$define")
11147         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11148         case "$d_endnetent_r_proto:$usethreads" in
11149         ":define")      d_endnetent_r_proto=define
11150                 set d_endnetent_r_proto endnetent_r $hdrs
11151                 eval $hasproto ;;
11152         *)      ;;
11153         esac
11154         case "$d_endnetent_r_proto" in
11155         define)
11156         case "$endnetent_r_proto" in
11157         ''|0) try='int endnetent_r(struct netent_data*);'
11158         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11159         esac
11160         case "$endnetent_r_proto" in
11161         ''|0) try='void endnetent_r(struct netent_data*);'
11162         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11163         esac
11164         case "$endnetent_r_proto" in
11165         ''|0)   d_endnetent_r=undef
11166                 endnetent_r_proto=0
11167                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11168         * )     case "$endnetent_r_proto" in
11169                 REENTRANT_PROTO*) ;;
11170                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11171                 esac
11172                 echo "Prototype: $try" ;;
11173         esac
11174         ;;
11175         *)      case "$usethreads" in
11176                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11177                 esac
11178                 d_endnetent_r=undef
11179                 endnetent_r_proto=0
11180                 ;;
11181         esac
11182         ;;
11183 *)      endnetent_r_proto=0
11184         ;;
11185 esac
11186
11187 : see if endprotoent exists
11188 set endprotoent d_endpent
11189 eval $inlibc
11190
11191 : see if endprotoent_r exists
11192 set endprotoent_r d_endprotoent_r
11193 eval $inlibc
11194 case "$d_endprotoent_r" in
11195 "$define")
11196         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11197         case "$d_endprotoent_r_proto:$usethreads" in
11198         ":define")      d_endprotoent_r_proto=define
11199                 set d_endprotoent_r_proto endprotoent_r $hdrs
11200                 eval $hasproto ;;
11201         *)      ;;
11202         esac
11203         case "$d_endprotoent_r_proto" in
11204         define)
11205         case "$endprotoent_r_proto" in
11206         ''|0) try='int endprotoent_r(struct protoent_data*);'
11207         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11208         esac
11209         case "$endprotoent_r_proto" in
11210         ''|0) try='void endprotoent_r(struct protoent_data*);'
11211         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11212         esac
11213         case "$endprotoent_r_proto" in
11214         ''|0)   d_endprotoent_r=undef
11215                 endprotoent_r_proto=0
11216                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11217         * )     case "$endprotoent_r_proto" in
11218                 REENTRANT_PROTO*) ;;
11219                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11220                 esac
11221                 echo "Prototype: $try" ;;
11222         esac
11223         ;;
11224         *)      case "$usethreads" in
11225                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11226                 esac
11227                 d_endprotoent_r=undef
11228                 endprotoent_r_proto=0
11229                 ;;
11230         esac
11231         ;;
11232 *)      endprotoent_r_proto=0
11233         ;;
11234 esac
11235
11236 : see if endpwent exists
11237 set endpwent d_endpwent
11238 eval $inlibc
11239
11240 : see if this is a pwd.h system
11241 set pwd.h i_pwd
11242 eval $inhdr
11243
11244 case "$i_pwd" in
11245 $define)
11246         xxx=`./findhdr pwd.h`
11247         $cppstdin $cppflags $cppminus < $xxx >$$.h
11248
11249         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11250                 val="$define"
11251         else
11252                 val="$undef"
11253         fi
11254         set d_pwquota
11255         eval $setvar
11256
11257         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11258                 val="$define"
11259         else
11260                 val="$undef"
11261         fi
11262         set d_pwage
11263         eval $setvar
11264
11265         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11266                 val="$define"
11267         else
11268                 val="$undef"
11269         fi
11270         set d_pwchange
11271         eval $setvar
11272
11273         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11274                 val="$define"
11275         else
11276                 val="$undef"
11277         fi
11278         set d_pwclass
11279         eval $setvar
11280
11281         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11282                 val="$define"
11283         else
11284                 val="$undef"
11285         fi
11286         set d_pwexpire
11287         eval $setvar
11288
11289         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11290                 val="$define"
11291         else
11292                 val="$undef"
11293         fi
11294         set d_pwcomment
11295         eval $setvar
11296
11297         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11298                 val="$define"
11299         else
11300                 val="$undef"
11301         fi
11302         set d_pwgecos
11303         eval $setvar
11304
11305         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11306                 val="$define"
11307         else
11308                 val="$undef"
11309         fi
11310         set d_pwpasswd
11311         eval $setvar
11312
11313         $rm -f $$.h
11314         ;;
11315 *)
11316         val="$undef"; 
11317         set d_pwquota; eval $setvar
11318         set d_pwage; eval $setvar
11319         set d_pwchange; eval $setvar
11320         set d_pwclass; eval $setvar
11321         set d_pwexpire; eval $setvar
11322         set d_pwcomment; eval $setvar
11323         set d_pwgecos; eval $setvar
11324         set d_pwpasswd; eval $setvar
11325         ;;
11326 esac
11327
11328 : see if endpwent_r exists
11329 set endpwent_r d_endpwent_r
11330 eval $inlibc
11331 case "$d_endpwent_r" in
11332 "$define")
11333         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11334         case "$d_endpwent_r_proto:$usethreads" in
11335         ":define")      d_endpwent_r_proto=define
11336                 set d_endpwent_r_proto endpwent_r $hdrs
11337                 eval $hasproto ;;
11338         *)      ;;
11339         esac
11340         case "$d_endpwent_r_proto" in
11341         define)
11342         case "$endpwent_r_proto" in
11343         ''|0) try='int endpwent_r(FILE**);'
11344         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11345         esac
11346         case "$endpwent_r_proto" in
11347         ''|0) try='void endpwent_r(FILE**);'
11348         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11349         esac
11350         case "$endpwent_r_proto" in
11351         ''|0)   d_endpwent_r=undef
11352                 endpwent_r_proto=0
11353                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11354         * )     case "$endpwent_r_proto" in
11355                 REENTRANT_PROTO*) ;;
11356                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11357                 esac
11358                 echo "Prototype: $try" ;;
11359         esac
11360         ;;
11361         *)      case "$usethreads" in
11362                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11363                 esac
11364                 d_endpwent_r=undef
11365                 endpwent_r_proto=0
11366                 ;;
11367         esac
11368         ;;
11369 *)      endpwent_r_proto=0
11370         ;;
11371 esac
11372
11373 : see if endservent exists
11374 set endservent d_endsent
11375 eval $inlibc
11376
11377 : see if endservent_r exists
11378 set endservent_r d_endservent_r
11379 eval $inlibc
11380 case "$d_endservent_r" in
11381 "$define")
11382         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11383         case "$d_endservent_r_proto:$usethreads" in
11384         ":define")      d_endservent_r_proto=define
11385                 set d_endservent_r_proto endservent_r $hdrs
11386                 eval $hasproto ;;
11387         *)      ;;
11388         esac
11389         case "$d_endservent_r_proto" in
11390         define)
11391         case "$endservent_r_proto" in
11392         ''|0) try='int endservent_r(struct servent_data*);'
11393         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11394         esac
11395         case "$endservent_r_proto" in
11396         ''|0) try='void endservent_r(struct servent_data*);'
11397         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11398         esac
11399         case "$endservent_r_proto" in
11400         ''|0)   d_endservent_r=undef
11401                 endservent_r_proto=0
11402                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11403         * )     case "$endservent_r_proto" in
11404                 REENTRANT_PROTO*) ;;
11405                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11406                 esac
11407                 echo "Prototype: $try" ;;
11408         esac
11409         ;;
11410         *)      case "$usethreads" in
11411                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11412                 esac
11413                 d_endservent_r=undef
11414                 endservent_r_proto=0
11415                 ;;
11416         esac
11417         ;;
11418 *)      endservent_r_proto=0
11419         ;;
11420 esac
11421
11422 : Locate the flags for 'open()'
11423 echo " "
11424 $cat >try.c <<EOCP
11425 #include <sys/types.h>
11426 #ifdef I_FCNTL
11427 #include <fcntl.h>
11428 #endif
11429 #ifdef I_SYS_FILE
11430 #include <sys/file.h>
11431 #endif
11432 #$i_stdlib I_STDLIB
11433 #ifdef I_STDLIB
11434 #include <stdlib.h>
11435 #endif
11436 int main() {
11437         if(O_RDONLY);
11438 #ifdef O_TRUNC
11439         exit(0);
11440 #else
11441         exit(1);
11442 #endif
11443 }
11444 EOCP
11445 : check sys/file.h first to get FREAD on Sun
11446 if $test `./findhdr sys/file.h` && \
11447                 set try -DI_SYS_FILE && eval $compile; then
11448         h_sysfile=true;
11449         echo "<sys/file.h> defines the O_* constants..." >&4
11450         if $run ./try; then
11451                 echo "and you have the 3 argument form of open()." >&4
11452                 val="$define"
11453         else
11454                 echo "but not the 3 argument form of open().  Oh, well." >&4
11455                 val="$undef"
11456         fi
11457 elif $test `./findhdr fcntl.h` && \
11458                 set try -DI_FCNTL && eval $compile; then
11459         h_fcntl=true;
11460         echo "<fcntl.h> defines the O_* constants..." >&4
11461         if $run ./try; then
11462                 echo "and you have the 3 argument form of open()." >&4
11463                 val="$define"
11464         else
11465                 echo "but not the 3 argument form of open().  Oh, well." >&4
11466                 val="$undef"
11467         fi
11468 else
11469         val="$undef"
11470         echo "I can't find the O_* constant definitions!  You got problems." >&4
11471 fi
11472 set d_open3
11473 eval $setvar
11474 $rm -f try try.*
11475
11476 : see which of string.h or strings.h is needed
11477 echo " "
11478 strings=`./findhdr string.h`
11479 if $test "$strings" && $test -r "$strings"; then
11480         echo "Using <string.h> instead of <strings.h>." >&4
11481         val="$define"
11482 else
11483         val="$undef"
11484         strings=`./findhdr strings.h`
11485         if $test "$strings" && $test -r "$strings"; then
11486                 echo "Using <strings.h> instead of <string.h>." >&4
11487         else
11488                 echo "No string header found -- You'll surely have problems." >&4
11489         fi
11490 fi
11491 set i_string
11492 eval $setvar
11493 case "$i_string" in
11494 "$undef") strings=`./findhdr strings.h`;;
11495 *)        strings=`./findhdr string.h`;;
11496 esac
11497
11498 : see if this is a sys/file.h system
11499 val=''
11500 set sys/file.h val
11501 eval $inhdr
11502
11503 : do we need to include sys/file.h ?
11504 case "$val" in
11505 "$define")
11506         echo " "
11507         if $h_sysfile; then
11508                 val="$define"
11509                 echo "We'll be including <sys/file.h>." >&4
11510         else
11511                 val="$undef"
11512                 echo "We won't be including <sys/file.h>." >&4
11513         fi
11514         ;;
11515 *)
11516         h_sysfile=false
11517         ;;
11518 esac
11519 set i_sysfile
11520 eval $setvar
11521
11522 : see if fcntl.h is there
11523 val=''
11524 set fcntl.h val
11525 eval $inhdr
11526
11527 : see if we can include fcntl.h
11528 case "$val" in
11529 "$define")
11530         echo " "
11531         if $h_fcntl; then
11532                 val="$define"
11533                 echo "We'll be including <fcntl.h>." >&4
11534         else
11535                 val="$undef"
11536                 if $h_sysfile; then
11537         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11538                 else
11539                         echo "We won't be including <fcntl.h>." >&4
11540                 fi
11541         fi
11542         ;;
11543 *)
11544         h_fcntl=false
11545         val="$undef"
11546         ;;
11547 esac
11548 set i_fcntl
11549 eval $setvar
11550
11551 : check for non-blocking I/O stuff
11552 case "$h_sysfile" in
11553 true) echo "#include <sys/file.h>" > head.c;;
11554 *)
11555        case "$h_fcntl" in
11556        true) echo "#include <fcntl.h>" > head.c;;
11557        *) echo "#include <sys/fcntl.h>" > head.c;;
11558        esac
11559        ;;
11560 esac
11561 echo " "
11562 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11563 case "$o_nonblock" in
11564 '')
11565         $cat head.c > try.c
11566         $cat >>try.c <<EOCP
11567 #include <stdio.h>
11568 #$i_stdlib I_STDLIB
11569 #ifdef I_STDLIB
11570 #include <stdlib.h>
11571 #endif
11572 #$i_fcntl I_FCNTL
11573 #ifdef I_FCNTL
11574 #include <fcntl.h>
11575 #endif
11576 int main() {
11577 #ifdef O_NONBLOCK
11578         printf("O_NONBLOCK\n");
11579         exit(0);
11580 #endif
11581 #ifdef O_NDELAY
11582         printf("O_NDELAY\n");
11583         exit(0);
11584 #endif
11585 #ifdef FNDELAY
11586         printf("FNDELAY\n");
11587         exit(0);
11588 #endif
11589         exit(0);
11590 }
11591 EOCP
11592         set try
11593         if eval $compile_ok; then
11594                 o_nonblock=`$run ./try`
11595                 case "$o_nonblock" in
11596                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11597                 *) echo "Seems like we can use $o_nonblock.";;
11598                 esac
11599         else
11600                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11601         fi
11602         ;;
11603 *) echo "Using $hint value $o_nonblock.";;
11604 esac
11605 $rm -f try try.* .out core
11606
11607 echo " "
11608 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11609 case "$eagain" in
11610 '')
11611         $cat head.c > try.c
11612         $cat >>try.c <<EOCP
11613 #include <errno.h>
11614 #include <sys/types.h>
11615 #include <signal.h>
11616 #include <stdio.h> 
11617 #$i_stdlib I_STDLIB
11618 #ifdef I_STDLIB
11619 #include <stdlib.h>
11620 #endif
11621 #$i_fcntl I_FCNTL
11622 #ifdef I_FCNTL
11623 #include <fcntl.h>
11624 #endif
11625 #define MY_O_NONBLOCK $o_nonblock
11626 #ifndef errno  /* XXX need better Configure test */
11627 extern int errno;
11628 #endif
11629 #$i_unistd I_UNISTD
11630 #ifdef I_UNISTD
11631 #include <unistd.h>
11632 #endif
11633 #$i_string I_STRING
11634 #ifdef I_STRING
11635 #include <string.h>
11636 #else
11637 #include <strings.h>
11638 #endif
11639 $signal_t blech(x) int x; { exit(3); }
11640 EOCP
11641         $cat >> try.c <<'EOCP'
11642 int main()
11643 {
11644         int pd[2];
11645         int pu[2];
11646         char buf[1];
11647         char string[100];
11648
11649         pipe(pd);       /* Down: child -> parent */
11650         pipe(pu);       /* Up: parent -> child */
11651         if (0 != fork()) {
11652                 int ret;
11653                 close(pd[1]);   /* Parent reads from pd[0] */
11654                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11655 #ifdef F_SETFL
11656                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11657                         exit(1);
11658 #else
11659                 exit(4);
11660 #endif
11661                 signal(SIGALRM, blech);
11662                 alarm(5);
11663                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11664                         exit(2);
11665                 sprintf(string, "%d\n", ret);
11666                 write(2, string, strlen(string));
11667                 alarm(0);
11668 #ifdef EAGAIN
11669                 if (errno == EAGAIN) {
11670                         printf("EAGAIN\n");
11671                         goto ok;
11672                 }
11673 #endif
11674 #ifdef EWOULDBLOCK
11675                 if (errno == EWOULDBLOCK)
11676                         printf("EWOULDBLOCK\n");
11677 #endif
11678         ok:
11679                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11680                 sleep(2);                               /* Give it time to close our pipe */
11681                 alarm(5);
11682                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11683                 alarm(0);
11684                 sprintf(string, "%d\n", ret);
11685                 write(4, string, strlen(string));
11686                 exit(0);
11687         }
11688
11689         close(pd[0]);                   /* We write to pd[1] */
11690         close(pu[1]);                   /* We read from pu[0] */
11691         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11692         close(pd[1]);                   /* Pipe pd is now fully closed! */
11693         exit(0);                                /* Bye bye, thank you for playing! */
11694 }
11695 EOCP
11696         set try
11697         if eval $compile_ok; then
11698                 echo "$startsh" >mtry
11699                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11700                 chmod +x mtry
11701                 ./mtry >/dev/null 2>&1
11702                 case $? in
11703                 0) eagain=`$cat try.out`;;
11704                 1) echo "Could not perform non-blocking setting!";;
11705                 2) echo "I did a successful read() for something that was not there!";;
11706                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11707                 4) echo "Could not find F_SETFL!";;
11708                 *) echo "Something terribly wrong happened during testing.";;
11709                 esac
11710                 rd_nodata=`$cat try.ret`
11711                 echo "A read() system call with no data present returns $rd_nodata."
11712                 case "$rd_nodata" in
11713                 0|-1) ;;
11714                 *)
11715                         echo "(That's peculiar, fixing that to be -1.)"
11716                         rd_nodata=-1
11717                         ;;
11718                 esac
11719                 case "$eagain" in
11720                 '')
11721                         echo "Forcing errno EAGAIN on read() with no data available."
11722                         eagain=EAGAIN
11723                         ;;
11724                 *)
11725                         echo "Your read() sets errno to $eagain when no data is available."
11726                         ;;
11727                 esac
11728                 status=`$cat try.err`
11729                 case "$status" in
11730                 0) echo "And it correctly returns 0 to signal EOF.";;
11731                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11732                 *) echo "However, your read() returns '$status' on EOF??";;
11733                 esac
11734                 val="$define"
11735                 if test "$status" = "$rd_nodata"; then
11736                         echo "WARNING: you can't distinguish between EOF and no data!"
11737                         val="$undef"
11738                 fi
11739         else
11740                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11741                 eagain=EAGAIN
11742         fi
11743         set d_eofnblk
11744         eval $setvar
11745         ;;
11746 *)
11747         echo "Using $hint value $eagain."
11748         echo "Your read() returns $rd_nodata when no data is present."
11749         case "$d_eofnblk" in
11750         "$define") echo "And you can see EOF because read() returns 0.";;
11751         "$undef") echo "But you can't see EOF status from read() returned value.";;
11752         *)
11753                 echo "(Assuming you can't see EOF status from read anyway.)"
11754                 d_eofnblk=$undef
11755                 ;;
11756         esac
11757         ;;
11758 esac
11759 $rm -f try try.* .out core head.c mtry
11760
11761 : see if _ptr and _cnt from stdio act std
11762 echo " "
11763
11764 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11765         echo "(Looks like you have stdio.h from BSD.)"
11766         case "$stdio_ptr" in
11767         '') stdio_ptr='((fp)->_p)'
11768                 ptr_lval=$define
11769                 ;;
11770         *)      ptr_lval=$d_stdio_ptr_lval;;
11771         esac
11772         case "$stdio_cnt" in
11773         '') stdio_cnt='((fp)->_r)'
11774                 cnt_lval=$define
11775                 ;;
11776         *)      cnt_lval=$d_stdio_cnt_lval;;
11777         esac
11778         case "$stdio_base" in
11779         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11780         esac
11781         case "$stdio_bufsiz" in
11782         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11783         esac
11784 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11785         echo "(Looks like you have stdio.h from Linux.)"
11786         case "$stdio_ptr" in
11787         '') stdio_ptr='((fp)->_IO_read_ptr)'
11788                 ptr_lval=$define
11789                 ;;
11790         *)      ptr_lval=$d_stdio_ptr_lval;;
11791         esac
11792         case "$stdio_cnt" in
11793         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11794                 cnt_lval=$undef
11795                 ;;
11796         *)      cnt_lval=$d_stdio_cnt_lval;;
11797         esac
11798         case "$stdio_base" in
11799         '') stdio_base='((fp)->_IO_read_base)';;
11800         esac
11801         case "$stdio_bufsiz" in
11802         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11803         esac
11804 else
11805         case "$stdio_ptr" in
11806         '') stdio_ptr='((fp)->_ptr)'
11807                 ptr_lval=$define
11808                 ;;
11809         *)      ptr_lval=$d_stdio_ptr_lval;;
11810         esac
11811         case "$stdio_cnt" in
11812         '') stdio_cnt='((fp)->_cnt)'
11813                 cnt_lval=$define
11814                 ;;
11815         *)      cnt_lval=$d_stdio_cnt_lval;;
11816         esac
11817         case "$stdio_base" in
11818         '') stdio_base='((fp)->_base)';;
11819         esac
11820         case "$stdio_bufsiz" in
11821         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11822         esac
11823 fi
11824
11825 : test whether _ptr and _cnt really work
11826 echo "Checking how std your stdio is..." >&4
11827 $cat >try.c <<EOP
11828 #include <stdio.h>
11829 #$i_stdlib I_STDLIB
11830 #ifdef I_STDLIB
11831 #include <stdlib.h>
11832 #endif
11833 #define FILE_ptr(fp)    $stdio_ptr
11834 #define FILE_cnt(fp)    $stdio_cnt
11835 int main() {
11836         FILE *fp = fopen("try.c", "r");
11837         char c = getc(fp);
11838         if (
11839                 18 <= FILE_cnt(fp) &&
11840                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11841         )
11842                 exit(0);
11843         exit(1);
11844 }
11845 EOP
11846 val="$undef"
11847 set try
11848 if eval $compile && $to try.c; then
11849         if $run ./try; then
11850                 echo "Your stdio acts pretty std."
11851                 val="$define"
11852         else
11853                 echo "Your stdio isn't very std."
11854         fi
11855 else
11856         echo "Your stdio doesn't appear very std."
11857 fi
11858 $rm -f try.c try
11859
11860 # glibc 2.2.90 and above apparently change stdio streams so Perl's
11861 # direct buffer manipulation no longer works.  The Configure tests
11862 # should be changed to correctly detect this, but until then,
11863 # the following check should at least let perl compile and run.
11864 # (This quick fix should be updated before 5.8.1.)
11865 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
11866 # A. Dougherty, June 3, 2002.
11867 case "$d_gnulibc" in
11868 $define)
11869         case "$gnulibc_version" in
11870         2.[01]*)  ;;
11871         2.2) ;;
11872         2.2.[0-9]) ;;
11873         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
11874                 val="$undef"
11875                 ;;
11876         esac
11877         ;;
11878 esac
11879 set d_stdstdio
11880 eval $setvar
11881
11882 : Can _ptr be used as an lvalue?
11883 case "$d_stdstdio$ptr_lval" in
11884 $define$define) val=$define ;;
11885 *) val=$undef ;;
11886 esac
11887 set d_stdio_ptr_lval
11888 eval $setvar
11889
11890 : Can _cnt be used as an lvalue?
11891 case "$d_stdstdio$cnt_lval" in
11892 $define$define) val=$define ;;
11893 *) val=$undef ;;
11894 esac
11895 set d_stdio_cnt_lval
11896 eval $setvar
11897
11898
11899 : test whether setting _ptr sets _cnt as a side effect
11900 d_stdio_ptr_lval_sets_cnt="$undef"
11901 d_stdio_ptr_lval_nochange_cnt="$undef"
11902 case "$d_stdio_ptr_lval$d_stdstdio" in
11903 $define$define)
11904         echo "Checking to see what happens if we set the stdio ptr..." >&4
11905 $cat >try.c <<EOP
11906 #include <stdio.h>
11907 /* Can we scream? */
11908 /* Eat dust sed :-) */
11909 /* In the buffer space, no one can hear you scream. */
11910 #$i_stdlib I_STDLIB
11911 #ifdef I_STDLIB
11912 #include <stdlib.h>
11913 #endif
11914 #define FILE_ptr(fp)    $stdio_ptr
11915 #define FILE_cnt(fp)    $stdio_cnt
11916 #include <sys/types.h>
11917 int main() {
11918         FILE *fp = fopen("try.c", "r");
11919         int c;
11920         char *ptr;
11921         size_t cnt;
11922         if (!fp) {
11923             puts("Fail even to read");
11924             exit(1);
11925         }
11926         c = getc(fp); /* Read away the first # */
11927         if (c == EOF) {
11928             puts("Fail even to read");
11929             exit(1);
11930         }
11931         if (!(
11932                 18 <= FILE_cnt(fp) &&
11933                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11934         )) {
11935                 puts("Fail even to read");
11936                 exit (1);
11937         }
11938         ptr = (char*) FILE_ptr(fp);
11939         cnt = (size_t)FILE_cnt(fp);
11940
11941         FILE_ptr(fp) += 42;
11942
11943         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11944                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11945                 exit (1);
11946         }
11947         if (FILE_cnt(fp) <= 20) {
11948                 printf ("Fail (<20 chars to test)");
11949                 exit (1);
11950         }
11951         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11952                 puts("Fail compare");
11953                 exit (1);
11954         }
11955         if (cnt == FILE_cnt(fp)) {
11956                 puts("Pass_unchanged");
11957                 exit (0);
11958         }       
11959         if (FILE_cnt(fp) == (cnt - 42)) {
11960                 puts("Pass_changed");
11961                 exit (0);
11962         }
11963         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11964         return 1;
11965
11966 }
11967 EOP
11968         set try
11969         if eval $compile && $to try.c; then
11970                 case `$run ./try` in
11971                 Pass_changed)
11972                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11973                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11974                 Pass_unchanged)
11975                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11976                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11977                 Fail*)
11978                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11979                 *)
11980                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11981         esac
11982         else
11983                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11984         fi
11985         $rm -f try.c try
11986         ;;
11987 esac
11988
11989 : see if _base is also standard
11990 val="$undef"
11991 case "$d_stdstdio" in
11992 $define)
11993         $cat >try.c <<EOP
11994 #include <stdio.h>
11995 #$i_stdlib I_STDLIB
11996 #ifdef I_STDLIB
11997 #include <stdlib.h>
11998 #endif
11999 #define FILE_base(fp)   $stdio_base
12000 #define FILE_bufsiz(fp) $stdio_bufsiz
12001 int main() {
12002         FILE *fp = fopen("try.c", "r");
12003         char c = getc(fp);
12004         if (
12005                 19 <= FILE_bufsiz(fp) &&
12006                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12007         )
12008                 exit(0);
12009         exit(1);
12010 }
12011 EOP
12012         set try
12013         if eval $compile && $to try.c; then
12014                 if $run ./try; then
12015                         echo "And its _base field acts std."
12016                         val="$define"
12017                 else
12018                         echo "But its _base field isn't std."
12019                 fi
12020         else
12021                 echo "However, it seems to be lacking the _base field."
12022         fi
12023         $rm -f try.c try
12024         ;;
12025 esac
12026 set d_stdiobase
12027 eval $setvar
12028
12029 : see if fast_stdio exists
12030 val="$undef"
12031 case "$d_stdstdio:$d_stdio_ptr_lval" in
12032 "$define:$define")
12033         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12034         *$define*)
12035                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12036                 val="$define"
12037                 ;;
12038         esac
12039         ;;
12040 esac
12041 set d_faststdio
12042 eval $setvar
12043
12044
12045
12046 : see if fchdir exists
12047 set fchdir d_fchdir
12048 eval $inlibc
12049
12050 : see if fchmod exists
12051 set fchmod d_fchmod
12052 eval $inlibc
12053
12054 : see if fchown exists
12055 set fchown d_fchown
12056 eval $inlibc
12057
12058 : see if this is an fcntl system
12059 set fcntl d_fcntl
12060 eval $inlibc
12061
12062 echo " "
12063 : See if fcntl-based locking works.
12064 $cat >try.c <<EOCP
12065 #$i_stdlib I_STDLIB
12066 #ifdef I_STDLIB
12067 #include <stdlib.h>
12068 #endif
12069 #include <unistd.h>
12070 #include <fcntl.h>
12071 #include <signal.h>
12072 $signal_t blech(x) int x; { exit(3); }
12073 int main() {
12074 #if defined(F_SETLK) && defined(F_SETLKW)
12075      struct flock flock;
12076      int retval, fd;
12077      fd = open("try.c", O_RDONLY);
12078      flock.l_type = F_RDLCK;
12079      flock.l_whence = SEEK_SET;
12080      flock.l_start = flock.l_len = 0;
12081      signal(SIGALRM, blech);
12082      alarm(10);
12083      retval = fcntl(fd, F_SETLK, &flock);
12084      close(fd);
12085      (retval < 0 ? exit(2) : exit(0));
12086 #else
12087      exit(2);
12088 #endif
12089 }
12090 EOCP
12091 echo "Checking if fcntl-based file locking works... "
12092 case "$d_fcntl" in
12093 "$define")
12094         set try
12095         if eval $compile_ok; then
12096                 if $run ./try; then
12097                         echo "Yes, it seems to work."
12098                         val="$define"
12099                 else
12100                         echo "Nope, it didn't work."
12101                         val="$undef"
12102                         case "$?" in
12103                         3) $cat >&4 <<EOM
12104 ***
12105 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12106 *** This is (almost) impossible.
12107 *** If your NFS lock daemons are not feeling well, something like
12108 *** this may happen, please investigate.  Cannot continue, aborting.
12109 ***
12110 EOM
12111                                 exit 1
12112                                 ;;
12113                         esac
12114                 fi
12115         else
12116                 echo "I'm unable to compile the test program, so I'll assume not."
12117                 val="$undef"
12118         fi
12119         ;;
12120 *) val="$undef";
12121         echo "Nope, since you don't even have fcntl()."
12122         ;;
12123 esac
12124 set d_fcntl_can_lock
12125 eval $setvar
12126 $rm -f try*
12127
12128
12129 : check for fd_set items
12130 $cat <<EOM
12131
12132 Checking to see how well your C compiler handles fd_set and friends ...
12133 EOM
12134 $cat >try.c <<EOCP
12135 #$i_stdlib I_STDLIB
12136 #ifdef I_STDLIB
12137 #include <stdlib.h>
12138 #endif
12139 #$i_systime I_SYS_TIME
12140 #$i_sysselct I_SYS_SELECT
12141 #$d_socket HAS_SOCKET
12142 #include <sys/types.h>
12143 #ifdef HAS_SOCKET
12144 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12145 #endif
12146 #ifdef I_SYS_TIME
12147 #include <sys/time.h>
12148 #endif
12149 #ifdef I_SYS_SELECT
12150 #include <sys/select.h>
12151 #endif
12152 int main() {
12153         fd_set fds;
12154
12155 #ifdef TRYBITS
12156         if(fds.fds_bits);
12157 #endif
12158
12159 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12160         exit(0);
12161 #else
12162         exit(1);
12163 #endif
12164 }
12165 EOCP
12166 set try -DTRYBITS
12167 if eval $compile; then
12168         d_fds_bits="$define"
12169         d_fd_set="$define"
12170         echo "Well, your system knows about the normal fd_set typedef..." >&4
12171         if $run ./try; then
12172                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12173                 d_fd_macros="$define"
12174         else
12175                 $cat >&4 <<'EOM'
12176 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12177 EOM
12178                 d_fd_macros="$undef"
12179         fi
12180 else
12181         $cat <<'EOM'
12182 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12183 EOM
12184         set try
12185         if eval $compile; then
12186                 d_fds_bits="$undef"
12187                 d_fd_set="$define"
12188                 echo "Well, your system has some sort of fd_set available..." >&4
12189                 if $run ./try; then
12190                         echo "and you have the normal fd_set macros." >&4
12191                         d_fd_macros="$define"
12192                 else
12193                         $cat <<'EOM'
12194 but not the normal fd_set macros!  Gross!  More work for me...
12195 EOM
12196                         d_fd_macros="$undef"
12197                 fi
12198         else
12199         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12200                 d_fd_set="$undef"
12201                 d_fds_bits="$undef"
12202                 d_fd_macros="$undef"
12203         fi
12204 fi
12205 $rm -f try try.*
12206
12207 : see if fgetpos exists
12208 set fgetpos d_fgetpos
12209 eval $inlibc
12210
12211 : see if finite exists
12212 set finite d_finite
12213 eval $inlibc
12214
12215 : see if finitel exists
12216 set finitel d_finitel
12217 eval $inlibc
12218
12219 : see if flock exists
12220 set flock d_flock
12221 eval $inlibc
12222
12223 : see if prototype for flock is available
12224 echo " "
12225 set d_flockproto flock $i_sysfile sys/file.h
12226 eval $hasproto
12227
12228 : see if fork exists
12229 set fork d_fork
12230 eval $inlibc
12231
12232 : see if fp_class exists
12233 set fp_class d_fp_class
12234 eval $inlibc
12235
12236 : see if pathconf exists
12237 set pathconf d_pathconf
12238 eval $inlibc
12239
12240 : see if fpathconf exists
12241 set fpathconf d_fpathconf
12242 eval $inlibc
12243
12244 : see if fpclass exists
12245 set fpclass d_fpclass
12246 eval $inlibc
12247
12248 : see if fpclassify exists
12249 set fpclassify d_fpclassify
12250 eval $inlibc
12251
12252 : see if fpclassl exists
12253 set fpclassl d_fpclassl
12254 eval $inlibc
12255
12256
12257 : check for fpos64_t
12258 echo " "
12259 echo "Checking to see if you have fpos64_t..." >&4
12260 $cat >try.c <<EOCP
12261 #include <stdio.h>
12262 int main() { fpos64_t x = 7; }
12263 EOCP
12264 set try
12265 if eval $compile; then
12266         val="$define"
12267         echo "You have fpos64_t."
12268 else
12269         val="$undef"
12270         echo "You do not have fpos64_t."
12271         case "$fpossize" in
12272         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12273         esac
12274 fi
12275 $rm -f try.* try
12276 set d_fpos64_t
12277 eval $setvar
12278
12279 : see if frexpl exists
12280 set frexpl d_frexpl
12281 eval $inlibc
12282
12283 : see if this is a sys/param system
12284 set sys/param.h i_sysparam
12285 eval $inhdr
12286
12287 : see if this is a sys/mount.h system
12288 set sys/mount.h i_sysmount
12289 eval $inhdr
12290
12291
12292 echo " "
12293 echo "Checking to see if your system supports struct fs_data..." >&4
12294 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12295 eval $hasstruct
12296 case "$d_fs_data_s" in
12297 "$define")      echo "Yes, it does."   ;;
12298 *)              echo "No, it doesn't." ;;
12299 esac
12300
12301 : see if fseeko exists
12302 set fseeko d_fseeko
12303 eval $inlibc
12304 case "$longsize" in
12305 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12306 esac
12307
12308 : see if fsetpos exists
12309 set fsetpos d_fsetpos
12310 eval $inlibc
12311
12312
12313 : see if fstatfs exists
12314 set fstatfs d_fstatfs
12315 eval $inlibc
12316
12317
12318 : see if statvfs exists
12319 set statvfs d_statvfs
12320 eval $inlibc
12321
12322 : see if fstatvfs exists
12323 set fstatvfs d_fstatvfs
12324 eval $inlibc
12325
12326
12327 : see if fsync exists
12328 set fsync d_fsync
12329 eval $inlibc
12330
12331 : see if ftello exists
12332 set ftello d_ftello
12333 eval $inlibc
12334 case "$longsize" in
12335 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12336 esac
12337
12338 : see if getcwd exists
12339 set getcwd d_getcwd
12340 eval $inlibc
12341
12342 : see if getespwnam exists
12343 set getespwnam d_getespwnam
12344 eval $inlibc
12345
12346
12347 : see if getfsstat exists
12348 set getfsstat d_getfsstat
12349 eval $inlibc
12350
12351 : see if getgrent exists
12352 set getgrent d_getgrent
12353 eval $inlibc
12354
12355 : see if getgrent_r exists
12356 set getgrent_r d_getgrent_r
12357 eval $inlibc
12358 case "$d_getgrent_r" in
12359 "$define")
12360         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12361         case "$d_getgrent_r_proto:$usethreads" in
12362         ":define")      d_getgrent_r_proto=define
12363                 set d_getgrent_r_proto getgrent_r $hdrs
12364                 eval $hasproto ;;
12365         *)      ;;
12366         esac
12367         case "$d_getgrent_r_proto" in
12368         define)
12369         case "$getgrent_r_proto" in
12370         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12371         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12372         esac
12373         case "$getgrent_r_proto" in
12374         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12375         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12376         esac
12377         case "$getgrent_r_proto" in
12378         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12379         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12380         esac
12381         case "$getgrent_r_proto" in
12382         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12383         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12384         esac
12385         case "$getgrent_r_proto" in
12386         ''|0) try='int getgrent_r(struct group*, char*, int);'
12387         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12388         esac
12389         case "$getgrent_r_proto" in
12390         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12391         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12392         esac
12393         case "$getgrent_r_proto" in
12394         ''|0)   d_getgrent_r=undef
12395                 getgrent_r_proto=0
12396                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12397         * )     case "$getgrent_r_proto" in
12398                 REENTRANT_PROTO*) ;;
12399                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12400                 esac
12401                 echo "Prototype: $try" ;;
12402         esac
12403         ;;
12404         *)      case "$usethreads" in
12405                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12406                 esac
12407                 d_getgrent_r=undef
12408                 getgrent_r_proto=0
12409                 ;;
12410         esac
12411         ;;
12412 *)      getgrent_r_proto=0
12413         ;;
12414 esac
12415
12416 : see if getgrgid_r exists
12417 set getgrgid_r d_getgrgid_r
12418 eval $inlibc
12419 case "$d_getgrgid_r" in
12420 "$define")
12421         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12422         case "$d_getgrgid_r_proto:$usethreads" in
12423         ":define")      d_getgrgid_r_proto=define
12424                 set d_getgrgid_r_proto getgrgid_r $hdrs
12425                 eval $hasproto ;;
12426         *)      ;;
12427         esac
12428         case "$d_getgrgid_r_proto" in
12429         define)
12430         case "$getgrgid_r_proto" in
12431         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12432         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12433         esac
12434         case "$getgrgid_r_proto" in
12435         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12436         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12437         esac
12438         case "$getgrgid_r_proto" in
12439         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12440         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12441         esac
12442         case "$getgrgid_r_proto" in
12443         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12444         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12445         esac
12446         case "$getgrgid_r_proto" in
12447         ''|0)   d_getgrgid_r=undef
12448                 getgrgid_r_proto=0
12449                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12450         * )     case "$getgrgid_r_proto" in
12451                 REENTRANT_PROTO*) ;;
12452                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12453                 esac
12454                 echo "Prototype: $try" ;;
12455         esac
12456         ;;
12457         *)      case "$usethreads" in
12458                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12459                 esac
12460                 d_getgrgid_r=undef
12461                 getgrgid_r_proto=0
12462                 ;;
12463         esac
12464         ;;
12465 *)      getgrgid_r_proto=0
12466         ;;
12467 esac
12468
12469 : see if getgrnam_r exists
12470 set getgrnam_r d_getgrnam_r
12471 eval $inlibc
12472 case "$d_getgrnam_r" in
12473 "$define")
12474         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12475         case "$d_getgrnam_r_proto:$usethreads" in
12476         ":define")      d_getgrnam_r_proto=define
12477                 set d_getgrnam_r_proto getgrnam_r $hdrs
12478                 eval $hasproto ;;
12479         *)      ;;
12480         esac
12481         case "$d_getgrnam_r_proto" in
12482         define)
12483         case "$getgrnam_r_proto" in
12484         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12485         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12486         esac
12487         case "$getgrnam_r_proto" in
12488         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12489         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12490         esac
12491         case "$getgrnam_r_proto" in
12492         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12493         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12494         esac
12495         case "$getgrnam_r_proto" in
12496         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12497         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12498         esac
12499         case "$getgrnam_r_proto" in
12500         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12501         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12502         esac
12503         case "$getgrnam_r_proto" in
12504         ''|0)   d_getgrnam_r=undef
12505                 getgrnam_r_proto=0
12506                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12507         * )     case "$getgrnam_r_proto" in
12508                 REENTRANT_PROTO*) ;;
12509                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12510                 esac
12511                 echo "Prototype: $try" ;;
12512         esac
12513         ;;
12514         *)      case "$usethreads" in
12515                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12516                 esac
12517                 d_getgrnam_r=undef
12518                 getgrnam_r_proto=0
12519                 ;;
12520         esac
12521         ;;
12522 *)      getgrnam_r_proto=0
12523         ;;
12524 esac
12525
12526 : see if gethostbyaddr exists
12527 set gethostbyaddr d_gethbyaddr
12528 eval $inlibc
12529
12530 : see if gethostbyname exists
12531 set gethostbyname d_gethbyname
12532 eval $inlibc
12533
12534 : see if gethostent exists
12535 set gethostent d_gethent
12536 eval $inlibc
12537
12538 : see how we will look up host name
12539 echo " "
12540 call=''
12541 if set gethostname val -f d_gethname; eval $csym; $val; then
12542         echo 'gethostname() found.' >&4
12543         d_gethname="$define"
12544         call=gethostname
12545 fi
12546 if set uname val -f d_uname; eval $csym; $val; then
12547         if ./xenix; then
12548                 $cat <<'EOM'
12549 uname() was found, but you're running xenix, and older versions of xenix
12550 have a broken uname(). If you don't really know whether your xenix is old
12551 enough to have a broken system call, use the default answer.
12552
12553 EOM
12554                 dflt=y
12555                 case "$d_uname" in
12556                 "$define") dflt=n;;
12557                 esac
12558                 rp='Is your uname() broken?'
12559                 . ./myread
12560                 case "$ans" in
12561                 n*) d_uname="$define"; call=uname;;
12562                 esac
12563         else
12564                 echo 'uname() found.' >&4
12565                 d_uname="$define"
12566                 case "$call" in
12567                 '') call=uname ;;
12568                 esac
12569         fi
12570 fi
12571 case "$d_gethname" in
12572 '') d_gethname="$undef";;
12573 esac
12574 case "$d_uname" in
12575 '') d_uname="$undef";;
12576 esac
12577 case "$d_uname$d_gethname" in
12578 *define*)
12579         dflt=n
12580         cat <<EOM
12581  
12582 Every now and then someone has a $call() that lies about the hostname
12583 but can't be fixed for political or economic reasons.  If you wish, I can
12584 pretend $call() isn't there and maybe compute hostname at run-time
12585 thanks to the '$phostname' command.
12586
12587 EOM
12588         rp="Shall I ignore $call() from now on?"
12589         . ./myread
12590         case "$ans" in
12591         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12592         esac;;
12593 esac
12594 case "$phostname" in
12595 '') aphostname='';;
12596 *) case "$aphostname" in
12597         /*) ;;
12598         *) set X $phostname
12599                 shift
12600                 file=$1
12601                 shift
12602                 file=`./loc $file $file $pth`
12603                 aphostname=`echo $file $*`
12604                 ;;
12605         esac
12606         ;;
12607 esac
12608 case "$d_uname$d_gethname" in
12609 *define*) ;;
12610 *)
12611         case "$phostname" in
12612         '')
12613                 echo "There will be no way for $package to get your hostname." >&4;;
12614         *)
12615         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12616                 ;;
12617         esac;;
12618 esac
12619 case "$d_phostname" in
12620 '') d_phostname="$undef";;
12621 esac
12622
12623 : see if gethostbyaddr_r exists
12624 set gethostbyaddr_r d_gethostbyaddr_r
12625 eval $inlibc
12626 case "$d_gethostbyaddr_r" in
12627 "$define")
12628         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12629         case "$d_gethostbyaddr_r_proto:$usethreads" in
12630         ":define")      d_gethostbyaddr_r_proto=define
12631                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12632                 eval $hasproto ;;
12633         *)      ;;
12634         esac
12635         case "$d_gethostbyaddr_r_proto" in
12636         define)
12637         case "$gethostbyaddr_r_proto" in
12638         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12639         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12640         esac
12641         case "$gethostbyaddr_r_proto" in
12642         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12643         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12644         esac
12645         case "$gethostbyaddr_r_proto" in
12646         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12647         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12648         esac
12649         case "$gethostbyaddr_r_proto" in
12650         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12651         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12652         esac
12653         case "$gethostbyaddr_r_proto" in
12654         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12655         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12656         esac
12657         case "$gethostbyaddr_r_proto" in
12658         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12659         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12660         esac
12661         case "$gethostbyaddr_r_proto" in
12662         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12663         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12664         esac
12665         case "$gethostbyaddr_r_proto" in
12666         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12667         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12668         esac
12669         case "$gethostbyaddr_r_proto" in
12670         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12671         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12672         esac
12673         case "$gethostbyaddr_r_proto" in
12674         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12675         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12676         esac
12677         case "$gethostbyaddr_r_proto" in
12678         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12679         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12680         esac
12681         case "$gethostbyaddr_r_proto" in
12682         ''|0)   d_gethostbyaddr_r=undef
12683                 gethostbyaddr_r_proto=0
12684                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12685         * )     case "$gethostbyaddr_r_proto" in
12686                 REENTRANT_PROTO*) ;;
12687                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12688                 esac
12689                 echo "Prototype: $try" ;;
12690         esac
12691         ;;
12692         *)      case "$usethreads" in
12693                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12694                 esac
12695                 d_gethostbyaddr_r=undef
12696                 gethostbyaddr_r_proto=0
12697                 ;;
12698         esac
12699         ;;
12700 *)      gethostbyaddr_r_proto=0
12701         ;;
12702 esac
12703
12704 : see if gethostbyname_r exists
12705 set gethostbyname_r d_gethostbyname_r
12706 eval $inlibc
12707 case "$d_gethostbyname_r" in
12708 "$define")
12709         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12710         case "$d_gethostbyname_r_proto:$usethreads" in
12711         ":define")      d_gethostbyname_r_proto=define
12712                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12713                 eval $hasproto ;;
12714         *)      ;;
12715         esac
12716         case "$d_gethostbyname_r_proto" in
12717         define)
12718         case "$gethostbyname_r_proto" in
12719         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12720         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12721         esac
12722         case "$gethostbyname_r_proto" in
12723         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12724         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12725         esac
12726         case "$gethostbyname_r_proto" in
12727         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12728         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12729         esac
12730         case "$gethostbyname_r_proto" in
12731         ''|0)   d_gethostbyname_r=undef
12732                 gethostbyname_r_proto=0
12733                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12734         * )     case "$gethostbyname_r_proto" in
12735                 REENTRANT_PROTO*) ;;
12736                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12737                 esac
12738                 echo "Prototype: $try" ;;
12739         esac
12740         ;;
12741         *)      case "$usethreads" in
12742                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12743                 esac
12744                 d_gethostbyname_r=undef
12745                 gethostbyname_r_proto=0
12746                 ;;
12747         esac
12748         ;;
12749 *)      gethostbyname_r_proto=0
12750         ;;
12751 esac
12752
12753 : see if gethostent_r exists
12754 set gethostent_r d_gethostent_r
12755 eval $inlibc
12756 case "$d_gethostent_r" in
12757 "$define")
12758         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12759         case "$d_gethostent_r_proto:$usethreads" in
12760         ":define")      d_gethostent_r_proto=define
12761                 set d_gethostent_r_proto gethostent_r $hdrs
12762                 eval $hasproto ;;
12763         *)      ;;
12764         esac
12765         case "$d_gethostent_r_proto" in
12766         define)
12767         case "$gethostent_r_proto" in
12768         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12769         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12770         esac
12771         case "$gethostent_r_proto" in
12772         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12773         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12774         esac
12775         case "$gethostent_r_proto" in
12776         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12777         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12778         esac
12779         case "$gethostent_r_proto" in
12780         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12781         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12782         esac
12783         case "$gethostent_r_proto" in
12784         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12785         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12786         esac
12787         case "$gethostent_r_proto" in
12788         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12789         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12790         esac
12791         case "$gethostent_r_proto" in
12792         ''|0)   d_gethostent_r=undef
12793                 gethostent_r_proto=0
12794                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12795         * )     case "$gethostent_r_proto" in
12796                 REENTRANT_PROTO*) ;;
12797                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12798                 esac
12799                 echo "Prototype: $try" ;;
12800         esac
12801         ;;
12802         *)      case "$usethreads" in
12803                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12804                 esac
12805                 d_gethostent_r=undef
12806                 gethostent_r_proto=0
12807                 ;;
12808         esac
12809         ;;
12810 *)      gethostent_r_proto=0
12811         ;;
12812 esac
12813
12814 : see if prototypes for various gethostxxx netdb.h functions are available
12815 echo " "
12816 set d_gethostprotos gethostent $i_netdb netdb.h
12817 eval $hasproto
12818
12819 : see if getitimer exists
12820 set getitimer d_getitimer
12821 eval $inlibc
12822
12823 : see if getlogin exists
12824 set getlogin d_getlogin
12825 eval $inlibc
12826
12827 : see if getlogin_r exists
12828 set getlogin_r d_getlogin_r
12829 eval $inlibc
12830 case "$d_getlogin_r" in
12831 "$define")
12832         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12833         case "$d_getlogin_r_proto:$usethreads" in
12834         ":define")      d_getlogin_r_proto=define
12835                 set d_getlogin_r_proto getlogin_r $hdrs
12836                 eval $hasproto ;;
12837         *)      ;;
12838         esac
12839         case "$d_getlogin_r_proto" in
12840         define)
12841         case "$getlogin_r_proto" in
12842         ''|0) try='int getlogin_r(char*, size_t);'
12843         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12844         esac
12845         case "$getlogin_r_proto" in
12846         ''|0) try='int getlogin_r(char*, int);'
12847         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12848         esac
12849         case "$getlogin_r_proto" in
12850         ''|0) try='char* getlogin_r(char*, size_t);'
12851         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12852         esac
12853         case "$getlogin_r_proto" in
12854         ''|0) try='char* getlogin_r(char*, int);'
12855         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12856         esac
12857         case "$getlogin_r_proto" in
12858         ''|0)   d_getlogin_r=undef
12859                 getlogin_r_proto=0
12860                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12861         * )     case "$getlogin_r_proto" in
12862                 REENTRANT_PROTO*) ;;
12863                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12864                 esac
12865                 echo "Prototype: $try" ;;
12866         esac
12867         ;;
12868         *)      case "$usethreads" in
12869                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12870                 esac
12871                 d_getlogin_r=undef
12872                 getlogin_r_proto=0
12873                 ;;
12874         esac
12875         ;;
12876 *)      getlogin_r_proto=0
12877         ;;
12878 esac
12879
12880 : see if getmnt exists
12881 set getmnt d_getmnt
12882 eval $inlibc
12883
12884 : see if getmntent exists
12885 set getmntent d_getmntent
12886 eval $inlibc
12887
12888 : see if getnetbyaddr exists
12889 set getnetbyaddr d_getnbyaddr
12890 eval $inlibc
12891
12892 : see if getnetbyname exists
12893 set getnetbyname d_getnbyname
12894 eval $inlibc
12895
12896 : see if getnetent exists
12897 set getnetent d_getnent
12898 eval $inlibc
12899
12900 : see if getnetbyaddr_r exists
12901 set getnetbyaddr_r d_getnetbyaddr_r
12902 eval $inlibc
12903 case "$d_getnetbyaddr_r" in
12904 "$define")
12905         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12906         case "$d_getnetbyaddr_r_proto:$usethreads" in
12907         ":define")      d_getnetbyaddr_r_proto=define
12908                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12909                 eval $hasproto ;;
12910         *)      ;;
12911         esac
12912         case "$d_getnetbyaddr_r_proto" in
12913         define)
12914         case "$getnetbyaddr_r_proto" in
12915         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12916         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12917         esac
12918         case "$getnetbyaddr_r_proto" in
12919         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12920         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12921         esac
12922         case "$getnetbyaddr_r_proto" in
12923         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12924         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12925         esac
12926         case "$getnetbyaddr_r_proto" in
12927         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12928         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12929         esac
12930         case "$getnetbyaddr_r_proto" in
12931         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12932         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12933         esac
12934         case "$getnetbyaddr_r_proto" in
12935         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12936         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12937         esac
12938         case "$getnetbyaddr_r_proto" in
12939         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12940         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12941         esac
12942         case "$getnetbyaddr_r_proto" in
12943         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12944         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12945         esac
12946         case "$getnetbyaddr_r_proto" in
12947         ''|0)   d_getnetbyaddr_r=undef
12948                 getnetbyaddr_r_proto=0
12949                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12950         * )     case "$getnetbyaddr_r_proto" in
12951                 REENTRANT_PROTO*) ;;
12952                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12953                 esac
12954                 echo "Prototype: $try" ;;
12955         esac
12956         ;;
12957         *)      case "$usethreads" in
12958                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12959                 esac
12960                 d_getnetbyaddr_r=undef
12961                 getnetbyaddr_r_proto=0
12962                 ;;
12963         esac
12964         ;;
12965 *)      getnetbyaddr_r_proto=0
12966         ;;
12967 esac
12968
12969 : see if getnetbyname_r exists
12970 set getnetbyname_r d_getnetbyname_r
12971 eval $inlibc
12972 case "$d_getnetbyname_r" in
12973 "$define")
12974         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12975         case "$d_getnetbyname_r_proto:$usethreads" in
12976         ":define")      d_getnetbyname_r_proto=define
12977                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12978                 eval $hasproto ;;
12979         *)      ;;
12980         esac
12981         case "$d_getnetbyname_r_proto" in
12982         define)
12983         case "$getnetbyname_r_proto" in
12984         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12985         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12986         esac
12987         case "$getnetbyname_r_proto" in
12988         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12989         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12990         esac
12991         case "$getnetbyname_r_proto" in
12992         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12993         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12994         esac
12995         case "$getnetbyname_r_proto" in
12996         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12997         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12998         esac
12999         case "$getnetbyname_r_proto" in
13000         ''|0)   d_getnetbyname_r=undef
13001                 getnetbyname_r_proto=0
13002                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13003         * )     case "$getnetbyname_r_proto" in
13004                 REENTRANT_PROTO*) ;;
13005                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13006                 esac
13007                 echo "Prototype: $try" ;;
13008         esac
13009         ;;
13010         *)      case "$usethreads" in
13011                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13012                 esac
13013                 d_getnetbyname_r=undef
13014                 getnetbyname_r_proto=0
13015                 ;;
13016         esac
13017         ;;
13018 *)      getnetbyname_r_proto=0
13019         ;;
13020 esac
13021
13022 : see if getnetent_r exists
13023 set getnetent_r d_getnetent_r
13024 eval $inlibc
13025 case "$d_getnetent_r" in
13026 "$define")
13027         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13028         case "$d_getnetent_r_proto:$usethreads" in
13029         ":define")      d_getnetent_r_proto=define
13030                 set d_getnetent_r_proto getnetent_r $hdrs
13031                 eval $hasproto ;;
13032         *)      ;;
13033         esac
13034         case "$d_getnetent_r_proto" in
13035         define)
13036         case "$getnetent_r_proto" in
13037         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13038         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13039         esac
13040         case "$getnetent_r_proto" in
13041         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13042         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13043         esac
13044         case "$getnetent_r_proto" in
13045         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13046         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13047         esac
13048         case "$getnetent_r_proto" in
13049         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13050         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13051         esac
13052         case "$getnetent_r_proto" in
13053         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13054         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13055         esac
13056         case "$getnetent_r_proto" in
13057         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13058         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13059         esac
13060         case "$getnetent_r_proto" in
13061         ''|0)   d_getnetent_r=undef
13062                 getnetent_r_proto=0
13063                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13064         * )     case "$getnetent_r_proto" in
13065                 REENTRANT_PROTO*) ;;
13066                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13067                 esac
13068                 echo "Prototype: $try" ;;
13069         esac
13070         ;;
13071         *)      case "$usethreads" in
13072                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13073                 esac
13074                 d_getnetent_r=undef
13075                 getnetent_r_proto=0
13076                 ;;
13077         esac
13078         ;;
13079 *)      getnetent_r_proto=0
13080         ;;
13081 esac
13082
13083 : see if prototypes for various getnetxxx netdb.h functions are available
13084 echo " "
13085 set d_getnetprotos getnetent $i_netdb netdb.h
13086 eval $hasproto
13087
13088 : see if getpagesize exists
13089 set getpagesize d_getpagsz
13090 eval $inlibc
13091
13092
13093 : see if getprotobyname exists
13094 set getprotobyname d_getpbyname
13095 eval $inlibc
13096
13097 : see if getprotobynumber exists
13098 set getprotobynumber d_getpbynumber
13099 eval $inlibc
13100
13101 : see if getprotoent exists
13102 set getprotoent d_getpent
13103 eval $inlibc
13104
13105 : see if getpgid exists
13106 set getpgid d_getpgid
13107 eval $inlibc
13108
13109 : see if getpgrp2 exists
13110 set getpgrp2 d_getpgrp2
13111 eval $inlibc
13112
13113 : see if getppid exists
13114 set getppid d_getppid
13115 eval $inlibc
13116
13117 : see if getpriority exists
13118 set getpriority d_getprior
13119 eval $inlibc
13120
13121 : see if getprotobyname_r exists
13122 set getprotobyname_r d_getprotobyname_r
13123 eval $inlibc
13124 case "$d_getprotobyname_r" in
13125 "$define")
13126         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13127         case "$d_getprotobyname_r_proto:$usethreads" in
13128         ":define")      d_getprotobyname_r_proto=define
13129                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13130                 eval $hasproto ;;
13131         *)      ;;
13132         esac
13133         case "$d_getprotobyname_r_proto" in
13134         define)
13135         case "$getprotobyname_r_proto" in
13136         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13137         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13138         esac
13139         case "$getprotobyname_r_proto" in
13140         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13141         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13142         esac
13143         case "$getprotobyname_r_proto" in
13144         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13145         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13146         esac
13147         case "$getprotobyname_r_proto" in
13148         ''|0)   d_getprotobyname_r=undef
13149                 getprotobyname_r_proto=0
13150                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13151         * )     case "$getprotobyname_r_proto" in
13152                 REENTRANT_PROTO*) ;;
13153                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13154                 esac
13155                 echo "Prototype: $try" ;;
13156         esac
13157         ;;
13158         *)      case "$usethreads" in
13159                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13160                 esac
13161                 d_getprotobyname_r=undef
13162                 getprotobyname_r_proto=0
13163                 ;;
13164         esac
13165         ;;
13166 *)      getprotobyname_r_proto=0
13167         ;;
13168 esac
13169
13170 : see if getprotobynumber_r exists
13171 set getprotobynumber_r d_getprotobynumber_r
13172 eval $inlibc
13173 case "$d_getprotobynumber_r" in
13174 "$define")
13175         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13176         case "$d_getprotobynumber_r_proto:$usethreads" in
13177         ":define")      d_getprotobynumber_r_proto=define
13178                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13179                 eval $hasproto ;;
13180         *)      ;;
13181         esac
13182         case "$d_getprotobynumber_r_proto" in
13183         define)
13184         case "$getprotobynumber_r_proto" in
13185         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13186         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13187         esac
13188         case "$getprotobynumber_r_proto" in
13189         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13190         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13191         esac
13192         case "$getprotobynumber_r_proto" in
13193         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13194         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13195         esac
13196         case "$getprotobynumber_r_proto" in
13197         ''|0)   d_getprotobynumber_r=undef
13198                 getprotobynumber_r_proto=0
13199                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13200         * )     case "$getprotobynumber_r_proto" in
13201                 REENTRANT_PROTO*) ;;
13202                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13203                 esac
13204                 echo "Prototype: $try" ;;
13205         esac
13206         ;;
13207         *)      case "$usethreads" in
13208                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13209                 esac
13210                 d_getprotobynumber_r=undef
13211                 getprotobynumber_r_proto=0
13212                 ;;
13213         esac
13214         ;;
13215 *)      getprotobynumber_r_proto=0
13216         ;;
13217 esac
13218
13219 : see if getprotoent_r exists
13220 set getprotoent_r d_getprotoent_r
13221 eval $inlibc
13222 case "$d_getprotoent_r" in
13223 "$define")
13224         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13225         case "$d_getprotoent_r_proto:$usethreads" in
13226         ":define")      d_getprotoent_r_proto=define
13227                 set d_getprotoent_r_proto getprotoent_r $hdrs
13228                 eval $hasproto ;;
13229         *)      ;;
13230         esac
13231         case "$d_getprotoent_r_proto" in
13232         define)
13233         case "$getprotoent_r_proto" in
13234         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13235         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13236         esac
13237         case "$getprotoent_r_proto" in
13238         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13239         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13240         esac
13241         case "$getprotoent_r_proto" in
13242         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13243         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13244         esac
13245         case "$getprotoent_r_proto" in
13246         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13247         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13248         esac
13249         case "$getprotoent_r_proto" in
13250         ''|0)   d_getprotoent_r=undef
13251                 getprotoent_r_proto=0
13252                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13253         * )     case "$getprotoent_r_proto" in
13254                 REENTRANT_PROTO*) ;;
13255                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13256                 esac
13257                 echo "Prototype: $try" ;;
13258         esac
13259         ;;
13260         *)      case "$usethreads" in
13261                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13262                 esac
13263                 d_getprotoent_r=undef
13264                 getprotoent_r_proto=0
13265                 ;;
13266         esac
13267         ;;
13268 *)      getprotoent_r_proto=0
13269         ;;
13270 esac
13271
13272 : see if prototypes for various getprotoxxx netdb.h functions are available
13273 echo " "
13274 set d_getprotoprotos getprotoent $i_netdb netdb.h
13275 eval $hasproto
13276
13277 : see if getprpwnam exists
13278 set getprpwnam d_getprpwnam
13279 eval $inlibc
13280
13281 : see if getpwent exists
13282 set getpwent d_getpwent
13283 eval $inlibc
13284
13285 : see if getpwent_r exists
13286 set getpwent_r d_getpwent_r
13287 eval $inlibc
13288 case "$d_getpwent_r" in
13289 "$define")
13290         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13291         case "$d_getpwent_r_proto:$usethreads" in
13292         ":define")      d_getpwent_r_proto=define
13293                 set d_getpwent_r_proto getpwent_r $hdrs
13294                 eval $hasproto ;;
13295         *)      ;;
13296         esac
13297         case "$d_getpwent_r_proto" in
13298         define)
13299         case "$getpwent_r_proto" in
13300         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13301         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13302         esac
13303         case "$getpwent_r_proto" in
13304         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13305         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13306         esac
13307         case "$getpwent_r_proto" in
13308         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13309         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13310         esac
13311         case "$getpwent_r_proto" in
13312         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13313         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13314         esac
13315         case "$getpwent_r_proto" in
13316         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13317         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13318         esac
13319         case "$getpwent_r_proto" in
13320         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13321         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13322         esac
13323         case "$getpwent_r_proto" in
13324         ''|0)   d_getpwent_r=undef
13325                 getpwent_r_proto=0
13326                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13327         * )     case "$getpwent_r_proto" in
13328                 REENTRANT_PROTO*) ;;
13329                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13330                 esac
13331                 echo "Prototype: $try" ;;
13332         esac
13333         ;;
13334         *)      case "$usethreads" in
13335                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13336                 esac
13337                 d_getpwent_r=undef
13338                 getpwent_r_proto=0
13339                 ;;
13340         esac
13341         ;;
13342 *)      getpwent_r_proto=0
13343         ;;
13344 esac
13345
13346 : see if getpwnam_r exists
13347 set getpwnam_r d_getpwnam_r
13348 eval $inlibc
13349 case "$d_getpwnam_r" in
13350 "$define")
13351         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13352         case "$d_getpwnam_r_proto:$usethreads" in
13353         ":define")      d_getpwnam_r_proto=define
13354                 set d_getpwnam_r_proto getpwnam_r $hdrs
13355                 eval $hasproto ;;
13356         *)      ;;
13357         esac
13358         case "$d_getpwnam_r_proto" in
13359         define)
13360         case "$getpwnam_r_proto" in
13361         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13362         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13363         esac
13364         case "$getpwnam_r_proto" in
13365         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13366         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13367         esac
13368         case "$getpwnam_r_proto" in
13369         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13370         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13371         esac
13372         case "$getpwnam_r_proto" in
13373         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13374         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13375         esac
13376         case "$getpwnam_r_proto" in
13377         ''|0)   d_getpwnam_r=undef
13378                 getpwnam_r_proto=0
13379                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13380         * )     case "$getpwnam_r_proto" in
13381                 REENTRANT_PROTO*) ;;
13382                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13383                 esac
13384                 echo "Prototype: $try" ;;
13385         esac
13386         ;;
13387         *)      case "$usethreads" in
13388                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13389                 esac
13390                 d_getpwnam_r=undef
13391                 getpwnam_r_proto=0
13392                 ;;
13393         esac
13394         ;;
13395 *)      getpwnam_r_proto=0
13396         ;;
13397 esac
13398
13399 : see if getpwuid_r exists
13400 set getpwuid_r d_getpwuid_r
13401 eval $inlibc
13402 case "$d_getpwuid_r" in
13403 "$define")
13404         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13405         case "$d_getpwuid_r_proto:$usethreads" in
13406         ":define")      d_getpwuid_r_proto=define
13407                 set d_getpwuid_r_proto getpwuid_r $hdrs
13408                 eval $hasproto ;;
13409         *)      ;;
13410         esac
13411         case "$d_getpwuid_r_proto" in
13412         define)
13413         case "$getpwuid_r_proto" in
13414         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13415         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13416         esac
13417         case "$getpwuid_r_proto" in
13418         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13419         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13420         esac
13421         case "$getpwuid_r_proto" in
13422         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13423         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13424         esac
13425         case "$getpwuid_r_proto" in
13426         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13427         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13428         esac
13429         case "$getpwuid_r_proto" in
13430         ''|0)   d_getpwuid_r=undef
13431                 getpwuid_r_proto=0
13432                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13433         * )     case "$getpwuid_r_proto" in
13434                 REENTRANT_PROTO*) ;;
13435                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13436                 esac
13437                 echo "Prototype: $try" ;;
13438         esac
13439         ;;
13440         *)      case "$usethreads" in
13441                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13442                 esac
13443                 d_getpwuid_r=undef
13444                 getpwuid_r_proto=0
13445                 ;;
13446         esac
13447         ;;
13448 *)      getpwuid_r_proto=0
13449         ;;
13450 esac
13451
13452
13453 : see if getservbyname exists
13454 set getservbyname d_getsbyname
13455 eval $inlibc
13456
13457 : see if getservbyport exists
13458 set getservbyport d_getsbyport
13459 eval $inlibc
13460
13461 : see if getservent exists
13462 set getservent d_getsent
13463 eval $inlibc
13464
13465 : see if getservbyname_r exists
13466 set getservbyname_r d_getservbyname_r
13467 eval $inlibc
13468 case "$d_getservbyname_r" in
13469 "$define")
13470         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13471         case "$d_getservbyname_r_proto:$usethreads" in
13472         ":define")      d_getservbyname_r_proto=define
13473                 set d_getservbyname_r_proto getservbyname_r $hdrs
13474                 eval $hasproto ;;
13475         *)      ;;
13476         esac
13477         case "$d_getservbyname_r_proto" in
13478         define)
13479         case "$getservbyname_r_proto" in
13480         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13481         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13482         esac
13483         case "$getservbyname_r_proto" in
13484         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13485         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13486         esac
13487         case "$getservbyname_r_proto" in
13488         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13489         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13490         esac
13491         case "$getservbyname_r_proto" in
13492         ''|0)   d_getservbyname_r=undef
13493                 getservbyname_r_proto=0
13494                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13495         * )     case "$getservbyname_r_proto" in
13496                 REENTRANT_PROTO*) ;;
13497                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13498                 esac
13499                 echo "Prototype: $try" ;;
13500         esac
13501         ;;
13502         *)      case "$usethreads" in
13503                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13504                 esac
13505                 d_getservbyname_r=undef
13506                 getservbyname_r_proto=0
13507                 ;;
13508         esac
13509         ;;
13510 *)      getservbyname_r_proto=0
13511         ;;
13512 esac
13513
13514 : see if getservbyport_r exists
13515 set getservbyport_r d_getservbyport_r
13516 eval $inlibc
13517 case "$d_getservbyport_r" in
13518 "$define")
13519         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13520         case "$d_getservbyport_r_proto:$usethreads" in
13521         ":define")      d_getservbyport_r_proto=define
13522                 set d_getservbyport_r_proto getservbyport_r $hdrs
13523                 eval $hasproto ;;
13524         *)      ;;
13525         esac
13526         case "$d_getservbyport_r_proto" in
13527         define)
13528         case "$getservbyport_r_proto" in
13529         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13530         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13531         esac
13532         case "$getservbyport_r_proto" in
13533         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13534         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13535         esac
13536         case "$getservbyport_r_proto" in
13537         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13538         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13539         esac
13540         case "$getservbyport_r_proto" in
13541         ''|0)   d_getservbyport_r=undef
13542                 getservbyport_r_proto=0
13543                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13544         * )     case "$getservbyport_r_proto" in
13545                 REENTRANT_PROTO*) ;;
13546                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13547                 esac
13548                 echo "Prototype: $try" ;;
13549         esac
13550         ;;
13551         *)      case "$usethreads" in
13552                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13553                 esac
13554                 d_getservbyport_r=undef
13555                 getservbyport_r_proto=0
13556                 ;;
13557         esac
13558         ;;
13559 *)      getservbyport_r_proto=0
13560         ;;
13561 esac
13562
13563 : see if getservent_r exists
13564 set getservent_r d_getservent_r
13565 eval $inlibc
13566 case "$d_getservent_r" in
13567 "$define")
13568         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13569         case "$d_getservent_r_proto:$usethreads" in
13570         ":define")      d_getservent_r_proto=define
13571                 set d_getservent_r_proto getservent_r $hdrs
13572                 eval $hasproto ;;
13573         *)      ;;
13574         esac
13575         case "$d_getservent_r_proto" in
13576         define)
13577         case "$getservent_r_proto" in
13578         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13579         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13580         esac
13581         case "$getservent_r_proto" in
13582         ''|0) try='int getservent_r(struct servent*, char*, int);'
13583         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13584         esac
13585         case "$getservent_r_proto" in
13586         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13587         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13588         esac
13589         case "$getservent_r_proto" in
13590         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13591         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13592         esac
13593         case "$getservent_r_proto" in
13594         ''|0)   d_getservent_r=undef
13595                 getservent_r_proto=0
13596                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13597         * )     case "$getservent_r_proto" in
13598                 REENTRANT_PROTO*) ;;
13599                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13600                 esac
13601                 echo "Prototype: $try" ;;
13602         esac
13603         ;;
13604         *)      case "$usethreads" in
13605                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13606                 esac
13607                 d_getservent_r=undef
13608                 getservent_r_proto=0
13609                 ;;
13610         esac
13611         ;;
13612 *)      getservent_r_proto=0
13613         ;;
13614 esac
13615
13616 : see if prototypes for various getservxxx netdb.h functions are available
13617 echo " "
13618 set d_getservprotos getservent $i_netdb netdb.h
13619 eval $hasproto
13620
13621 : see if getspnam exists
13622 set getspnam d_getspnam
13623 eval $inlibc
13624
13625 : see if this is a shadow.h system
13626 set shadow.h i_shadow
13627 eval $inhdr
13628
13629 : see if getspnam_r exists
13630 set getspnam_r d_getspnam_r
13631 eval $inlibc
13632 case "$d_getspnam_r" in
13633 "$define")
13634         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13635         case "$d_getspnam_r_proto:$usethreads" in
13636         ":define")      d_getspnam_r_proto=define
13637                 set d_getspnam_r_proto getspnam_r $hdrs
13638                 eval $hasproto ;;
13639         *)      ;;
13640         esac
13641         case "$d_getspnam_r_proto" in
13642         define)
13643         case "$getspnam_r_proto" in
13644         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13645         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13646         esac
13647         case "$getspnam_r_proto" in
13648         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13649         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13650         esac
13651         case "$getspnam_r_proto" in
13652         ''|0)   d_getspnam_r=undef
13653                 getspnam_r_proto=0
13654                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13655         * )     case "$getspnam_r_proto" in
13656                 REENTRANT_PROTO*) ;;
13657                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13658                 esac
13659                 echo "Prototype: $try" ;;
13660         esac
13661         ;;
13662         *)      case "$usethreads" in
13663                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13664                 esac
13665                 d_getspnam_r=undef
13666                 getspnam_r_proto=0
13667                 ;;
13668         esac
13669         ;;
13670 *)      getspnam_r_proto=0
13671         ;;
13672 esac
13673
13674 : see if gettimeofday or ftime exists
13675 set gettimeofday d_gettimeod
13676 eval $inlibc
13677 case "$d_gettimeod" in
13678 "$undef")
13679         set ftime d_ftime 
13680         eval $inlibc
13681         ;;
13682 *)
13683         val="$undef"; set d_ftime; eval $setvar
13684         ;;
13685 esac
13686 case "$d_gettimeod$d_ftime" in
13687 "$undef$undef")
13688         echo " "
13689         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13690         ;;
13691 esac
13692
13693 : see if gmtime_r exists
13694 set gmtime_r d_gmtime_r
13695 eval $inlibc
13696 case "$d_gmtime_r" in
13697 "$define")
13698         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13699         case "$d_gmtime_r_proto:$usethreads" in
13700         ":define")      d_gmtime_r_proto=define
13701                 set d_gmtime_r_proto gmtime_r $hdrs
13702                 eval $hasproto ;;
13703         *)      ;;
13704         esac
13705         case "$d_gmtime_r_proto" in
13706         define)
13707         case "$gmtime_r_proto" in
13708         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13709         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13710         esac
13711         case "$gmtime_r_proto" in
13712         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13713         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13714         esac
13715         case "$gmtime_r_proto" in
13716         ''|0)   d_gmtime_r=undef
13717                 gmtime_r_proto=0
13718                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13719         * )     case "$gmtime_r_proto" in
13720                 REENTRANT_PROTO*) ;;
13721                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13722                 esac
13723                 echo "Prototype: $try" ;;
13724         esac
13725         ;;
13726         *)      case "$usethreads" in
13727                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13728                 esac
13729                 d_gmtime_r=undef
13730                 gmtime_r_proto=0
13731                 ;;
13732         esac
13733         ;;
13734 *)      gmtime_r_proto=0
13735         ;;
13736 esac
13737
13738 : see if hasmntopt exists
13739 set hasmntopt d_hasmntopt
13740 eval $inlibc
13741
13742 : see if this is a netinet/in.h or sys/in.h system
13743 set netinet/in.h i_niin sys/in.h i_sysin
13744 eval $inhdr
13745
13746 : see if arpa/inet.h has to be included
13747 set arpa/inet.h i_arpainet
13748 eval $inhdr
13749
13750 : see if htonl --and friends-- exists
13751 val=''
13752 set htonl val
13753 eval $inlibc
13754
13755 : Maybe they are macros.
13756 case "$val" in
13757 $undef)
13758         $cat >htonl.c <<EOM
13759 #include <stdio.h>
13760 #include <sys/types.h>
13761 #$i_niin I_NETINET_IN
13762 #$i_sysin I_SYS_IN
13763 #$i_arpainet I_ARPA_INET
13764 #ifdef I_NETINET_IN
13765 #include <netinet/in.h>
13766 #endif
13767 #ifdef I_SYS_IN
13768 #include <sys/in.h>
13769 #endif
13770 #ifdef I_ARPA_INET
13771 #include <arpa/inet.h>
13772 #endif
13773 #ifdef htonl
13774 printf("Defined as a macro.");
13775 #endif
13776 EOM
13777         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13778         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13779                 val="$define"
13780                 echo "But it seems to be defined as a macro." >&4
13781         fi
13782         $rm -f htonl.?
13783         ;;
13784 esac
13785 set d_htonl
13786 eval $setvar
13787
13788 : see if ilogbl exists
13789 set ilogbl d_ilogbl
13790 eval $inlibc
13791
13792 : index or strchr
13793 echo " "
13794 if set index val -f; eval $csym; $val; then
13795         if set strchr val -f d_strchr; eval $csym; $val; then
13796                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13797                         val="$define"
13798                         vali="$undef"
13799                         echo "strchr() found." >&4
13800                 else
13801                         val="$undef"
13802                         vali="$define"
13803                         echo "index() found." >&4
13804                 fi
13805         else
13806                 val="$undef"
13807                 vali="$define"
13808                 echo "index() found." >&4
13809         fi
13810 else
13811         if set strchr val -f d_strchr; eval $csym; $val; then
13812                 val="$define"
13813                 vali="$undef"
13814                 echo "strchr() found." >&4
13815         else
13816                 echo "No index() or strchr() found!" >&4
13817                 val="$undef"
13818                 vali="$undef"
13819         fi
13820 fi
13821 set d_strchr; eval $setvar
13822 val="$vali"
13823 set d_index; eval $setvar
13824
13825 : check whether inet_aton exists
13826 set inet_aton d_inetaton
13827 eval $inlibc
13828
13829 : Look for isascii
13830 echo " "
13831 $cat >isascii.c <<EOCP
13832 #include <stdio.h>
13833 #include <ctype.h>
13834 #$i_stdlib I_STDLIB
13835 #ifdef I_STDLIB
13836 #include <stdlib.h>
13837 #endif
13838 int main() {
13839         int c = 'A';
13840         if (isascii(c))
13841                 exit(0);
13842         else
13843                 exit(1);
13844 }
13845 EOCP
13846 set isascii
13847 if eval $compile; then
13848         echo "isascii() found." >&4
13849         val="$define"
13850 else
13851         echo "isascii() NOT found." >&4
13852         val="$undef"
13853 fi
13854 set d_isascii
13855 eval $setvar
13856 $rm -f isascii*
13857
13858 : see if isfinite exists
13859 set isfinite d_isfinite
13860 eval $inlibc
13861
13862 : see if isinf exists
13863 set isinf d_isinf
13864 eval $inlibc
13865
13866 : see if isnan exists
13867 set isnan d_isnan
13868 eval $inlibc
13869
13870 : see if isnanl exists
13871 set isnanl d_isnanl
13872 eval $inlibc
13873
13874 : see if killpg exists
13875 set killpg d_killpg
13876 eval $inlibc
13877
13878 : see if lchown exists
13879 echo " "
13880 $cat > try.c <<'EOCP'
13881 /* System header to define __stub macros and hopefully few prototypes,
13882     which can conflict with char lchown(); below.  */
13883 #include <assert.h>
13884 /* Override any gcc2 internal prototype to avoid an error.  */
13885 /* We use char because int might match the return type of a gcc2
13886    builtin and then its argument prototype would still apply.  */
13887 char lchown();
13888 int main() {
13889     /*  The GNU C library defines this for functions which it implements
13890         to always fail with ENOSYS.  Some functions are actually named
13891         something starting with __ and the normal name is an alias.  */
13892 #if defined (__stub_lchown) || defined (__stub___lchown)
13893 choke me
13894 #else
13895 lchown();
13896 #endif
13897 ; return 0; }
13898 EOCP
13899 set try
13900 if eval $compile; then
13901     $echo "lchown() found." >&4
13902     val="$define"
13903 else
13904     $echo "lchown() NOT found." >&4
13905     val="$undef"
13906 fi
13907 set d_lchown
13908 eval $setvar
13909
13910 : See if number of significant digits in a double precision number is known
13911 echo " "
13912 $cat >ldbl_dig.c <<EOM
13913 #$i_limits I_LIMITS
13914 #$i_float I_FLOAT
13915 #ifdef I_LIMITS
13916 #include <limits.h>
13917 #endif
13918 #ifdef I_FLOAT
13919 #include <float.h>
13920 #endif
13921 #ifdef LDBL_DIG
13922 printf("Contains LDBL_DIG");
13923 #endif
13924 EOM
13925 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13926 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13927         echo "LDBL_DIG found." >&4
13928         val="$define"
13929 else
13930         echo "LDBL_DIG NOT found." >&4
13931         val="$undef"
13932 fi
13933 $rm -f ldbl_dig.?
13934 set d_ldbl_dig
13935 eval $setvar
13936
13937 : see if link exists
13938 set link d_link
13939 eval $inlibc
13940
13941 : see if localtime_r exists
13942 set localtime_r d_localtime_r
13943 eval $inlibc
13944 case "$d_localtime_r" in
13945 "$define")
13946         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13947         case "$d_localtime_r_proto:$usethreads" in
13948         ":define")      d_localtime_r_proto=define
13949                 set d_localtime_r_proto localtime_r $hdrs
13950                 eval $hasproto ;;
13951         *)      ;;
13952         esac
13953         case "$d_localtime_r_proto" in
13954         define)
13955         case "$localtime_r_proto" in
13956         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13957         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13958         esac
13959         case "$localtime_r_proto" in
13960         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13961         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13962         esac
13963         case "$localtime_r_proto" in
13964         ''|0)   d_localtime_r=undef
13965                 localtime_r_proto=0
13966                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13967         * )     case "$localtime_r_proto" in
13968                 REENTRANT_PROTO*) ;;
13969                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13970                 esac
13971                 echo "Prototype: $try" ;;
13972         esac
13973         ;;
13974         *)      case "$usethreads" in
13975                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13976                 esac
13977                 d_localtime_r=undef
13978                 localtime_r_proto=0
13979                 ;;
13980         esac
13981         ;;
13982 *)      localtime_r_proto=0
13983         ;;
13984 esac
13985
13986 : see if localeconv exists
13987 set localeconv d_locconv
13988 eval $inlibc
13989
13990 : see if lockf exists
13991 set lockf d_lockf
13992 eval $inlibc
13993
13994 : see if prototype for lseek is available
13995 echo " "
13996 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13997 eval $hasproto
13998
13999 : see if lstat exists
14000 set lstat d_lstat
14001 eval $inlibc
14002
14003 : see if madvise exists
14004 set madvise d_madvise
14005 eval $inlibc
14006
14007 : see if mblen exists
14008 set mblen d_mblen
14009 eval $inlibc
14010
14011 : see if mbstowcs exists
14012 set mbstowcs d_mbstowcs
14013 eval $inlibc
14014
14015 : see if mbtowc exists
14016 set mbtowc d_mbtowc
14017 eval $inlibc
14018
14019 : see if memchr exists
14020 set memchr d_memchr
14021 eval $inlibc
14022
14023 : see if memcmp exists
14024 set memcmp d_memcmp
14025 eval $inlibc
14026
14027 : see if memcpy exists
14028 set memcpy d_memcpy
14029 eval $inlibc
14030
14031 : see if memmove exists
14032 set memmove d_memmove
14033 eval $inlibc
14034
14035 : see if memset exists
14036 set memset d_memset
14037 eval $inlibc
14038
14039 : see if mkdir exists
14040 set mkdir d_mkdir
14041 eval $inlibc
14042
14043 : see if mkdtemp exists
14044 set mkdtemp d_mkdtemp
14045 eval $inlibc
14046
14047 : see if mkfifo exists
14048 set mkfifo d_mkfifo
14049 eval $inlibc
14050
14051 : see if mkstemp exists
14052 set mkstemp d_mkstemp
14053 eval $inlibc
14054
14055 : see if mkstemps exists
14056 set mkstemps d_mkstemps
14057 eval $inlibc
14058
14059 : see if mktime exists
14060 set mktime d_mktime
14061 eval $inlibc
14062
14063 : see if this is a sys/mman.h system
14064 set sys/mman.h i_sysmman
14065 eval $inhdr
14066
14067 : see if mmap exists
14068 set mmap d_mmap
14069 eval $inlibc
14070 : see what shmat returns
14071 : default to something harmless
14072 mmaptype='void *'
14073 case "$i_sysmman$d_mmap" in
14074 "$define$define")
14075         $cat >mmap.c <<'END'
14076 #include <sys/mman.h>
14077 void *mmap();
14078 END
14079         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14080                 mmaptype='void *'
14081         else
14082                 mmaptype='caddr_t'
14083         fi
14084         echo "and it returns ($mmaptype)." >&4
14085         ;;
14086 esac
14087
14088
14089
14090 : see if sqrtl exists
14091 set sqrtl d_sqrtl
14092 eval $inlibc
14093
14094 : see if scalbnl exists
14095 set scalbnl d_scalbnl
14096 eval $inlibc
14097
14098 : see if modfl exists
14099 set modfl d_modfl
14100 eval $inlibc
14101
14102 : see if prototype for modfl is available
14103 echo " "
14104 set d_modflproto modfl math.h
14105 eval $hasproto
14106
14107 d_modfl_pow32_bug="$undef"
14108
14109 case "$d_longdbl$d_modfl" in
14110 $define$define)
14111         $cat <<EOM
14112 Checking to see whether your modfl() is okay for large values...
14113 EOM
14114 $cat >try.c <<EOCP
14115 #include <math.h> 
14116 #include <stdio.h>
14117 EOCP
14118 if $test "X$d_modflproto" != "X$define"; then
14119         $cat >>try.c <<EOCP
14120 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14121 long double modfl (long double, long double *);
14122 EOCP
14123 fi
14124 $cat >>try.c <<EOCP
14125 int main() {
14126     long double nv = 4294967303.15;
14127     long double v, w;
14128     v = modfl(nv, &w);         
14129 #ifdef __GLIBC__
14130     printf("glibc");
14131 #endif
14132     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14133     return 0;
14134 }
14135 EOCP
14136         case "$osname:$gccversion" in
14137         aix:)   saveccflags="$ccflags"
14138                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14139         esac
14140         set try
14141         if eval $compile; then
14142                 foo=`$run ./try`
14143                 case "$foo" in
14144                 *" 4294967303.150000 1.150000 4294967302.000000")
14145                         echo >&4 "Your modfl() is broken for large values."
14146                         d_modfl_pow32_bug="$define"
14147                         case "$foo" in
14148                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14149                         ;;
14150                         esac
14151                         ;;
14152                 *" 4294967303.150000 0.150000 4294967303.000000")
14153                         echo >&4 "Your modfl() seems okay for large values."
14154                         ;;
14155                 *)      echo >&4 "I don't understand your modfl() at all."
14156                         d_modfl="$undef"
14157                         ;;
14158                 esac
14159                 $rm -f try.* try core core.try.*
14160         else
14161                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14162                 d_modfl="$undef"
14163         fi
14164         case "$osname:$gccversion" in
14165         aix:)   ccflags="$saveccflags" ;; # restore
14166         esac
14167         ;;
14168 esac
14169
14170 if $test "$uselongdouble" = "$define"; then
14171     message=""
14172     if $test "$d_sqrtl" != "$define"; then
14173         message="$message sqrtl"
14174     fi
14175     if $test "$d_modfl" != "$define"; then
14176         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14177             echo "You have both aintl and copysignl, so I can emulate modfl."
14178         else
14179             message="$message modfl"
14180         fi
14181     fi
14182     if $test "$d_frexpl" != "$define"; then
14183         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14184             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14185         else
14186             message="$message frexpl"
14187         fi
14188     fi
14189
14190     if $test "$message" != ""; then
14191         $cat <<EOM >&4
14192
14193 *** You requested the use of long doubles but you do not seem to have
14194 *** the following mathematical functions needed for long double support:
14195 ***    $message
14196 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14197 *** Cannot continue, aborting.
14198
14199 EOM
14200
14201         exit 1
14202     fi
14203 fi
14204
14205 : see if mprotect exists
14206 set mprotect d_mprotect
14207 eval $inlibc
14208
14209 : see if msgctl exists
14210 set msgctl d_msgctl
14211 eval $inlibc
14212
14213 : see if msgget exists
14214 set msgget d_msgget
14215 eval $inlibc
14216
14217 : see if msgsnd exists
14218 set msgsnd d_msgsnd
14219 eval $inlibc
14220
14221 : see if msgrcv exists
14222 set msgrcv d_msgrcv
14223 eval $inlibc
14224
14225 : see how much of the 'msg*(2)' library is present.
14226 h_msg=true
14227 echo " "
14228 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14229 *"$undef"*) h_msg=false;;
14230 esac
14231 case "$osname" in
14232 freebsd)
14233     case "`ipcs 2>&1`" in
14234     "SVID messages"*"not configured"*)
14235         echo "Your $osname does not have the msg*(2) configured." >&4
14236         h_msg=false
14237         val="$undef"
14238         set msgctl d_msgctl
14239         eval $setvar
14240         set msgget d_msgget
14241         eval $setvar
14242         set msgsnd d_msgsnd
14243         eval $setvar
14244         set msgrcv d_msgrcv
14245         eval $setvar
14246         ;;
14247     esac
14248     ;;
14249 esac
14250 : we could also check for sys/ipc.h ...
14251 if $h_msg && $test `./findhdr sys/msg.h`; then
14252         echo "You have the full msg*(2) library." >&4
14253         val="$define"
14254 else
14255         echo "You don't have the full msg*(2) library." >&4
14256         val="$undef"
14257 fi
14258 set d_msg
14259 eval $setvar
14260
14261
14262 echo " "
14263 echo "Checking to see if your system supports struct msghdr..." >&4
14264 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14265 eval $hasstruct
14266 case "$d_msghdr_s" in
14267 "$define")      echo "Yes, it does."   ;;
14268 *)              echo "No, it doesn't." ;;
14269 esac
14270
14271
14272 : see if msync exists
14273 set msync d_msync
14274 eval $inlibc
14275
14276 : see if munmap exists
14277 set munmap d_munmap
14278 eval $inlibc
14279
14280 : see if nice exists
14281 set nice d_nice
14282 eval $inlibc
14283
14284 : see if this is a langinfo.h system
14285 set langinfo.h i_langinfo
14286 eval $inhdr
14287
14288 : see if nl_langinfo exists
14289 set nl_langinfo d_nl_langinfo
14290 eval $inlibc
14291
14292 : check for length of character
14293 echo " "
14294 case "$charsize" in
14295 '')
14296         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14297         $cat >try.c <<EOCP
14298 #include <stdio.h>
14299 #$i_stdlib I_STDLIB
14300 #ifdef I_STDLIB
14301 #include <stdlib.h>
14302 #endif
14303 int main()
14304 {
14305     printf("%d\n", (int)sizeof(char));
14306     exit(0);
14307 }
14308 EOCP
14309         set try
14310         if eval $compile_ok; then
14311                 dflt=`$run ./try`
14312         else
14313                 dflt='1'
14314                 echo "(I can't seem to compile the test program.  Guessing...)"
14315         fi
14316         ;;
14317 *)
14318         dflt="$charsize"
14319         ;;
14320 esac
14321 rp="What is the size of a character (in bytes)?"
14322 . ./myread
14323 charsize="$ans"
14324 $rm -f try.c try
14325
14326 : check for volatile keyword
14327 echo " "
14328 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14329 $cat >try.c <<'EOCP'
14330 int main()
14331 {
14332         typedef struct _goo_struct goo_struct;
14333         goo_struct * volatile goo = ((goo_struct *)0);
14334         struct _goo_struct {
14335                 long long_int;
14336                 int reg_int;
14337                 char char_var;
14338         };
14339         typedef unsigned short foo_t;
14340         char *volatile foo;
14341         volatile int bar;
14342         volatile foo_t blech;
14343         foo = foo;
14344 }
14345 EOCP
14346 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14347         val="$define"
14348         echo "Yup, it does."
14349 else
14350         val="$undef"
14351         echo "Nope, it doesn't."
14352 fi
14353 set d_volatile
14354 eval $setvar
14355 $rm -f try.*
14356
14357
14358 echo " "
14359 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14360
14361 case "$use64bitint:$d_quad:$quadtype" in
14362 define:define:?*)
14363         ivtype="$quadtype"
14364         uvtype="$uquadtype"
14365         ivsize=8
14366         uvsize=8
14367         ;;
14368 *)      ivtype="long"
14369         uvtype="unsigned long"
14370         ivsize=$longsize
14371         uvsize=$longsize
14372         ;;
14373 esac
14374
14375 case "$uselongdouble:$d_longdbl" in
14376 define:define)
14377         nvtype="long double"
14378         nvsize=$longdblsize
14379         ;;
14380 *)      nvtype=double
14381         nvsize=$doublesize
14382         ;;
14383 esac
14384
14385 $echo "(IV will be "$ivtype", $ivsize bytes)"
14386 $echo "(UV will be "$uvtype", $uvsize bytes)"
14387 $echo "(NV will be "$nvtype", $nvsize bytes)"
14388
14389 $cat >try.c <<EOCP
14390 #$i_inttypes I_INTTYPES
14391 #ifdef I_INTTYPES
14392 #include <inttypes.h>
14393 #endif
14394 #include <stdio.h>
14395 int main() {
14396 #ifdef INT8
14397    int8_t i =  INT8_MAX;
14398   uint8_t u = UINT8_MAX;
14399   printf("int8_t\n");
14400 #endif
14401 #ifdef INT16
14402    int16_t i =  INT16_MAX;
14403   uint16_t i = UINT16_MAX;
14404   printf("int16_t\n");
14405 #endif
14406 #ifdef INT32
14407    int32_t i =  INT32_MAX;
14408   uint32_t u = UINT32_MAX;
14409   printf("int32_t\n");
14410 #endif
14411 }
14412 EOCP
14413
14414 case "$i8type" in
14415 '')     case "$charsize" in
14416         1)      i8type=char
14417                 u8type="unsigned char"
14418                 i8size=$charsize
14419                 u8size=$charsize
14420                 ;;
14421         esac
14422         ;;
14423 esac
14424 case "$i8type" in
14425 '')     set try -DINT8
14426         if eval $compile; then
14427                 case "`$run ./try`" in
14428                 int8_t) i8type=int8_t
14429                         u8type=uint8_t
14430                         i8size=1
14431                         u8size=1
14432                         ;;
14433                 esac
14434         fi
14435         ;;
14436 esac
14437 case "$i8type" in
14438 '')     if $test $charsize -ge 1; then
14439                 i8type=char
14440                 u8type="unsigned char"
14441                 i8size=$charsize
14442                 u8size=$charsize
14443         fi
14444         ;;
14445 esac
14446
14447 case "$i16type" in
14448 '')     case "$shortsize" in
14449         2)      i16type=short
14450                 u16type="unsigned short"
14451                 i16size=$shortsize
14452                 u16size=$shortsize
14453                 ;;
14454         esac
14455         ;;
14456 esac
14457 case "$i16type" in
14458 '')     set try -DINT16
14459         if eval $compile; then
14460                 case "`$run ./try`" in
14461                 int16_t)
14462                         i16type=int16_t
14463                         u16type=uint16_t
14464                         i16size=2
14465                         u16size=2
14466                         ;;
14467                 esac
14468         fi
14469         ;;
14470 esac
14471 case "$i16type" in
14472 '')     if $test $shortsize -ge 2; then
14473                 i16type=short
14474                 u16type="unsigned short"
14475                 i16size=$shortsize
14476                 u16size=$shortsize
14477         fi
14478         ;;
14479 esac
14480
14481 case "$i32type" in
14482 '')     case "$longsize" in
14483         4)      i32type=long
14484                 u32type="unsigned long"
14485                 i32size=$longsize
14486                 u32size=$longsize
14487                 ;;
14488         *)      case "$intsize" in
14489                 4)      i32type=int
14490                         u32type="unsigned int"
14491                         i32size=$intsize
14492                         u32size=$intsize
14493                         ;;
14494                 esac
14495                 ;;
14496         esac
14497         ;;
14498 esac
14499 case "$i32type" in
14500 '')     set try -DINT32
14501         if eval $compile; then
14502                 case "`$run ./try`" in
14503                 int32_t)
14504                         i32type=int32_t
14505                         u32type=uint32_t
14506                         i32size=4
14507                         u32size=4
14508                         ;;
14509                 esac
14510         fi
14511         ;;
14512 esac
14513 case "$i32type" in
14514 '')     if $test $intsize -ge 4; then
14515                 i32type=int
14516                 u32type="unsigned int"
14517                 i32size=$intsize
14518                 u32size=$intsize
14519         fi
14520         ;;
14521 esac
14522
14523 case "$i64type" in
14524 '')     case "$d_quad:$quadtype" in
14525         define:?*)
14526                 i64type="$quadtype"
14527                 u64type="$uquadtype"
14528                 i64size=8
14529                 u64size=8
14530                 ;;
14531         esac
14532         ;;
14533 esac
14534
14535 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14536 : volatile so that the compiler has to store it out to memory.
14537 if test X"$d_volatile" = X"$define"; then
14538         volatile=volatile
14539 fi
14540 $cat <<EOP >try.c
14541 #include <stdio.h>
14542 #$i_stdlib I_STDLIB
14543 #ifdef I_STDLIB
14544 #include <stdlib.h>
14545 #endif
14546 #include <sys/types.h>
14547 #include <signal.h>
14548 #ifdef SIGFPE
14549 $volatile int bletched = 0;
14550 $signal_t blech(s) int s; { bletched = 1; }
14551 #endif
14552 int main() {
14553     $uvtype u = 0;
14554     $nvtype d;
14555     int     n = 8 * $uvsize;
14556     int     i;
14557 #ifdef SIGFPE
14558     signal(SIGFPE, blech);
14559 #endif
14560
14561     for (i = 0; i < n; i++) {
14562       u = u << 1 | ($uvtype)1;
14563       d = ($nvtype)u;
14564       if (($uvtype)d != u)
14565         break;
14566       if (d <= 0)
14567         break;
14568       d = ($nvtype)(u - 1);
14569       if (($uvtype)d != (u - 1))
14570         break;
14571 #ifdef SIGFPE
14572       if (bletched) {
14573         break;
14574 #endif
14575       } 
14576     }
14577     printf("%d\n", ((i == n) ? -n : i));
14578     exit(0);
14579 }
14580 EOP
14581 set try
14582
14583 d_nv_preserves_uv="$undef"
14584 if eval $compile; then
14585         nv_preserves_uv_bits="`$run ./try`"
14586 fi
14587 case "$nv_preserves_uv_bits" in
14588 \-[1-9]*)       
14589         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14590         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14591         d_nv_preserves_uv="$define"
14592         ;;
14593 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14594         d_nv_preserves_uv="$undef" ;;
14595 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14596         nv_preserves_uv_bits="$undef" ;;
14597 esac
14598
14599 $rm -f try.* try
14600
14601
14602 : check for off64_t
14603 echo " "
14604 echo "Checking to see if you have off64_t..." >&4
14605 $cat >try.c <<EOCP
14606 #include <sys/types.h>
14607 #include <unistd.h>
14608 int main() { off64_t x = 7; }
14609 EOCP
14610 set try
14611 if eval $compile; then
14612         val="$define"
14613         echo "You have off64_t."
14614 else
14615         val="$undef"
14616         echo "You do not have off64_t."
14617         case "$lseeksize" in
14618         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14619         esac
14620 fi
14621 $rm -f try.* try
14622 set d_off64_t
14623 eval $setvar
14624
14625 : how to create joinable pthreads
14626 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14627         echo " "
14628         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14629         $cat >try.c <<'EOCP'
14630 #include <pthread.h>
14631 int main() {
14632     int detachstate = JOINABLE;
14633 }
14634 EOCP
14635         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14636         if eval $compile; then
14637                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14638                 val="$undef" # Yes, undef.
14639                 set d_old_pthread_create_joinable
14640                 eval $setvar
14641                 val=""
14642                 set old_pthread_create_joinable
14643                 eval $setvar
14644         else
14645                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14646                 if eval $compile; then
14647                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14648                         val="$define"
14649                         set d_old_pthread_create_joinable
14650                         eval $setvar
14651                         val=PTHREAD_CREATE_UNDETACHED
14652                         set old_pthread_create_joinable
14653                         eval $setvar
14654                 else            
14655                         set try -DJOINABLE=__UNDETACHED
14656                         if eval $compile; then
14657                                 echo "You seem to use __UNDETACHED." >&4
14658                                 val="$define"
14659                                 set d_old_pthread_create_joinable
14660                                 eval $setvar
14661                                 val=__UNDETACHED
14662                                 set old_pthread_create_joinable
14663                                 eval $setvar
14664                         else
14665                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14666                                 val="$define"
14667                                 set d_old_pthread_create_joinable
14668                                 eval $setvar
14669                                 val=0
14670                                 set old_pthread_create_joinable
14671                                 eval $setvar
14672                         fi
14673                 fi
14674         fi
14675         $rm -f try try.*
14676 else
14677     d_old_pthread_create_joinable="$undef"
14678     old_pthread_create_joinable=""
14679 fi
14680
14681 : see if pause exists
14682 set pause d_pause
14683 eval $inlibc
14684
14685 : see if pipe exists
14686 set pipe d_pipe
14687 eval $inlibc
14688
14689 : see if poll exists
14690 set poll d_poll
14691 eval $inlibc
14692
14693 : see if readlink exists
14694 set readlink d_readlink
14695 eval $inlibc
14696
14697 echo " "
14698 procselfexe=''
14699 val="$undef"
14700 case "$d_readlink" in
14701 "$define")
14702         if $issymlink /proc/self/exe ; then
14703                 $ls -l /proc/self/exe > reflect
14704                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14705                         echo "You have Linux-like /proc/self/exe."
14706                         procselfexe='"/proc/self/exe"'
14707                         val="$define"
14708                 fi
14709         fi
14710         if $issymlink /proc/curproc/file ; then
14711                 $ls -l /proc/curproc/file > reflect
14712                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14713                         echo "You have BSD-like /proc/curproc/file."
14714                         procselfexe='"/proc/curproc/file"'
14715                         val="$define"
14716                 fi
14717         fi
14718         ;;
14719 esac
14720 $rm -f reflect
14721 set d_procselfexe
14722 eval $setvar
14723
14724 : see whether the pthread_atfork exists
14725 $cat >try.c <<EOP
14726 #include <pthread.h>
14727 #include <stdio.h>
14728 int main() {
14729 #ifdef  PTHREAD_ATFORK
14730         pthread_atfork(NULL,NULL,NULL);
14731 #endif
14732 }
14733 EOP
14734
14735 : see if pthread_atfork exists
14736 set try -DPTHREAD_ATFORK
14737 if eval $compile; then
14738     val="$define"
14739 else
14740     val="$undef"
14741 fi
14742 case "$usethreads" in
14743 $define)
14744         case "$val" in
14745         $define) echo 'pthread_atfork found.' >&4        ;;
14746         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14747         esac
14748 esac
14749 set d_pthread_atfork
14750 eval $setvar
14751
14752 : see if pthread_attr_setscope exists
14753 set pthread_attr_setscope d_pthread_attr_setscope
14754 eval $inlibc
14755
14756
14757 : see whether the various POSIXish _yields exist
14758 $cat >try.c <<EOP
14759 #include <pthread.h>
14760 #include <stdio.h>
14761 int main() {
14762 #ifdef SCHED_YIELD
14763         sched_yield();
14764 #else
14765 #ifdef PTHREAD_YIELD
14766         pthread_yield();
14767 #else
14768 #ifdef PTHREAD_YIELD_NULL
14769         pthread_yield(NULL);
14770 #endif
14771 #endif
14772 #endif
14773 }
14774 EOP
14775 : see if sched_yield exists
14776 set try -DSCHED_YIELD
14777 if eval $compile; then
14778     val="$define"
14779     sched_yield='sched_yield()'
14780 else
14781     val="$undef"
14782 fi
14783 case "$usethreads" in
14784 $define)
14785         case "$val" in
14786         $define) echo 'sched_yield() found.' >&4        ;;
14787         *)       echo 'sched_yield() NOT found.' >&4    ;;
14788         esac
14789 esac
14790 set d_sched_yield
14791 eval $setvar
14792
14793 : see if pthread_yield exists
14794 set try -DPTHREAD_YIELD
14795 if eval $compile; then
14796     val="$define"
14797     case "$sched_yield" in
14798     '') sched_yield='pthread_yield()' ;;
14799     esac
14800 else
14801     set try -DPTHREAD_YIELD_NULL
14802     if eval $compile; then
14803         val="$define"
14804         case "$sched_yield" in
14805         '') sched_yield='pthread_yield(NULL)' ;;
14806         esac
14807     else
14808         val="$undef"
14809     fi
14810 fi
14811 case "$usethreads" in
14812 $define)
14813         case "$val" in
14814         $define) echo 'pthread_yield() found.' >&4      ;;
14815         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14816         esac
14817         ;;
14818 esac
14819 set d_pthread_yield
14820 eval $setvar
14821
14822 case "$sched_yield" in
14823 '') sched_yield=undef ;;
14824 esac
14825
14826 $rm -f try try.*
14827
14828 : see if random_r exists
14829 set random_r d_random_r
14830 eval $inlibc
14831 case "$d_random_r" in
14832 "$define")
14833         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14834         case "$d_random_r_proto:$usethreads" in
14835         ":define")      d_random_r_proto=define
14836                 set d_random_r_proto random_r $hdrs
14837                 eval $hasproto ;;
14838         *)      ;;
14839         esac
14840         case "$d_random_r_proto" in
14841         define)
14842         case "$random_r_proto" in
14843         ''|0) try='int random_r(int*, struct random_data*);'
14844         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14845         esac
14846         case "$random_r_proto" in
14847         ''|0) try='int random_r(long*, struct random_data*);'
14848         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14849         esac
14850         case "$random_r_proto" in
14851         ''|0) try='int random_r(struct random_data*, int32_t*);'
14852         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
14853         esac
14854         case "$random_r_proto" in
14855         ''|0)   d_random_r=undef
14856                 random_r_proto=0
14857                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14858         * )     case "$random_r_proto" in
14859                 REENTRANT_PROTO*) ;;
14860                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14861                 esac
14862                 echo "Prototype: $try" ;;
14863         esac
14864         ;;
14865         *)      case "$usethreads" in
14866                 define) echo "random_r has no prototype, not using it." >&4 ;;
14867                 esac
14868                 d_random_r=undef
14869                 random_r_proto=0
14870                 ;;
14871         esac
14872         ;;
14873 *)      random_r_proto=0
14874         ;;
14875 esac
14876
14877 : see if readdir and friends exist
14878 set readdir d_readdir
14879 eval $inlibc
14880 set seekdir d_seekdir
14881 eval $inlibc
14882 set telldir d_telldir
14883 eval $inlibc
14884 set rewinddir d_rewinddir
14885 eval $inlibc
14886
14887 : see if readdir64_r exists
14888 set readdir64_r d_readdir64_r
14889 eval $inlibc
14890 case "$d_readdir64_r" in
14891 "$define")
14892         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14893         case "$d_readdir64_r_proto:$usethreads" in
14894         ":define")      d_readdir64_r_proto=define
14895                 set d_readdir64_r_proto readdir64_r $hdrs
14896                 eval $hasproto ;;
14897         *)      ;;
14898         esac
14899         case "$d_readdir64_r_proto" in
14900         define)
14901         case "$readdir64_r_proto" in
14902         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14903         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14904         esac
14905         case "$readdir64_r_proto" in
14906         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14907         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14908         esac
14909         case "$readdir64_r_proto" in
14910         ''|0)   d_readdir64_r=undef
14911                 readdir64_r_proto=0
14912                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14913         * )     case "$readdir64_r_proto" in
14914                 REENTRANT_PROTO*) ;;
14915                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14916                 esac
14917                 echo "Prototype: $try" ;;
14918         esac
14919         ;;
14920         *)      case "$usethreads" in
14921                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14922                 esac
14923                 d_readdir64_r=undef
14924                 readdir64_r_proto=0
14925                 ;;
14926         esac
14927         ;;
14928 *)      readdir64_r_proto=0
14929         ;;
14930 esac
14931
14932 : see if readdir_r exists
14933 set readdir_r d_readdir_r
14934 eval $inlibc
14935 case "$d_readdir_r" in
14936 "$define")
14937         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14938         case "$d_readdir_r_proto:$usethreads" in
14939         ":define")      d_readdir_r_proto=define
14940                 set d_readdir_r_proto readdir_r $hdrs
14941                 eval $hasproto ;;
14942         *)      ;;
14943         esac
14944         case "$d_readdir_r_proto" in
14945         define)
14946         case "$readdir_r_proto" in
14947         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14948         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14949         esac
14950         case "$readdir_r_proto" in
14951         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14952         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14953         esac
14954         case "$readdir_r_proto" in
14955         ''|0)   d_readdir_r=undef
14956                 readdir_r_proto=0
14957                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14958         * )     case "$readdir_r_proto" in
14959                 REENTRANT_PROTO*) ;;
14960                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14961                 esac
14962                 echo "Prototype: $try" ;;
14963         esac
14964         ;;
14965         *)      case "$usethreads" in
14966                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14967                 esac
14968                 d_readdir_r=undef
14969                 readdir_r_proto=0
14970                 ;;
14971         esac
14972         ;;
14973 *)      readdir_r_proto=0
14974         ;;
14975 esac
14976
14977 : see if readv exists
14978 set readv d_readv
14979 eval $inlibc
14980
14981 : see if recvmsg exists
14982 set recvmsg d_recvmsg
14983 eval $inlibc
14984
14985 : see if rename exists
14986 set rename d_rename
14987 eval $inlibc
14988
14989 : see if rmdir exists
14990 set rmdir d_rmdir
14991 eval $inlibc
14992
14993 : see if memory.h is available.
14994 val=''
14995 set memory.h val
14996 eval $inhdr
14997
14998 : See if it conflicts with string.h
14999 case "$val" in
15000 $define)
15001         case "$strings" in
15002         '') ;;
15003         *)
15004                 $cppstdin $cppflags $cppminus < $strings > mem.h
15005                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15006                         echo " "
15007                         echo "We won't be including <memory.h>."
15008                         val="$undef"
15009                 fi
15010                 $rm -f mem.h
15011                 ;;
15012         esac
15013 esac
15014 set i_memory
15015 eval $setvar
15016
15017 : can bcopy handle overlapping blocks?
15018 echo " "
15019 val="$undef"
15020 case "$d_memmove" in
15021 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15022 *)      case "$d_bcopy" in
15023         "$define")
15024                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15025                 $cat >try.c <<EOCP
15026 #$i_memory I_MEMORY
15027 #$i_stdlib I_STDLIB
15028 #$i_string I_STRING
15029 #$i_unistd I_UNISTD
15030 EOCP
15031         $cat >>try.c <<'EOCP'
15032 #include <stdio.h>
15033 #ifdef I_MEMORY
15034 #  include <memory.h>
15035 #endif
15036 #ifdef I_STDLIB
15037 #  include <stdlib.h>
15038 #endif
15039 #ifdef I_STRING
15040 #  include <string.h>
15041 #else
15042 #  include <strings.h>
15043 #endif
15044 #ifdef I_UNISTD
15045 #  include <unistd.h>  /* Needed for NetBSD */
15046 #endif
15047 int main()
15048 {
15049 char buf[128], abc[128];
15050 char *b;
15051 int len;
15052 int off;
15053 int align;
15054
15055 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15056    try to store the string in read-only memory. */
15057 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15058
15059 for (align = 7; align >= 0; align--) {
15060         for (len = 36; len; len--) {
15061                 b = buf+align;
15062                 bcopy(abc, b, len);
15063                 for (off = 1; off <= len; off++) {
15064                         bcopy(b, b+off, len);
15065                         bcopy(b+off, b, len);
15066                         if (bcmp(b, abc, len))
15067                                 exit(1);
15068                 }
15069         }
15070 }
15071 exit(0);
15072 }
15073 EOCP
15074                 set try
15075                 if eval $compile_ok; then
15076                         if ./try 2>/dev/null; then
15077                                 echo "Yes, it can."
15078                                 val="$define"
15079                         else
15080                                 echo "It can't, sorry."
15081                         fi
15082                 else
15083                         echo "(I can't compile the test program, so we'll assume not...)"
15084                 fi
15085                 ;;
15086         esac
15087         $rm -f try.* try core
15088         ;;
15089 esac
15090 set d_safebcpy
15091 eval $setvar
15092
15093 : can memcpy handle overlapping blocks?
15094 echo " "
15095 val="$undef"
15096 case "$d_memmove" in
15097 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15098 *)      case "$d_memcpy" in
15099         "$define")
15100                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15101                 $cat >try.c <<EOCP
15102 #$i_memory I_MEMORY
15103 #$i_stdlib I_STDLIB
15104 #$i_string I_STRING
15105 #$i_unistd I_UNISTD
15106 EOCP
15107         $cat >>try.c <<'EOCP'
15108 #include <stdio.h>
15109 #ifdef I_MEMORY
15110 #  include <memory.h>
15111 #endif
15112 #ifdef I_STDLIB
15113 #  include <stdlib.h>
15114 #endif
15115 #ifdef I_STRING
15116 #  include <string.h>
15117 #else
15118 #  include <strings.h>
15119 #endif
15120 #ifdef I_UNISTD
15121 #  include <unistd.h>  /* Needed for NetBSD */
15122 #endif
15123 int main()
15124 {
15125 char buf[128], abc[128];
15126 char *b;
15127 int len;
15128 int off;
15129 int align;
15130
15131 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15132    try to store the string in read-only memory. */
15133 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15134
15135 for (align = 7; align >= 0; align--) {
15136         for (len = 36; len; len--) {
15137                 b = buf+align;
15138                 memcpy(b, abc, len);
15139                 for (off = 1; off <= len; off++) {
15140                         memcpy(b+off, b, len);
15141                         memcpy(b, b+off, len);
15142                         if (memcmp(b, abc, len))
15143                                 exit(1);
15144                 }
15145         }
15146 }
15147 exit(0);
15148 }
15149 EOCP
15150                 set try
15151                 if eval $compile_ok; then
15152                         if ./try 2>/dev/null; then
15153                                 echo "Yes, it can."
15154                                 val="$define"
15155                         else
15156                                 echo "It can't, sorry."
15157                         fi
15158                 else
15159                         echo "(I can't compile the test program, so we'll assume not...)"
15160                 fi
15161                 ;;
15162         esac
15163         $rm -f try.* try core
15164         ;;
15165 esac
15166 set d_safemcpy
15167 eval $setvar
15168
15169 : can memcmp be trusted to compare relative magnitude?
15170 val="$undef"
15171 case "$d_memcmp" in
15172 "$define")
15173         echo " "
15174         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15175         $cat >try.c <<EOCP
15176 #$i_memory I_MEMORY
15177 #$i_stdlib I_STDLIB
15178 #$i_string I_STRING
15179 #$i_unistd I_UNISTD
15180 EOCP
15181         $cat >>try.c <<'EOCP'
15182 #include <stdio.h>
15183 #ifdef I_MEMORY
15184 #  include <memory.h>
15185 #endif
15186 #ifdef I_STDLIB
15187 #  include <stdlib.h>
15188 #endif
15189 #ifdef I_STRING
15190 #  include <string.h>
15191 #else
15192 #  include <strings.h>
15193 #endif
15194 #ifdef I_UNISTD
15195 #  include <unistd.h>  /* Needed for NetBSD */
15196 #endif
15197 int main()
15198 {
15199 char a = -1;
15200 char b = 0;
15201 if ((a < b) && memcmp(&a, &b, 1) < 0)
15202         exit(1);
15203 exit(0);
15204 }
15205 EOCP
15206         set try
15207         if eval $compile_ok; then
15208                 if $run ./try 2>/dev/null; then
15209                         echo "Yes, it can."
15210                         val="$define"
15211                 else
15212                         echo "No, it can't (it uses signed chars)."
15213                 fi
15214         else
15215                 echo "(I can't compile the test program, so we'll assume not...)"
15216         fi
15217         ;;
15218 esac
15219 $rm -f try.* try core
15220 set d_sanemcmp
15221 eval $setvar
15222
15223 : see if prototype for sbrk is available
15224 echo " "
15225 set d_sbrkproto sbrk $i_unistd unistd.h
15226 eval $hasproto
15227
15228 : see if select exists
15229 set select d_select
15230 eval $inlibc
15231
15232 : see if semctl exists
15233 set semctl d_semctl
15234 eval $inlibc
15235
15236 : see if semget exists
15237 set semget d_semget
15238 eval $inlibc
15239
15240 : see if semop exists
15241 set semop d_semop
15242 eval $inlibc
15243
15244 : see how much of the 'sem*(2)' library is present.
15245 h_sem=true
15246 echo " "
15247 case "$d_semctl$d_semget$d_semop" in
15248 *"$undef"*) h_sem=false;;
15249 esac
15250 case "$osname" in
15251 freebsd)
15252     case "`ipcs 2>&1`" in
15253     "SVID messages"*"not configured"*)
15254         echo "Your $osname does not have the sem*(2) configured." >&4
15255         h_sem=false
15256         val="$undef"
15257         set semctl d_semctl
15258         eval $setvar
15259         set semget d_semget
15260         eval $setvar
15261         set semop d_semop
15262         eval $setvar
15263         ;;
15264     esac
15265     ;;
15266 esac
15267 : we could also check for sys/ipc.h ...
15268 if $h_sem && $test `./findhdr sys/sem.h`; then
15269         echo "You have the full sem*(2) library." >&4
15270         val="$define"
15271 else
15272         echo "You don't have the full sem*(2) library." >&4
15273         val="$undef"
15274 fi
15275 set d_sem
15276 eval $setvar
15277
15278 : see whether sys/sem.h defines union semun
15279 echo " "
15280 $cat > try.c <<'END'
15281 #include <sys/types.h>
15282 #include <sys/ipc.h>
15283 #include <sys/sem.h>
15284 int main () { union semun semun; semun.buf = 0; }
15285 END
15286 set try
15287 if eval $compile; then
15288     echo "You have union semun in <sys/sem.h>." >&4
15289     val="$define"
15290 else
15291     echo "You do not have union semun in <sys/sem.h>." >&4
15292     val="$undef"
15293 fi
15294 $rm -f try try.c
15295 set d_union_semun
15296 eval $setvar
15297
15298 : see how to do semctl IPC_STAT
15299 case "$d_sem" in
15300 $define)
15301     echo " "
15302     $cat > try.h <<END
15303 #ifndef S_IRUSR
15304 #   ifdef S_IREAD
15305 #       define S_IRUSR S_IREAD
15306 #       define S_IWUSR S_IWRITE
15307 #       define S_IXUSR S_IEXEC
15308 #   else
15309 #       define S_IRUSR 0400
15310 #       define S_IWUSR 0200
15311 #       define S_IXUSR 0100
15312 #   endif
15313 #   define S_IRGRP (S_IRUSR>>3)
15314 #   define S_IWGRP (S_IWUSR>>3)
15315 #   define S_IXGRP (S_IXUSR>>3)
15316 #   define S_IROTH (S_IRUSR>>6)
15317 #   define S_IWOTH (S_IWUSR>>6)
15318 #   define S_IXOTH (S_IXUSR>>6)
15319 #endif
15320 #ifndef S_IRWXU
15321 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15322 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15323 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15324 #endif
15325 END
15326     : see whether semctl IPC_STAT can use union semun
15327     val="$undef"
15328     case "$d_semctl_semun" in
15329     '')
15330       $cat > try.c <<END
15331 #include <sys/types.h>
15332 #include <sys/ipc.h>
15333 #include <sys/sem.h>
15334 #include <sys/stat.h>
15335 #include <stdio.h>
15336 #include <errno.h>
15337 #include "try.h"
15338 #ifndef errno
15339 extern int errno;
15340 #endif
15341 #$d_union_semun HAS_UNION_SEMUN
15342 int main() {
15343     union semun
15344 #ifndef HAS_UNION_SEMUN
15345     {
15346         int val;
15347         struct semid_ds *buf;
15348         unsigned short *array;
15349     }
15350 #endif
15351     arg;
15352     int sem, st;
15353
15354 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15355     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15356     if (sem > -1) {
15357         struct semid_ds argbuf;
15358         arg.buf = &argbuf;
15359 #       ifdef IPC_STAT
15360         st = semctl(sem, 0, IPC_STAT, arg);
15361         if (st == 0)
15362             printf("semun\n");
15363         else
15364 #       endif /* IPC_STAT */
15365             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15366 #       ifdef IPC_RMID
15367         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15368 #       endif /* IPC_RMID */
15369             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15370     } else
15371 #endif /* IPC_PRIVATE && ... */
15372         printf("semget failed: errno = %d\n", errno);
15373   return 0;
15374 }
15375 END
15376       set try
15377       if eval $compile; then
15378           xxx=`$run ./try`
15379           case "$xxx" in
15380           semun) val="$define" ;;
15381           esac
15382       fi
15383       $rm -f try try.c
15384       ;;
15385     esac
15386     set d_semctl_semun
15387     eval $setvar
15388     case "$d_semctl_semun" in
15389     $define)
15390         echo "You can use union semun for semctl IPC_STAT." >&4
15391         also='also'
15392         ;;
15393     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15394         also=''
15395         ;;
15396     esac
15397
15398     : see whether semctl IPC_STAT can use struct semid_ds pointer
15399     val="$undef"
15400     case "$d_semctl_semid_ds" in
15401     '')
15402       $cat > try.c <<'END'
15403 #include <sys/types.h>
15404 #include <sys/ipc.h>
15405 #include <sys/sem.h>
15406 #include <sys/stat.h>
15407 #include "try.h"
15408 #include <stdio.h>
15409 #include <errno.h>
15410 #ifndef errno
15411 extern int errno;
15412 #endif
15413 int main() {
15414     struct semid_ds arg;
15415     int sem, st;
15416
15417 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15418     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15419     if (sem > -1) {
15420 #       ifdef IPC_STAT
15421         st = semctl(sem, 0, IPC_STAT, &arg);
15422         if (st == 0)
15423             printf("semid_ds\n");
15424         else
15425 #       endif /* IPC_STAT */
15426             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15427 #       ifdef IPC_RMID
15428         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15429 #       endif /* IPC_RMID */
15430             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15431     } else
15432 #endif /* IPC_PRIVATE && ... */
15433         printf("semget failed: errno = %d\n", errno);
15434
15435     return 0;
15436 }
15437 END
15438       set try
15439       if eval $compile; then
15440           xxx=`$run ./try`
15441           case "$xxx" in
15442           semid_ds) val="$define" ;;
15443           esac
15444       fi
15445       $rm -f try try.c
15446       ;;
15447     esac
15448     set d_semctl_semid_ds
15449     eval $setvar
15450     case "$d_semctl_semid_ds" in
15451     $define)
15452         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15453         ;;
15454     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15455         ;;
15456     esac
15457     $rm -f try.h
15458     ;;
15459 *)  val="$undef"
15460
15461     # We do not have the full sem*(2) library, so assume we can not
15462     # use either.
15463
15464     set d_semctl_semun
15465     eval $setvar
15466
15467     set d_semctl_semid_ds
15468     eval $setvar
15469     ;;
15470 esac
15471
15472 : see if sendmsg exists
15473 set sendmsg d_sendmsg
15474 eval $inlibc
15475
15476 : see if setegid exists
15477 set setegid d_setegid
15478 eval $inlibc
15479
15480 : see if seteuid exists
15481 set seteuid d_seteuid
15482 eval $inlibc
15483
15484 : see if setgrent exists
15485 set setgrent d_setgrent
15486 eval $inlibc
15487
15488 : see if setgrent_r exists
15489 set setgrent_r d_setgrent_r
15490 eval $inlibc
15491 case "$d_setgrent_r" in
15492 "$define")
15493         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15494         case "$d_setgrent_r_proto:$usethreads" in
15495         ":define")      d_setgrent_r_proto=define
15496                 set d_setgrent_r_proto setgrent_r $hdrs
15497                 eval $hasproto ;;
15498         *)      ;;
15499         esac
15500         case "$d_setgrent_r_proto" in
15501         define)
15502         case "$setgrent_r_proto" in
15503         ''|0) try='int setgrent_r(FILE**);'
15504         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15505         esac
15506         case "$setgrent_r_proto" in
15507         ''|0) try='void setgrent_r(FILE**);'
15508         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15509         esac
15510         case "$setgrent_r_proto" in
15511         ''|0)   d_setgrent_r=undef
15512                 setgrent_r_proto=0
15513                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15514         * )     case "$setgrent_r_proto" in
15515                 REENTRANT_PROTO*) ;;
15516                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15517                 esac
15518                 echo "Prototype: $try" ;;
15519         esac
15520         ;;
15521         *)      case "$usethreads" in
15522                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15523                 esac
15524                 d_setgrent_r=undef
15525                 setgrent_r_proto=0
15526                 ;;
15527         esac
15528         ;;
15529 *)      setgrent_r_proto=0
15530         ;;
15531 esac
15532
15533 : see if sethostent exists
15534 set sethostent d_sethent
15535 eval $inlibc
15536
15537 : see if sethostent_r exists
15538 set sethostent_r d_sethostent_r
15539 eval $inlibc
15540 case "$d_sethostent_r" in
15541 "$define")
15542         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15543         case "$d_sethostent_r_proto:$usethreads" in
15544         ":define")      d_sethostent_r_proto=define
15545                 set d_sethostent_r_proto sethostent_r $hdrs
15546                 eval $hasproto ;;
15547         *)      ;;
15548         esac
15549         case "$d_sethostent_r_proto" in
15550         define)
15551         case "$sethostent_r_proto" in
15552         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15553         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15554         esac
15555         case "$sethostent_r_proto" in
15556         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15557         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15558         esac
15559         case "$sethostent_r_proto" in
15560         ''|0)   d_sethostent_r=undef
15561                 sethostent_r_proto=0
15562                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15563         * )     case "$sethostent_r_proto" in
15564                 REENTRANT_PROTO*) ;;
15565                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15566                 esac
15567                 echo "Prototype: $try" ;;
15568         esac
15569         ;;
15570         *)      case "$usethreads" in
15571                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15572                 esac
15573                 d_sethostent_r=undef
15574                 sethostent_r_proto=0
15575                 ;;
15576         esac
15577         ;;
15578 *)      sethostent_r_proto=0
15579         ;;
15580 esac
15581
15582 : see if setitimer exists
15583 set setitimer d_setitimer
15584 eval $inlibc
15585
15586 : see if setlinebuf exists
15587 set setlinebuf d_setlinebuf
15588 eval $inlibc
15589
15590 : see if setlocale exists
15591 set setlocale d_setlocale
15592 eval $inlibc
15593
15594 : see if locale.h is available
15595 set locale.h i_locale
15596 eval $inhdr
15597
15598 : see if setlocale_r exists
15599 set setlocale_r d_setlocale_r
15600 eval $inlibc
15601 case "$d_setlocale_r" in
15602 "$define")
15603         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15604         case "$d_setlocale_r_proto:$usethreads" in
15605         ":define")      d_setlocale_r_proto=define
15606                 set d_setlocale_r_proto setlocale_r $hdrs
15607                 eval $hasproto ;;
15608         *)      ;;
15609         esac
15610         case "$d_setlocale_r_proto" in
15611         define)
15612         case "$setlocale_r_proto" in
15613         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15614         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15615         esac
15616         case "$setlocale_r_proto" in
15617         ''|0)   d_setlocale_r=undef
15618                 setlocale_r_proto=0
15619                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15620         * )     case "$setlocale_r_proto" in
15621                 REENTRANT_PROTO*) ;;
15622                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15623                 esac
15624                 echo "Prototype: $try" ;;
15625         esac
15626         ;;
15627         *)      case "$usethreads" in
15628                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15629                 esac
15630                 d_setlocale_r=undef
15631                 setlocale_r_proto=0
15632                 ;;
15633         esac
15634         ;;
15635 *)      setlocale_r_proto=0
15636         ;;
15637 esac
15638
15639 : see if setnetent exists
15640 set setnetent d_setnent
15641 eval $inlibc
15642
15643 : see if setnetent_r exists
15644 set setnetent_r d_setnetent_r
15645 eval $inlibc
15646 case "$d_setnetent_r" in
15647 "$define")
15648         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15649         case "$d_setnetent_r_proto:$usethreads" in
15650         ":define")      d_setnetent_r_proto=define
15651                 set d_setnetent_r_proto setnetent_r $hdrs
15652                 eval $hasproto ;;
15653         *)      ;;
15654         esac
15655         case "$d_setnetent_r_proto" in
15656         define)
15657         case "$setnetent_r_proto" in
15658         ''|0) try='int setnetent_r(int, struct netent_data*);'
15659         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15660         esac
15661         case "$setnetent_r_proto" in
15662         ''|0) try='void setnetent_r(int, struct netent_data*);'
15663         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15664         esac
15665         case "$setnetent_r_proto" in
15666         ''|0)   d_setnetent_r=undef
15667                 setnetent_r_proto=0
15668                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15669         * )     case "$setnetent_r_proto" in
15670                 REENTRANT_PROTO*) ;;
15671                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15672                 esac
15673                 echo "Prototype: $try" ;;
15674         esac
15675         ;;
15676         *)      case "$usethreads" in
15677                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15678                 esac
15679                 d_setnetent_r=undef
15680                 setnetent_r_proto=0
15681                 ;;
15682         esac
15683         ;;
15684 *)      setnetent_r_proto=0
15685         ;;
15686 esac
15687
15688 : see if setprotoent exists
15689 set setprotoent d_setpent
15690 eval $inlibc
15691
15692 : see if setpgid exists
15693 set setpgid d_setpgid
15694 eval $inlibc
15695
15696 : see if setpgrp2 exists
15697 set setpgrp2 d_setpgrp2
15698 eval $inlibc
15699
15700 : see if setpriority exists
15701 set setpriority d_setprior
15702 eval $inlibc
15703
15704 : see if setproctitle exists
15705 set setproctitle d_setproctitle
15706 eval $inlibc
15707
15708 : see if setprotoent_r exists
15709 set setprotoent_r d_setprotoent_r
15710 eval $inlibc
15711 case "$d_setprotoent_r" in
15712 "$define")
15713         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15714         case "$d_setprotoent_r_proto:$usethreads" in
15715         ":define")      d_setprotoent_r_proto=define
15716                 set d_setprotoent_r_proto setprotoent_r $hdrs
15717                 eval $hasproto ;;
15718         *)      ;;
15719         esac
15720         case "$d_setprotoent_r_proto" in
15721         define)
15722         case "$setprotoent_r_proto" in
15723         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15724         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15725         esac
15726         case "$setprotoent_r_proto" in
15727         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15728         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15729         esac
15730         case "$setprotoent_r_proto" in
15731         ''|0)   d_setprotoent_r=undef
15732                 setprotoent_r_proto=0
15733                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15734         * )     case "$setprotoent_r_proto" in
15735                 REENTRANT_PROTO*) ;;
15736                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15737                 esac
15738                 echo "Prototype: $try" ;;
15739         esac
15740         ;;
15741         *)      case "$usethreads" in
15742                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15743                 esac
15744                 d_setprotoent_r=undef
15745                 setprotoent_r_proto=0
15746                 ;;
15747         esac
15748         ;;
15749 *)      setprotoent_r_proto=0
15750         ;;
15751 esac
15752
15753 : see if setpwent exists
15754 set setpwent d_setpwent
15755 eval $inlibc
15756
15757 : see if setpwent_r exists
15758 set setpwent_r d_setpwent_r
15759 eval $inlibc
15760 case "$d_setpwent_r" in
15761 "$define")
15762         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15763         case "$d_setpwent_r_proto:$usethreads" in
15764         ":define")      d_setpwent_r_proto=define
15765                 set d_setpwent_r_proto setpwent_r $hdrs
15766                 eval $hasproto ;;
15767         *)      ;;
15768         esac
15769         case "$d_setpwent_r_proto" in
15770         define)
15771         case "$setpwent_r_proto" in
15772         ''|0) try='int setpwent_r(FILE**);'
15773         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15774         esac
15775         case "$setpwent_r_proto" in
15776         ''|0) try='void setpwent_r(FILE**);'
15777         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15778         esac
15779         case "$setpwent_r_proto" in
15780         ''|0)   d_setpwent_r=undef
15781                 setpwent_r_proto=0
15782                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15783         * )     case "$setpwent_r_proto" in
15784                 REENTRANT_PROTO*) ;;
15785                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15786                 esac
15787                 echo "Prototype: $try" ;;
15788         esac
15789         ;;
15790         *)      case "$usethreads" in
15791                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15792                 esac
15793                 d_setpwent_r=undef
15794                 setpwent_r_proto=0
15795                 ;;
15796         esac
15797         ;;
15798 *)      setpwent_r_proto=0
15799         ;;
15800 esac
15801
15802 : see if setregid exists
15803 set setregid d_setregid
15804 eval $inlibc
15805 set setresgid d_setresgid
15806 eval $inlibc
15807
15808 : see if setreuid exists
15809 set setreuid d_setreuid
15810 eval $inlibc
15811 set setresuid d_setresuid
15812 eval $inlibc
15813
15814 : see if setrgid exists
15815 set setrgid d_setrgid
15816 eval $inlibc
15817
15818 : see if setruid exists
15819 set setruid d_setruid
15820 eval $inlibc
15821
15822 : see if setservent exists
15823 set setservent d_setsent
15824 eval $inlibc
15825
15826 : see if setservent_r exists
15827 set setservent_r d_setservent_r
15828 eval $inlibc
15829 case "$d_setservent_r" in
15830 "$define")
15831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15832         case "$d_setservent_r_proto:$usethreads" in
15833         ":define")      d_setservent_r_proto=define
15834                 set d_setservent_r_proto setservent_r $hdrs
15835                 eval $hasproto ;;
15836         *)      ;;
15837         esac
15838         case "$d_setservent_r_proto" in
15839         define)
15840         case "$setservent_r_proto" in
15841         ''|0) try='int setservent_r(int, struct servent_data*);'
15842         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15843         esac
15844         case "$setservent_r_proto" in
15845         ''|0) try='void setservent_r(int, struct servent_data*);'
15846         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15847         esac
15848         case "$setservent_r_proto" in
15849         ''|0)   d_setservent_r=undef
15850                 setservent_r_proto=0
15851                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15852         * )     case "$setservent_r_proto" in
15853                 REENTRANT_PROTO*) ;;
15854                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15855                 esac
15856                 echo "Prototype: $try" ;;
15857         esac
15858         ;;
15859         *)      case "$usethreads" in
15860                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15861                 esac
15862                 d_setservent_r=undef
15863                 setservent_r_proto=0
15864                 ;;
15865         esac
15866         ;;
15867 *)      setservent_r_proto=0
15868         ;;
15869 esac
15870
15871 : see if setsid exists
15872 set setsid d_setsid
15873 eval $inlibc
15874
15875 : see if setvbuf exists
15876 set setvbuf d_setvbuf
15877 eval $inlibc
15878
15879 : see if sfio.h is available
15880 set sfio.h i_sfio
15881 eval $inhdr
15882
15883
15884 : see if sfio library is available
15885 case "$i_sfio" in
15886 $define)
15887         val=''
15888         set sfreserve val
15889         eval $inlibc
15890         ;;
15891 *)
15892         val="$undef"
15893         ;;
15894 esac
15895 : Ok, but do we want to use it.
15896 case "$val" in
15897 $define)
15898         case "$usesfio" in
15899         true|$define|[yY]*) dflt='y';;
15900         *) dflt='n';;
15901         esac
15902         echo "$package can use the sfio library, but it is experimental."
15903         case "$useperlio" in
15904         "$undef")
15905             echo "For sfio also the PerlIO abstraction layer is needed."
15906             echo "Earlier you said you wouldn't want that."
15907             ;;
15908         esac
15909         rp="You seem to have sfio available, do you want to try using it?"
15910         . ./myread
15911         case "$ans" in
15912         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15913                 useperlio="$define"
15914                 val="$define"
15915                 ;;
15916         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15917                 val="$undef"
15918                 ;;
15919         esac
15920         ;;
15921 *)      case "$usesfio" in
15922         true|$define|[yY]*)
15923                 echo "Sorry, cannot find sfio on this machine." >&4
15924                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15925                 val="$undef"
15926                 ;;
15927         esac
15928         ;;
15929 esac
15930 set d_sfio
15931 eval $setvar
15932 case "$d_sfio" in
15933 $define) usesfio='true';;
15934 *) usesfio='false';;
15935 esac
15936 case "$d_sfio" in
15937 $define) ;;
15938 *)      : Remove sfio from list of libraries to use
15939         case "$libs" in
15940         *-lsfio*)
15941                 echo "Removing unneeded -lsfio from library list" >&4
15942                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15943                 shift
15944                 libs="$*"
15945                 echo "libs = $libs" >&4
15946                 ;;
15947         esac
15948 ;;
15949 esac
15950
15951
15952 : see if shmctl exists
15953 set shmctl d_shmctl
15954 eval $inlibc
15955
15956 : see if shmget exists
15957 set shmget d_shmget
15958 eval $inlibc
15959
15960 : see if shmat exists
15961 set shmat d_shmat
15962 eval $inlibc
15963 : see what shmat returns
15964 case "$d_shmat" in
15965 "$define")
15966         $cat >shmat.c <<'END'
15967 #include <sys/shm.h>
15968 void *shmat();
15969 END
15970         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15971                 shmattype='void *'
15972         else
15973                 shmattype='char *'
15974         fi
15975         echo "and it returns ($shmattype)." >&4
15976         : see if a prototype for shmat is available
15977         xxx=`./findhdr sys/shm.h`
15978         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15979         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15980                 val="$define"
15981         else
15982                 val="$undef"
15983         fi
15984         $rm -f shmat.[co]
15985         ;;
15986 *)
15987         val="$undef"
15988         ;;
15989 esac
15990 set d_shmatprototype
15991 eval $setvar
15992
15993 : see if shmdt exists
15994 set shmdt d_shmdt
15995 eval $inlibc
15996
15997 : see how much of the 'shm*(2)' library is present.
15998 h_shm=true
15999 echo " "
16000 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16001 *"$undef"*) h_shm=false;;
16002 esac
16003 case "$osname" in
16004 freebsd)
16005     case "`ipcs 2>&1`" in
16006     "SVID shared memory"*"not configured"*)
16007         echo "Your $osname does not have the shm*(2) configured." >&4
16008         h_shm=false
16009         val="$undef"
16010         set shmctl d_shmctl
16011         evat $setvar
16012         set shmget d_shmget
16013         evat $setvar
16014         set shmat d_shmat
16015         evat $setvar
16016         set shmdt d_shmdt
16017         evat $setvar
16018         ;;
16019     esac
16020     ;;
16021 esac
16022 : we could also check for sys/ipc.h ...
16023 if $h_shm && $test `./findhdr sys/shm.h`; then
16024         echo "You have the full shm*(2) library." >&4
16025         val="$define"
16026 else
16027         echo "You don't have the full shm*(2) library." >&4
16028         val="$undef"
16029 fi
16030 set d_shm
16031 eval $setvar
16032
16033 echo " "
16034 : see if we have sigaction
16035 if set sigaction val -f d_sigaction; eval $csym; $val; then
16036         echo 'sigaction() found.' >&4
16037         $cat > try.c <<EOP
16038 #include <stdio.h>
16039 #include <sys/types.h>
16040 #include <signal.h>
16041 #$i_stdlib I_STDLIB
16042 #ifdef I_STDLIB
16043 #include <stdlib.h>
16044 #endif
16045 int main()
16046 {
16047     struct sigaction act, oact;
16048     act.sa_flags = 0;
16049     oact.sa_handler = 0;
16050     /* so that act and oact are used */
16051     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16052 }
16053 EOP
16054         set try
16055         if eval $compile_ok; then
16056                 val="$define"
16057         else
16058                 echo "But you don't seem to have a useable struct sigaction." >&4
16059                 val="$undef"
16060         fi
16061 else
16062         echo 'sigaction NOT found.' >&4
16063         val="$undef"
16064 fi
16065 set d_sigaction; eval $setvar
16066 $rm -f try try$_o try.c
16067
16068 : see if sigprocmask exists
16069 set sigprocmask d_sigprocmask
16070 eval $inlibc
16071
16072 : see if sigsetjmp exists
16073 echo " "
16074 case "$d_sigsetjmp" in
16075 '')
16076         $cat >try.c <<EOP
16077 #include <setjmp.h>
16078 #$i_stdlib I_STDLIB
16079 #ifdef I_STDLIB
16080 #include <stdlib.h>
16081 #endif
16082 sigjmp_buf env;
16083 int set = 1;
16084 int main()
16085 {
16086         if (sigsetjmp(env,1))
16087                 exit(set);
16088         set = 0;
16089         siglongjmp(env, 1);
16090         exit(1);
16091 }
16092 EOP
16093         set try
16094         if eval $compile; then
16095                 if $run ./try >/dev/null 2>&1; then
16096                         echo "POSIX sigsetjmp found." >&4
16097                         val="$define"
16098                 else
16099                         $cat >&4 <<EOM
16100 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16101 I'll ignore them.
16102 EOM
16103                         val="$undef"
16104                 fi
16105         else
16106                 echo "sigsetjmp not found." >&4
16107                 val="$undef"
16108         fi
16109         ;;
16110 *) val="$d_sigsetjmp"
16111         case "$d_sigsetjmp" in
16112         $define) echo "POSIX sigsetjmp found." >&4;;
16113         $undef) echo "sigsetjmp not found." >&4;;
16114         esac
16115         ;;
16116 esac
16117 set d_sigsetjmp
16118 eval $setvar
16119 $rm -f try.c try
16120
16121 : see if sockatmark exists
16122 set sockatmark d_sockatmark
16123 eval $inlibc
16124
16125 : see if prototype for sockatmark is available
16126 echo " "
16127 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16128 eval $hasproto
16129
16130 : see if socks5_init exists
16131 set socks5_init d_socks5_init
16132 eval $inlibc
16133
16134 : see if srand48_r exists
16135 set srand48_r d_srand48_r
16136 eval $inlibc
16137 case "$d_srand48_r" in
16138 "$define")
16139         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16140         case "$d_srand48_r_proto:$usethreads" in
16141         ":define")      d_srand48_r_proto=define
16142                 set d_srand48_r_proto srand48_r $hdrs
16143                 eval $hasproto ;;
16144         *)      ;;
16145         esac
16146         case "$d_srand48_r_proto" in
16147         define)
16148         case "$srand48_r_proto" in
16149         ''|0) try='int srand48_r(long, struct drand48_data*);'
16150         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16151         esac
16152         case "$srand48_r_proto" in
16153         ''|0)   d_srand48_r=undef
16154                 srand48_r_proto=0
16155                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16156         * )     case "$srand48_r_proto" in
16157                 REENTRANT_PROTO*) ;;
16158                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16159                 esac
16160                 echo "Prototype: $try" ;;
16161         esac
16162         ;;
16163         *)      case "$usethreads" in
16164                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16165                 esac
16166                 d_srand48_r=undef
16167                 srand48_r_proto=0
16168                 ;;
16169         esac
16170         ;;
16171 *)      srand48_r_proto=0
16172         ;;
16173 esac
16174
16175 : see if srandom_r exists
16176 set srandom_r d_srandom_r
16177 eval $inlibc
16178 case "$d_srandom_r" in
16179 "$define")
16180         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16181         case "$d_srandom_r_proto:$usethreads" in
16182         ":define")      d_srandom_r_proto=define
16183                 set d_srandom_r_proto srandom_r $hdrs
16184                 eval $hasproto ;;
16185         *)      ;;
16186         esac
16187         case "$d_srandom_r_proto" in
16188         define)
16189         case "$srandom_r_proto" in
16190         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16191         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16192         esac
16193         case "$srandom_r_proto" in
16194         ''|0)   d_srandom_r=undef
16195                 srandom_r_proto=0
16196                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16197         * )     case "$srandom_r_proto" in
16198                 REENTRANT_PROTO*) ;;
16199                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16200                 esac
16201                 echo "Prototype: $try" ;;
16202         esac
16203         ;;
16204         *)      case "$usethreads" in
16205                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16206                 esac
16207                 d_srandom_r=undef
16208                 srandom_r_proto=0
16209                 ;;
16210         esac
16211         ;;
16212 *)      srandom_r_proto=0
16213         ;;
16214 esac
16215
16216 : see if prototype for setresgid is available
16217 echo " "
16218 set d_sresgproto setresgid $i_unistd unistd.h
16219 eval $hasproto
16220
16221 : see if prototype for setresuid is available
16222 echo " "
16223 set d_sresuproto setresuid $i_unistd unistd.h
16224 eval $hasproto
16225
16226 : see if sys/stat.h is available
16227 set sys/stat.h i_sysstat
16228 eval $inhdr
16229
16230
16231 : see if stat knows about block sizes
16232 echo " "
16233 echo "Checking to see if your struct stat has st_blocks field..." >&4
16234 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16235 eval $hasfield
16236
16237
16238 : see if this is a sys/vfs.h system
16239 set sys/vfs.h i_sysvfs
16240 eval $inhdr
16241
16242
16243 : see if this is a sys/statfs.h system
16244 set sys/statfs.h i_sysstatfs
16245 eval $inhdr
16246
16247
16248 echo " "
16249 echo "Checking to see if your system supports struct statfs..." >&4
16250 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
16251 eval $hasstruct
16252 case "$d_statfs_s" in
16253 "$define")      echo "Yes, it does."   ;;
16254 *)              echo "No, it doesn't." ;;
16255 esac
16256
16257
16258
16259 : see if struct statfs knows about f_flags
16260 case "$d_statfs_s" in
16261 define) 
16262         echo " "
16263         echo "Checking to see if your struct statfs has f_flags field..." >&4
16264         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
16265         eval $hasfield
16266         ;;
16267 *)      val="$undef"
16268         set d_statfs_f_flags
16269         eval $setvar
16270         ;;
16271 esac
16272 case "$d_statfs_f_flags" in
16273 "$define")      echo "Yes, it does."   ;;
16274 *)              echo "No, it doesn't." ;;
16275 esac
16276
16277 $cat >&4 <<EOM
16278 Checking how to access stdio streams by file descriptor number...
16279 EOM
16280 case "$stdio_stream_array" in
16281 '')     $cat >try.c <<EOCP
16282 #include <stdio.h>
16283 int main() {
16284   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16285     printf("yes\n");
16286 }
16287 EOCP
16288         for s in _iob __iob __sF
16289         do
16290                 set try -DSTDIO_STREAM_ARRAY=$s
16291                 if eval $compile; then
16292                         case "`$run ./try`" in
16293                         yes)    stdio_stream_array=$s; break ;;
16294                         esac
16295                 fi
16296         done
16297         $rm -f try.* try$exe_ext
16298 esac
16299 case "$stdio_stream_array" in
16300 '')     $cat >&4 <<EOM
16301 I can't figure out how to access stdio streams by file descriptor number.
16302 EOM
16303         d_stdio_stream_array="$undef"
16304         ;;
16305 *)      $cat >&4 <<EOM
16306 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16307 EOM
16308         d_stdio_stream_array="$define"
16309         ;;
16310 esac
16311
16312 : see if strcoll exists
16313 set strcoll d_strcoll
16314 eval $inlibc
16315
16316 : check for structure copying
16317 echo " "
16318 echo "Checking to see if your C compiler can copy structs..." >&4
16319 $cat >try.c <<'EOCP'
16320 int main()
16321 {
16322         struct blurfl {
16323                 int dyick;
16324         } foo, bar;
16325
16326         foo = bar;
16327 }
16328 EOCP
16329 if $cc -c try.c >/dev/null 2>&1 ; then
16330         val="$define"
16331         echo "Yup, it can."
16332 else
16333         val="$undef"
16334         echo "Nope, it can't."
16335 fi
16336 set d_strctcpy
16337 eval $setvar
16338 $rm -f try.*
16339
16340 : see if strerror and/or sys_errlist[] exist
16341 echo " "
16342 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16343     if set strerror val -f d_strerror; eval $csym; $val; then
16344                 echo 'strerror() found.' >&4
16345                 d_strerror="$define"
16346                 d_strerrm='strerror(e)'
16347                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16348                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16349                         d_syserrlst="$define"
16350                 else
16351                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16352                         d_syserrlst="$undef"
16353                 fi
16354     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16355                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16356                 echo 'strerror() found in string header.' >&4
16357                 d_strerror="$define"
16358                 d_strerrm='strerror(e)'
16359                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16360                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16361                                 d_syserrlst="$define"
16362                 else
16363                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16364                         d_syserrlst="$undef"
16365                 fi
16366     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16367                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16368                 d_strerror="$undef"
16369                 d_syserrlst="$define"
16370                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16371     else
16372                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16373                 d_strerror="$undef"
16374                 d_syserrlst="$undef"
16375                 d_strerrm='"unknown"'
16376     fi
16377 fi
16378
16379 : see if strerror_r exists
16380 set strerror_r d_strerror_r
16381 eval $inlibc
16382 case "$d_strerror_r" in
16383 "$define")
16384         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16385         case "$d_strerror_r_proto:$usethreads" in
16386         ":define")      d_strerror_r_proto=define
16387                 set d_strerror_r_proto strerror_r $hdrs
16388                 eval $hasproto ;;
16389         *)      ;;
16390         esac
16391         case "$d_strerror_r_proto" in
16392         define)
16393         case "$strerror_r_proto" in
16394         ''|0) try='int strerror_r(int, char*, size_t);'
16395         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16396         esac
16397         case "$strerror_r_proto" in
16398         ''|0) try='int strerror_r(int, char*, int);'
16399         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16400         esac
16401         case "$strerror_r_proto" in
16402         ''|0) try='char* strerror_r(int, char*, size_t);'
16403         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16404         esac
16405         case "$strerror_r_proto" in
16406         ''|0)   d_strerror_r=undef
16407                 strerror_r_proto=0
16408                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16409         * )     case "$strerror_r_proto" in
16410                 REENTRANT_PROTO*) ;;
16411                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16412                 esac
16413                 echo "Prototype: $try" ;;
16414         esac
16415         ;;
16416         *)      case "$usethreads" in
16417                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16418                 esac
16419                 d_strerror_r=undef
16420                 strerror_r_proto=0
16421                 ;;
16422         esac
16423         ;;
16424 *)      strerror_r_proto=0
16425         ;;
16426 esac
16427
16428 : see if strftime exists
16429 set strftime d_strftime
16430 eval $inlibc
16431
16432 : see if strtod exists
16433 set strtod d_strtod
16434 eval $inlibc
16435
16436 : see if strtol exists
16437 set strtol d_strtol
16438 eval $inlibc
16439
16440 : see if strtold exists
16441 set strtold d_strtold
16442 eval $inlibc
16443
16444 : see if strtoll exists
16445 set strtoll d_strtoll
16446 eval $inlibc
16447
16448 case "$d_longlong-$d_strtoll" in
16449 "$define-$define")
16450         $cat <<EOM
16451 Checking whether your strtoll() works okay...
16452 EOM
16453         $cat >try.c <<'EOCP'
16454 #include <errno.h>
16455 #ifdef __hpux
16456 #define strtoll __strtoll
16457 #endif
16458 #ifdef __EMX__
16459 #define strtoll _strtoll
16460 #endif
16461 #include <stdio.h>
16462 extern long long int strtoll(char *s, char **, int); 
16463 static int bad = 0;
16464 int check(char *s, long long ell, int een) {
16465         long long gll;
16466         errno = 0;
16467         gll = strtoll(s, 0, 10);
16468         if (!((gll == ell) && (errno == een)))
16469                 bad++;
16470 }
16471 int main() {
16472         check(" 1",                                      1LL, 0);
16473         check(" 0",                                      0LL, 0);
16474         check("-1",                                     -1LL, 0);
16475         check("-9223372036854775808", -9223372036854775808LL, 0);
16476         check("-9223372036854775808", -9223372036854775808LL, 0);
16477         check(" 9223372036854775807",  9223372036854775807LL, 0);
16478         check("-9223372036854775808", -9223372036854775808LL, 0);
16479         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16480         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16481         if (!bad)
16482                 printf("ok\n");
16483 }
16484 EOCP
16485         set try
16486         if eval $compile; then
16487                 yyy=`$run ./try`
16488                 case "$yyy" in
16489                 ok) echo "Your strtoll() seems to be working okay." ;;
16490                 *) cat <<EOM >&4
16491 Your strtoll() doesn't seem to be working okay.
16492 EOM
16493                    d_strtoll="$undef"
16494                    ;;
16495                 esac
16496         else
16497                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16498                 d_strtoll="$undef"
16499         fi
16500         ;;
16501 esac
16502
16503 : see if strtoq exists
16504 set strtoq d_strtoq
16505 eval $inlibc
16506
16507 : see if strtoul exists
16508 set strtoul d_strtoul
16509 eval $inlibc
16510
16511 case "$d_strtoul" in
16512 "$define")
16513         $cat <<EOM
16514 Checking whether your strtoul() works okay...
16515 EOM
16516         $cat >try.c <<'EOCP'
16517 #include <errno.h>
16518 #include <stdio.h>
16519 extern unsigned long int strtoul(char *s, char **, int); 
16520 static int bad = 0;
16521 void check(char *s, unsigned long eul, int een) {
16522         unsigned long gul;
16523         errno = 0;
16524         gul = strtoul(s, 0, 10);
16525         if (!((gul == eul) && (errno == een)))
16526                 bad++;
16527 }
16528 int main() {
16529         check(" 1", 1L, 0);
16530         check(" 0", 0L, 0);
16531 EOCP
16532         case "$longsize" in
16533         8)
16534             $cat >>try.c <<'EOCP'
16535         check("18446744073709551615", 18446744073709551615UL, 0);
16536         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16537 #if 0 /* strtoul() for /^-/ strings is undefined. */
16538         check("-1", 18446744073709551615UL, 0);
16539         check("-18446744073709551614", 2, 0);
16540         check("-18446744073709551615", 1, 0);
16541         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16542         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16543 #endif
16544 EOCP
16545                 ;;
16546         4)
16547                     $cat >>try.c <<'EOCP'
16548         check("4294967295", 4294967295UL, 0);
16549         check("4294967296", 4294967295UL, ERANGE);
16550 #if 0 /* strtoul() for /^-/ strings is undefined. */
16551         check("-1", 4294967295UL, 0);
16552         check("-4294967294", 2, 0);
16553         check("-4294967295", 1, 0);
16554         check("-4294967296", 4294967295UL, ERANGE);
16555         check("-4294967297", 4294967295UL, ERANGE);
16556 #endif
16557 EOCP
16558                 ;;
16559         *)
16560 : Should we write these tests to be more portable by sprintf-ing
16561 : ~0 and then manipulating that char string as input for strtol?
16562                 ;;
16563         esac
16564         $cat >>try.c <<'EOCP'
16565         if (!bad)
16566                 printf("ok\n");
16567         return 0;
16568 }
16569 EOCP
16570         set try
16571         if eval $compile; then
16572                 case "`$run ./try`" in
16573                 ok) echo "Your strtoul() seems to be working okay." ;;
16574                 *) cat <<EOM >&4
16575 Your strtoul() doesn't seem to be working okay.
16576 EOM
16577                    d_strtoul="$undef"
16578                    ;;
16579                 esac
16580         fi
16581         ;;
16582 esac
16583
16584 : see if strtoull exists
16585 set strtoull d_strtoull
16586 eval $inlibc
16587
16588 case "$d_longlong-$d_strtoull" in
16589 "$define-$define")
16590         $cat <<EOM
16591 Checking whether your strtoull() works okay...
16592 EOM
16593         $cat >try.c <<'EOCP'
16594 #include <errno.h>
16595 #ifdef __hpux
16596 #define strtoull __strtoull
16597 #endif
16598 #include <stdio.h>
16599 extern unsigned long long int strtoull(char *s, char **, int); 
16600 static int bad = 0;
16601 int check(char *s, long long eull, int een) {
16602         long long gull;
16603         errno = 0;
16604         gull = strtoull(s, 0, 10);
16605         if (!((gull == eull) && (errno == een)))
16606                 bad++;
16607 }
16608 int main() {
16609         check(" 1",                                        1LL, 0);
16610         check(" 0",                                        0LL, 0);
16611         check("18446744073709551615",  18446744073709551615ULL, 0);
16612         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16613 #if 0 /* strtoull() for /^-/ strings is undefined. */
16614         check("-1",                    18446744073709551615ULL, 0);
16615         check("-18446744073709551614",                     2LL, 0);
16616         check("-18446744073709551615",                     1LL, 0);
16617         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16618         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16619 #endif
16620         if (!bad)
16621                 printf("ok\n");
16622 }
16623 EOCP
16624         set try
16625         if eval $compile; then
16626                 case "`$run ./try`" in
16627                 ok) echo "Your strtoull() seems to be working okay." ;;
16628                 *) cat <<EOM >&4
16629 Your strtoull() doesn't seem to be working okay.
16630 EOM
16631                    d_strtoull="$undef"
16632                    ;;
16633                 esac
16634         fi
16635         ;;
16636 esac
16637
16638 : see if strtouq exists
16639 set strtouq d_strtouq
16640 eval $inlibc
16641
16642 case "$d_strtouq" in
16643 "$define")
16644         $cat <<EOM
16645 Checking whether your strtouq() works okay...
16646 EOM
16647         $cat >try.c <<'EOCP'
16648 #include <errno.h>
16649 #include <stdio.h>
16650 extern unsigned long long int strtouq(char *s, char **, int); 
16651 static int bad = 0;
16652 void check(char *s, unsigned long long eull, int een) {
16653         unsigned long long gull;
16654         errno = 0;
16655         gull = strtouq(s, 0, 10);
16656         if (!((gull == eull) && (errno == een)))
16657                 bad++;
16658 }
16659 int main() {
16660         check(" 1",                                        1LL, 0);
16661         check(" 0",                                        0LL, 0);
16662         check("18446744073709551615",  18446744073709551615ULL, 0);
16663         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16664 #if 0 /* strtouq() for /^-/ strings is undefined. */
16665         check("-1",                    18446744073709551615ULL, 0);
16666         check("-18446744073709551614",                     2LL, 0);
16667         check("-18446744073709551615",                     1LL, 0);
16668         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16669         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16670 #endif
16671         if (!bad)
16672                 printf("ok\n");
16673         return 0;
16674 }
16675 EOCP
16676         set try
16677         if eval $compile; then
16678                 case "`$run ./try`" in
16679                 ok) echo "Your strtouq() seems to be working okay." ;;
16680                 *) cat <<EOM >&4
16681 Your strtouq() doesn't seem to be working okay.
16682 EOM
16683                    d_strtouq="$undef"
16684                    ;;
16685                 esac
16686         fi
16687         ;;
16688 esac
16689
16690 : see if strxfrm exists
16691 set strxfrm d_strxfrm
16692 eval $inlibc
16693
16694 : see if symlink exists
16695 set symlink d_symlink
16696 eval $inlibc
16697
16698 : see if syscall exists
16699 set syscall d_syscall
16700 eval $inlibc
16701
16702 : see if prototype for syscall is available
16703 echo " "
16704 set d_syscallproto syscall $i_unistd unistd.h
16705 eval $hasproto
16706
16707 : see if sysconf exists
16708 set sysconf d_sysconf
16709 eval $inlibc
16710
16711 : see if system exists
16712 set system d_system
16713 eval $inlibc
16714
16715 : see if tcgetpgrp exists
16716 set tcgetpgrp d_tcgetpgrp
16717 eval $inlibc
16718
16719 : see if tcsetpgrp exists
16720 set tcsetpgrp d_tcsetpgrp
16721 eval $inlibc
16722
16723 : see if prototype for telldir is available
16724 echo " "
16725 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16726 eval $hasproto
16727
16728 : see if time exists
16729 echo " "
16730 if test "X$d_time" = X -o X"$timetype" = X; then
16731     if set time val -f d_time; eval $csym; $val; then
16732                 echo 'time() found.' >&4
16733                 val="$define"
16734                 rp="What is the type returned by time() on this system?"
16735                 set time_t timetype long stdio.h sys/types.h
16736                 eval $typedef_ask
16737     else
16738                 echo 'time() not found, hope that will do.' >&4
16739                 val="$undef"
16740                 timetype='int';
16741     fi
16742     set d_time
16743     eval $setvar
16744 fi
16745
16746 : see if this is a sys/times.h system
16747 set sys/times.h i_systimes
16748 eval $inhdr
16749
16750 : see if times exists
16751 echo " "
16752 if set times val -f d_times; eval $csym; $val; then
16753         echo 'times() found.' >&4
16754         d_times="$define"
16755         inc=''
16756         case "$i_systimes" in
16757         "$define") inc='sys/times.h';;
16758         esac
16759         rp="What is the type returned by times() on this system?"
16760         set clock_t clocktype long stdio.h sys/types.h $inc
16761         eval $typedef_ask
16762 else
16763         echo 'times() NOT found, hope that will do.' >&4
16764         d_times="$undef"
16765         clocktype='int'
16766 fi
16767
16768 : see if tmpnam_r exists
16769 set tmpnam_r d_tmpnam_r
16770 eval $inlibc
16771 case "$d_tmpnam_r" in
16772 "$define")
16773         hdrs="$i_systypes sys/types.h define stdio.h "
16774         case "$d_tmpnam_r_proto:$usethreads" in
16775         ":define")      d_tmpnam_r_proto=define
16776                 set d_tmpnam_r_proto tmpnam_r $hdrs
16777                 eval $hasproto ;;
16778         *)      ;;
16779         esac
16780         case "$d_tmpnam_r_proto" in
16781         define)
16782         case "$tmpnam_r_proto" in
16783         ''|0) try='char* tmpnam_r(char*);'
16784         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16785         esac
16786         case "$tmpnam_r_proto" in
16787         ''|0)   d_tmpnam_r=undef
16788                 tmpnam_r_proto=0
16789                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16790         * )     case "$tmpnam_r_proto" in
16791                 REENTRANT_PROTO*) ;;
16792                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16793                 esac
16794                 echo "Prototype: $try" ;;
16795         esac
16796         ;;
16797         *)      case "$usethreads" in
16798                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16799                 esac
16800                 d_tmpnam_r=undef
16801                 tmpnam_r_proto=0
16802                 ;;
16803         esac
16804         ;;
16805 *)      tmpnam_r_proto=0
16806         ;;
16807 esac
16808
16809 : see if truncate exists
16810 set truncate d_truncate
16811 eval $inlibc
16812
16813 : see if ttyname_r exists
16814 set ttyname_r d_ttyname_r
16815 eval $inlibc
16816 case "$d_ttyname_r" in
16817 "$define")
16818         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16819         case "$d_ttyname_r_proto:$usethreads" in
16820         ":define")      d_ttyname_r_proto=define
16821                 set d_ttyname_r_proto ttyname_r $hdrs
16822                 eval $hasproto ;;
16823         *)      ;;
16824         esac
16825         case "$d_ttyname_r_proto" in
16826         define)
16827         case "$ttyname_r_proto" in
16828         ''|0) try='int ttyname_r(int, char*, size_t);'
16829         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16830         esac
16831         case "$ttyname_r_proto" in
16832         ''|0) try='int ttyname_r(int, char*, int);'
16833         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16834         esac
16835         case "$ttyname_r_proto" in
16836         ''|0) try='char* ttyname_r(int, char*, int);'
16837         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16838         esac
16839         case "$ttyname_r_proto" in
16840         ''|0)   d_ttyname_r=undef
16841                 ttyname_r_proto=0
16842                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16843         * )     case "$ttyname_r_proto" in
16844                 REENTRANT_PROTO*) ;;
16845                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16846                 esac
16847                 echo "Prototype: $try" ;;
16848         esac
16849         ;;
16850         *)      case "$usethreads" in
16851                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16852                 esac
16853                 d_ttyname_r=undef
16854                 ttyname_r_proto=0
16855                 ;;
16856         esac
16857         ;;
16858 *)      ttyname_r_proto=0
16859         ;;
16860 esac
16861
16862 : see if tzname[] exists
16863 echo " "
16864 if set tzname val -a d_tzname; eval $csym; $val; then
16865         val="$define"
16866         echo 'tzname[] found.' >&4
16867 else
16868         val="$undef"
16869         echo 'tzname[] NOT found.' >&4
16870 fi
16871 set d_tzname
16872 eval $setvar
16873
16874 case "$osname" in
16875 next|rhapsody|darwin) multiarch="$define" ;;
16876 esac
16877 case "$multiarch" in
16878 ''|[nN]*) multiarch="$undef" ;;
16879 esac
16880
16881 : check for ordering of bytes in a UV
16882 echo " "
16883 case "$usecrosscompile$multiarch" in
16884 *$define*)
16885         $cat <<EOM
16886 You seem to be either cross-compiling or doing a multiarchitecture build,
16887 skipping the byteorder check.
16888
16889 EOM
16890         byteorder='ffff'
16891         ;;
16892 *)
16893         case "$byteorder" in
16894         '')
16895                 $cat <<'EOM'
16896 In the following, larger digits indicate more significance.  A big-endian
16897 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16898 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16899 machines may have weird orders like 3412.  A Cray will report 87654321,
16900 an Alpha will report 12345678. If the test program works the default is
16901 probably right.
16902 I'm now running the test program...
16903 EOM
16904                 $cat >try.c <<EOCP
16905 #include <stdio.h>
16906 #$i_stdlib I_STDLIB
16907 #ifdef I_STDLIB
16908 #include <stdlib.h>
16909 #endif
16910 #include <sys/types.h>
16911 typedef $uvtype UV;
16912 int main()
16913 {
16914         int i;
16915         union {
16916                 UV l;
16917                 char c[$uvsize];
16918         } u;
16919
16920         if ($uvsize > 4)
16921                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16922         else
16923                 u.l = (UV)0x04030201;
16924         for (i = 0; i < $uvsize; i++)
16925                 printf("%c", u.c[i]+'0');
16926         printf("\n");
16927         exit(0);
16928 }
16929 EOCP
16930                 xxx_prompt=y
16931                 set try
16932                 if eval $compile && ./try > /dev/null; then
16933                         dflt=`$run ./try`
16934                         case "$dflt" in
16935                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16936                                 echo "(The test program ran ok.)"
16937                                 echo "byteorder=$dflt"
16938                                 xxx_prompt=n
16939                         ;;
16940                         ????|????????) echo "(The test program ran ok.)" ;;
16941                         *) echo "(The test program didn't run right for some reason.)" ;;
16942                         esac
16943                 else
16944                         dflt='4321'
16945                         cat <<'EOM'
16946 (I can't seem to compile the test program.  Guessing big-endian...)
16947 EOM
16948                 fi
16949                 case "$xxx_prompt" in
16950                 y)
16951                         rp="What is the order of bytes in $uvtype?"
16952                         . ./myread
16953                         byteorder="$ans"
16954                         ;;
16955                 *)      byteorder=$dflt
16956                         ;;
16957                 esac
16958                 ;;
16959         esac
16960         $rm -f try.c try
16961         ;;
16962 esac
16963
16964
16965 $cat <<EOM
16966
16967 Checking to see whether you can access character data unalignedly...
16968 EOM
16969 case "$d_u32align" in
16970 '')   $cat >try.c <<EOCP
16971 #include <stdio.h>
16972 #$i_stdlib I_STDLIB
16973 #ifdef I_STDLIB
16974 #include <stdlib.h>
16975 #endif
16976 #define U32 $u32type
16977 #define BYTEORDER 0x$byteorder
16978 #define U8 $u8type
16979 #include <signal.h>
16980 #ifdef SIGBUS
16981 $signal_t bletch(s) int s; { exit(4); }
16982 #endif
16983 int main() {
16984 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16985     U8 buf[8];
16986     U32 *up;
16987     int i;
16988
16989     if (sizeof(U32) != 4) {
16990         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16991         exit(1);
16992     }
16993
16994     fflush(stdout);
16995
16996 #ifdef SIGBUS
16997     signal(SIGBUS, bletch);
16998 #endif
16999
17000     buf[0] = 0;
17001     buf[1] = 0;
17002     buf[2] = 0;
17003     buf[3] = 1;
17004     buf[4] = 0;
17005     buf[5] = 0;
17006     buf[6] = 0;
17007     buf[7] = 1;
17008
17009     for (i = 0; i < 4; i++) {
17010         up = (U32*)(buf + i);
17011         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17012                (*up == 1 << (8*(3-i)))  /* little-endian */
17013               )
17014            )
17015         {
17016             printf("read failed (%x)\n", *up);
17017             exit(2);
17018         }
17019     }
17020
17021     /* write test */
17022     for (i = 0; i < 4; i++) {
17023         up = (U32*)(buf + i);
17024         *up = 0xBeef;
17025         if (*up != 0xBeef) {
17026             printf("write failed (%x)\n", *up);
17027             exit(3);
17028         }
17029     }
17030
17031     exit(0);
17032 #else
17033     printf("1\n");
17034     exit(1);
17035 #endif
17036     return 0;
17037 }
17038 EOCP
17039 set try
17040 if eval $compile_ok; then
17041         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17042         $run ./try 2>&1 >/dev/null
17043         case "$?" in
17044         0)      cat >&4 <<EOM
17045 You can access character data pretty unalignedly.
17046 EOM
17047                 d_u32align="$undef"
17048                 ;;
17049         *)      cat >&4 <<EOM
17050 It seems that you must access character data in an aligned manner.
17051 EOM
17052                 d_u32align="$define"
17053                 ;;
17054         esac
17055 else
17056         rp='Can you access character data at unaligned addresses?'
17057         dflt='n'
17058         . ./myread
17059         case "$ans" in
17060         [yY]*)  d_u32align="$undef"  ;;
17061         *)      d_u32align="$define" ;;
17062         esac
17063 fi
17064 $rm -f core core.try.* try.core
17065 ;;
17066 esac
17067
17068 : see if ualarm exists
17069 set ualarm d_ualarm
17070 eval $inlibc
17071
17072 : see if umask exists
17073 set umask d_umask
17074 eval $inlibc
17075
17076 : see if unordered exists
17077 set unordered d_unordered
17078 eval $inlibc
17079
17080 : see if usleep exists
17081 set usleep d_usleep
17082 eval $inlibc
17083
17084 : see if prototype for usleep is available
17085 echo " "
17086 set d_usleepproto usleep $i_unistd unistd.h
17087 eval $hasproto
17088
17089 : see if ustat exists
17090 set ustat d_ustat
17091 eval $inlibc
17092
17093 : backward compatibility for d_hvfork
17094 if test X$d_hvfork != X; then
17095         d_vfork="$d_hvfork"
17096         d_hvfork=''
17097 fi
17098 : see if there is a vfork
17099 val=''
17100 set vfork val
17101 eval $inlibc
17102
17103 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17104 : perl on Solaris 2.x, and probably elsewhere.
17105 case "$val" in
17106 $define)
17107         echo " "
17108         case "$usevfork" in
17109         false) dflt='n';;
17110         *) dflt='y';;
17111         esac
17112         cat <<'EOM'
17113  
17114 Perl can only use a vfork() that doesn't suffer from strict
17115 restrictions on calling functions or modifying global data in
17116 the child.  For example, glibc-2.1 contains such a vfork()
17117 that is unsuitable.  If your system provides a proper fork()
17118 call, chances are that you do NOT want perl to use vfork().
17119
17120 EOM
17121         rp="Do you still want to use vfork()?"
17122         . ./myread
17123         case "$ans" in
17124         y|Y) ;;
17125         *)
17126                 echo "Ok, we won't use vfork()."
17127                 val="$undef"
17128                 ;;
17129         esac
17130         ;;
17131 esac
17132 set d_vfork
17133 eval $setvar
17134 case "$d_vfork" in
17135 $define) usevfork='true';;
17136 *) usevfork='false';;
17137 esac
17138
17139 : see if closedir exists
17140 set closedir d_closedir
17141 eval $inlibc
17142
17143 case "$d_closedir" in
17144 "$define")
17145         echo " "
17146         echo "Checking whether closedir() returns a status..." >&4
17147         cat > try.c <<EOM
17148 #$i_dirent I_DIRENT             /**/
17149 #$i_sysdir I_SYS_DIR            /**/
17150 #$i_sysndir I_SYS_NDIR          /**/
17151 #$i_systypes I_SYS_TYPES        /**/
17152
17153 #if defined(I_SYS_TYPES)
17154 #include <sys/types.h>
17155 #endif
17156 #if defined(I_DIRENT)
17157 #include <dirent.h>
17158 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17159 #include <sys/dir.h>
17160 #endif
17161 #else
17162 #ifdef I_SYS_NDIR
17163 #include <sys/ndir.h>
17164 #else
17165 #ifdef I_SYS_DIR
17166 #ifdef hp9000s500
17167 #include <ndir.h>       /* may be wrong in the future */
17168 #else
17169 #include <sys/dir.h>
17170 #endif
17171 #endif
17172 #endif
17173 #endif 
17174 int main() { return closedir(opendir(".")); }
17175 EOM
17176         set try
17177         if eval $compile_ok; then
17178                 if $run ./try > /dev/null 2>&1 ; then
17179                         echo "Yes, it does."
17180                         val="$undef"
17181                 else
17182                         echo "No, it doesn't."
17183                         val="$define"
17184                 fi
17185         else
17186                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17187                 val="$define"
17188         fi
17189         ;;
17190 *)
17191         val="$undef";
17192         ;;
17193 esac
17194 set d_void_closedir
17195 eval $setvar
17196 $rm -f try try.*
17197 : see if there is a wait4
17198 set wait4 d_wait4
17199 eval $inlibc
17200
17201 : see if waitpid exists
17202 set waitpid d_waitpid
17203 eval $inlibc
17204
17205 : see if wcstombs exists
17206 set wcstombs d_wcstombs
17207 eval $inlibc
17208
17209 : see if wctomb exists
17210 set wctomb d_wctomb
17211 eval $inlibc
17212
17213 : see if writev exists
17214 set writev d_writev
17215 eval $inlibc
17216
17217 : preserve RCS keywords in files with variable substitution, grrr
17218 Date='$Date'
17219 Id='$Id'
17220 Log='$Log'
17221 RCSfile='$RCSfile'
17222 Revision='$Revision'
17223
17224 : check for alignment requirements
17225 echo " "
17226 case "$usecrosscompile$multiarch" in
17227 *$define*)
17228         $cat <<EOM
17229 You seem to be either cross-compiling or doing a multiarchitecture build,
17230 skipping the memory alignment check.
17231
17232 EOM
17233         case "$alignbytes" in
17234         '') alignbytes=8 ;;
17235         esac
17236         ;;
17237 *)
17238         case "$alignbytes" in
17239         '') echo "Checking alignment constraints..." >&4
17240                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17241                         $cat >try.c <<'EOCP'
17242 typedef long double NV;
17243 EOCP
17244                 else
17245                         $cat >try.c <<'EOCP'
17246 typedef double NV;
17247 EOCP
17248                 fi
17249                 $cat >>try.c <<'EOCP'
17250 #include <stdio.h>
17251 struct foobar {
17252         char foo;
17253         NV bar;
17254 } try_algn;
17255 int main()
17256 {
17257     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17258     return(0);
17259 }
17260 EOCP
17261                 set try
17262                 if eval $compile_ok; then
17263                         dflt=`$run ./try`
17264                 else
17265                         dflt='8'
17266                         echo "(I can't seem to compile the test program...)"
17267                 fi
17268                 ;;
17269         *) dflt="$alignbytes"
17270                 ;;
17271         esac
17272         rp="Doubles must be aligned on a how-many-byte boundary?"
17273         . ./myread
17274         alignbytes="$ans"
17275         $rm -f try.c try
17276         ;;
17277 esac
17278
17279
17280 : set the base revision
17281 baserev=5.0
17282
17283 : how do we concatenate cpp tokens here?
17284 echo " "
17285 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17286 $cat >cpp_stuff.c <<'EOCP'
17287 #define RCAT(a,b)a/**/b
17288 #define ACAT(a,b)a ## b
17289 RCAT(Rei,ser)
17290 ACAT(Cir,cus)
17291 EOCP
17292 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17293 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17294         echo "Oh!  Smells like ANSI's been here." >&4
17295         echo "We can catify or stringify, separately or together!"
17296         cpp_stuff=42
17297 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17298         echo "Ah, yes!  The good old days!" >&4
17299         echo "However, in the good old days we don't know how to stringify and"
17300         echo "catify at the same time."
17301         cpp_stuff=1
17302 else
17303         $cat >&4 <<EOM
17304 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17305 You're going to have to edit the values of CAT[2-5] in config.h...
17306 EOM
17307         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17308 fi
17309 $rm -f cpp_stuff.*
17310
17311 : see if this is a db.h system
17312 set db.h i_db
17313 eval $inhdr
17314
17315 case "$i_db" in
17316 $define)
17317         : Check db version.
17318         echo " "
17319         echo "Checking Berkeley DB version ..." >&4
17320         $cat >try.c <<EOCP
17321 #$d_const HASCONST
17322 #ifndef HASCONST
17323 #define const
17324 #endif
17325 #include <sys/types.h>
17326 #include <stdio.h>
17327 #$i_stdlib I_STDLIB
17328 #ifdef I_STDLIB
17329 #include <stdlib.h>
17330 #endif
17331 #include <db.h>
17332 int main(int argc, char *argv[])
17333 {
17334 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17335     int Major, Minor, Patch ;
17336     unsigned long Version ;
17337     (void)db_version(&Major, &Minor, &Patch) ;
17338     if (argc == 2) {
17339         printf("%d %d %d %d %d %d\n",
17340                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17341                Major, Minor, Patch);
17342         exit(0);
17343     }
17344     printf("You have Berkeley DB Version 2 or greater.\n");
17345
17346     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17347                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17348     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17349                 Major, Minor, Patch) ;
17350
17351     /* check that db.h & libdb are compatible */
17352     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17353         printf("db.h and libdb are incompatible.\n") ;
17354         exit(3);        
17355     }
17356
17357     printf("db.h and libdb are compatible.\n") ;
17358
17359     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17360                 + DB_VERSION_PATCH ;
17361
17362     /* needs to be >= 2.3.4 */
17363     if (Version < 2003004) {
17364     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17365         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17366         exit(2);        
17367     }
17368
17369     exit(0);
17370 #else
17371 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17372     if (argc == 2) {
17373         printf("1 0 0\n");
17374         exit(0);
17375     }
17376     printf("You have Berkeley DB Version 1.\n");
17377     exit(0);    /* DB version < 2: the coast is clear. */
17378 #else
17379     exit(1);    /* <db.h> not Berkeley DB? */
17380 #endif
17381 #endif
17382 }
17383 EOCP
17384         set try
17385         if eval $compile_ok && $run ./try; then
17386                 echo 'Looks OK.' >&4
17387                 set `$run ./try 1`
17388                 db_version_major=$1
17389                 db_version_minor=$2
17390                 db_version_patch=$3
17391         else
17392                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17393                 i_db=$undef
17394                 case " $libs " in
17395                 *"-ldb "*)
17396                         : Remove db from list of libraries to use
17397                         echo "Removing unusable -ldb from library list" >&4
17398                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17399                         shift
17400                         libs="$*"
17401                         echo "libs = $libs" >&4
17402                         ;;
17403                 esac
17404         fi
17405         $rm -f try.*
17406         ;;
17407 esac
17408
17409 case "$i_db" in
17410 define)
17411         : Check the return type needed for hash 
17412         echo " "
17413         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17414         $cat >try.c <<EOCP
17415 #$d_const HASCONST
17416 #ifndef HASCONST
17417 #define const
17418 #endif
17419 #include <sys/types.h>
17420 #include <db.h>
17421
17422 #ifndef DB_VERSION_MAJOR
17423 u_int32_t hash_cb (ptr, size)
17424 const void *ptr;
17425 size_t size;
17426 {
17427 }
17428 HASHINFO info;
17429 int main()
17430 {
17431         info.hash = hash_cb;
17432 }
17433 #endif
17434 EOCP
17435         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17436                 if $contains warning try.out >>/dev/null 2>&1 ; then
17437                         db_hashtype='int'
17438                 else
17439                         db_hashtype='u_int32_t'
17440                 fi
17441         else
17442                 : XXX Maybe we should just give up here.
17443                 db_hashtype=u_int32_t
17444                 $cat try.out >&4
17445                 echo "Help:  I can't seem to compile the db test program." >&4
17446                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17447         fi
17448         $rm -f try.*
17449         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17450         ;;
17451 *)      db_hashtype=u_int32_t
17452         ;;
17453 esac
17454 case "$i_db" in
17455 define)
17456         : Check the return type needed for prefix 
17457         echo " "
17458         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17459         cat >try.c <<EOCP
17460 #$d_const HASCONST
17461 #ifndef HASCONST
17462 #define const
17463 #endif
17464 #include <sys/types.h>
17465 #include <db.h>
17466
17467 #ifndef DB_VERSION_MAJOR
17468 size_t prefix_cb (key1, key2)
17469 const DBT *key1;
17470 const DBT *key2;
17471 {
17472 }
17473 BTREEINFO info;
17474 int main()
17475 {
17476         info.prefix = prefix_cb;
17477 }
17478 #endif
17479 EOCP
17480         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17481                 if $contains warning try.out >>/dev/null 2>&1 ; then
17482                         db_prefixtype='int'
17483                 else
17484                         db_prefixtype='size_t'
17485                 fi
17486         else
17487                 db_prefixtype='size_t'
17488                 : XXX Maybe we should just give up here.
17489                 $cat try.out >&4
17490                 echo "Help:  I can't seem to compile the db test program." >&4
17491                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17492         fi
17493         $rm -f try.*
17494         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17495         ;;
17496 *)      db_prefixtype='size_t'
17497         ;;
17498 esac
17499
17500
17501 : How can we generate normalized random numbers ?
17502 echo " "
17503 echo "Looking for a random number function..." >&4
17504 case "$randfunc" in
17505 '')
17506         if set drand48 val -f; eval $csym; $val; then
17507                 dflt="drand48"
17508                 echo "Good, found drand48()." >&4
17509         elif set random val -f; eval $csym; $val; then
17510                 dflt="random"
17511                 echo "OK, found random()." >&4
17512         else
17513                 dflt="rand"
17514                 echo "Yick, looks like I have to use rand()." >&4
17515         fi
17516         echo " "
17517         ;;
17518 *)
17519         dflt="$randfunc"
17520         ;;
17521 esac
17522 cont=true
17523
17524 case "$ccflags" in
17525 *-Dmy_rand=*|*-Dmy_srand=*)
17526         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17527         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17528         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17529         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17530         ;;
17531 esac
17532
17533 while $test "$cont"; do
17534         rp="Use which function to generate random numbers?"
17535         . ./myread
17536         if $test "$ans" = "$dflt"; then
17537                 : null
17538         else
17539                 randbits=''
17540         fi
17541         randfunc="$ans"
17542         if set $ans val -f; eval $csym; $val; then
17543                 cont=''
17544         else
17545                 dflt=y
17546                 rp="I cannot find function $ans. Use that name anyway?"
17547                 . ./myread
17548                 dflt=rand
17549                 case "$ans" in
17550                         [yY]*) cont='';;
17551                 esac
17552         fi
17553         case "$cont" in
17554         '')
17555                 case "$randfunc" in
17556                 drand48)
17557                         drand01="drand48()"
17558                         seedfunc="srand48"
17559                         randbits=48
17560                         randseedtype=long
17561                         ;;
17562                 rand|random)
17563                         case "$randbits" in
17564                         '')
17565 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17566                                 $cat >try.c <<EOCP
17567 #$i_unistd I_UNISTD
17568 #$i_stdlib I_STDLIB
17569 #include <stdio.h>
17570 #ifdef I_UNISTD
17571 #  include <unistd.h>
17572 #endif
17573 #ifdef I_STDLIB
17574 #  include <stdlib.h>
17575 #endif
17576 int main()
17577 {
17578         register int i;
17579         register unsigned long tmp;
17580         register unsigned long max = 0L;
17581
17582         for (i = 1000; i; i--) {
17583                 tmp = (unsigned long) $randfunc();
17584                 if (tmp > max) max = tmp;
17585         }
17586         for (i = 0; max; i++)
17587                 max /= 2;
17588         printf("%d\n",i);
17589 }
17590 EOCP
17591                                 set try
17592                                 if eval $compile_ok; then
17593                                         dflt=`try`
17594                                 else
17595                                         dflt='?'
17596                                         echo "(I can't seem to compile the test program...)"
17597                                 fi
17598                                 ;;
17599                         *)
17600                                 dflt="$randbits"
17601                                 ;;
17602                         esac
17603                         rp="How many bits does your $randfunc() function produce?"
17604                         . ./myread
17605                         randbits="$ans"
17606                         $rm -f try.c try
17607                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17608                         seedfunc="s$randfunc"
17609                         randseedtype=unsigned
17610                         ;;
17611                 *)
17612                         dflt="31"
17613                         rp="How many bits does your $randfunc() function produce?"
17614                         . ./myread
17615                         randbits="$ans"
17616                         seedfunc="s$randfunc"
17617                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17618                         if set $seedfunc val -f; eval $csym; $val; then
17619                                 echo "(Using $seedfunc() to seed random generator)"
17620                         else
17621                                 echo "(Warning: no $seedfunc() to seed random generator)"
17622                                 seedfunc=rand
17623                         fi
17624                         randseedtype=unsigned
17625                         ;;
17626                 esac
17627                 ;;
17628         esac
17629 done
17630
17631 echo " "
17632 echo "Determining whether or not we are on an EBCDIC system..." >&4
17633 $cat >try.c <<'EOM'
17634 int main()
17635 {
17636   if ('M'==0xd4) return 0;
17637   return 1;
17638 }
17639 EOM
17640
17641 val=$undef
17642 set try
17643 if eval $compile_ok; then
17644         if $run ./try; then
17645                 echo "You seem to speak EBCDIC." >&4
17646                 val="$define"
17647         else
17648                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17649         fi
17650 else
17651         echo "I'm unable to compile the test program." >&4
17652         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17653 fi
17654 $rm -f try try.*
17655 set ebcdic
17656 eval $setvar
17657
17658 echo " "
17659 $cat >&4 <<EOM
17660 Checking how to flush all pending stdio output...
17661 EOM
17662 # I only know how to find the first 32 possibly open files on SunOS.
17663 # See also hints/sunos_4_1.sh and util.c  --AD
17664 case "$osname" in
17665 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17666 esac
17667 $cat >>try.c <<EOCP
17668 #include <stdio.h>
17669 #$i_stdlib I_STDLIB
17670 #ifdef I_STDLIB
17671 #include <stdlib.h>
17672 #endif
17673 #$i_unistd I_UNISTD
17674 #ifdef I_UNISTD
17675 # include <unistd.h>
17676 #endif
17677 #$d_sysconf HAS_SYSCONF
17678 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17679 #ifdef HAS_STDIO_STREAM_ARRAY
17680 # define STDIO_STREAM_ARRAY $stdio_stream_array
17681 #endif
17682 int main() {
17683   FILE* p;
17684   unlink("try.out");
17685   p = fopen("try.out", "w");
17686 #ifdef TRY_FPUTC
17687   fputc('x', p);
17688 #else
17689 # ifdef TRY_FPRINTF
17690   fprintf(p, "x");
17691 # endif
17692 #endif
17693 #ifdef TRY_FFLUSH_NULL
17694   fflush(NULL);
17695 #endif
17696 #ifdef TRY_FFLUSH_ALL
17697   {
17698     long open_max = -1;
17699 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17700     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17701 # else
17702 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17703     open_max = sysconf(_SC_OPEN_MAX);
17704 #  else
17705 #   ifdef FOPEN_MAX
17706     open_max = FOPEN_MAX;
17707 #   else
17708 #    ifdef OPEN_MAX
17709     open_max = OPEN_MAX;
17710 #    else
17711 #     ifdef _NFILE
17712     open_max = _NFILE;
17713 #     endif
17714 #    endif
17715 #   endif
17716 #  endif
17717 # endif 
17718 # ifdef HAS_STDIO_STREAM_ARRAY
17719     if (open_max > 0) {
17720       long i;
17721       for (i = 0; i < open_max; i++)
17722             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17723                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17724                 STDIO_STREAM_ARRAY[i]._flag)
17725                 fflush(&STDIO_STREAM_ARRAY[i]);
17726     }   
17727   }
17728 # endif
17729 #endif
17730   _exit(42);
17731 }
17732 EOCP
17733 : first we have to find out how _not_ to flush
17734 $to try.c
17735 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17736     output=''
17737     set try -DTRY_FPUTC
17738     if eval $compile; then
17739             $run ./try 2>/dev/null
17740             code="$?"
17741             $from try.out
17742             if $test ! -s try.out -a "X$code" = X42; then
17743                 output=-DTRY_FPUTC
17744             fi
17745     fi
17746     case "$output" in
17747     '')
17748             set try -DTRY_FPRINTF
17749             if eval $compile; then
17750                     $run ./try 2>/dev/null
17751                     code="$?"
17752                     $from try.out
17753                     if $test ! -s try.out -a "X$code" = X42; then
17754                         output=-DTRY_FPRINTF
17755                     fi
17756             fi
17757         ;;
17758     esac
17759 fi
17760 : check for fflush NULL behaviour
17761 case "$fflushNULL" in
17762 '')     set try -DTRY_FFLUSH_NULL $output
17763         if eval $compile; then
17764                 $run ./try 2>/dev/null
17765                 code="$?"
17766                 $from try.out
17767                 if $test -s try.out -a "X$code" = X42; then
17768                         fflushNULL="`$cat try.out`"
17769                 else
17770                         if $test "X$code" != X42; then
17771                                 $cat >&4 <<EOM
17772 (If this test failed, don't worry, we'll try another method shortly.)
17773 EOM
17774                         fi
17775                 fi
17776         fi
17777         $rm -f core try.core core.try.*
17778         case "$fflushNULL" in
17779         x)      $cat >&4 <<EOM
17780 Your fflush(NULL) works okay for output streams.
17781 Let's see if it clobbers input pipes...
17782 EOM
17783 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17784 # bug that improperly flushes the input end of pipes.  So we avoid the
17785 # autoflush on fork/system/exec support for now. :-(
17786 $cat >tryp.c <<EOCP
17787 #include <stdio.h>
17788 int
17789 main(int argc, char **argv)
17790 {
17791     char buf[1024];
17792     int i;
17793     char *bp = buf;
17794     while (1) {
17795         while ((i = getc(stdin)) != -1
17796                && (*bp++ = i) != '\n'
17797                && bp < &buf[1024])
17798         /* DO NOTHING */ ;
17799         *bp = '\0';
17800         fprintf(stdout, "%s", buf);
17801         fflush(NULL);
17802         if (i == -1)
17803             return 0;
17804         bp = buf;
17805     }
17806 }
17807 EOCP
17808                 fflushNULL="$define"
17809                 set tryp
17810                 if eval $compile; then
17811                     $rm -f tryp.out
17812                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17813                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17814                        $cat >&4 <<EOM
17815 fflush(NULL) seems to behave okay with input streams.
17816 EOM
17817                         fflushNULL="$define"
17818                     else
17819                         $cat >&4 <<EOM
17820 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17821 EOM
17822                         fflushNULL="$undef"
17823                     fi
17824                 fi
17825                 $rm -f core tryp.c tryp.core core.tryp.*
17826                 ;;
17827         '')     $cat >&4 <<EOM
17828 Your fflush(NULL) isn't working (contrary to ANSI C).
17829 EOM
17830                 fflushNULL="$undef"
17831                 ;;
17832         *)      $cat >&4 <<EOM
17833 Cannot figure out whether your fflush(NULL) works or not.
17834 I'm assuming it doesn't (contrary to ANSI C).
17835 EOM
17836                 fflushNULL="$undef"
17837                 ;;
17838         esac
17839         ;;
17840 $define|true|[yY]*)
17841         fflushNULL="$define"
17842         ;;
17843 *)
17844         fflushNULL="$undef"
17845         ;;
17846 esac
17847 : check explicit looping only if NULL did not work, and if the pipe
17848 : bug does not show up on an explicit flush too
17849 case "$fflushNULL" in
17850 "$undef")
17851         $cat >tryp.c <<EOCP
17852 #include <stdio.h>
17853 int
17854 main(int argc, char **argv)
17855 {
17856     char buf[1024];
17857     int i;
17858     char *bp = buf;
17859     while (1) {
17860         while ((i = getc(stdin)) != -1
17861                && (*bp++ = i) != '\n'
17862                && bp < &buf[1024])
17863         /* DO NOTHING */ ;
17864         *bp = '\0';
17865         fprintf(stdout, "%s", buf);
17866         fflush(stdin);
17867         if (i == -1)
17868             return 0;
17869         bp = buf;
17870     }
17871 }
17872 EOCP
17873         set tryp
17874         if eval $compile; then
17875             $rm -f tryp.out
17876             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17877             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17878                $cat >&4 <<EOM
17879 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17880 EOM
17881                 : now check for fflushall behaviour
17882                 case "$fflushall" in
17883                 '')     set try -DTRY_FFLUSH_ALL $output
17884                         if eval $compile; then
17885                                 $cat >&4 <<EOM
17886 (Now testing the other method--but note that this also may fail.)
17887 EOM
17888                                 $run ./try 2>/dev/null
17889                                 code=$?
17890                                 $from try.out
17891                                 if $test -s try.out -a "X$code" = X42; then
17892                                         fflushall="`$cat try.out`"
17893                                 fi
17894                         fi
17895                         $rm -f core try.core core.try.*
17896                         case "$fflushall" in
17897                         x)      $cat >&4 <<EOM
17898 Whew. Flushing explicitly all the stdio streams works.
17899 EOM
17900                                 fflushall="$define"
17901                                 ;;
17902                         '')     $cat >&4 <<EOM
17903 Sigh. Flushing explicitly all the stdio streams doesn't work.
17904 EOM
17905                                 fflushall="$undef"
17906                                 ;;
17907                         *)      $cat >&4 <<EOM
17908 Cannot figure out whether flushing stdio streams explicitly works or not.
17909 I'm assuming it doesn't.
17910 EOM
17911                                 fflushall="$undef"
17912                                 ;;
17913                         esac
17914                         ;;
17915                 "$define"|true|[yY]*)
17916                         fflushall="$define"
17917                         ;;
17918                 *)
17919                         fflushall="$undef"
17920                         ;;
17921                 esac
17922             else
17923                 $cat >&4 <<EOM
17924 All is futile.  Even fflush(stdin) clobbers input pipes!
17925 EOM
17926                 fflushall="$undef"
17927             fi
17928         else
17929             fflushall="$undef"
17930         fi
17931         $rm -f core tryp.c tryp.core core.tryp.*
17932         ;;
17933 *)      fflushall="$undef"
17934         ;;
17935 esac
17936
17937 case "$fflushNULL$fflushall" in
17938 undefundef)
17939         $cat <<EOM
17940 OK, I give up.  I cannot figure out how to flush pending stdio output.
17941 We won't be flushing handles at all before fork/exec/popen.
17942 EOM
17943         ;;
17944 esac
17945 $rm -f try.* try$exe_ext
17946
17947 : Store the full pathname to the ar program for use in the C program
17948 : Respect a hint or command line value for full_ar.
17949 case "$full_ar" in
17950 '') full_ar=$ar ;;
17951 esac
17952
17953 : Store the full pathname to the sed program for use in the C program
17954 full_sed=$sed
17955
17956 : see what type gids are declared as in the kernel
17957 echo " "
17958 echo "Looking for the type for group ids returned by getgid()."
17959 set gid_t gidtype xxx stdio.h sys/types.h
17960 eval $typedef
17961 case "$gidtype" in
17962 xxx)
17963         xxx=`./findhdr sys/user.h`
17964         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17965         case $1 in
17966         unsigned) dflt="$1 $2" ;;
17967         *) dflt="$1" ;;
17968         esac
17969         ;;
17970 *) dflt="$gidtype";;
17971 esac
17972 case "$gidtype" in
17973 gid_t) echo "gid_t found." ;;
17974 *)      rp="What is the type for group ids returned by getgid()?"
17975         . ./myread
17976         gidtype="$ans"
17977         ;;
17978 esac
17979
17980 echo " "
17981 case "$gidtype" in
17982 *_t) zzz="$gidtype"     ;;
17983 *)   zzz="gid"          ;;
17984 esac
17985 echo "Checking the size of $zzz..." >&4 
17986 cat > try.c <<EOCP
17987 #include <sys/types.h>
17988 #include <stdio.h>
17989 #$i_stdlib I_STDLIB
17990 #ifdef I_STDLIB
17991 #include <stdlib.h>
17992 #endif
17993 int main() {
17994     printf("%d\n", (int)sizeof($gidtype));
17995     exit(0);
17996 }
17997 EOCP
17998 set try
17999 if eval $compile_ok; then
18000         yyy=`$run ./try`
18001         case "$yyy" in
18002         '')     gidsize=4
18003                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18004                 ;;
18005         *)      gidsize=$yyy
18006                 echo "Your $zzz is $gidsize bytes long."
18007                 ;;
18008         esac
18009 else
18010         gidsize=4
18011         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18012 fi
18013
18014
18015 echo " "
18016 case "$gidtype" in
18017 *_t) zzz="$gidtype"     ;;
18018 *)   zzz="gid"          ;;
18019 esac
18020 echo "Checking the sign of $zzz..." >&4 
18021 cat > try.c <<EOCP
18022 #include <sys/types.h>
18023 #include <stdio.h>
18024 int main() {
18025         $gidtype foo = -1;
18026         if (foo < 0)
18027                 printf("-1\n");
18028         else
18029                 printf("1\n");
18030 }
18031 EOCP
18032 set try
18033 if eval $compile; then
18034         yyy=`$run ./try`
18035         case "$yyy" in
18036         '')     gidsign=1
18037                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18038                 ;;
18039         *)      gidsign=$yyy
18040                 case "$gidsign" in
18041                  1) echo "Your $zzz is unsigned." ;;
18042                 -1) echo "Your $zzz is signed."   ;;
18043                 esac
18044                 ;;
18045         esac
18046 else
18047         gidsign=1
18048         echo "(I can't compile the test program--guessing unsigned.)" >&4
18049 fi
18050
18051
18052 echo " "
18053
18054 if $test X"$quadtype" != X; then
18055
18056 echo "Checking how to print 64-bit integers..." >&4
18057
18058 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18059         $cat >try.c <<'EOCP'
18060 #include <sys/types.h>
18061 #include <stdio.h>
18062 int main() {
18063   int q = 12345678901;
18064   printf("%ld\n", q);
18065 }
18066 EOCP
18067         set try
18068         if eval $compile; then
18069                 yyy=`$run ./try`
18070                 case "$yyy" in
18071                 12345678901)
18072                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18073                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18074                         echo "We will use %d."
18075                         ;;
18076                 esac
18077         fi
18078 fi
18079
18080 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18081         $cat >try.c <<'EOCP'
18082 #include <sys/types.h>
18083 #include <stdio.h>
18084 int main() {
18085   long q = 12345678901;
18086   printf("%ld\n", q);
18087 }
18088 EOCP
18089         set try
18090         if eval $compile; then
18091                 yyy=`$run ./try`
18092                 case "$yyy" in
18093                 12345678901)
18094                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18095                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18096                         echo "We will use %ld."
18097                         ;;
18098                 esac
18099         fi
18100 fi
18101
18102 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18103         $cat >try.c <<'EOCP'
18104 #include <sys/types.h>
18105 #include <inttypes.h>
18106 #include <stdio.h>
18107 int main() {
18108   int64_t q = 12345678901;
18109   printf("%" PRId64 "\n", q);
18110 }
18111 EOCP
18112         set try
18113         if eval $compile; then
18114                 yyy=`$run ./try`
18115                 case "$yyy" in
18116                 12345678901)
18117                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18118                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18119                         echo "We will use the C9X style."
18120                         ;;
18121                 esac
18122         fi
18123 fi
18124
18125 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18126         $cat >try.c <<EOCP
18127 #include <sys/types.h>
18128 #include <stdio.h>
18129 int main() {
18130   $quadtype q = 12345678901;
18131   printf("%Ld\n", q);
18132 }
18133 EOCP
18134         set try
18135         if eval $compile; then
18136                 yyy=`$run ./try`
18137                 case "$yyy" in
18138                 12345678901)
18139                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18140                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18141                         echo "We will use %Ld."
18142                         ;;
18143                 esac
18144         fi
18145 fi
18146
18147 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18148         $cat >try.c <<'EOCP'
18149 #include <sys/types.h>
18150 #include <stdio.h>
18151 int main() {
18152   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18153   printf("%lld\n", q);
18154 }
18155 EOCP
18156         set try
18157         if eval $compile; then
18158                 yyy=`$run ./try`
18159                 case "$yyy" in
18160                 12345678901)
18161                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18162                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18163                         echo "We will use the %lld style."
18164                         ;;
18165                 esac
18166         fi
18167 fi
18168
18169 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18170         $cat >try.c <<EOCP
18171 #include <sys/types.h>
18172 #include <stdio.h>
18173 int main() {
18174   $quadtype q = 12345678901;
18175   printf("%qd\n", q);
18176 }
18177 EOCP
18178         set try
18179         if eval $compile; then
18180                 yyy=`$run ./try`
18181                 case "$yyy" in
18182                 12345678901)
18183                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18184                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18185                         echo "We will use %qd."
18186                         ;;
18187                 esac
18188         fi
18189 fi
18190
18191 if $test X"$sPRId64" = X; then
18192         echo "Cannot figure out how to print 64-bit integers." >&4
18193 fi
18194
18195 $rm -f try try.*
18196
18197 fi
18198
18199 case "$sPRId64" in
18200 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18201         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18202         ;;
18203 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18204         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18205         ;;
18206 esac
18207
18208
18209 echo " "
18210 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18211
18212 if $test X"$ivsize" = X8; then
18213         ivdformat="$sPRId64"
18214         uvuformat="$sPRIu64"
18215         uvoformat="$sPRIo64"
18216         uvxformat="$sPRIx64"
18217         uvXUformat="$sPRIXU64"
18218 else
18219         if $test X"$ivsize" = X"$longsize"; then
18220                 ivdformat='"ld"'
18221                 uvuformat='"lu"'
18222                 uvoformat='"lo"'
18223                 uvxformat='"lx"'
18224                 uvXUformat='"lX"'
18225         else
18226                 if $test X"$ivsize" = X"$intsize"; then
18227                         ivdformat='"d"'
18228                         uvuformat='"u"'
18229                         uvoformat='"o"'
18230                         uvxformat='"x"'
18231                         uvXUformat='"X"'
18232                 else
18233                         : far out
18234                         if $test X"$ivsize" = X"$shortsize"; then
18235                                 ivdformat='"hd"'
18236                                 uvuformat='"hu"'
18237                                 uvoformat='"ho"'
18238                                 uvxformat='"hx"'
18239                                 uvXUformat='"hX"'
18240                         fi
18241                 fi
18242         fi
18243 fi
18244
18245 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18246         nveformat="$sPRIeldbl"
18247         nvfformat="$sPRIfldbl"
18248         nvgformat="$sPRIgldbl"
18249         nvEUformat="$sPRIEUldbl"
18250         nvFUformat="$sPRIFUldbl"
18251         nvGUformat="$sPRIGUldbl"
18252 else
18253         nveformat='"e"'
18254         nvfformat='"f"'
18255         nvgformat='"g"'
18256         nvEUformat='"E"'
18257         nvFUformat='"F"'
18258         nvGUformat='"G"'
18259 fi
18260
18261 case "$ivdformat" in
18262 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18263     exit 1
18264     ;;
18265 esac
18266
18267
18268 echo " "
18269 $echo "Checking the format string to be used for gids..." >&4
18270
18271 case "$gidsign" in
18272 -1)     if $test X"$gidsize" = X"$ivsize"; then
18273                 gidformat="$ivdformat"
18274         else
18275                 if $test X"$gidsize" = X"$longsize"; then
18276                         gidformat='"ld"'
18277                 else
18278                         if $test X"$gidsize" = X"$intsize"; then
18279                                 gidformat='"d"'
18280                         else
18281                                 if $test X"$gidsize" = X"$shortsize"; then
18282                                         gidformat='"hd"'
18283                                 fi
18284                         fi
18285                 fi
18286         fi
18287         ;;
18288 *)      if $test X"$gidsize" = X"$uvsize"; then
18289                 gidformat="$uvuformat"
18290         else
18291                 if $test X"$gidsize" = X"$longsize"; then
18292                         gidformat='"lu"'
18293                 else
18294                         if $test X"$gidsize" = X"$intsize"; then
18295                                 gidformat='"u"'
18296                         else
18297                                 if $test X"$gidsize" = X"$shortsize"; then
18298                                         gidformat='"hu"'
18299                                 fi
18300                         fi
18301                 fi
18302         fi
18303         ;;
18304 esac
18305
18306 : see if getgroups exists
18307 set getgroups d_getgrps
18308 eval $inlibc
18309
18310 : see if setgroups exists
18311 set setgroups d_setgrps
18312 eval $inlibc
18313
18314
18315 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18316 echo " "
18317 case "$d_getgrps$d_setgrps" in
18318 *define*)
18319         case "$groupstype" in
18320         '') dflt="$gidtype" ;;
18321         *)  dflt="$groupstype" ;;
18322         esac
18323         $cat <<EOM
18324 What type of pointer is the second argument to getgroups() and setgroups()?
18325 Usually this is the same as group ids, $gidtype, but not always.
18326
18327 EOM
18328         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18329         . ./myread
18330         groupstype="$ans"
18331         ;;
18332 *)  groupstype="$gidtype";;
18333 esac
18334
18335 echo " "
18336 echo "Checking if your $make program sets \$(MAKE)..." >&4
18337 case "$make_set_make" in
18338 '')
18339         $sed 's/^X //' > testmake.mak << 'EOF'
18340 Xall:
18341 X       @echo 'maketemp="$(MAKE)"'
18342 EOF
18343         case "`$make -f testmake.mak 2>/dev/null`" in
18344         *maketemp=*) make_set_make='#' ;;
18345         *)      make_set_make="MAKE=$make" ;;
18346         esac
18347         $rm -f testmake.mak
18348         ;;
18349 esac
18350 case "$make_set_make" in
18351 '#') echo "Yup, it does.";;
18352 *) echo "Nope, it doesn't.";;
18353 esac
18354
18355 : see what type is used for mode_t
18356 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18357 set mode_t modetype int stdio.h sys/types.h
18358 eval $typedef_ask
18359
18360 : see if stdarg is available
18361 echo " "
18362 if $test `./findhdr stdarg.h`; then
18363         echo "<stdarg.h> found." >&4
18364         valstd="$define"
18365 else
18366         echo "<stdarg.h> NOT found." >&4
18367         valstd="$undef"
18368 fi
18369
18370 : see if varags is available
18371 echo " "
18372 if $test `./findhdr varargs.h`; then
18373         echo "<varargs.h> found." >&4
18374 else
18375         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18376 fi
18377
18378 : set up the varargs testing programs
18379 $cat > varargs.c <<EOP
18380 #ifdef I_STDARG
18381 #include <stdarg.h>
18382 #endif
18383 #ifdef I_VARARGS
18384 #include <varargs.h>
18385 #endif
18386
18387 #ifdef I_STDARG
18388 int f(char *p, ...)
18389 #else
18390 int f(va_alist)
18391 va_dcl
18392 #endif
18393 {
18394         va_list ap;
18395 #ifndef I_STDARG
18396         char *p;
18397 #endif
18398 #ifdef I_STDARG
18399         va_start(ap,p);
18400 #else
18401         va_start(ap);
18402         p = va_arg(ap, char *);
18403 #endif
18404         va_end(ap);
18405 }
18406 EOP
18407 $cat > varargs <<EOP
18408 $startsh
18409 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18410         echo "true"
18411 else
18412         echo "false"
18413 fi
18414 $rm -f varargs$_o
18415 EOP
18416 chmod +x varargs
18417
18418 : now check which varargs header should be included
18419 echo " "
18420 i_varhdr=''
18421 case "$valstd" in
18422 "$define")
18423         if `./varargs I_STDARG`; then
18424                 val='stdarg.h'
18425         elif `./varargs I_VARARGS`; then
18426                 val='varargs.h'
18427         fi
18428         ;;
18429 *)
18430         if `./varargs I_VARARGS`; then
18431                 val='varargs.h'
18432         fi
18433         ;;
18434 esac
18435 case "$val" in
18436 '')
18437 echo "I could not find the definition for va_dcl... You have problems..." >&4
18438         val="$undef"; set i_stdarg; eval $setvar
18439         val="$undef"; set i_varargs; eval $setvar
18440         ;;
18441 *) 
18442         set i_varhdr
18443         eval $setvar
18444         case "$i_varhdr" in
18445         stdarg.h)
18446                 val="$define"; set i_stdarg; eval $setvar
18447                 val="$undef"; set i_varargs; eval $setvar
18448                 ;;
18449         varargs.h)
18450                 val="$undef"; set i_stdarg; eval $setvar
18451                 val="$define"; set i_varargs; eval $setvar
18452                 ;;
18453         esac
18454         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18455 esac
18456 $rm -f varargs*
18457
18458 : see if we need va_copy
18459 echo " "
18460 case "$i_stdarg" in
18461 "$define")
18462         $cat >try.c <<EOCP
18463 #include <stdarg.h>
18464 #include <stdio.h>
18465 #$i_stdlib I_STDLIB
18466 #ifdef I_STDLIB
18467 #include <stdlib.h>
18468 #endif
18469 #include <signal.h>
18470
18471 int
18472 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18473 {
18474   return vfprintf(f, fmt, *valp);
18475 }
18476  
18477 int    
18478 myvfprintf(FILE *f, const  char *fmt, va_list val)
18479 {
18480   return ivfprintf(f, fmt, &val);
18481 }
18482       
18483 int
18484 myprintf(char *fmt, ...) 
18485 {
18486   va_list val;
18487   va_start(val, fmt);
18488   return myvfprintf(stdout, fmt, val); 
18489 }         
18490
18491 int
18492 main(int ac, char **av)
18493 {
18494   signal(SIGSEGV, exit);
18495
18496   myprintf("%s%cs all right, then\n", "that", '\'');                            
18497   exit(0);      
18498 }
18499 EOCP
18500         set try
18501         if eval $compile && $run ./try 2>&1 >/dev/null; then
18502                 case "`$run ./try`" in
18503                 "that's all right, then")
18504                         okay=yes
18505                         ;;
18506                 esac
18507         fi
18508         case "$okay" in
18509         yes)    echo "It seems that you don't need va_copy()." >&4
18510                 need_va_copy="$undef"
18511                 ;;
18512         *)      echo "It seems that va_copy() or similar will be needed." >&4
18513                 need_va_copy="$define"
18514                 ;;
18515         esac
18516         $rm -f try.* core core.* *.core *.core.*
18517         ;;
18518 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18519         ;;
18520 esac
18521
18522 : see what type is used for size_t
18523 rp="What is the type used for the length parameter for string functions?"
18524 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18525 eval $typedef_ask
18526
18527 : check for type of arguments to gethostbyaddr. 
18528 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18529         case "$d_gethbyaddr" in
18530         $define)
18531                 $cat <<EOM
18532
18533 Checking to see what type of arguments are accepted by gethostbyaddr().
18534 EOM
18535                 hdrs="$define sys/types.h
18536                         $d_socket sys/socket.h 
18537                         $i_niin netinet/in.h 
18538                         $i_netdb netdb.h
18539                         $i_unistd unistd.h"
18540                 : The first arg can 'char *' or 'void *'
18541                 : The second arg is some of integral type
18542                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18543                         for yyy in size_t long int; do
18544                                 case "$netdb_host_type" in
18545                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18546                                         if ./protochk "$try" $hdrs; then
18547                                                 echo "Your system accepts $xxx for the first arg."
18548                                                 echo "...and $yyy for the second arg."
18549                                                 netdb_host_type="$xxx"
18550                                                 netdb_hlen_type="$yyy"
18551                                         fi
18552                                         ;;
18553                                 esac
18554                         done
18555                 done
18556                 : In case none of those worked, prompt the user.
18557                 case "$netdb_host_type" in
18558                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18559                         dflt='char *'
18560                         . ./myread
18561                         netdb_host_type=$ans
18562                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18563                         dflt="$sizetype"
18564                         . ./myread
18565                         netdb_hlen_type=$ans
18566                         ;;
18567                 esac
18568                 ;;
18569         *)      : no gethostbyaddr, so pick harmless defaults
18570                 netdb_host_type='char *'
18571                 netdb_hlen_type="$sizetype"
18572                 ;;
18573         esac
18574         # Remove the "const" if needed. -- but then we'll have a 
18575         # prototype clash!
18576         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18577 fi
18578
18579 : check for type of argument to gethostbyname. 
18580 if test "X$netdb_name_type" = X ; then
18581         case "$d_gethbyname" in
18582         $define)
18583                 $cat <<EOM
18584
18585 Checking to see what type of argument is accepted by gethostbyname().
18586 EOM
18587                 hdrs="$define sys/types.h
18588                         $d_socket sys/socket.h 
18589                         $i_niin netinet/in.h 
18590                         $i_netdb netdb.h
18591                         $i_unistd unistd.h"
18592                 for xxx in "const char *" "char *"; do
18593                         case "$netdb_name_type" in
18594                         '')     try="extern struct hostent *gethostbyname($xxx);"
18595                                 if ./protochk "$try" $hdrs; then
18596                                         echo "Your system accepts $xxx."
18597                                         netdb_name_type="$xxx"
18598                                 fi
18599                                 ;;
18600                         esac
18601                 done
18602                 : In case none of those worked, prompt the user.
18603                 case "$netdb_name_type" in
18604                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18605                         dflt='char *'
18606                         . ./myread
18607                         netdb_name_type=$ans
18608                         ;;
18609                 esac
18610                 ;;
18611         *)      : no gethostbyname, so pick harmless default
18612                 netdb_name_type='char *'
18613                 ;;
18614         esac
18615 fi
18616
18617 : check for type of 1st argument to getnetbyaddr. 
18618 if test "X$netdb_net_type" = X ; then
18619         case "$d_getnbyaddr" in
18620         $define)
18621                 $cat <<EOM
18622
18623 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18624 EOM
18625                 hdrs="$define sys/types.h
18626                         $d_socket sys/socket.h 
18627                         $i_niin netinet/in.h 
18628                         $i_netdb netdb.h
18629                         $i_unistd unistd.h"
18630                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18631                         case "$netdb_net_type" in
18632                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18633                                 if ./protochk "$try" $hdrs; then
18634                                         echo "Your system accepts $xxx."
18635                                         netdb_net_type="$xxx"
18636                                 fi
18637                                 ;;
18638                         esac
18639                 done
18640                 : In case none of those worked, prompt the user.
18641                 case "$netdb_net_type" in
18642                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18643                         dflt='long'
18644                         . ./myread
18645                         netdb_net_type=$ans
18646                         ;;
18647                 esac
18648                 ;;
18649         *)      : no getnetbyaddr, so pick harmless default
18650                 netdb_net_type='long'
18651                 ;;
18652         esac
18653 fi
18654 : locate the preferred pager for this system
18655 fn=f/
18656 case "$pager" in
18657 '')
18658         dflt=''
18659         case "$pg" in
18660         /*) dflt=$pg;;
18661         [a-zA-Z]:/*) dflt=$pg;;
18662         esac
18663         case "$more" in
18664         /*) dflt=$more;;
18665         [a-zA-Z]:/*) dflt=$more;;
18666         esac
18667         case "$less" in
18668         /*) dflt=$less;;
18669         [a-zA-Z]:/*) dflt=$less;;
18670         esac
18671         case "$dflt" in
18672         '') dflt=/usr/ucb/more;;
18673         esac
18674         ;;
18675 *)      dflt="$pager"
18676         : Instruct ./getfile to trust the hinted or previous pager value,
18677         : even if it does not begin with a slash.  For example, on os2,
18678         : pager might be cmd /c more.  See comments in UU/getfile.
18679         fn="f/($pager)"
18680         ;;
18681 esac
18682 echo " "
18683 rp='What pager is used on your system?'
18684 . ./getfile
18685 pager="$ans"
18686
18687 : see what type pids are declared as in the kernel
18688 rp="What is the type of process ids on this system?"
18689 set pid_t pidtype int stdio.h sys/types.h
18690 eval $typedef_ask
18691
18692 : see if ar generates random libraries by itself
18693 echo " "
18694 echo "Checking how to generate random libraries on your machine..." >&4
18695 echo 'int bar1() { return bar2(); }' > bar1.c
18696 echo 'int bar2() { return 2; }' > bar2.c
18697 $cat > foo.c <<EOP
18698 #$i_stdlib I_STDLIB
18699 #ifdef I_STDLIB
18700 #include <stdlib.h>
18701 #endif
18702 int main() { printf("%d\n", bar1()); exit(0); }
18703 EOP
18704 $cc $ccflags -c bar1.c >/dev/null 2>&1
18705 $cc $ccflags -c bar2.c >/dev/null 2>&1
18706 $cc $ccflags -c foo.c >/dev/null 2>&1
18707 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18708 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18709         $run ./foobar >/dev/null 2>&1; then
18710         echo "$ar appears to generate random libraries itself."
18711         orderlib=false
18712         ranlib=":"
18713 elif $ar ts bar$_a >/dev/null 2>&1 &&
18714         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18715         $run ./foobar >/dev/null 2>&1; then
18716                 echo "a table of contents needs to be added with '$ar ts'."
18717                 orderlib=false
18718                 ranlib="$ar ts"
18719 else
18720         case "$ranlib" in
18721         :) ranlib='';;
18722         '')
18723                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18724                 $test -f $ranlib || ranlib=''
18725                 ;;
18726         esac
18727         if $test -n "$ranlib"; then
18728                 echo "your system has '$ranlib'; we'll use that."
18729                 orderlib=false
18730         else
18731                 echo "your system doesn't seem to support random libraries"
18732                 echo "so we'll use lorder and tsort to order the libraries."
18733                 orderlib=true
18734                 ranlib=":"
18735         fi
18736 fi
18737 $rm -f foo* bar* 
18738
18739 : check for type of arguments to select. 
18740 case "$selecttype" in
18741 '') case "$d_select" in
18742         $define)
18743                 echo " "
18744                 $cat <<EOM
18745 Checking to see what type of arguments are accepted by select().
18746 EOM
18747                 hdrs="$define sys/types.h
18748                         $i_systime sys/time.h 
18749                         $i_sysselct sys/select.h
18750                         $d_socket sys/socket.h"
18751                 : The first arg can be int, unsigned, or size_t
18752                 : The last arg may or may not be 'const'
18753                 val=''
18754                 : void pointer has been seen but using that
18755                 : breaks the selectminbits test
18756                 for xxx in 'fd_set *' 'int *'; do
18757                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18758                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18759                                         case "$val" in
18760                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18761                                                 if ./protochk "$try" $hdrs; then
18762                                                         echo "Your system accepts $xxx."
18763                                                         val="$xxx"
18764                                                 fi
18765                                                 ;;
18766                                         esac
18767                                 done
18768                         done
18769                 done
18770                 case "$val" in
18771                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18772                         case "$d_fd_set" in
18773                                 $define) dflt="fd_set *" ;;
18774                                 *)              dflt="int *" ;;
18775                         esac
18776                         . ./myread
18777                         val=$ans
18778                         ;;
18779                 esac
18780                 selecttype="$val"
18781                 ;;
18782         *)      : no select, so pick a harmless default
18783                 selecttype='int *'
18784                 ;;
18785         esac
18786         ;;
18787 esac
18788
18789 : check for the select 'width'
18790 case "$selectminbits" in
18791 '') safebits=`expr $ptrsize \* 8`
18792     case "$d_select" in
18793         $define)
18794                 $cat <<EOM
18795
18796 Checking to see on how many bits at a time your select() operates...
18797 EOM
18798                 $cat >try.c <<EOCP
18799 #include <sys/types.h>
18800 #$i_time I_TIME
18801 #$i_systime I_SYS_TIME
18802 #$i_systimek I_SYS_TIME_KERNEL
18803 #ifdef I_TIME
18804 #   include <time.h>
18805 #endif
18806 #ifdef I_SYS_TIME
18807 #   ifdef I_SYS_TIME_KERNEL
18808 #       define KERNEL
18809 #   endif
18810 #   include <sys/time.h>
18811 #   ifdef I_SYS_TIME_KERNEL
18812 #       undef KERNEL
18813 #   endif
18814 #endif
18815 #$i_sysselct I_SYS_SELECT
18816 #ifdef I_SYS_SELECT
18817 #include <sys/select.h>
18818 #endif
18819 #$d_socket HAS_SOCKET
18820 #ifdef HAS_SOCKET
18821 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18822 #endif
18823 #include <stdio.h>
18824 #$i_stdlib I_STDLIB
18825 #ifdef I_STDLIB
18826 #include <stdlib.h>
18827 #endif
18828 $selecttype b;
18829 #define S sizeof(*(b))
18830 #define MINBITS 64
18831 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18832 #define NBITS  (NBYTES * 8)
18833 int main() {
18834     char *s = malloc(NBYTES);
18835     struct timeval t;
18836     int i;
18837     FILE* fp;
18838     int fd;
18839
18840     if (!s)
18841         exit(1);
18842     fclose(stdin);
18843     fp = fopen("try.c", "r");
18844     if (fp == 0)
18845       exit(2);
18846     fd = fileno(fp);
18847     if (fd < 0)
18848       exit(3);
18849     b = ($selecttype)s;
18850     for (i = 0; i < NBITS; i++)
18851         FD_SET(i, b);
18852     t.tv_sec  = 0;
18853     t.tv_usec = 0;
18854     select(fd + 1, b, 0, 0, &t);
18855     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18856     free(s);
18857     printf("%d\n", i + 1);
18858     return 0;
18859 }
18860 EOCP
18861                 set try
18862                 if eval $compile_ok; then
18863                         selectminbits=`$run ./try`
18864                         case "$selectminbits" in
18865                         '')     cat >&4 <<EOM
18866 Cannot figure out on how many bits at a time your select() operates.
18867 I'll play safe and guess it is $safebits bits.
18868 EOM
18869                                 selectminbits=$safebits
18870                                 bits="$safebits bits"
18871                                 ;;
18872                         1)      bits="1 bit" ;;
18873                         *)      bits="$selectminbits bits" ;;
18874                         esac
18875                         echo "Your select() operates on $bits at a time." >&4
18876                 else
18877                         rp='What is the minimum number of bits your select() operates on?'
18878                         case "$byteorder" in
18879                         12345678)       dflt=64 ;;
18880                         1234)           dflt=32 ;;
18881                         *)              dflt=1  ;;
18882                         esac
18883                         . ./myread
18884                         val=$ans
18885                         selectminbits="$val"
18886                 fi
18887                 $rm -f try.* try
18888                 ;;
18889         *)      : no select, so pick a harmless default
18890                 selectminbits=$safebits
18891                 ;;
18892         esac
18893         ;;
18894 esac
18895
18896 : Trace out the files included by signal.h, then look for SIGxxx names.
18897 : Remove SIGARRAYSIZE used by HPUX.
18898 : Remove SIGSTKSIZE used by Linux.
18899 : Remove SIGSTKSZ used by Posix.
18900 : Remove SIGTYP void lines used by OS2.
18901 : Some cpps, like os390, dont give the file name anywhere
18902 if [ "X$fieldn" = X ]; then
18903         : Just make some guesses.  We check them later.
18904         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18905 else
18906         xxx=`echo '#include <signal.h>' |
18907         $cppstdin $cppminus $cppflags 2>/dev/null |
18908         $grep '^[       ]*#.*include' | 
18909         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18910 fi
18911 : Check this list of files to be sure we have parsed the cpp output ok.
18912 : This will also avoid potentially non-existent files, such 
18913 : as ../foo/bar.h
18914 xxxfiles=''
18915 for xx in $xxx /dev/null ; do
18916         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18917 done
18918 : If we have found no files, at least try signal.h
18919 case "$xxxfiles" in
18920 '')     xxxfiles=`./findhdr signal.h` ;;
18921 esac
18922 xxx=`awk '
18923 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18924         print substr($2, 4, 20)
18925 }
18926 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18927         print substr($3, 4, 20)
18928 }' $xxxfiles`
18929 : Append some common names just in case the awk scan failed.
18930 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18931 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18932 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18933 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18934 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18935
18936 : generate a few handy files for later
18937 $cat > signal.c <<EOCP
18938 #include <sys/types.h>
18939 #include <signal.h>
18940 #$i_stdlib I_STDLIB
18941 #ifdef I_STDLIB
18942 #include <stdlib.h>
18943 #endif
18944 #include <stdio.h>
18945 int main() {
18946
18947 /* Strange style to avoid deeply-nested #if/#else/#endif */
18948 #ifndef NSIG
18949 #  ifdef _NSIG
18950 #    define NSIG (_NSIG)
18951 #  endif
18952 #endif
18953
18954 #ifndef NSIG
18955 #  ifdef SIGMAX
18956 #    define NSIG (SIGMAX+1)
18957 #  endif
18958 #endif
18959
18960 #ifndef NSIG
18961 #  ifdef SIG_MAX
18962 #    define NSIG (SIG_MAX+1)
18963 #  endif
18964 #endif
18965
18966 #ifndef NSIG
18967 #  ifdef MAXSIG
18968 #    define NSIG (MAXSIG+1)
18969 #  endif
18970 #endif
18971
18972 #ifndef NSIG
18973 #  ifdef MAX_SIG
18974 #    define NSIG (MAX_SIG+1)
18975 #  endif
18976 #endif
18977
18978 #ifndef NSIG
18979 #  ifdef SIGARRAYSIZE
18980 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18981 #  endif
18982 #endif
18983
18984 #ifndef NSIG
18985 #  ifdef _sys_nsig
18986 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18987 #  endif
18988 #endif
18989
18990 /* Default to some arbitrary number that's big enough to get most
18991    of the common signals.
18992 */
18993 #ifndef NSIG
18994 #    define NSIG 50
18995 #endif
18996
18997 printf("NSIG %d\n", NSIG);
18998
18999 #ifndef JUST_NSIG
19000
19001 EOCP
19002
19003 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19004 {
19005         printf "#ifdef SIG"; printf $1; printf "\n"
19006         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19007         printf $1; printf ");\n"
19008         printf "#endif\n"
19009 }
19010 END {
19011         printf "#endif /* JUST_NSIG */\n";
19012         printf "exit(0);\n}\n";
19013 }
19014 ' >>signal.c
19015 $cat >signal.awk <<'EOP'
19016 BEGIN { ndups = 0 }
19017 $1 ~ /^NSIG$/ { nsig = $2 }
19018 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19019     if ($2 > maxsig) { maxsig = $2 }
19020     if (sig_name[$2]) {
19021         dup_name[ndups] = $1
19022         dup_num[ndups] = $2
19023         ndups++ 
19024     }
19025     else {
19026         sig_name[$2] = $1
19027         sig_num[$2] = $2
19028     }
19029 }
19030 END { 
19031     if (nsig == 0) {
19032         nsig = maxsig + 1
19033     }
19034     printf("NSIG %d\n", nsig);
19035     for (n = 1; n < nsig; n++) {
19036         if (sig_name[n]) {
19037             printf("%s %d\n", sig_name[n], sig_num[n])
19038         }
19039         else {
19040             printf("NUM%d %d\n", n, n) 
19041         }
19042     }
19043     for (n = 0; n < ndups; n++) {
19044         printf("%s %d\n", dup_name[n], dup_num[n])
19045     }
19046 }
19047 EOP
19048 $cat >signal_cmd <<EOS
19049 $startsh
19050 if $test -s signal.lst; then
19051     echo "Using your existing signal.lst file"
19052         exit 0
19053 fi
19054 xxx="$xxx"
19055 EOS
19056 $cat >>signal_cmd <<'EOS'
19057
19058 set signal
19059 if eval $compile_ok; then
19060         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19061 else
19062         echo "(I can't seem be able to compile the whole test program)" >&4
19063         echo "(I'll try it in little pieces.)" >&4
19064         set signal -DJUST_NSIG
19065         if eval $compile_ok; then
19066                 $run ./signal$_exe > signal.nsg
19067                 $cat signal.nsg
19068         else
19069                 echo "I can't seem to figure out how many signals you have." >&4
19070                 echo "Guessing 50." >&4
19071                 echo 'NSIG 50' > signal.nsg
19072         fi
19073         : Now look at all the signal names, one at a time.
19074         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19075                 $cat > signal.c <<EOCP
19076 #include <sys/types.h>
19077 #include <signal.h>
19078 #include <stdio.h>
19079 int main() {
19080 printf("$xx %d\n", SIG${xx});
19081 return 0;
19082 }
19083 EOCP
19084                 set signal
19085                 if eval $compile; then
19086                         echo "SIG${xx} found."
19087                         $run ./signal$_exe  >> signal.ls1
19088                 else
19089                         echo "SIG${xx} NOT found."
19090                 fi
19091         done
19092         if $test -s signal.ls1; then
19093                 $cat signal.nsg signal.ls1 |
19094                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19095         fi
19096
19097 fi
19098 if $test -s signal.lst; then
19099         :
19100 else
19101         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19102         echo 'kill -l' >signal
19103         set X `csh -f <signal`
19104         $rm -f signal
19105         shift
19106         case $# in
19107         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19108         esac
19109         echo $@ | $tr ' ' $trnl | \
19110             $awk '{ printf "%s %d\n", $1, ++s; }
19111                   END { printf "NSIG %d\n", ++s }' >signal.lst
19112 fi
19113 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19114 EOS
19115 chmod a+x signal_cmd
19116 $eunicefix signal_cmd
19117
19118 : generate list of signal names
19119 echo " "
19120 case "$sig_name_init" in
19121 '') doinit=yes ;;
19122 *)  case "$sig_num_init" in
19123     ''|*,*) doinit=yes ;;
19124     esac ;;
19125 esac
19126 case "$doinit" in
19127 yes)
19128         echo "Generating a list of signal names and numbers..." >&4
19129         . ./signal_cmd
19130         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19131         sig_name=`$awk 'BEGIN { printf "ZERO " }
19132                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19133         sig_num=`$awk  'BEGIN { printf "0 " }
19134                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19135         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19136                              !/^NSIG/   { printf "\"%s\", ", $1 }
19137                              END        { printf "0\n" }' signal.lst`
19138         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19139                              !/^NSIG/   { printf "%d, ", $2}
19140                              END        { printf "0\n"}' signal.lst`
19141         ;;
19142 esac
19143 echo "The following $sig_count signals are available:"
19144 echo " "
19145 echo $sig_name | $awk \
19146 'BEGIN { linelen = 0 }
19147 {
19148         for (i = 1; i <= NF; i++) {
19149                 name = "SIG" $i " "
19150                 linelen = linelen + length(name)
19151                 if (linelen > 70) {
19152                         printf "\n"
19153                         linelen = length(name)
19154                 }
19155                 printf "%s", name
19156         }
19157         printf "\n"
19158 }'
19159 sig_size=`echo $sig_name | awk '{print NF}'`
19160 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19161
19162 echo " "
19163 case "$sizetype" in
19164 *_t) zzz="$sizetype"    ;;
19165 *)   zzz="filesize"     ;;
19166 esac
19167 echo "Checking the size of $zzz..." >&4 
19168 cat > try.c <<EOCP
19169 #include <sys/types.h>
19170 #include <stdio.h>
19171 #$i_stdlib I_STDLIB
19172 #ifdef I_STDLIB
19173 #include <stdlib.h>
19174 #endif
19175 int main() {
19176     printf("%d\n", (int)sizeof($sizetype));
19177     exit(0);
19178 }
19179 EOCP
19180 set try
19181 if eval $compile_ok; then
19182         yyy=`$run ./try`
19183         case "$yyy" in
19184         '')     sizesize=4
19185                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19186                 ;;
19187         *)      sizesize=$yyy
19188                 echo "Your $zzz size is $sizesize bytes."
19189                 ;;
19190         esac
19191 else
19192         sizesize=4
19193         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19194 fi
19195
19196
19197 : check for socklen_t
19198 echo " "
19199 echo "Checking to see if you have socklen_t..." >&4
19200 $cat >try.c <<EOCP
19201 #include <sys/types.h>
19202 #$d_socket HAS_SOCKET
19203 #ifdef HAS_SOCKET
19204 #include <sys/socket.h>
19205 #endif
19206 int main() { socklen_t x = 16; }
19207 EOCP
19208 set try
19209 if eval $compile; then
19210         val="$define"
19211         echo "You have socklen_t."
19212 else
19213         val="$undef"
19214         echo "You do not have socklen_t."
19215         case "$sizetype" in
19216         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19217         esac
19218 fi
19219 $rm -f try try.*
19220 set d_socklen_t
19221 eval $setvar
19222
19223 : see if this is a socks.h system
19224 set socks.h i_socks
19225 eval $inhdr
19226
19227 : check for type of the size argument to socket calls
19228 case "$d_socket" in
19229 "$define")
19230         $cat <<EOM
19231
19232 Checking to see what type is the last argument of accept().
19233 EOM
19234         yyy=''
19235         case "$d_socklen_t" in
19236         "$define") yyy="$yyy socklen_t"
19237         esac
19238         yyy="$yyy $sizetype int long unsigned"
19239         for xxx in $yyy; do
19240                 case "$socksizetype" in
19241                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19242                         case "$usesocks" in
19243                         "$define")
19244                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19245                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19246                                         socksizetype="$xxx"
19247                                 fi
19248                                 ;;
19249                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19250                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19251                                         socksizetype="$xxx"
19252                                 fi
19253                                 ;;
19254                         esac
19255                         ;;
19256                 esac
19257         done
19258 : In case none of those worked, prompt the user.
19259         case "$socksizetype" in
19260         '')     rp='What is the type for socket address structure sizes?'
19261                 dflt='int'
19262                 . ./myread
19263                 socksizetype=$ans
19264                 ;;
19265         esac
19266         ;;
19267 *)      : no sockets, so pick relatively harmless default
19268         socksizetype='int'
19269         ;;
19270 esac
19271
19272 : see what type is used for signed size_t
19273 set ssize_t ssizetype int stdio.h sys/types.h
19274 eval $typedef
19275 dflt="$ssizetype"
19276 $cat > try.c <<EOM
19277 #include <stdio.h>
19278 #$i_stdlib I_STDLIB
19279 #ifdef I_STDLIB
19280 #include <stdlib.h>
19281 #endif
19282 #include <sys/types.h>
19283 #define Size_t $sizetype
19284 #define SSize_t $dflt
19285 int main()
19286 {
19287         if (sizeof(Size_t) == sizeof(SSize_t))
19288                 printf("$dflt\n");
19289         else if (sizeof(Size_t) == sizeof(int))
19290                 printf("int\n");
19291         else 
19292                 printf("long\n");
19293         exit(0);
19294 }
19295 EOM
19296 echo " "
19297 set try
19298 if eval $compile_ok && $run ./try > /dev/null; then
19299         ssizetype=`$run ./try`
19300         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19301 else
19302         $cat >&4 <<EOM
19303 Help! I can't compile and run the ssize_t test program: please enlighten me!
19304 (This is probably a misconfiguration in your system or libraries, and
19305 you really ought to fix it.  Still, I'll try anyway.)
19306
19307 I need a type that is the same size as $sizetype, but is guaranteed to
19308 be signed.  Common values are ssize_t, int and long.
19309
19310 EOM
19311         rp="What signed type is the same size as $sizetype?"
19312         . ./myread
19313         ssizetype="$ans"
19314 fi
19315 $rm -f try try.*
19316
19317 : see what type of char stdio uses.
19318 echo " "
19319 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19320 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19321         echo "Your stdio uses unsigned chars." >&4
19322         stdchar="unsigned char"
19323 else
19324         echo "Your stdio uses signed chars." >&4
19325         stdchar="char"
19326 fi
19327 $rm -f stdioh
19328
19329
19330
19331 : see what type uids are declared as in the kernel
19332 echo " "
19333 echo "Looking for the type for user ids returned by getuid()."
19334 set uid_t uidtype xxx stdio.h sys/types.h
19335 eval $typedef
19336 case "$uidtype" in
19337 xxx)
19338         xxx=`./findhdr sys/user.h`
19339         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19340         case $1 in
19341         unsigned) dflt="$1 $2" ;;
19342         *) dflt="$1" ;;
19343         esac
19344         ;;
19345 *) dflt="$uidtype";;
19346 esac
19347 case "$uidtype" in
19348 uid_t)  echo "uid_t found." ;;
19349 *)      rp="What is the type for user ids returned by getuid()?"
19350         . ./myread
19351         uidtype="$ans"
19352         ;;
19353 esac
19354
19355 echo " "
19356 case "$uidtype" in
19357 *_t) zzz="$uidtype"     ;;
19358 *)   zzz="uid"          ;;
19359 esac
19360 echo "Checking the size of $zzz..." >&4 
19361 cat > try.c <<EOCP
19362 #include <sys/types.h>
19363 #include <stdio.h>
19364 #$i_stdlib I_STDLIB
19365 #ifdef I_STDLIB
19366 #include <stdlib.h>
19367 #endif
19368 int main() {
19369     printf("%d\n", (int)sizeof($uidtype));
19370     exit(0);
19371 }
19372 EOCP
19373 set try
19374 if eval $compile_ok; then
19375         yyy=`$run ./try`
19376         case "$yyy" in
19377         '')     uidsize=4
19378                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19379                 ;;
19380         *)      uidsize=$yyy
19381                 echo "Your $zzz is $uidsize bytes long."
19382                 ;;
19383         esac
19384 else
19385         uidsize=4
19386         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19387 fi
19388
19389 echo " "
19390 case "$uidtype" in
19391 *_t) zzz="$uidtype"     ;;
19392 *)   zzz="uid"          ;;
19393 esac
19394 echo "Checking the sign of $zzz..." >&4
19395 cat > try.c <<EOCP
19396 #include <sys/types.h>
19397 #include <stdio.h>
19398 int main() {
19399         $uidtype foo = -1;
19400         if (foo < 0)
19401                 printf("-1\n");
19402         else
19403                 printf("1\n");
19404 }
19405 EOCP
19406 set try
19407 if eval $compile; then
19408         yyy=`$run ./try`
19409         case "$yyy" in
19410         '')     uidsign=1
19411                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19412                 ;;
19413         *)      uidsign=$yyy
19414                 case "$uidsign" in
19415                  1) echo "Your $zzz is unsigned." ;;
19416                 -1) echo "Your $zzz is signed."   ;;
19417                 esac
19418                 ;;
19419         esac
19420 else
19421         uidsign=1
19422         echo "(I can't compile the test program--guessing unsigned.)" >&4
19423 fi
19424
19425
19426
19427 echo " "
19428 $echo "Checking the format string to be used for uids..." >&4
19429
19430 case "$uidsign" in
19431 -1)     if $test X"$uidsize" = X"$ivsize"; then
19432                 uidformat="$ivdformat"
19433         else
19434                 if $test X"$uidsize" = X"$longsize"; then
19435                         uidformat='"ld"'
19436                 else
19437                         if $test X"$uidsize" = X"$intsize"; then
19438                                 uidformat='"d"'
19439                         else
19440                                 if $test X"$uidsize" = X"$shortsize"; then
19441                                         uidformat='"hd"'
19442                                 fi
19443                         fi
19444                 fi
19445         fi
19446         ;;
19447 *)      if $test X"$uidsize" = X"$uvsize"; then
19448                 uidformat="$uvuformat"
19449         else
19450                 if $test X"$uidsize" = X"$longsize"; then
19451                         uidformat='"lu"'
19452                 else
19453                         if $test X"$uidsize" = X"$intsize"; then
19454                                 uidformat='"u"'
19455                         else
19456                                 if $test X"$uidsize" = X"$shortsize"; then
19457                                         uidformat='"hu"'
19458                                 fi
19459                         fi
19460                 fi
19461         fi
19462         ;;
19463 esac
19464
19465 : determine compiler compiler
19466 case "$yacc" in
19467 '')
19468         dflt=yacc;;
19469 *)
19470         dflt="$yacc";;
19471 esac
19472 echo " "
19473 comp='yacc'
19474 if $test -f "$byacc$_exe"; then
19475         dflt="$byacc"
19476         comp="byacc or $comp"
19477 fi
19478 if $test -f "$bison$_exe"; then
19479         comp="$comp or bison -y"
19480 fi
19481 rp="Which compiler compiler ($comp) shall I use?"
19482 . ./myread
19483 yacc="$ans"
19484 case "$yacc" in
19485 *bis*)
19486         case "$yacc" in
19487         *-y*) ;;
19488         *)
19489                 yacc="$yacc -y"
19490                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19491                 ;;
19492         esac
19493         ;;
19494 esac
19495
19496 : see if this is a fp.h system
19497 set fp.h i_fp
19498 eval $inhdr
19499
19500 : see if this is a fp_class.h system
19501 set fp_class.h i_fp_class
19502 eval $inhdr
19503
19504 : see if this is a ieeefp.h system
19505 case "$i_ieeefp" in
19506 '' ) set ieeefp.h i_ieeefp
19507      eval $inhdr
19508      ;;
19509 esac
19510
19511 : see if this is a libutil.h system
19512 set libutil.h i_libutil
19513 eval $inhdr
19514
19515 : see if mach cthreads are available
19516 if test "X$usethreads" = "X$define"; then
19517         set mach/cthreads.h i_machcthr
19518         eval $inhdr
19519 else
19520         i_machcthr="$undef"
19521 fi
19522
19523
19524
19525 : see if this is a math.h system
19526 set math.h i_math
19527 eval $inhdr
19528
19529 : see if this is a mntent.h system
19530 set mntent.h i_mntent
19531 eval $inhdr
19532
19533 : see if ndbm.h is available
19534 set ndbm.h t_ndbm
19535 eval $inhdr
19536
19537 case "$t_ndbm" in
19538 $undef)
19539     # Some Linux distributions such as RedHat 7.1 put the
19540     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19541     if $test -f /usr/include/gdbm/ndbm.h; then
19542         echo '<gdbm/ndbm.h> found.'
19543         ccflags="$ccflags -I/usr/include/gdbm"
19544         cppflags="$cppflags -I/usr/include/gdbm"
19545         t_ndbm=$define
19546     fi
19547     ;;
19548 esac
19549
19550 case "$t_ndbm" in
19551 $define)
19552         : see if dbm_open exists
19553         set dbm_open d_dbm_open
19554         eval $inlibc
19555         case "$d_dbm_open" in
19556         $undef)
19557                 t_ndbm="$undef"
19558                 echo "We won't be including <ndbm.h>"
19559                 ;;
19560         esac
19561         ;;
19562 esac
19563 val="$t_ndbm"
19564 set i_ndbm
19565 eval $setvar
19566
19567 : see if net/errno.h is available
19568 val=''
19569 set net/errno.h val
19570 eval $inhdr
19571
19572 : Unfortunately, it causes problems on some systems.  Arrgh.
19573 case "$val" in
19574 $define)
19575         cat > try.c <<'EOM'
19576 #include <stdio.h>
19577 #include <errno.h>
19578 #include <net/errno.h>
19579 int func()
19580 {
19581         return ENOTSOCK;
19582 }
19583 EOM
19584         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19585                 echo "We'll be including <net/errno.h>." >&4
19586         else
19587                 echo "We won't be including <net/errno.h>." >&4
19588                 val="$undef"
19589         fi
19590         $rm -f try.* try
19591         ;;
19592 esac
19593 set i_neterrno
19594 eval $setvar
19595
19596 : see if netinet/tcp.h is available
19597 set netinet/tcp.h i_netinettcp
19598 eval $inhdr
19599
19600 : see if this is a poll.h system
19601 set poll.h i_poll
19602 eval $inhdr
19603
19604 : see if this is a prot.h system
19605 set prot.h i_prot
19606 eval $inhdr
19607
19608 echo " "
19609 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19610 $cat <<'EOSH' > Cppsym.know
19611 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19612 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19613 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19614 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19615 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19616 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19617 bull c cadmus clipper CMU COFF COMPILER_VERSION
19618 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19619 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19620 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19621 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19622 GLIBC GLIBC_MINOR
19623 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19624 H3050R H3050RX hbullx20 hcx host_mips
19625 hp200 hp300 hp700 HP700 hp800 hp9000
19626 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19627 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19628 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19629 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19630 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19631 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19632 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19633 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19634 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19635 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19636 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19637 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19638 MATH_HAS_NO_SIDE_EFFECTS
19639 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19640 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19641 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19642 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19643 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19644 NetBSD news1500 news1700 news1800 news1900 news3700
19645 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19646 ns32016 ns32332 ns32k nsc32000
19647 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19648 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19649 pc532 pdp11 PGC PIC plexus PORTAR posix
19650 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19651 POSIX_C_SOURCE POSIX_SOURCE POWER
19652 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19653 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19654 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19655 sony sony_news sonyrisc sparc sparclite spectrum
19656 stardent stdc STDC_EXT stratos sun sun3 sun386
19657 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19658 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19659 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19660 sysV68 sysV88 Tek4132 Tek4300 titan
19661 TM3200 TM5400 TM5600
19662 tower tower32 tower32_200 tower32_600 tower32_700
19663 tower32_800 tower32_850 tss
19664 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19665 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19666 unix UNIX95 UNIX99 unixpc unos
19667 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19668 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19669 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19670 USGr4 USGr4_2
19671 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19672 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19673 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19674 z8000
19675 EOSH
19676 # Maybe put other stuff here too.
19677 cat <<EOSH >>Cppsym.know
19678 $osname
19679 EOSH
19680 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19681 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19682 $cat Cppsym.know > Cppsym.c
19683 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19684 $rm -f Cppsym.a Cppsym.b Cppsym.c
19685 cat <<EOSH > Cppsym
19686 $startsh
19687 if $test \$# -gt 0; then
19688     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19689     if $test -s Cppsym.got; then
19690         $rm -f Cppsym.got
19691         exit 0
19692     fi
19693     $rm -f Cppsym.got
19694     exit 1
19695 else
19696     $tr " " "$trnl" | ./Cppsym.try
19697     exit 0
19698 fi
19699 EOSH
19700 chmod +x Cppsym
19701 $eunicefix Cppsym
19702 cat <<EOSH > Cppsym.try
19703 $startsh
19704 cat <<'EOCP' > try.c
19705 #include <stdio.h>
19706 int main() {
19707 EOCP
19708 $awk \\
19709 EOSH
19710 cat <<'EOSH' >> Cppsym.try
19711 'length($1) > 0 {
19712     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
19713     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
19714     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
19715     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
19716 }'       >> try.c
19717 echo 'return 0;}' >> try.c
19718 EOSH
19719 cat <<EOSH >> Cppsym.try
19720 ccflags="$ccflags"
19721 case "$osname-$gccversion" in
19722 irix-) ccflags="\$ccflags -woff 1178" ;;
19723 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19724 esac
19725 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19726 EOSH
19727 chmod +x Cppsym.try
19728 $eunicefix Cppsym.try
19729 ./Cppsym < Cppsym.know > Cppsym.true
19730 : now check the C compiler for additional symbols
19731 postprocess_cc_v=''
19732 case "$osname" in
19733 aix) postprocess_cc_v="|$tr , ' '" ;;
19734 esac
19735 $cat >ccsym <<EOS
19736 $startsh
19737 $cat >tmp.c <<EOF
19738 extern int foo;
19739 EOF
19740 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19741 do
19742         case "\$i" in
19743         -D*) echo "\$i" | $sed 's/^-D//';;
19744         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19745         esac
19746 done
19747 $rm -f try.c
19748 EOS
19749 postprocess_cc_v=''
19750 chmod +x ccsym
19751 $eunicefix ccsym
19752 ./ccsym > ccsym1.raw
19753 if $test -s ccsym1.raw; then
19754        $sort ccsym1.raw | $uniq >ccsym.raw
19755 else
19756        mv ccsym1.raw ccsym.raw
19757 fi
19758
19759 $awk '/\=/ { print $0; next }
19760         { print $0"=1" }' ccsym.raw >ccsym.list
19761 $awk '/\=/ { print $0; next }
19762         { print $0"=1" }' Cppsym.true >ccsym.true
19763 $comm -13 ccsym.true ccsym.list >ccsym.own
19764 $comm -12 ccsym.true ccsym.list >ccsym.com
19765 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19766 also=''
19767 if $test -z ccsym.raw; then
19768         echo "Your C compiler doesn't seem to define any symbols!" >&4
19769         echo " "
19770         echo "However, your C preprocessor defines the following symbols:"
19771         $cat Cppsym.true
19772         ccsymbols=''
19773         cppsymbols=`$cat Cppsym.true`
19774         cppsymbols=`echo $cppsymbols`
19775         cppccsymbols="$cppsymbols"
19776 else
19777         if $test -s ccsym.com; then
19778                 echo "Your C compiler and pre-processor define these symbols:"
19779                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19780                 also='also '
19781                 symbols='ones'
19782                 cppccsymbols=`$cat ccsym.com`
19783                 cppccsymbols=`echo $cppccsymbols`
19784                 $test "$silent" || sleep 1
19785         fi
19786         if $test -s ccsym.cpp; then
19787                 $test "$also" && echo " "
19788                 echo "Your C pre-processor ${also}defines the following symbols:"
19789                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19790                 also='further '
19791                 cppsymbols=`$cat ccsym.cpp`
19792                 cppsymbols=`echo $cppsymbols`
19793                 $test "$silent" || sleep 1
19794         fi
19795         if $test -s ccsym.own; then
19796                 $test "$also" && echo " "
19797                 echo "Your C compiler ${also}defines the following cpp symbols:"
19798                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19799                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19800                 ccsymbols=`$cat ccsym.own`
19801                 ccsymbols=`echo $ccsymbols`
19802                 $test "$silent" || sleep 1
19803         fi
19804 fi
19805
19806 : see if this is a termio system
19807 val="$undef"
19808 val2="$undef"
19809 val3="$undef"
19810 if $test `./findhdr termios.h`; then
19811         set tcsetattr i_termios
19812         eval $inlibc
19813         val3="$i_termios"
19814 fi
19815 echo " "
19816 case "$val3" in
19817 "$define") echo "You have POSIX termios.h... good!" >&4;;
19818 *) if ./Cppsym pyr; then
19819                 case "`/bin/universe`" in
19820                 ucb) if $test `./findhdr sgtty.h`; then
19821                                 val2="$define"
19822                                 echo "<sgtty.h> found." >&4
19823                         else
19824                                 echo "System is pyramid with BSD universe."
19825                                 echo "<sgtty.h> not found--you could have problems." >&4
19826                         fi;;
19827                 *) if $test `./findhdr termio.h`; then
19828                                 val="$define"
19829                                 echo "<termio.h> found." >&4
19830                         else
19831                                 echo "System is pyramid with USG universe."
19832                                 echo "<termio.h> not found--you could have problems." >&4
19833                         fi;;
19834                 esac
19835         elif ./usg; then
19836                 if $test `./findhdr termio.h`; then
19837                         echo "<termio.h> found." >&4
19838                         val="$define"
19839                 elif $test `./findhdr sgtty.h`; then
19840                         echo "<sgtty.h> found." >&4
19841                         val2="$define"
19842                 else
19843 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19844                 fi
19845         else
19846                 if $test `./findhdr sgtty.h`; then
19847                         echo "<sgtty.h> found." >&4
19848                         val2="$define"
19849                 elif $test `./findhdr termio.h`; then
19850                         echo "<termio.h> found." >&4
19851                         val="$define"
19852                 else
19853 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19854                 fi
19855         fi;;
19856 esac
19857 set i_termio; eval $setvar
19858 val=$val2; set i_sgtty; eval $setvar
19859 val=$val3; set i_termios; eval $setvar
19860
19861 : see if stddef is available
19862 set stddef.h i_stddef
19863 eval $inhdr
19864
19865 : see if this is a sunmath.h system
19866 set sunmath.h i_sunmath
19867 eval $inhdr
19868
19869 : see if sys/access.h is available
19870 set sys/access.h i_sysaccess
19871 eval $inhdr
19872
19873 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19874 set sys/filio.h i_sysfilio
19875 eval $inhdr
19876 echo " "
19877 if $test `./findhdr sys/ioctl.h`; then
19878         val="$define"
19879         echo '<sys/ioctl.h> found.' >&4
19880 else
19881         val="$undef"
19882         if $test $i_sysfilio = "$define"; then
19883             echo '<sys/ioctl.h> NOT found.' >&4
19884         else
19885                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19886                 $test $i_termio = "$define" && xxx="termio.h"
19887                 $test $i_termios = "$define" && xxx="termios.h"
19888 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19889         fi
19890 fi
19891 set i_sysioctl
19892 eval $setvar
19893
19894 : see if socket ioctl defs are in sys/sockio.h
19895 echo " "
19896 xxx=`./findhdr sys/sockio.h`
19897 if $test "$xxx"; then
19898         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19899                 val="$define"
19900                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19901         else
19902                 val="$undef"
19903                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19904         fi
19905 else
19906         val="$undef"
19907         $cat <<EOM
19908 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19909 EOM
19910 fi
19911 set i_syssockio
19912 eval $setvar
19913
19914
19915 : see if this is a syslog.h system
19916 set syslog.h i_syslog
19917 eval $inhdr
19918
19919
19920 : see if this is a sys/mode.h system
19921 set sys/mode.h i_sysmode
19922 eval $inhdr
19923
19924 : see if sys/resource.h has to be included
19925 set sys/resource.h i_sysresrc
19926 eval $inhdr
19927
19928 : see if sys/security.h is available
19929 set sys/security.h i_syssecrt
19930 eval $inhdr
19931
19932 : see if this is a sys/statvfs.h system
19933 set sys/statvfs.h i_sysstatvfs
19934 eval $inhdr
19935
19936 : see if this is a sys/un.h system
19937 set sys/un.h i_sysun
19938 eval $inhdr
19939
19940
19941 : see if this is a sys/utsname.h system
19942 set sys/utsname.h i_sysutsname
19943 eval $inhdr
19944
19945 : see if this is a syswait system
19946 set sys/wait.h i_syswait
19947 eval $inhdr
19948
19949 : see if this is a ustat.h system
19950 set ustat.h i_ustat
19951 eval $inhdr
19952
19953 : see if this is an utime system
19954 set utime.h i_utime
19955 eval $inhdr
19956
19957 : see if this is a values.h system
19958 set values.h i_values
19959 eval $inhdr
19960
19961 : see if this is a vfork system
19962 case "$d_vfork" in
19963 "$define")
19964         set vfork.h i_vfork
19965         eval $inhdr
19966         ;;
19967 *)
19968         i_vfork="$undef"
19969         ;;
19970 esac
19971
19972 : see if gdbm.h is available
19973 set gdbm.h t_gdbm
19974 eval $inhdr
19975 case "$t_gdbm" in
19976 $define)
19977         : see if gdbm_open exists
19978         set gdbm_open d_gdbm_open
19979         eval $inlibc
19980         case "$d_gdbm_open" in
19981         $undef)
19982                 t_gdbm="$undef"
19983                 echo "We won't be including <gdbm.h>"
19984                 ;;
19985         esac
19986         ;;
19987 esac
19988 val="$t_gdbm"
19989 set i_gdbm
19990 eval $setvar
19991
19992 echo " "
19993 echo "Looking for extensions..." >&4
19994 : If we are using the old config.sh, known_extensions may contain
19995 : old or inaccurate or duplicate values.
19996 known_extensions=''
19997 nonxs_extensions=''
19998 : We do not use find because it might not be available.
19999 : We do not just use MANIFEST because the user may have dropped
20000 : some additional extensions into the source tree and expect them
20001 : to be built.
20002
20003 : Function to recursively find available extensions, ignoring DynaLoader
20004 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20005 find_extensions='
20006     for xxx in *; do
20007        case "$xxx" in
20008            DynaLoader|dynaload) ;;
20009            *)
20010            if $test -f $xxx/$xxx.xs; then
20011                known_extensions="$known_extensions $1$xxx";
20012            elif $test -f $xxx/Makefile.PL; then
20013                nonxs_extensions="$nonxs_extensions $1$xxx";
20014            else
20015                if $test -d $xxx -a $# -lt 10; then
20016                    set $1$xxx/ $*;
20017                    cd "$xxx";
20018                    eval $find_extensions;
20019                    cd ..;
20020                    shift;
20021                fi;
20022            fi
20023            ;;
20024        esac;
20025     done'
20026 tdir=`pwd`
20027 cd "$rsrc/ext"
20028 set X
20029 shift
20030 eval $find_extensions
20031 # Special case:  Add in threads/shared since it is not picked up by the
20032 # recursive find above (and adding in general recursive finding breaks
20033 # SDBM_File/sdbm).  A.D.  10/25/2001.
20034 known_extensions="$known_extensions threads/shared"
20035 set X $nonxs_extensions
20036 shift
20037 nonxs_extensions="$*"
20038 set X $known_extensions
20039 shift
20040 known_extensions="$*"
20041 cd "$tdir"
20042
20043 : Now see which are supported on this system.
20044 avail_ext=''
20045 for xxx in $known_extensions ; do
20046         case "$xxx" in
20047         DB_File|db_file)
20048                 case "$i_db" in
20049                 $define) avail_ext="$avail_ext $xxx" ;;
20050                 esac
20051                 ;;
20052         GDBM_File|gdbm_fil)
20053                 case "$i_gdbm" in 
20054                 $define) avail_ext="$avail_ext $xxx" ;;
20055                 esac
20056                 ;;
20057         I18N/Langinfo|i18n_lan)
20058                 case "$i_langinfo$d_nl_langinfo" in 
20059                 $define$define) avail_ext="$avail_ext $xxx" ;;
20060                 esac
20061                 ;;
20062         NDBM_File|ndbm_fil)
20063                 case "$i_ndbm" in
20064                 $define)
20065                     case "$osname-$use64bitint" in
20066                     hpux-define)
20067                         case "$libs" in
20068                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20069                         esac
20070                         ;;
20071                     *) avail_ext="$avail_ext $xxx" ;;
20072                     esac
20073                     ;;
20074                 esac
20075                 ;;
20076         ODBM_File|odbm_fil) 
20077                 case "${i_dbm}${i_rpcsvcdbm}" in
20078                 *"${define}"*)
20079                     case "$osname-$use64bitint" in
20080                     hpux-define)
20081                         case "$libs" in
20082                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20083                         esac
20084                         ;;
20085                     *) avail_ext="$avail_ext $xxx" ;;
20086                     esac
20087                     ;;
20088                 esac
20089                 ;;
20090         POSIX|posix)
20091                 case "$useposix" in
20092                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20093                 esac
20094                 ;;
20095         Opcode|opcode)
20096                 case "$useopcode" in
20097                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20098                 esac
20099                 ;;
20100         Socket|socket)
20101                 case "$d_socket" in 
20102                 true|$define|y)
20103                     case "$osname" in
20104                     beos) ;; # not unless BONE
20105                     *) avail_ext="$avail_ext $xxx" ;;
20106                     esac
20107                     ;;
20108                 esac
20109                 ;;
20110         Sys/Syslog|sys/syslog)
20111                 : XXX syslog requires socket
20112                 case "$d_socket" in 
20113                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20114                 esac
20115                 ;;
20116         Thread|thread)
20117                 case "$usethreads" in
20118                 true|$define|y)
20119                         case "$useithreads" in
20120                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20121                         esac
20122                 esac
20123                 ;;
20124         XS/APItest|xs/apitest)
20125                 # This is just for testing.  Skip it unless we have dynamic loading.
20126
20127                 case "$usedl" in
20128                 $define) avail_ext="$avail_ext $xxx" ;;
20129                 esac
20130                 ;;
20131         XS/Typemap|xs/typemap)
20132                 # This is just for testing.  Skip it unless we have dynamic loading.
20133                 case "$usedl" in
20134                 $define) avail_ext="$avail_ext $xxx" ;;
20135                 esac
20136                 ;;
20137         threads|threads/shared)
20138                 # threads and threads::shared are special cases.
20139                 # To stop people from asking "Perl 5.8.0 was supposed
20140                 # to have this new fancy threads implementation but my
20141                 # perl doesn't have it" and from people trying to
20142                 # (re)install the threads module using CPAN.pm and
20143                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20144                 # the threads.pm and threads/shared.pm will always be
20145                 # there, croaking informatively ("you need to rebuild
20146                 # all of Perl with threads, sorry") when threads haven't
20147                 # been compiled in.
20148                 # --jhi
20149                 avail_ext="$avail_ext $xxx"
20150                 ;;
20151         IPC/SysV|ipc/sysv)
20152                 : XXX Do we need a useipcsysv variable here
20153                 case "${d_msg}${d_sem}${d_shm}" in 
20154                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20155                 esac
20156                 ;;
20157         *)      avail_ext="$avail_ext $xxx"
20158                 ;;
20159         esac
20160 done
20161
20162 set X $avail_ext
20163 shift
20164 avail_ext="$*"
20165
20166 case "$onlyextensions" in
20167 '') ;;
20168 *)  keepextensions=''
20169     echo "You have requested that only certains extensions be included..." >&4
20170     for i in $onlyextensions; do
20171         case " $avail_ext " in
20172         *" $i "*)
20173             echo "Keeping extension $i."
20174             keepextensions="$keepextensions $i"
20175             ;;
20176         *) echo "Ignoring extension $i." ;;
20177         esac
20178     done
20179     avail_ext="$keepextensions"
20180     ;;
20181 esac
20182
20183 case "$noextensions" in
20184 '') ;;
20185 *)  keepextensions=''
20186     echo "You have requested that certain extensions be ignored..." >&4
20187     for i in $avail_ext; do
20188         case " $noextensions " in
20189         *" $i "*) echo "Ignoring extension $i." ;;
20190         *) echo "Keeping extension $i.";
20191            keepextensions="$keepextensions $i"
20192            ;;
20193         esac
20194     done
20195     avail_ext="$keepextensions"
20196     ;;
20197 esac
20198
20199 : Now see which nonxs extensions are supported on this system.
20200 : For now assume all are.
20201 nonxs_ext=''
20202 for xxx in $nonxs_extensions ; do
20203         case "$xxx" in
20204         *)      nonxs_ext="$nonxs_ext $xxx"
20205                 ;;
20206         esac
20207 done
20208
20209 set X $nonxs_ext
20210 shift
20211 nonxs_ext="$*"
20212
20213 case $usedl in
20214 $define)
20215         $cat <<EOM
20216 A number of extensions are supplied with $package.  You may choose to
20217 compile these extensions for dynamic loading (the default), compile
20218 them into the $package executable (static loading), or not include
20219 them at all.  Answer "none" to include no extensions.
20220 Note that DynaLoader is always built and need not be mentioned here.
20221
20222 EOM
20223         case "$dynamic_ext" in
20224         '')
20225                 : Exclude those listed in static_ext
20226                 dflt=''
20227                 for xxx in $avail_ext; do
20228                         case " $static_ext " in
20229                         *" $xxx "*) ;;
20230                         *) dflt="$dflt $xxx" ;;
20231                         esac
20232                 done
20233                 set X $dflt
20234                 shift
20235                 dflt="$*"
20236                 ;;
20237         *)      dflt="$dynamic_ext"
20238                 # Perhaps we are reusing an old out-of-date config.sh.
20239                 case "$hint" in
20240                 previous)
20241                         if test X"$dynamic_ext" != X"$avail_ext"; then
20242                                 $cat <<EOM
20243 NOTICE:  Your previous config.sh list may be incorrect. 
20244 The extensions now available to you are 
20245         ${avail_ext}
20246 but the default list from your previous config.sh is
20247         ${dynamic_ext} 
20248
20249 EOM
20250                         fi
20251                         ;;
20252                 esac
20253                 ;;
20254         esac
20255         case "$dflt" in
20256         '')     dflt=none;;
20257         esac
20258         rp="What extensions do you wish to load dynamically?"
20259         . ./myread
20260         case "$ans" in
20261         none) dynamic_ext=' ' ;;
20262         *) dynamic_ext="$ans" ;;
20263         esac
20264
20265         case "$static_ext" in
20266         '')
20267                 : Exclude those already listed in dynamic linking
20268                 dflt=''
20269                 for xxx in $avail_ext; do
20270                         case " $dynamic_ext " in
20271                         *" $xxx "*) ;;
20272                         *) dflt="$dflt $xxx" ;;
20273                         esac
20274                 done
20275                 set X $dflt
20276                 shift
20277                 dflt="$*"
20278                 ;;
20279         *)  dflt="$static_ext" 
20280                 ;;
20281         esac
20282
20283         case "$dflt" in
20284         '')     dflt=none;;
20285         esac
20286         rp="What extensions do you wish to load statically?"
20287         . ./myread
20288         case "$ans" in
20289         none) static_ext=' ' ;;
20290         *) static_ext="$ans" ;;
20291         esac
20292         ;;
20293 *)
20294         $cat <<EOM
20295 A number of extensions are supplied with $package.  Answer "none" 
20296 to include no extensions. 
20297 Note that DynaLoader is always built and need not be mentioned here.
20298
20299 EOM
20300         case "$static_ext" in
20301         '') dflt="$avail_ext" ;;
20302         *)      dflt="$static_ext"
20303                 # Perhaps we are reusing an old out-of-date config.sh.
20304                 case "$hint" in
20305                 previous)
20306                         if test X"$static_ext" != X"$avail_ext"; then
20307                                 $cat <<EOM
20308 NOTICE:  Your previous config.sh list may be incorrect. 
20309 The extensions now available to you are 
20310         ${avail_ext}
20311 but the default list from your previous config.sh is
20312         ${static_ext} 
20313
20314 EOM
20315                         fi
20316                         ;;
20317                 esac
20318                 ;;
20319         esac
20320         : Exclude those that are not xs extensions
20321         case "$dflt" in
20322         '')     dflt=none;;
20323         esac
20324         rp="What extensions do you wish to include?"
20325         . ./myread
20326         case "$ans" in
20327         none) static_ext=' ' ;;
20328         *) static_ext="$ans" ;;
20329         esac
20330         ;;
20331 esac
20332 #        
20333 # Encode is a special case.  If we are building Encode as a static
20334 # extension, we need to explicitly list its subextensions as well.
20335 # For other nested extensions, this is handled automatically by
20336 # the appropriate Makefile.PL.
20337 case " $static_ext " in
20338         *" Encode "*) # Add the subextensions of Encode
20339         cd "$rsrc/ext"
20340         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20341                 static_ext="$static_ext Encode/$xxx"
20342         done
20343         cd "$tdir"
20344         ;;
20345 esac
20346
20347 set X $dynamic_ext $static_ext $nonxs_ext
20348 shift
20349 extensions="$*"
20350
20351 # Sanity check:  We require an extension suitable for use with
20352 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20353 # should show up as failures in the test suite, but it's helpful to
20354 # catch them now.) The 'extensions' list is normally sorted
20355 # alphabetically, so we need to accept either
20356 #    DB_File ... Fcntl ... IO  ....
20357 # or something like
20358 #    Fcntl ... NDBM_File ... IO  ....
20359 case " $extensions"  in
20360 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20361 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20362 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20363 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20364    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20365    ;;
20366 esac
20367
20368 : Remove libraries needed only for extensions
20369 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20370 : The exception is SunOS 4.x, which needs them.
20371 case "${osname}X${osvers}" in
20372 sunos*X4*)
20373     perllibs="$libs"
20374     ;;
20375 *) case "$usedl" in
20376     $define|true|[yY]*)
20377             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20378             shift
20379             perllibs="$*"
20380             ;;
20381     *)  perllibs="$libs"
20382             ;;
20383     esac
20384     ;;
20385 esac
20386
20387 : Remove build directory name from cppstdin so it can be used from
20388 : either the present location or the final installed location.
20389 echo " "
20390 : Get out of the UU directory to get correct path name.
20391 cd ..
20392 case "$cppstdin" in
20393 `pwd`/cppstdin)
20394         echo "Stripping down cppstdin path name"
20395         cppstdin=cppstdin
20396         ;;
20397 esac
20398 cd UU
20399
20400 : end of configuration questions
20401 echo " "
20402 echo "End of configuration questions."
20403 echo " "
20404
20405 : back to where it started
20406 if test -d ../UU; then
20407         cd ..
20408 fi
20409
20410 : configuration may be patched via a 'config.arch' file
20411 if $test -f config.arch; then
20412         echo "I see a config.arch file, loading it."
20413         . ./config.arch
20414 fi
20415
20416 : configuration may be patched via a 'config.over' file
20417 if $test -f config.over; then
20418         echo " "
20419         dflt=y
20420         rp='I see a config.over file.  Do you wish to load it?'
20421         . UU/myread
20422         case "$ans" in
20423         n*) echo "OK, I'll ignore it.";;
20424         *)      . ./config.over
20425                 echo "Configuration override changes have been loaded."
20426                 ;;
20427         esac
20428 fi
20429
20430 : in case they want portability, strip down executable paths
20431 case "$d_portable" in
20432 "$define")
20433         echo " "
20434         echo "Stripping down executable paths..." >&4
20435         for file in $loclist $trylist; do
20436                 eval temp=\$$file
20437                 eval $file=`basename $temp`
20438         done
20439         ;;
20440 esac
20441
20442 : create config.sh file
20443 echo " "
20444 echo "Creating config.sh..." >&4
20445 $spitshell <<EOT >config.sh
20446 $startsh
20447 #
20448 # This file was produced by running the Configure script. It holds all the
20449 # definitions figured out by Configure. Should you modify one of these values,
20450 # do not forget to propagate your changes by running "Configure -der". You may
20451 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20452 #
20453
20454 # Package name      : $package
20455 # Source directory  : $src
20456 # Configuration time: $cf_time
20457 # Configured by     : $cf_by
20458 # Target system     : $myuname
20459
20460 Author='$Author'
20461 Date='$Date'
20462 Header='$Header'
20463 Id='$Id'
20464 Locker='$Locker'
20465 Log='$Log'
20466 Mcc='$Mcc'
20467 RCSfile='$RCSfile'
20468 Revision='$Revision'
20469 Source='$Source'
20470 State='$State'
20471 _a='$_a'
20472 _exe='$_exe'
20473 _o='$_o'
20474 afs='$afs'
20475 afsroot='$afsroot'
20476 alignbytes='$alignbytes'
20477 ansi2knr='$ansi2knr'
20478 aphostname='$aphostname'
20479 api_revision='$api_revision'
20480 api_subversion='$api_subversion'
20481 api_version='$api_version'
20482 api_versionstring='$api_versionstring'
20483 ar='$ar'
20484 archlib='$archlib'
20485 archlibexp='$archlibexp'
20486 archname64='$archname64'
20487 archname='$archname'
20488 archobjs='$archobjs'
20489 asctime_r_proto='$asctime_r_proto'
20490 awk='$awk'
20491 baserev='$baserev'
20492 bash='$bash'
20493 bin='$bin'
20494 binexp='$binexp'
20495 bison='$bison'
20496 byacc='$byacc'
20497 byteorder='$byteorder'
20498 c='$c'
20499 castflags='$castflags'
20500 cat='$cat'
20501 cc='$cc'
20502 cccdlflags='$cccdlflags'
20503 ccdlflags='$ccdlflags'
20504 ccflags='$ccflags'
20505 ccflags_uselargefiles='$ccflags_uselargefiles'
20506 ccname='$ccname'
20507 ccsymbols='$ccsymbols'
20508 ccversion='$ccversion'
20509 cf_by='$cf_by'
20510 cf_email='$cf_email'
20511 cf_time='$cf_time'
20512 charsize='$charsize'
20513 chgrp='$chgrp'
20514 chmod='$chmod'
20515 chown='$chown'
20516 clocktype='$clocktype'
20517 comm='$comm'
20518 compress='$compress'
20519 contains='$contains'
20520 cp='$cp'
20521 cpio='$cpio'
20522 cpp='$cpp'
20523 cpp_stuff='$cpp_stuff'
20524 cppccsymbols='$cppccsymbols'
20525 cppflags='$cppflags'
20526 cpplast='$cpplast'
20527 cppminus='$cppminus'
20528 cpprun='$cpprun'
20529 cppstdin='$cppstdin'
20530 cppsymbols='$cppsymbols'
20531 crypt_r_proto='$crypt_r_proto'
20532 cryptlib='$cryptlib'
20533 csh='$csh'
20534 ctermid_r_proto='$ctermid_r_proto'
20535 ctime_r_proto='$ctime_r_proto'
20536 d_Gconvert='$d_Gconvert'
20537 d_PRIEUldbl='$d_PRIEUldbl'
20538 d_PRIFUldbl='$d_PRIFUldbl'
20539 d_PRIGUldbl='$d_PRIGUldbl'
20540 d_PRIXU64='$d_PRIXU64'
20541 d_PRId64='$d_PRId64'
20542 d_PRIeldbl='$d_PRIeldbl'
20543 d_PRIfldbl='$d_PRIfldbl'
20544 d_PRIgldbl='$d_PRIgldbl'
20545 d_PRIi64='$d_PRIi64'
20546 d_PRIo64='$d_PRIo64'
20547 d_PRIu64='$d_PRIu64'
20548 d_PRIx64='$d_PRIx64'
20549 d_SCNfldbl='$d_SCNfldbl'
20550 d__fwalk='$d__fwalk'
20551 d_access='$d_access'
20552 d_accessx='$d_accessx'
20553 d_aintl='$d_aintl'
20554 d_alarm='$d_alarm'
20555 d_archlib='$d_archlib'
20556 d_asctime_r='$d_asctime_r'
20557 d_atolf='$d_atolf'
20558 d_atoll='$d_atoll'
20559 d_attribut='$d_attribut'
20560 d_bcmp='$d_bcmp'
20561 d_bcopy='$d_bcopy'
20562 d_bsd='$d_bsd'
20563 d_bsdgetpgrp='$d_bsdgetpgrp'
20564 d_bsdsetpgrp='$d_bsdsetpgrp'
20565 d_bzero='$d_bzero'
20566 d_casti32='$d_casti32'
20567 d_castneg='$d_castneg'
20568 d_charvspr='$d_charvspr'
20569 d_chown='$d_chown'
20570 d_chroot='$d_chroot'
20571 d_chsize='$d_chsize'
20572 d_class='$d_class'
20573 d_closedir='$d_closedir'
20574 d_cmsghdr_s='$d_cmsghdr_s'
20575 d_const='$d_const'
20576 d_copysignl='$d_copysignl'
20577 d_crypt='$d_crypt'
20578 d_crypt_r='$d_crypt_r'
20579 d_csh='$d_csh'
20580 d_ctermid_r='$d_ctermid_r'
20581 d_ctime_r='$d_ctime_r'
20582 d_cuserid='$d_cuserid'
20583 d_dbl_dig='$d_dbl_dig'
20584 d_dbminitproto='$d_dbminitproto'
20585 d_difftime='$d_difftime'
20586 d_dirfd='$d_dirfd'
20587 d_dirnamlen='$d_dirnamlen'
20588 d_dlerror='$d_dlerror'
20589 d_dlopen='$d_dlopen'
20590 d_dlsymun='$d_dlsymun'
20591 d_dosuid='$d_dosuid'
20592 d_drand48_r='$d_drand48_r'
20593 d_drand48proto='$d_drand48proto'
20594 d_dup2='$d_dup2'
20595 d_eaccess='$d_eaccess'
20596 d_endgrent='$d_endgrent'
20597 d_endgrent_r='$d_endgrent_r'
20598 d_endhent='$d_endhent'
20599 d_endhostent_r='$d_endhostent_r'
20600 d_endnent='$d_endnent'
20601 d_endnetent_r='$d_endnetent_r'
20602 d_endpent='$d_endpent'
20603 d_endprotoent_r='$d_endprotoent_r'
20604 d_endpwent='$d_endpwent'
20605 d_endpwent_r='$d_endpwent_r'
20606 d_endsent='$d_endsent'
20607 d_endservent_r='$d_endservent_r'
20608 d_eofnblk='$d_eofnblk'
20609 d_eunice='$d_eunice'
20610 d_faststdio='$d_faststdio'
20611 d_fchdir='$d_fchdir'
20612 d_fchmod='$d_fchmod'
20613 d_fchown='$d_fchown'
20614 d_fcntl='$d_fcntl'
20615 d_fcntl_can_lock='$d_fcntl_can_lock'
20616 d_fd_macros='$d_fd_macros'
20617 d_fd_set='$d_fd_set'
20618 d_fds_bits='$d_fds_bits'
20619 d_fgetpos='$d_fgetpos'
20620 d_finite='$d_finite'
20621 d_finitel='$d_finitel'
20622 d_flexfnam='$d_flexfnam'
20623 d_flock='$d_flock'
20624 d_flockproto='$d_flockproto'
20625 d_fork='$d_fork'
20626 d_fp_class='$d_fp_class'
20627 d_fpathconf='$d_fpathconf'
20628 d_fpclass='$d_fpclass'
20629 d_fpclassify='$d_fpclassify'
20630 d_fpclassl='$d_fpclassl'
20631 d_fpos64_t='$d_fpos64_t'
20632 d_frexpl='$d_frexpl'
20633 d_fs_data_s='$d_fs_data_s'
20634 d_fseeko='$d_fseeko'
20635 d_fsetpos='$d_fsetpos'
20636 d_fstatfs='$d_fstatfs'
20637 d_fstatvfs='$d_fstatvfs'
20638 d_fsync='$d_fsync'
20639 d_ftello='$d_ftello'
20640 d_ftime='$d_ftime'
20641 d_getcwd='$d_getcwd'
20642 d_getespwnam='$d_getespwnam'
20643 d_getfsstat='$d_getfsstat'
20644 d_getgrent='$d_getgrent'
20645 d_getgrent_r='$d_getgrent_r'
20646 d_getgrgid_r='$d_getgrgid_r'
20647 d_getgrnam_r='$d_getgrnam_r'
20648 d_getgrps='$d_getgrps'
20649 d_gethbyaddr='$d_gethbyaddr'
20650 d_gethbyname='$d_gethbyname'
20651 d_gethent='$d_gethent'
20652 d_gethname='$d_gethname'
20653 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20654 d_gethostbyname_r='$d_gethostbyname_r'
20655 d_gethostent_r='$d_gethostent_r'
20656 d_gethostprotos='$d_gethostprotos'
20657 d_getitimer='$d_getitimer'
20658 d_getlogin='$d_getlogin'
20659 d_getlogin_r='$d_getlogin_r'
20660 d_getmnt='$d_getmnt'
20661 d_getmntent='$d_getmntent'
20662 d_getnbyaddr='$d_getnbyaddr'
20663 d_getnbyname='$d_getnbyname'
20664 d_getnent='$d_getnent'
20665 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20666 d_getnetbyname_r='$d_getnetbyname_r'
20667 d_getnetent_r='$d_getnetent_r'
20668 d_getnetprotos='$d_getnetprotos'
20669 d_getpagsz='$d_getpagsz'
20670 d_getpbyname='$d_getpbyname'
20671 d_getpbynumber='$d_getpbynumber'
20672 d_getpent='$d_getpent'
20673 d_getpgid='$d_getpgid'
20674 d_getpgrp2='$d_getpgrp2'
20675 d_getpgrp='$d_getpgrp'
20676 d_getppid='$d_getppid'
20677 d_getprior='$d_getprior'
20678 d_getprotobyname_r='$d_getprotobyname_r'
20679 d_getprotobynumber_r='$d_getprotobynumber_r'
20680 d_getprotoent_r='$d_getprotoent_r'
20681 d_getprotoprotos='$d_getprotoprotos'
20682 d_getprpwnam='$d_getprpwnam'
20683 d_getpwent='$d_getpwent'
20684 d_getpwent_r='$d_getpwent_r'
20685 d_getpwnam_r='$d_getpwnam_r'
20686 d_getpwuid_r='$d_getpwuid_r'
20687 d_getsbyname='$d_getsbyname'
20688 d_getsbyport='$d_getsbyport'
20689 d_getsent='$d_getsent'
20690 d_getservbyname_r='$d_getservbyname_r'
20691 d_getservbyport_r='$d_getservbyport_r'
20692 d_getservent_r='$d_getservent_r'
20693 d_getservprotos='$d_getservprotos'
20694 d_getspnam='$d_getspnam'
20695 d_getspnam_r='$d_getspnam_r'
20696 d_gettimeod='$d_gettimeod'
20697 d_gmtime_r='$d_gmtime_r'
20698 d_gnulibc='$d_gnulibc'
20699 d_grpasswd='$d_grpasswd'
20700 d_hasmntopt='$d_hasmntopt'
20701 d_htonl='$d_htonl'
20702 d_ilogbl='$d_ilogbl'
20703 d_index='$d_index'
20704 d_inetaton='$d_inetaton'
20705 d_int64_t='$d_int64_t'
20706 d_isascii='$d_isascii'
20707 d_isfinite='$d_isfinite'
20708 d_isinf='$d_isinf'
20709 d_isnan='$d_isnan'
20710 d_isnanl='$d_isnanl'
20711 d_killpg='$d_killpg'
20712 d_lchown='$d_lchown'
20713 d_ldbl_dig='$d_ldbl_dig'
20714 d_link='$d_link'
20715 d_localtime_r='$d_localtime_r'
20716 d_locconv='$d_locconv'
20717 d_lockf='$d_lockf'
20718 d_longdbl='$d_longdbl'
20719 d_longlong='$d_longlong'
20720 d_lseekproto='$d_lseekproto'
20721 d_lstat='$d_lstat'
20722 d_madvise='$d_madvise'
20723 d_mblen='$d_mblen'
20724 d_mbstowcs='$d_mbstowcs'
20725 d_mbtowc='$d_mbtowc'
20726 d_memchr='$d_memchr'
20727 d_memcmp='$d_memcmp'
20728 d_memcpy='$d_memcpy'
20729 d_memmove='$d_memmove'
20730 d_memset='$d_memset'
20731 d_mkdir='$d_mkdir'
20732 d_mkdtemp='$d_mkdtemp'
20733 d_mkfifo='$d_mkfifo'
20734 d_mkstemp='$d_mkstemp'
20735 d_mkstemps='$d_mkstemps'
20736 d_mktime='$d_mktime'
20737 d_mmap='$d_mmap'
20738 d_modfl='$d_modfl'
20739 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20740 d_modflproto='$d_modflproto'
20741 d_mprotect='$d_mprotect'
20742 d_msg='$d_msg'
20743 d_msg_ctrunc='$d_msg_ctrunc'
20744 d_msg_dontroute='$d_msg_dontroute'
20745 d_msg_oob='$d_msg_oob'
20746 d_msg_peek='$d_msg_peek'
20747 d_msg_proxy='$d_msg_proxy'
20748 d_msgctl='$d_msgctl'
20749 d_msgget='$d_msgget'
20750 d_msghdr_s='$d_msghdr_s'
20751 d_msgrcv='$d_msgrcv'
20752 d_msgsnd='$d_msgsnd'
20753 d_msync='$d_msync'
20754 d_munmap='$d_munmap'
20755 d_mymalloc='$d_mymalloc'
20756 d_nice='$d_nice'
20757 d_nl_langinfo='$d_nl_langinfo'
20758 d_nv_preserves_uv='$d_nv_preserves_uv'
20759 d_off64_t='$d_off64_t'
20760 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20761 d_oldpthreads='$d_oldpthreads'
20762 d_oldsock='$d_oldsock'
20763 d_open3='$d_open3'
20764 d_pathconf='$d_pathconf'
20765 d_pause='$d_pause'
20766 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20767 d_phostname='$d_phostname'
20768 d_pipe='$d_pipe'
20769 d_poll='$d_poll'
20770 d_portable='$d_portable'
20771 d_procselfexe='$d_procselfexe'
20772 d_pthread_atfork='$d_pthread_atfork'
20773 d_pthread_attr_setscope='$d_pthread_attr_setscope'
20774 d_pthread_yield='$d_pthread_yield'
20775 d_pwage='$d_pwage'
20776 d_pwchange='$d_pwchange'
20777 d_pwclass='$d_pwclass'
20778 d_pwcomment='$d_pwcomment'
20779 d_pwexpire='$d_pwexpire'
20780 d_pwgecos='$d_pwgecos'
20781 d_pwpasswd='$d_pwpasswd'
20782 d_pwquota='$d_pwquota'
20783 d_qgcvt='$d_qgcvt'
20784 d_quad='$d_quad'
20785 d_random_r='$d_random_r'
20786 d_readdir64_r='$d_readdir64_r'
20787 d_readdir='$d_readdir'
20788 d_readdir_r='$d_readdir_r'
20789 d_readlink='$d_readlink'
20790 d_readv='$d_readv'
20791 d_recvmsg='$d_recvmsg'
20792 d_rename='$d_rename'
20793 d_rewinddir='$d_rewinddir'
20794 d_rmdir='$d_rmdir'
20795 d_safebcpy='$d_safebcpy'
20796 d_safemcpy='$d_safemcpy'
20797 d_sanemcmp='$d_sanemcmp'
20798 d_sbrkproto='$d_sbrkproto'
20799 d_scalbnl='$d_scalbnl'
20800 d_sched_yield='$d_sched_yield'
20801 d_scm_rights='$d_scm_rights'
20802 d_seekdir='$d_seekdir'
20803 d_select='$d_select'
20804 d_sem='$d_sem'
20805 d_semctl='$d_semctl'
20806 d_semctl_semid_ds='$d_semctl_semid_ds'
20807 d_semctl_semun='$d_semctl_semun'
20808 d_semget='$d_semget'
20809 d_semop='$d_semop'
20810 d_sendmsg='$d_sendmsg'
20811 d_setegid='$d_setegid'
20812 d_seteuid='$d_seteuid'
20813 d_setgrent='$d_setgrent'
20814 d_setgrent_r='$d_setgrent_r'
20815 d_setgrps='$d_setgrps'
20816 d_sethent='$d_sethent'
20817 d_sethostent_r='$d_sethostent_r'
20818 d_setitimer='$d_setitimer'
20819 d_setlinebuf='$d_setlinebuf'
20820 d_setlocale='$d_setlocale'
20821 d_setlocale_r='$d_setlocale_r'
20822 d_setnent='$d_setnent'
20823 d_setnetent_r='$d_setnetent_r'
20824 d_setpent='$d_setpent'
20825 d_setpgid='$d_setpgid'
20826 d_setpgrp2='$d_setpgrp2'
20827 d_setpgrp='$d_setpgrp'
20828 d_setprior='$d_setprior'
20829 d_setproctitle='$d_setproctitle'
20830 d_setprotoent_r='$d_setprotoent_r'
20831 d_setpwent='$d_setpwent'
20832 d_setpwent_r='$d_setpwent_r'
20833 d_setregid='$d_setregid'
20834 d_setresgid='$d_setresgid'
20835 d_setresuid='$d_setresuid'
20836 d_setreuid='$d_setreuid'
20837 d_setrgid='$d_setrgid'
20838 d_setruid='$d_setruid'
20839 d_setsent='$d_setsent'
20840 d_setservent_r='$d_setservent_r'
20841 d_setsid='$d_setsid'
20842 d_setvbuf='$d_setvbuf'
20843 d_sfio='$d_sfio'
20844 d_shm='$d_shm'
20845 d_shmat='$d_shmat'
20846 d_shmatprototype='$d_shmatprototype'
20847 d_shmctl='$d_shmctl'
20848 d_shmdt='$d_shmdt'
20849 d_shmget='$d_shmget'
20850 d_sigaction='$d_sigaction'
20851 d_sigprocmask='$d_sigprocmask'
20852 d_sigsetjmp='$d_sigsetjmp'
20853 d_sockatmark='$d_sockatmark'
20854 d_sockatmarkproto='$d_sockatmarkproto'
20855 d_socket='$d_socket'
20856 d_socklen_t='$d_socklen_t'
20857 d_sockpair='$d_sockpair'
20858 d_socks5_init='$d_socks5_init'
20859 d_sqrtl='$d_sqrtl'
20860 d_srand48_r='$d_srand48_r'
20861 d_srandom_r='$d_srandom_r'
20862 d_sresgproto='$d_sresgproto'
20863 d_sresuproto='$d_sresuproto'
20864 d_statblks='$d_statblks'
20865 d_statfs_f_flags='$d_statfs_f_flags'
20866 d_statfs_s='$d_statfs_s'
20867 d_statvfs='$d_statvfs'
20868 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20869 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20870 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20871 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20872 d_stdio_stream_array='$d_stdio_stream_array'
20873 d_stdiobase='$d_stdiobase'
20874 d_stdstdio='$d_stdstdio'
20875 d_strchr='$d_strchr'
20876 d_strcoll='$d_strcoll'
20877 d_strctcpy='$d_strctcpy'
20878 d_strerrm='$d_strerrm'
20879 d_strerror='$d_strerror'
20880 d_strerror_r='$d_strerror_r'
20881 d_strftime='$d_strftime'
20882 d_strtod='$d_strtod'
20883 d_strtol='$d_strtol'
20884 d_strtold='$d_strtold'
20885 d_strtoll='$d_strtoll'
20886 d_strtoq='$d_strtoq'
20887 d_strtoul='$d_strtoul'
20888 d_strtoull='$d_strtoull'
20889 d_strtouq='$d_strtouq'
20890 d_strxfrm='$d_strxfrm'
20891 d_suidsafe='$d_suidsafe'
20892 d_symlink='$d_symlink'
20893 d_syscall='$d_syscall'
20894 d_syscallproto='$d_syscallproto'
20895 d_sysconf='$d_sysconf'
20896 d_sysernlst='$d_sysernlst'
20897 d_syserrlst='$d_syserrlst'
20898 d_system='$d_system'
20899 d_tcgetpgrp='$d_tcgetpgrp'
20900 d_tcsetpgrp='$d_tcsetpgrp'
20901 d_telldir='$d_telldir'
20902 d_telldirproto='$d_telldirproto'
20903 d_time='$d_time'
20904 d_times='$d_times'
20905 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20906 d_tm_tm_zone='$d_tm_tm_zone'
20907 d_tmpnam_r='$d_tmpnam_r'
20908 d_truncate='$d_truncate'
20909 d_ttyname_r='$d_ttyname_r'
20910 d_tzname='$d_tzname'
20911 d_u32align='$d_u32align'
20912 d_ualarm='$d_ualarm'
20913 d_umask='$d_umask'
20914 d_uname='$d_uname'
20915 d_union_semun='$d_union_semun'
20916 d_unordered='$d_unordered'
20917 d_usleep='$d_usleep'
20918 d_usleepproto='$d_usleepproto'
20919 d_ustat='$d_ustat'
20920 d_vendorarch='$d_vendorarch'
20921 d_vendorbin='$d_vendorbin'
20922 d_vendorlib='$d_vendorlib'
20923 d_vendorscript='$d_vendorscript'
20924 d_vfork='$d_vfork'
20925 d_void_closedir='$d_void_closedir'
20926 d_voidsig='$d_voidsig'
20927 d_voidtty='$d_voidtty'
20928 d_volatile='$d_volatile'
20929 d_vprintf='$d_vprintf'
20930 d_wait4='$d_wait4'
20931 d_waitpid='$d_waitpid'
20932 d_wcstombs='$d_wcstombs'
20933 d_wctomb='$d_wctomb'
20934 d_writev='$d_writev'
20935 d_xenix='$d_xenix'
20936 date='$date'
20937 db_hashtype='$db_hashtype'
20938 db_prefixtype='$db_prefixtype'
20939 db_version_major='$db_version_major'
20940 db_version_minor='$db_version_minor'
20941 db_version_patch='$db_version_patch'
20942 defvoidused='$defvoidused'
20943 direntrytype='$direntrytype'
20944 dlext='$dlext'
20945 dlsrc='$dlsrc'
20946 doublesize='$doublesize'
20947 drand01='$drand01'
20948 drand48_r_proto='$drand48_r_proto'
20949 dynamic_ext='$dynamic_ext'
20950 eagain='$eagain'
20951 ebcdic='$ebcdic'
20952 echo='$echo'
20953 egrep='$egrep'
20954 emacs='$emacs'
20955 endgrent_r_proto='$endgrent_r_proto'
20956 endhostent_r_proto='$endhostent_r_proto'
20957 endnetent_r_proto='$endnetent_r_proto'
20958 endprotoent_r_proto='$endprotoent_r_proto'
20959 endpwent_r_proto='$endpwent_r_proto'
20960 endservent_r_proto='$endservent_r_proto'
20961 eunicefix='$eunicefix'
20962 exe_ext='$exe_ext'
20963 expr='$expr'
20964 extensions='$extensions'
20965 extras='$extras'
20966 fflushNULL='$fflushNULL'
20967 fflushall='$fflushall'
20968 find='$find'
20969 firstmakefile='$firstmakefile'
20970 flex='$flex'
20971 fpossize='$fpossize'
20972 fpostype='$fpostype'
20973 freetype='$freetype'
20974 from='$from'
20975 full_ar='$full_ar'
20976 full_csh='$full_csh'
20977 full_sed='$full_sed'
20978 gccansipedantic='$gccansipedantic'
20979 gccosandvers='$gccosandvers'
20980 gccversion='$gccversion'
20981 getgrent_r_proto='$getgrent_r_proto'
20982 getgrgid_r_proto='$getgrgid_r_proto'
20983 getgrnam_r_proto='$getgrnam_r_proto'
20984 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20985 gethostbyname_r_proto='$gethostbyname_r_proto'
20986 gethostent_r_proto='$gethostent_r_proto'
20987 getlogin_r_proto='$getlogin_r_proto'
20988 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20989 getnetbyname_r_proto='$getnetbyname_r_proto'
20990 getnetent_r_proto='$getnetent_r_proto'
20991 getprotobyname_r_proto='$getprotobyname_r_proto'
20992 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20993 getprotoent_r_proto='$getprotoent_r_proto'
20994 getpwent_r_proto='$getpwent_r_proto'
20995 getpwnam_r_proto='$getpwnam_r_proto'
20996 getpwuid_r_proto='$getpwuid_r_proto'
20997 getservbyname_r_proto='$getservbyname_r_proto'
20998 getservbyport_r_proto='$getservbyport_r_proto'
20999 getservent_r_proto='$getservent_r_proto'
21000 getspnam_r_proto='$getspnam_r_proto'
21001 gidformat='$gidformat'
21002 gidsign='$gidsign'
21003 gidsize='$gidsize'
21004 gidtype='$gidtype'
21005 glibpth='$glibpth'
21006 gmake='$gmake'
21007 gmtime_r_proto='$gmtime_r_proto'
21008 gnulibc_version='$gnulibc_version'
21009 grep='$grep'
21010 groupcat='$groupcat'
21011 groupstype='$groupstype'
21012 gzip='$gzip'
21013 h_fcntl='$h_fcntl'
21014 h_sysfile='$h_sysfile'
21015 hint='$hint'
21016 hostcat='$hostcat'
21017 html1dir='$html1dir'
21018 html1direxp='$html1direxp'
21019 html3dir='$html3dir'
21020 html3direxp='$html3direxp'
21021 i16size='$i16size'
21022 i16type='$i16type'
21023 i32size='$i32size'
21024 i32type='$i32type'
21025 i64size='$i64size'
21026 i64type='$i64type'
21027 i8size='$i8size'
21028 i8type='$i8type'
21029 i_arpainet='$i_arpainet'
21030 i_bsdioctl='$i_bsdioctl'
21031 i_crypt='$i_crypt'
21032 i_db='$i_db'
21033 i_dbm='$i_dbm'
21034 i_dirent='$i_dirent'
21035 i_dld='$i_dld'
21036 i_dlfcn='$i_dlfcn'
21037 i_fcntl='$i_fcntl'
21038 i_float='$i_float'
21039 i_fp='$i_fp'
21040 i_fp_class='$i_fp_class'
21041 i_gdbm='$i_gdbm'
21042 i_grp='$i_grp'
21043 i_ieeefp='$i_ieeefp'
21044 i_inttypes='$i_inttypes'
21045 i_langinfo='$i_langinfo'
21046 i_libutil='$i_libutil'
21047 i_limits='$i_limits'
21048 i_locale='$i_locale'
21049 i_machcthr='$i_machcthr'
21050 i_malloc='$i_malloc'
21051 i_math='$i_math'
21052 i_memory='$i_memory'
21053 i_mntent='$i_mntent'
21054 i_ndbm='$i_ndbm'
21055 i_netdb='$i_netdb'
21056 i_neterrno='$i_neterrno'
21057 i_netinettcp='$i_netinettcp'
21058 i_niin='$i_niin'
21059 i_poll='$i_poll'
21060 i_prot='$i_prot'
21061 i_pthread='$i_pthread'
21062 i_pwd='$i_pwd'
21063 i_rpcsvcdbm='$i_rpcsvcdbm'
21064 i_sfio='$i_sfio'
21065 i_sgtty='$i_sgtty'
21066 i_shadow='$i_shadow'
21067 i_socks='$i_socks'
21068 i_stdarg='$i_stdarg'
21069 i_stddef='$i_stddef'
21070 i_stdlib='$i_stdlib'
21071 i_string='$i_string'
21072 i_sunmath='$i_sunmath'
21073 i_sysaccess='$i_sysaccess'
21074 i_sysdir='$i_sysdir'
21075 i_sysfile='$i_sysfile'
21076 i_sysfilio='$i_sysfilio'
21077 i_sysin='$i_sysin'
21078 i_sysioctl='$i_sysioctl'
21079 i_syslog='$i_syslog'
21080 i_sysmman='$i_sysmman'
21081 i_sysmode='$i_sysmode'
21082 i_sysmount='$i_sysmount'
21083 i_sysndir='$i_sysndir'
21084 i_sysparam='$i_sysparam'
21085 i_sysresrc='$i_sysresrc'
21086 i_syssecrt='$i_syssecrt'
21087 i_sysselct='$i_sysselct'
21088 i_syssockio='$i_syssockio'
21089 i_sysstat='$i_sysstat'
21090 i_sysstatfs='$i_sysstatfs'
21091 i_sysstatvfs='$i_sysstatvfs'
21092 i_systime='$i_systime'
21093 i_systimek='$i_systimek'
21094 i_systimes='$i_systimes'
21095 i_systypes='$i_systypes'
21096 i_sysuio='$i_sysuio'
21097 i_sysun='$i_sysun'
21098 i_sysutsname='$i_sysutsname'
21099 i_sysvfs='$i_sysvfs'
21100 i_syswait='$i_syswait'
21101 i_termio='$i_termio'
21102 i_termios='$i_termios'
21103 i_time='$i_time'
21104 i_unistd='$i_unistd'
21105 i_ustat='$i_ustat'
21106 i_utime='$i_utime'
21107 i_values='$i_values'
21108 i_varargs='$i_varargs'
21109 i_varhdr='$i_varhdr'
21110 i_vfork='$i_vfork'
21111 ignore_versioned_solibs='$ignore_versioned_solibs'
21112 inc_version_list='$inc_version_list'
21113 inc_version_list_init='$inc_version_list_init'
21114 incpath='$incpath'
21115 inews='$inews'
21116 installarchlib='$installarchlib'
21117 installbin='$installbin'
21118 installhtml1dir='$installhtml1dir'
21119 installhtml3dir='$installhtml3dir'
21120 installman1dir='$installman1dir'
21121 installman3dir='$installman3dir'
21122 installprefix='$installprefix'
21123 installprefixexp='$installprefixexp'
21124 installprivlib='$installprivlib'
21125 installscript='$installscript'
21126 installsitearch='$installsitearch'
21127 installsitebin='$installsitebin'
21128 installsitehtml1dir='$installsitehtml1dir'
21129 installsitehtml3dir='$installsitehtml3dir'
21130 installsitelib='$installsitelib'
21131 installsiteman1dir='$installsiteman1dir'
21132 installsiteman3dir='$installsiteman3dir'
21133 installsitescript='$installsitescript'
21134 installstyle='$installstyle'
21135 installusrbinperl='$installusrbinperl'
21136 installvendorarch='$installvendorarch'
21137 installvendorbin='$installvendorbin'
21138 installvendorhtml1dir='$installvendorhtml1dir'
21139 installvendorhtml3dir='$installvendorhtml3dir'
21140 installvendorlib='$installvendorlib'
21141 installvendorman1dir='$installvendorman1dir'
21142 installvendorman3dir='$installvendorman3dir'
21143 installvendorscript='$installvendorscript'
21144 intsize='$intsize'
21145 issymlink='$issymlink'
21146 ivdformat='$ivdformat'
21147 ivsize='$ivsize'
21148 ivtype='$ivtype'
21149 known_extensions='$known_extensions'
21150 ksh='$ksh'
21151 ld='$ld'
21152 lddlflags='$lddlflags'
21153 ldflags='$ldflags'
21154 ldflags_uselargefiles='$ldflags_uselargefiles'
21155 ldlibpthname='$ldlibpthname'
21156 less='$less'
21157 lib_ext='$lib_ext'
21158 libc='$libc'
21159 libperl='$libperl'
21160 libpth='$libpth'
21161 libs='$libs'
21162 libsdirs='$libsdirs'
21163 libsfiles='$libsfiles'
21164 libsfound='$libsfound'
21165 libspath='$libspath'
21166 libswanted='$libswanted'
21167 libswanted_uselargefiles='$libswanted_uselargefiles'
21168 line='$line'
21169 lint='$lint'
21170 lkflags='$lkflags'
21171 ln='$ln'
21172 lns='$lns'
21173 localtime_r_proto='$localtime_r_proto'
21174 locincpth='$locincpth'
21175 loclibpth='$loclibpth'
21176 longdblsize='$longdblsize'
21177 longlongsize='$longlongsize'
21178 longsize='$longsize'
21179 lp='$lp'
21180 lpr='$lpr'
21181 ls='$ls'
21182 lseeksize='$lseeksize'
21183 lseektype='$lseektype'
21184 mail='$mail'
21185 mailx='$mailx'
21186 make='$make'
21187 make_set_make='$make_set_make'
21188 mallocobj='$mallocobj'
21189 mallocsrc='$mallocsrc'
21190 malloctype='$malloctype'
21191 man1dir='$man1dir'
21192 man1direxp='$man1direxp'
21193 man1ext='$man1ext'
21194 man3dir='$man3dir'
21195 man3direxp='$man3direxp'
21196 man3ext='$man3ext'
21197 mips_type='$mips_type'
21198 mistrustnm='$mistrustnm'
21199 mkdir='$mkdir'
21200 mmaptype='$mmaptype'
21201 modetype='$modetype'
21202 more='$more'
21203 multiarch='$multiarch'
21204 mv='$mv'
21205 myarchname='$myarchname'
21206 mydomain='$mydomain'
21207 myhostname='$myhostname'
21208 myuname='$myuname'
21209 n='$n'
21210 need_va_copy='$need_va_copy'
21211 netdb_hlen_type='$netdb_hlen_type'
21212 netdb_host_type='$netdb_host_type'
21213 netdb_name_type='$netdb_name_type'
21214 netdb_net_type='$netdb_net_type'
21215 nm='$nm'
21216 nm_opt='$nm_opt'
21217 nm_so_opt='$nm_so_opt'
21218 nonxs_ext='$nonxs_ext'
21219 nroff='$nroff'
21220 nvEUformat='$nvEUformat'
21221 nvFUformat='$nvFUformat'
21222 nvGUformat='$nvGUformat'
21223 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21224 nveformat='$nveformat'
21225 nvfformat='$nvfformat'
21226 nvgformat='$nvgformat'
21227 nvsize='$nvsize'
21228 nvtype='$nvtype'
21229 o_nonblock='$o_nonblock'
21230 obj_ext='$obj_ext'
21231 old_pthread_create_joinable='$old_pthread_create_joinable'
21232 optimize='$optimize'
21233 orderlib='$orderlib'
21234 osname='$osname'
21235 osvers='$osvers'
21236 otherlibdirs='$otherlibdirs'
21237 package='$package'
21238 pager='$pager'
21239 passcat='$passcat'
21240 patchlevel='$patchlevel'
21241 path_sep='$path_sep'
21242 perl5='$perl5'
21243 perl='$perl'
21244 perl_patchlevel='$perl_patchlevel'
21245 perladmin='$perladmin'
21246 perllibs='$perllibs'
21247 perlpath='$perlpath'
21248 pg='$pg'
21249 phostname='$phostname'
21250 pidtype='$pidtype'
21251 plibpth='$plibpth'
21252 pmake='$pmake'
21253 pr='$pr'
21254 prefix='$prefix'
21255 prefixexp='$prefixexp'
21256 privlib='$privlib'
21257 privlibexp='$privlibexp'
21258 procselfexe='$procselfexe'
21259 prototype='$prototype'
21260 ptrsize='$ptrsize'
21261 quadkind='$quadkind'
21262 quadtype='$quadtype'
21263 randbits='$randbits'
21264 randfunc='$randfunc'
21265 random_r_proto='$random_r_proto'
21266 randseedtype='$randseedtype'
21267 ranlib='$ranlib'
21268 rd_nodata='$rd_nodata'
21269 readdir64_r_proto='$readdir64_r_proto'
21270 readdir_r_proto='$readdir_r_proto'
21271 revision='$revision'
21272 rm='$rm'
21273 rmail='$rmail'
21274 run='$run'
21275 runnm='$runnm'
21276 sPRIEUldbl='$sPRIEUldbl'
21277 sPRIFUldbl='$sPRIFUldbl'
21278 sPRIGUldbl='$sPRIGUldbl'
21279 sPRIXU64='$sPRIXU64'
21280 sPRId64='$sPRId64'
21281 sPRIeldbl='$sPRIeldbl'
21282 sPRIfldbl='$sPRIfldbl'
21283 sPRIgldbl='$sPRIgldbl'
21284 sPRIi64='$sPRIi64'
21285 sPRIo64='$sPRIo64'
21286 sPRIu64='$sPRIu64'
21287 sPRIx64='$sPRIx64'
21288 sSCNfldbl='$sSCNfldbl'
21289 sched_yield='$sched_yield'
21290 scriptdir='$scriptdir'
21291 scriptdirexp='$scriptdirexp'
21292 sed='$sed'
21293 seedfunc='$seedfunc'
21294 selectminbits='$selectminbits'
21295 selecttype='$selecttype'
21296 sendmail='$sendmail'
21297 setgrent_r_proto='$setgrent_r_proto'
21298 sethostent_r_proto='$sethostent_r_proto'
21299 setlocale_r_proto='$setlocale_r_proto'
21300 setnetent_r_proto='$setnetent_r_proto'
21301 setprotoent_r_proto='$setprotoent_r_proto'
21302 setpwent_r_proto='$setpwent_r_proto'
21303 setservent_r_proto='$setservent_r_proto'
21304 sh='$sh'
21305 shar='$shar'
21306 sharpbang='$sharpbang'
21307 shmattype='$shmattype'
21308 shortsize='$shortsize'
21309 shrpenv='$shrpenv'
21310 shsharp='$shsharp'
21311 sig_count='$sig_count'
21312 sig_name='$sig_name'
21313 sig_name_init='$sig_name_init'
21314 sig_num='$sig_num'
21315 sig_num_init='$sig_num_init'
21316 sig_size='$sig_size'
21317 signal_t='$signal_t'
21318 sitearch='$sitearch'
21319 sitearchexp='$sitearchexp'
21320 sitebin='$sitebin'
21321 sitebinexp='$sitebinexp'
21322 sitehtml1dir='$sitehtml1dir'
21323 sitehtml1direxp='$sitehtml1direxp'
21324 sitehtml3dir='$sitehtml3dir'
21325 sitehtml3direxp='$sitehtml3direxp'
21326 sitelib='$sitelib'
21327 sitelib_stem='$sitelib_stem'
21328 sitelibexp='$sitelibexp'
21329 siteman1dir='$siteman1dir'
21330 siteman1direxp='$siteman1direxp'
21331 siteman3dir='$siteman3dir'
21332 siteman3direxp='$siteman3direxp'
21333 siteprefix='$siteprefix'
21334 siteprefixexp='$siteprefixexp'
21335 sitescript='$sitescript'
21336 sitescriptexp='$sitescriptexp'
21337 sizesize='$sizesize'
21338 sizetype='$sizetype'
21339 sleep='$sleep'
21340 smail='$smail'
21341 so='$so'
21342 sockethdr='$sockethdr'
21343 socketlib='$socketlib'
21344 socksizetype='$socksizetype'
21345 sort='$sort'
21346 spackage='$spackage'
21347 spitshell='$spitshell'
21348 srand48_r_proto='$srand48_r_proto'
21349 srandom_r_proto='$srandom_r_proto'
21350 src='$src'
21351 ssizetype='$ssizetype'
21352 startperl='$startperl'
21353 startsh='$startsh'
21354 static_ext='$static_ext'
21355 stdchar='$stdchar'
21356 stdio_base='$stdio_base'
21357 stdio_bufsiz='$stdio_bufsiz'
21358 stdio_cnt='$stdio_cnt'
21359 stdio_filbuf='$stdio_filbuf'
21360 stdio_ptr='$stdio_ptr'
21361 stdio_stream_array='$stdio_stream_array'
21362 strerror_r_proto='$strerror_r_proto'
21363 strings='$strings'
21364 submit='$submit'
21365 subversion='$subversion'
21366 sysman='$sysman'
21367 tail='$tail'
21368 tar='$tar'
21369 targetarch='$targetarch'
21370 tbl='$tbl'
21371 tee='$tee'
21372 test='$test'
21373 timeincl='$timeincl'
21374 timetype='$timetype'
21375 tmpnam_r_proto='$tmpnam_r_proto'
21376 to='$to'
21377 touch='$touch'
21378 tr='$tr'
21379 trnl='$trnl'
21380 troff='$troff'
21381 ttyname_r_proto='$ttyname_r_proto'
21382 u16size='$u16size'
21383 u16type='$u16type'
21384 u32size='$u32size'
21385 u32type='$u32type'
21386 u64size='$u64size'
21387 u64type='$u64type'
21388 u8size='$u8size'
21389 u8type='$u8type'
21390 uidformat='$uidformat'
21391 uidsign='$uidsign'
21392 uidsize='$uidsize'
21393 uidtype='$uidtype'
21394 uname='$uname'
21395 uniq='$uniq'
21396 uquadtype='$uquadtype'
21397 use5005threads='$use5005threads'
21398 use64bitall='$use64bitall'
21399 use64bitint='$use64bitint'
21400 usecrosscompile='$usecrosscompile'
21401 usedl='$usedl'
21402 usefaststdio='$usefaststdio'
21403 useithreads='$useithreads'
21404 uselargefiles='$uselargefiles'
21405 uselongdouble='$uselongdouble'
21406 usemallocwrap='$usemallocwrap'
21407 usemorebits='$usemorebits'
21408 usemultiplicity='$usemultiplicity'
21409 usemymalloc='$usemymalloc'
21410 usenm='$usenm'
21411 useopcode='$useopcode'
21412 useperlio='$useperlio'
21413 useposix='$useposix'
21414 usereentrant='$usereentrant'
21415 usesfio='$usesfio'
21416 useshrplib='$useshrplib'
21417 usesocks='$usesocks'
21418 usethreads='$usethreads'
21419 usevendorprefix='$usevendorprefix'
21420 usevfork='$usevfork'
21421 usrinc='$usrinc'
21422 uuname='$uuname'
21423 uvXUformat='$uvXUformat'
21424 uvoformat='$uvoformat'
21425 uvsize='$uvsize'
21426 uvtype='$uvtype'
21427 uvuformat='$uvuformat'
21428 uvxformat='$uvxformat'
21429 vendorarch='$vendorarch'
21430 vendorarchexp='$vendorarchexp'
21431 vendorbin='$vendorbin'
21432 vendorbinexp='$vendorbinexp'
21433 vendorhtml1dir='$vendorhtml1dir'
21434 vendorhtml1direxp='$vendorhtml1direxp'
21435 vendorhtml3dir='$vendorhtml3dir'
21436 vendorhtml3direxp='$vendorhtml3direxp'
21437 vendorlib='$vendorlib'
21438 vendorlib_stem='$vendorlib_stem'
21439 vendorlibexp='$vendorlibexp'
21440 vendorman1dir='$vendorman1dir'
21441 vendorman1direxp='$vendorman1direxp'
21442 vendorman3dir='$vendorman3dir'
21443 vendorman3direxp='$vendorman3direxp'
21444 vendorprefix='$vendorprefix'
21445 vendorprefixexp='$vendorprefixexp'
21446 vendorscript='$vendorscript'
21447 vendorscriptexp='$vendorscriptexp'
21448 version='$version'
21449 version_patchlevel_string='$version_patchlevel_string'
21450 versiononly='$versiononly'
21451 vi='$vi'
21452 voidflags='$voidflags'
21453 xlibpth='$xlibpth'
21454 yacc='$yacc'
21455 yaccflags='$yaccflags'
21456 zcat='$zcat'
21457 zip='$zip'
21458 EOT
21459
21460 : Add in command line options if available
21461 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21462
21463 : add special variables
21464 $test -f $src/patchlevel.h && \
21465 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21466 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21467 echo "PERL_CONFIG_SH=true" >>config.sh
21468
21469 : propagate old symbols
21470 if $test -f UU/config.sh; then
21471         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21472         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21473         $sort | $uniq -u >UU/oldsyms
21474         set X `cat UU/oldsyms`
21475         shift
21476         case $# in
21477         0) ;;
21478         *)
21479                 cat <<EOM
21480 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21481 EOM
21482                 echo "# Variables propagated from previous config.sh file." >>config.sh
21483                 for sym in `cat UU/oldsyms`; do
21484                         echo "    Propagating $hint variable "'$'"$sym..."
21485                         eval 'tmp="$'"${sym}"'"'
21486                         echo "$tmp" | \
21487                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21488                 done
21489                 ;;
21490         esac
21491 fi
21492
21493 : Finish up by extracting the .SH files
21494 case "$alldone" in
21495 exit)
21496         $rm -rf UU
21497         echo "Extraction done."
21498         exit 0
21499         ;;
21500 cont)
21501         ;;
21502 '')
21503         dflt=''
21504         nostick=true
21505         $cat <<EOM
21506
21507 If you'd like to make any changes to the config.sh file before I begin
21508 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21509
21510 EOM
21511         rp="Press return or use a shell escape to edit config.sh:"
21512         . UU/myread
21513         nostick=''
21514         case "$ans" in
21515         '') ;;
21516         *) : in case they cannot read
21517                 sh 1>&4 -c "$ans";;
21518         esac
21519         ;;
21520 esac
21521
21522 : if this fails, just run all the .SH files by hand
21523 . ./config.sh
21524
21525 echo " "
21526 exec 1>&4
21527 pwd=`pwd`
21528 . ./UU/extract
21529 cd "$pwd"
21530
21531 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21532         dflt=y
21533         case "$silent" in
21534         true) ;;
21535         *)
21536                 $cat <<EOM
21537
21538 Now you need to generate make dependencies by running "$make depend".
21539 You might prefer to run it in background: "$make depend > makedepend.out &"
21540 It can take a while, so you might not want to run it right now.
21541
21542 EOM
21543                 ;;
21544         esac
21545         rp="Run $make depend now?"
21546         . UU/myread
21547         case "$ans" in
21548         y*)
21549                 $make depend && echo "Now you must run '$make'."
21550                 ;;
21551         *)
21552                 echo "You must run '$make depend' then '$make'."
21553                 ;;
21554         esac
21555 elif test -f [Mm]akefile; then
21556         echo " "
21557         echo "Now you must run a $make."
21558 else
21559         echo "Configure done."
21560 fi
21561
21562 if $test -f Policy.sh; then
21563     $cat <<EOM
21564
21565 If you compile $package on a different machine or from a different object
21566 directory, copy the Policy.sh file from this object directory to the
21567 new one before you run Configure -- this will help you with most of
21568 the policy defaults.
21569
21570 EOM
21571 fi
21572 if $test -f config.msg; then
21573     echo "Hmm.  I also noted the following information while running:"
21574     echo " "
21575     $cat config.msg >&4
21576     $rm -f config.msg
21577 fi
21578 $rm -f kit*isdone ark*isdone
21579 $rm -rf UU
21580
21581 : End of Configure
21582