Add DECC to the symbol list
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue May 31 08:06:05 CEST 2005 [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_attribute_format=''
343 d_attribute_malloc=''
344 d_attribute_nonnull=''
345 d_attribute_noreturn=''
346 d_attribute_pure=''
347 d_attribute_unused=''
348 d_attribute_warn_unused_result=''
349 d_bcmp=''
350 d_bcopy=''
351 d_bzero=''
352 d_casti32=''
353 castflags=''
354 d_castneg=''
355 d_chown=''
356 d_chroot=''
357 d_chsize=''
358 d_class=''
359 d_closedir=''
360 d_void_closedir=''
361 d_cmsghdr_s=''
362 d_const=''
363 d_copysignl=''
364 cryptlib=''
365 d_crypt=''
366 crypt_r_proto=''
367 d_crypt_r=''
368 d_csh=''
369 full_csh=''
370 ctermid_r_proto=''
371 d_ctermid_r=''
372 ctime_r_proto=''
373 d_ctime_r=''
374 d_cuserid=''
375 d_dbl_dig=''
376 d_dbminitproto=''
377 d_difftime=''
378 d_dirfd=''
379 d_dlerror=''
380 d_dlopen=''
381 d_dlsymun=''
382 d_dosuid=''
383 d_suidsafe=''
384 d_drand48_r=''
385 drand48_r_proto=''
386 d_drand48proto=''
387 d_dup2=''
388 d_eaccess=''
389 d_endgrent=''
390 d_endgrent_r=''
391 endgrent_r_proto=''
392 d_endhent=''
393 d_endhostent_r=''
394 endhostent_r_proto=''
395 d_endnent=''
396 d_endnetent_r=''
397 endnetent_r_proto=''
398 d_endpent=''
399 d_endprotoent_r=''
400 endprotoent_r_proto=''
401 d_endpwent=''
402 d_endpwent_r=''
403 endpwent_r_proto=''
404 d_endsent=''
405 d_endservent_r=''
406 endservent_r_proto=''
407 d_faststdio=''
408 d_fchdir=''
409 d_fchmod=''
410 d_fchown=''
411 d_fcntl=''
412 d_fcntl_can_lock=''
413 d_fd_macros=''
414 d_fd_set=''
415 d_fds_bits=''
416 d_fgetpos=''
417 d_finite=''
418 d_finitel=''
419 d_flexfnam=''
420 d_flock=''
421 d_flockproto=''
422 d_fork=''
423 d_fp_class=''
424 d_fpclass=''
425 d_fpclassify=''
426 d_fpclassl=''
427 d_fpos64_t=''
428 d_frexpl=''
429 d_fs_data_s=''
430 d_fseeko=''
431 d_fsetpos=''
432 d_fstatfs=''
433 d_fsync=''
434 d_ftello=''
435 d_ftime=''
436 d_gettimeod=''
437 d_Gconvert=''
438 d_getcwd=''
439 d_getespwnam=''
440 d_getfsstat=''
441 d_getgrent=''
442 d_getgrent_r=''
443 getgrent_r_proto=''
444 d_getgrgid_r=''
445 getgrgid_r_proto=''
446 d_getgrnam_r=''
447 getgrnam_r_proto=''
448 d_getgrps=''
449 d_gethbyaddr=''
450 d_gethbyname=''
451 d_gethent=''
452 aphostname=''
453 d_gethname=''
454 d_phostname=''
455 d_uname=''
456 d_gethostbyaddr_r=''
457 gethostbyaddr_r_proto=''
458 d_gethostbyname_r=''
459 gethostbyname_r_proto=''
460 d_gethostent_r=''
461 gethostent_r_proto=''
462 d_gethostprotos=''
463 d_getitimer=''
464 d_getlogin=''
465 d_getlogin_r=''
466 getlogin_r_proto=''
467 d_getmnt=''
468 d_getmntent=''
469 d_getnbyaddr=''
470 d_getnbyname=''
471 d_getnent=''
472 d_getnetbyaddr_r=''
473 getnetbyaddr_r_proto=''
474 d_getnetbyname_r=''
475 getnetbyname_r_proto=''
476 d_getnetent_r=''
477 getnetent_r_proto=''
478 d_getnetprotos=''
479 d_getpagsz=''
480 d_getpent=''
481 d_getpgid=''
482 d_getpgrp2=''
483 d_bsdgetpgrp=''
484 d_getpgrp=''
485 d_getppid=''
486 d_getprior=''
487 d_getpbyname=''
488 d_getpbynumber=''
489 d_getprotobyname_r=''
490 getprotobyname_r_proto=''
491 d_getprotobynumber_r=''
492 getprotobynumber_r_proto=''
493 d_getprotoent_r=''
494 getprotoent_r_proto=''
495 d_getprotoprotos=''
496 d_getprpwnam=''
497 d_getpwent=''
498 d_getpwent_r=''
499 getpwent_r_proto=''
500 d_getpwnam_r=''
501 getpwnam_r_proto=''
502 d_getpwuid_r=''
503 getpwuid_r_proto=''
504 d_getsent=''
505 d_getservbyname_r=''
506 getservbyname_r_proto=''
507 d_getservbyport_r=''
508 getservbyport_r_proto=''
509 d_getservent_r=''
510 getservent_r_proto=''
511 d_getservprotos=''
512 d_getspnam=''
513 d_getspnam_r=''
514 getspnam_r_proto=''
515 d_getsbyname=''
516 d_getsbyport=''
517 d_gmtime_r=''
518 gmtime_r_proto=''
519 d_gnulibc=''
520 gnulibc_version=''
521 d_hasmntopt=''
522 d_htonl=''
523 d_ilogbl=''
524 d_inetaton=''
525 d_int64_t=''
526 d_isascii=''
527 d_isfinite=''
528 d_isinf=''
529 d_isnan=''
530 d_isnanl=''
531 d_killpg=''
532 d_lchown=''
533 d_ldbl_dig=''
534 d_libm_lib_version=''
535 d_link=''
536 d_localtime_r=''
537 localtime_r_proto=''
538 d_locconv=''
539 d_lockf=''
540 d_longdbl=''
541 longdblsize=''
542 d_longlong=''
543 longlongsize=''
544 d_lseekproto=''
545 d_lstat=''
546 d_madvise=''
547 d_mblen=''
548 d_mbstowcs=''
549 d_mbtowc=''
550 d_memchr=''
551 d_memcmp=''
552 d_memcpy=''
553 d_memmove=''
554 d_memset=''
555 d_mkdir=''
556 d_mkdtemp=''
557 d_mkfifo=''
558 d_mkstemp=''
559 d_mkstemps=''
560 d_mktime=''
561 d_mmap=''
562 mmaptype=''
563 d_modfl=''
564 d_modfl_pow32_bug=''
565 d_modflproto=''
566 d_mprotect=''
567 d_msg=''
568 d_msgctl=''
569 d_msgget=''
570 d_msghdr_s=''
571 d_msgrcv=''
572 d_msgsnd=''
573 d_msync=''
574 d_munmap=''
575 d_nice=''
576 d_nl_langinfo=''
577 d_off64_t=''
578 d_open3=''
579 d_fpathconf=''
580 d_pathconf=''
581 d_pause=''
582 d_pipe=''
583 d_poll=''
584 d_portable=''
585 d_procselfexe=''
586 procselfexe=''
587 d_old_pthread_create_joinable=''
588 old_pthread_create_joinable=''
589 d_pthread_atfork=''
590 d_pthread_attr_setscope=''
591 d_pthread_yield=''
592 d_sched_yield=''
593 sched_yield=''
594 d_qgcvt=''
595 d_random_r=''
596 random_r_proto=''
597 d_readdir64_r=''
598 readdir64_r_proto=''
599 d_readdir=''
600 d_rewinddir=''
601 d_seekdir=''
602 d_telldir=''
603 d_readdir_r=''
604 readdir_r_proto=''
605 d_readlink=''
606 d_readv=''
607 d_recvmsg=''
608 d_rename=''
609 d_rmdir=''
610 d_safebcpy=''
611 d_safemcpy=''
612 d_sanemcmp=''
613 d_sbrkproto=''
614 d_scalbnl=''
615 d_select=''
616 d_sem=''
617 d_semctl=''
618 d_semget=''
619 d_semop=''
620 d_sendmsg=''
621 d_setegid=''
622 d_seteuid=''
623 d_setgrent=''
624 d_setgrent_r=''
625 setgrent_r_proto=''
626 d_setgrps=''
627 d_sethent=''
628 d_sethostent_r=''
629 sethostent_r_proto=''
630 d_setitimer=''
631 d_setlinebuf=''
632 d_setlocale=''
633 d_setlocale_r=''
634 setlocale_r_proto=''
635 d_setnent=''
636 d_setnetent_r=''
637 setnetent_r_proto=''
638 d_setpent=''
639 d_setpgid=''
640 d_setpgrp2=''
641 d_bsdsetpgrp=''
642 d_setpgrp=''
643 d_setprior=''
644 d_setproctitle=''
645 d_setprotoent_r=''
646 setprotoent_r_proto=''
647 d_setpwent=''
648 d_setpwent_r=''
649 setpwent_r_proto=''
650 d_setregid=''
651 d_setresgid=''
652 d_setresuid=''
653 d_setreuid=''
654 d_setrgid=''
655 d_setruid=''
656 d_setsent=''
657 d_setservent_r=''
658 setservent_r_proto=''
659 d_setsid=''
660 d_setvbuf=''
661 d_sfio=''
662 usesfio=''
663 d_shm=''
664 d_shmat=''
665 d_shmatprototype=''
666 shmattype=''
667 d_shmctl=''
668 d_shmdt=''
669 d_shmget=''
670 d_sigaction=''
671 d_sigprocmask=''
672 d_sigsetjmp=''
673 usesitecustomize=''
674 d_sockatmark=''
675 d_sockatmarkproto=''
676 d_msg_ctrunc=''
677 d_msg_dontroute=''
678 d_msg_oob=''
679 d_msg_peek=''
680 d_msg_proxy=''
681 d_oldsock=''
682 d_scm_rights=''
683 d_socket=''
684 d_sockpair=''
685 sockethdr=''
686 socketlib=''
687 d_socklen_t=''
688 d_socks5_init=''
689 d_sqrtl=''
690 d_srand48_r=''
691 srand48_r_proto=''
692 d_srandom_r=''
693 srandom_r_proto=''
694 d_sresgproto=''
695 d_sresuproto=''
696 d_statblks=''
697 d_statfs_f_flags=''
698 d_statfs_s=''
699 d_fstatvfs=''
700 d_statvfs=''
701 d_stdio_cnt_lval=''
702 d_stdio_ptr_lval=''
703 d_stdio_ptr_lval_nochange_cnt=''
704 d_stdio_ptr_lval_sets_cnt=''
705 d_stdiobase=''
706 d_stdstdio=''
707 stdio_base=''
708 stdio_bufsiz=''
709 stdio_cnt=''
710 stdio_filbuf=''
711 stdio_ptr=''
712 d_index=''
713 d_strchr=''
714 d_strcoll=''
715 d_strctcpy=''
716 d_strerrm=''
717 d_strerror=''
718 d_sysernlst=''
719 d_syserrlst=''
720 d_strerror_r=''
721 strerror_r_proto=''
722 d_strftime=''
723 d_strlcat=''
724 d_strlcpy=''
725 d_strtod=''
726 d_strtol=''
727 d_strtold=''
728 d_strtoll=''
729 d_strtoq=''
730 d_strtoul=''
731 d_strtoull=''
732 d_strtouq=''
733 d_strxfrm=''
734 d_symlink=''
735 d_syscall=''
736 d_syscallproto=''
737 d_sysconf=''
738 d_system=''
739 d_tcgetpgrp=''
740 d_tcsetpgrp=''
741 d_telldirproto=''
742 d_time=''
743 timetype=''
744 clocktype=''
745 d_times=''
746 d_tmpnam_r=''
747 tmpnam_r_proto=''
748 d_truncate=''
749 d_ttyname_r=''
750 ttyname_r_proto=''
751 d_tzname=''
752 d_u32align=''
753 d_ualarm=''
754 d_umask=''
755 d_semctl_semid_ds=''
756 d_semctl_semun=''
757 d_union_semun=''
758 d_unordered=''
759 d_usleep=''
760 d_usleepproto=''
761 d_ustat=''
762 d_vfork=''
763 usevfork=''
764 d_voidsig=''
765 signal_t=''
766 d_volatile=''
767 d_charvspr=''
768 d_vprintf=''
769 d_wait4=''
770 d_waitpid=''
771 d_wcstombs=''
772 d_wctomb=''
773 d_writev=''
774 dlext=''
775 cccdlflags=''
776 ccdlflags=''
777 dlsrc=''
778 ld=''
779 lddlflags=''
780 usedl=''
781 doublesize=''
782 ebcdic=''
783 fflushNULL=''
784 fflushall=''
785 fpossize=''
786 fpostype=''
787 gccansipedantic=''
788 gccosandvers=''
789 gccversion=''
790 gidformat=''
791 gidsign=''
792 gidsize=''
793 gidtype=''
794 groupstype=''
795 h_fcntl=''
796 h_sysfile=''
797 html1dir=''
798 html1direxp=''
799 installhtml1dir=''
800 html3dir=''
801 html3direxp=''
802 installhtml3dir=''
803 i_arpainet=''
804 i_crypt=''
805 db_hashtype=''
806 db_prefixtype=''
807 db_version_major=''
808 db_version_minor=''
809 db_version_patch=''
810 i_db=''
811 i_dbm=''
812 i_rpcsvcdbm=''
813 d_dirnamlen=''
814 direntrytype=''
815 i_dirent=''
816 i_dld=''
817 i_dlfcn=''
818 i_fcntl=''
819 i_float=''
820 i_fp=''
821 i_fp_class=''
822 i_gdbm=''
823 d_grpasswd=''
824 i_grp=''
825 i_ieeefp=''
826 i_inttypes=''
827 i_langinfo=''
828 i_libutil=''
829 i_limits=''
830 i_locale=''
831 i_machcthr=''
832 i_malloc=''
833 i_math=''
834 i_memory=''
835 i_mntent=''
836 i_ndbm=''
837 i_netdb=''
838 i_neterrno=''
839 i_netinettcp=''
840 i_niin=''
841 i_sysin=''
842 i_poll=''
843 i_prot=''
844 i_pthread=''
845 d_pwage=''
846 d_pwchange=''
847 d_pwclass=''
848 d_pwcomment=''
849 d_pwexpire=''
850 d_pwgecos=''
851 d_pwpasswd=''
852 d_pwquota=''
853 i_pwd=''
854 i_sfio=''
855 i_shadow=''
856 i_socks=''
857 i_stddef=''
858 i_stdlib=''
859 i_string=''
860 strings=''
861 i_sunmath=''
862 i_sysaccess=''
863 i_sysdir=''
864 i_sysfile=''
865 d_voidtty=''
866 i_bsdioctl=''
867 i_sysfilio=''
868 i_sysioctl=''
869 i_syssockio=''
870 i_syslog=''
871 i_sysmman=''
872 i_sysmode=''
873 i_sysmount=''
874 i_sysndir=''
875 i_sysparam=''
876 i_sysresrc=''
877 i_syssecrt=''
878 i_sysselct=''
879 i_sysstat=''
880 i_sysstatfs=''
881 i_sysstatvfs=''
882 i_systimes=''
883 i_systypes=''
884 i_sysuio=''
885 i_sysun=''
886 i_sysutsname=''
887 i_sysvfs=''
888 i_syswait=''
889 i_sgtty=''
890 i_termio=''
891 i_termios=''
892 d_tm_tm_gmtoff=''
893 d_tm_tm_zone=''
894 i_systime=''
895 i_systimek=''
896 i_time=''
897 timeincl=''
898 i_unistd=''
899 i_ustat=''
900 i_utime=''
901 i_values=''
902 i_stdarg=''
903 i_varargs=''
904 i_varhdr=''
905 i_vfork=''
906 inc_version_list=''
907 inc_version_list_init=''
908 installprefix=''
909 installprefixexp=''
910 installstyle=''
911 installusrbinperl=''
912 intsize=''
913 longsize=''
914 shortsize=''
915 issymlink=''
916 libc=''
917 ldlibpthname=''
918 libperl=''
919 shrpenv=''
920 useshrplib=''
921 glibpth=''
922 libpth=''
923 loclibpth=''
924 plibpth=''
925 xlibpth=''
926 ignore_versioned_solibs=''
927 libs=''
928 libsdirs=''
929 libsfiles=''
930 libsfound=''
931 libspath=''
932 lns=''
933 d_PRIEUldbl=''
934 d_PRIFUldbl=''
935 d_PRIGUldbl=''
936 d_PRIeldbl=''
937 d_PRIfldbl=''
938 d_PRIgldbl=''
939 d_SCNfldbl=''
940 sPRIEUldbl=''
941 sPRIFUldbl=''
942 sPRIGUldbl=''
943 sPRIeldbl=''
944 sPRIfldbl=''
945 sPRIgldbl=''
946 sSCNfldbl=''
947 lseeksize=''
948 lseektype=''
949 make_set_make=''
950 d_mymalloc=''
951 freetype=''
952 mallocobj=''
953 mallocsrc=''
954 malloctype=''
955 usemallocwrap=''
956 usemymalloc=''
957 installman1dir=''
958 man1dir=''
959 man1direxp=''
960 man1ext=''
961 installman3dir=''
962 man3dir=''
963 man3direxp=''
964 man3ext=''
965 modetype=''
966 multiarch=''
967 mydomain=''
968 myhostname=''
969 phostname=''
970 c=''
971 n=''
972 d_eofnblk=''
973 eagain=''
974 o_nonblock=''
975 rd_nodata=''
976 need_va_copy=''
977 netdb_hlen_type=''
978 netdb_host_type=''
979 netdb_name_type=''
980 netdb_net_type=''
981 groupcat=''
982 hostcat=''
983 passcat=''
984 orderlib=''
985 ranlib=''
986 d_perl_otherlibdirs=''
987 otherlibdirs=''
988 package=''
989 spackage=''
990 pager=''
991 api_revision=''
992 api_subversion=''
993 api_version=''
994 api_versionstring=''
995 patchlevel=''
996 perl_patchlevel=''
997 revision=''
998 subversion=''
999 version=''
1000 version_patchlevel_string=''
1001 perl5=''
1002 perladmin=''
1003 perlpath=''
1004 d_nv_preserves_uv=''
1005 i16size=''
1006 i16type=''
1007 i32size=''
1008 i32type=''
1009 i64size=''
1010 i64type=''
1011 i8size=''
1012 i8type=''
1013 ivsize=''
1014 ivtype=''
1015 nv_preserves_uv_bits=''
1016 nvsize=''
1017 nvtype=''
1018 u16size=''
1019 u16type=''
1020 u32size=''
1021 u32type=''
1022 u64size=''
1023 u64type=''
1024 u8size=''
1025 u8type=''
1026 uvsize=''
1027 uvtype=''
1028 ivdformat=''
1029 nvEUformat=''
1030 nvFUformat=''
1031 nvGUformat=''
1032 nveformat=''
1033 nvfformat=''
1034 nvgformat=''
1035 uvXUformat=''
1036 uvoformat=''
1037 uvuformat=''
1038 uvxformat=''
1039 pidtype=''
1040 prefix=''
1041 prefixexp=''
1042 installprivlib=''
1043 privlib=''
1044 privlibexp=''
1045 prototype=''
1046 ptrsize=''
1047 d_PRIXU64=''
1048 d_PRId64=''
1049 d_PRIi64=''
1050 d_PRIo64=''
1051 d_PRIu64=''
1052 d_PRIx64=''
1053 sPRIXU64=''
1054 sPRId64=''
1055 sPRIi64=''
1056 sPRIo64=''
1057 sPRIu64=''
1058 sPRIx64=''
1059 d_quad=''
1060 quadkind=''
1061 quadtype=''
1062 uquadtype=''
1063 drand01=''
1064 randbits=''
1065 randfunc=''
1066 randseedtype=''
1067 seedfunc=''
1068 installscript=''
1069 scriptdir=''
1070 scriptdirexp=''
1071 selectminbits=''
1072 selecttype=''
1073 sh=''
1074 sig_count=''
1075 sig_name=''
1076 sig_name_init=''
1077 sig_num=''
1078 sig_num_init=''
1079 sig_size=''
1080 installsitearch=''
1081 sitearch=''
1082 sitearchexp=''
1083 installsitebin=''
1084 sitebin=''
1085 sitebinexp=''
1086 installsitehtml1dir=''
1087 sitehtml1dir=''
1088 sitehtml1direxp=''
1089 installsitehtml3dir=''
1090 sitehtml3dir=''
1091 sitehtml3direxp=''
1092 installsitelib=''
1093 sitelib=''
1094 sitelib_stem=''
1095 sitelibexp=''
1096 installsiteman1dir=''
1097 siteman1dir=''
1098 siteman1direxp=''
1099 installsiteman3dir=''
1100 siteman3dir=''
1101 siteman3direxp=''
1102 siteprefix=''
1103 siteprefixexp=''
1104 installsitescript=''
1105 sitescript=''
1106 sitescriptexp=''
1107 sizesize=''
1108 sizetype=''
1109 so=''
1110 socksizetype=''
1111 sharpbang=''
1112 shsharp=''
1113 spitshell=''
1114 src=''
1115 ssizetype=''
1116 startperl=''
1117 startsh=''
1118 stdchar=''
1119 d_stdio_stream_array=''
1120 stdio_stream_array=''
1121 sysman=''
1122 trnl=''
1123 uidformat=''
1124 uidsign=''
1125 uidsize=''
1126 uidtype=''
1127 archname64=''
1128 use64bitall=''
1129 use64bitint=''
1130 usefaststdio=''
1131 ccflags_uselargefiles=''
1132 ldflags_uselargefiles=''
1133 libswanted_uselargefiles=''
1134 uselargefiles=''
1135 uselongdouble=''
1136 usemorebits=''
1137 usemultiplicity=''
1138 nm_opt=''
1139 nm_so_opt=''
1140 runnm=''
1141 usenm=''
1142 useperlio=''
1143 userelocatableinc=''
1144 usesocks=''
1145 d_oldpthreads=''
1146 use5005threads=''
1147 useithreads=''
1148 usereentrant=''
1149 usethreads=''
1150 incpath=''
1151 mips_type=''
1152 usrinc=''
1153 d_vendorarch=''
1154 installvendorarch=''
1155 vendorarch=''
1156 vendorarchexp=''
1157 d_vendorbin=''
1158 installvendorbin=''
1159 vendorbin=''
1160 vendorbinexp=''
1161 installvendorhtml1dir=''
1162 vendorhtml1dir=''
1163 vendorhtml1direxp=''
1164 installvendorhtml3dir=''
1165 vendorhtml3dir=''
1166 vendorhtml3direxp=''
1167 d_vendorlib=''
1168 installvendorlib=''
1169 vendorlib=''
1170 vendorlib_stem=''
1171 vendorlibexp=''
1172 installvendorman1dir=''
1173 vendorman1dir=''
1174 vendorman1direxp=''
1175 installvendorman3dir=''
1176 vendorman3dir=''
1177 vendorman3direxp=''
1178 usevendorprefix=''
1179 vendorprefix=''
1180 vendorprefixexp=''
1181 d_vendorscript=''
1182 installvendorscript=''
1183 vendorscript=''
1184 vendorscriptexp=''
1185 versiononly=''
1186 defvoidused=''
1187 voidflags=''
1188 yacc=''
1189 yaccflags=''
1190 CONFIG=''
1191
1192 define='define'
1193 undef='undef'
1194 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1195 rmlist=''
1196
1197 : We must find out about Eunice early
1198 eunicefix=':'
1199 if test -f /etc/unixtovms; then
1200         eunicefix=/etc/unixtovms
1201 fi
1202 if test -f /etc/unixtovms.exe; then
1203         eunicefix=/etc/unixtovms.exe
1204 fi
1205
1206 : Set executable suffix now -- needed before hints available
1207 if test -f "/libs/version.library"; then
1208 : Amiga OS
1209     _exe=""
1210 elif test -f "/system/gnu_library/bin/ar.pm"; then
1211 : Stratus VOS
1212     _exe=".pm"
1213 elif test -n "$DJGPP"; then
1214 : DOS DJGPP
1215     _exe=".exe"
1216 elif test -d c:/. -o -n "$is_os2" ; then
1217 : OS/2 or cygwin
1218     _exe=".exe"
1219 fi
1220
1221 i_whoami=''
1222 ccname=''
1223 ccversion=''
1224 perllibs=''
1225 : set useposix=false in your hint file to disable the POSIX extension.
1226 useposix=true
1227 : set useopcode=false in your hint file to disable the Opcode extension.
1228 useopcode=true
1229 : Trailing extension.  Override this in a hint file, if needed.
1230 : Extra object files, if any, needed on this platform.
1231 archobjs=''
1232 archname=''
1233 : Possible local include directories to search.
1234 : Set locincpth to "" in a hint file to defeat local include searches.
1235 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1236 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1237 :
1238 : no include file wanted by default
1239 inclwanted=''
1240
1241 groupstype=''
1242 libnames=''
1243 : change the next line if compiling for Xenix/286 on Xenix/386
1244 xlibpth='/usr/lib/386 /lib/386'
1245 : Possible local library directories to search.
1246 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1247 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1248
1249 : general looking path for locating libraries
1250 glibpth="/lib /usr/lib $xlibpth"
1251 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1252 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1253 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1254
1255 : Private path used by Configure to find libraries.  Its value
1256 : is prepended to libpth. This variable takes care of special
1257 : machines, like the mips.  Usually, it should be empty.
1258 plibpth=''
1259
1260 : default library list
1261 libswanted=''
1262 : some systems want to use only the non-versioned libso:s
1263 ignore_versioned_solibs=''
1264 siteman1dir=''
1265 siteman3dir=''
1266 sitescript=''
1267 archname64=''
1268 ccflags_uselargefiles=''
1269 ldflags_uselargefiles=''
1270 libswanted_uselargefiles=''
1271 : set usemultiplicity on the Configure command line to enable multiplicity.
1272 : set usesocks on the Configure command line to enable socks.
1273 : set usethreads on the Configure command line to enable threads.
1274 usereentrant='undef'
1275 : full support for void wanted by default
1276 defvoidused=15
1277
1278 : List of libraries we want.
1279 : If anyone needs extra -lxxx, put those in a hint file.
1280 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1281 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1282 : We probably want to search /usr/shlib before most other libraries.
1283 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1284 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1285 glibpth="/usr/shlib $glibpth"
1286 : Do not use vfork unless overridden by a hint file.
1287 usevfork=false
1288
1289 : Find the basic shell for Bourne shell scripts
1290 case "$sh" in
1291 '')
1292         case "$SYSTYPE" in
1293         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1294         *) xxx='/bin/sh';;
1295         esac
1296         if test -f "$xxx"; then
1297                 sh="$xxx"
1298         else
1299                 : Build up a list and do a single loop so we can 'break' out.
1300                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1301                 for xxx in sh bash ksh pdksh ash; do
1302                         for p in $pth; do
1303                                 try="$try ${p}/${xxx}"
1304                         done
1305                 done
1306                 for xxx in $try; do
1307                         if test -f "$xxx"; then
1308                                 sh="$xxx";
1309                                 break
1310                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1311                                 sh="$xxx";
1312                                 break
1313                         elif test -f "$xxx.exe"; then
1314                                 sh="$xxx";
1315                                 break
1316                         fi
1317                 done
1318         fi
1319         ;;
1320 esac
1321
1322 case "$sh" in
1323 '')     cat >&2 <<EOM
1324 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1325
1326 Usually it's in /bin/sh.  How did you even get this far?
1327 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1328 we'll try to straighten this all out.
1329 EOM
1330         exit 1
1331         ;;
1332 esac
1333
1334 : see if sh knows # comments
1335 if `$sh -c '#' >/dev/null 2>&1`; then
1336         shsharp=true
1337         spitshell=cat
1338         xcat=/bin/cat
1339         test -f $xcat$_exe || xcat=/usr/bin/cat
1340         if test ! -f $xcat$_exe; then
1341                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1342                         if test -f $p/cat$_exe; then
1343                                 xcat=$p/cat
1344                                 break
1345                         fi
1346                 done
1347                 if test ! -f $xcat$_exe; then
1348                         echo "Can't find cat anywhere!"
1349                         exit 1
1350                 fi
1351         fi
1352         echo "#!$xcat" >sharp
1353         $eunicefix sharp
1354         chmod +x sharp
1355         ./sharp > today
1356         if test -s today; then
1357                 sharpbang='#!'
1358         else
1359                 echo "#! $xcat" > sharp
1360                 $eunicefix sharp
1361                 chmod +x sharp
1362                 ./sharp > today
1363                 if test -s today; then
1364                         sharpbang='#! '
1365                 else
1366                         sharpbang=': use '
1367                 fi
1368         fi
1369 else
1370         echo " "
1371         echo "Your $sh doesn't grok # comments--I will strip them later on."
1372         shsharp=false
1373         cd ..
1374         echo "exec grep -v '^[  ]*#'" >spitshell
1375         chmod +x spitshell
1376         $eunicefix spitshell
1377         spitshell=`pwd`/spitshell
1378         cd UU
1379         echo "I presume that if # doesn't work, #! won't work either!"
1380         sharpbang=': use '
1381 fi
1382 rm -f sharp today
1383
1384 : figure out how to guarantee sh startup
1385 case "$startsh" in
1386 '') startsh=${sharpbang}${sh} ;;
1387 *)
1388 esac
1389 cat >sharp <<EOSS
1390 $startsh
1391 set abc
1392 test "$?abc" != 1
1393 EOSS
1394
1395 chmod +x sharp
1396 $eunicefix sharp
1397 if ./sharp; then
1398         : echo "Yup, it does."
1399 else
1400         echo "Hmm... '$startsh' does not guarantee sh startup..."
1401         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1402 fi
1403 rm -f sharp
1404
1405
1406 : Save command line options in file UU/cmdline.opt for later use in
1407 : generating config.sh.
1408 cat > cmdline.opt <<EOSH
1409 # Configure command line arguments.
1410 config_arg0='$0'
1411 config_args='$*'
1412 config_argc=$#
1413 EOSH
1414 argn=1
1415 args_exp=''
1416 args_sep=''
1417 for arg in "$@"; do
1418         cat >>cmdline.opt <<EOSH
1419 config_arg$argn='$arg'
1420 EOSH
1421         # Extreme backslashitis: replace each ' by '"'"'
1422         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1423 $arg
1424 EOC
1425         arg_exp=`cat cmdl.opt`
1426         args_exp="$args_exp$args_sep'$arg_exp'"
1427         argn=`expr $argn + 1`
1428         args_sep=' '
1429 done
1430 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1431 # used by ./hints/os2.sh
1432 rm -f cmdl.opt
1433
1434 : produce awk script to parse command line options
1435 cat >options.awk <<'EOF'
1436 BEGIN {
1437         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1438
1439         len = length(optstr);
1440         for (i = 1; i <= len; i++) {
1441                 c = substr(optstr, i, 1);
1442                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1443                 if (a == ":") {
1444                         arg[c] = 1;
1445                         i++;
1446                 }
1447                 opt[c] = 1;
1448         }
1449 }
1450 {
1451         expect = 0;
1452         str = $0;
1453         if (substr(str, 1, 1) != "-") {
1454                 printf("'%s'\n", str);
1455                 next;
1456         }
1457         len = length($0);
1458         for (i = 2; i <= len; i++) {
1459                 c = substr(str, i, 1);
1460                 if (!opt[c]) {
1461                         printf("-%s\n", substr(str, i));
1462                         next;
1463                 }
1464                 printf("-%s\n", c);
1465                 if (arg[c]) {
1466                         if (i < len)
1467                                 printf("'%s'\n", substr(str, i + 1));
1468                         else
1469                                 expect = 1;
1470                         next;
1471                 }
1472         }
1473 }
1474 END {
1475         if (expect)
1476                 print "?";
1477 }
1478 EOF
1479
1480 : process the command line options
1481 set X `for arg in "$@"; do echo "X$arg"; done |
1482         sed -e s/X// | awk -f options.awk`
1483 eval "set $*"
1484 shift
1485 rm -f options.awk
1486
1487 : set up default values
1488 fastread=''
1489 reuseval=false
1490 config_sh=''
1491 alldone=''
1492 error=''
1493 silent=''
1494 extractsh=''
1495 override=''
1496 knowitall=''
1497 rm -f optdef.sh posthint.sh
1498 cat >optdef.sh <<EOS
1499 $startsh
1500 EOS
1501
1502
1503 : option parsing
1504 while test $# -gt 0; do
1505         case "$1" in
1506         -d) shift; fastread=yes;;
1507         -e) shift; alldone=cont;;
1508         -f)
1509                 shift
1510                 cd ..
1511                 if test -r "$1"; then
1512                         config_sh="$1"
1513                 else
1514                         echo "$me: cannot read config file $1." >&2
1515                         error=true
1516                 fi
1517                 cd UU
1518                 shift;;
1519         -h) shift; error=true;;
1520         -r) shift; reuseval=true;;
1521         -s) shift; silent=true; realsilent=true;;
1522         -E) shift; alldone=exit;;
1523         -K) shift; knowitall=true;;
1524         -O) shift; override=true;;
1525         -S) shift; silent=true; extractsh=true;;
1526         -D)
1527                 shift
1528                 case "$1" in
1529                 *=)
1530                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1531                         echo "$me: ignoring -D $1" >&2
1532                         ;;
1533                 *=*) echo "$1" | \
1534                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1535                 *) echo "$1='define'" >> optdef.sh;;
1536                 esac
1537                 shift
1538                 ;;
1539         -U)
1540                 shift
1541                 case "$1" in
1542                 *=) echo "$1" >> optdef.sh;;
1543                 *=*)
1544                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1545                         echo "$me: ignoring -U $1" >&2
1546                         ;;
1547                 *) echo "$1='undef'" >> optdef.sh;;
1548                 esac
1549                 shift
1550                 ;;
1551         -A)
1552             shift
1553             xxx=''
1554             yyy="$1"
1555             zzz=''
1556             uuu=undef
1557             case "$yyy" in
1558             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1559                  case "$zzz" in
1560                  *:*) zzz='' ;;
1561                  *)   xxx=append
1562                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1563                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1564                  esac
1565                  ;;
1566             esac
1567             case "$xxx" in
1568             '')  case "$yyy" in
1569                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1570                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1571                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1572                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1573                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1574                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1575                  esac
1576                  ;;       
1577             esac
1578             case "$xxx" in
1579             append)
1580                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1581             clear)
1582                 echo "$yyy=''"                  >> posthint.sh ;;
1583             define)
1584                 case "$zzz" in
1585                 '') zzz=define ;;
1586                 esac
1587                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1588             eval)
1589                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1590             prepend)
1591                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1592             undef)
1593                 case "$zzz" in
1594                 '') zzz="$uuu" ;;
1595                 esac
1596                 echo "$yyy=$zzz"                >> posthint.sh ;;
1597             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1598             esac
1599             shift
1600             ;;
1601         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1602             exit 0;;
1603         --) break;;
1604         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1605         *) break;;
1606         esac
1607 done
1608
1609 case "$error" in
1610 true)
1611         cat >&2 <<EOM
1612 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1613                  [-U symbol] [-U symbol=] [-A command:symbol...]
1614   -d : use defaults for all answers.
1615   -e : go on without questioning past the production of config.sh.
1616   -f : specify an alternate default configuration file.
1617   -h : print this help message and exit (with an error status).
1618   -r : reuse C symbols value if possible (skips costly nm extraction).
1619   -s : silent mode, only echoes questions and essential information.
1620   -D : define symbol to have some value:
1621          -D symbol         symbol gets the value 'define'
1622          -D symbol=value   symbol gets the value 'value'
1623   -E : stop at the end of questions, after having produced config.sh.
1624   -K : do not use unless you know what you are doing.
1625   -O : let -D and -U override definitions from loaded configuration file.
1626   -S : perform variable substitutions on all .SH files (can mix with -f)
1627   -U : undefine symbol:
1628          -U symbol    symbol gets the value 'undef'
1629          -U symbol=   symbol gets completely empty
1630   -A : manipulate symbol after the platform specific hints have been applied:
1631          -A symbol=value                append " "value to symbol
1632          -A append:symbol=value         append value to symbol
1633          -A define:symbol=value         define symbol to have value
1634          -A clear:symbol                define symbol to be ''
1635          -A define:symbol               define symbol to be 'define'
1636          -A eval:symbol=value           define symbol to be eval of value
1637          -A prepend:symbol=value        prepend value to symbol
1638          -A undef:symbol                define symbol to be 'undef'
1639          -A undef:symbol=               define symbol to be ''
1640   -V : print version number and exit (with a zero status).
1641 EOM
1642         exit 1
1643         ;;
1644 esac
1645
1646 : Sanity checks
1647 case "$fastread$alldone" in
1648 yescont|yesexit) ;;
1649 *)
1650         case "$extractsh" in
1651         true) ;;
1652         *)
1653                 if test ! -t 0; then
1654                         echo "Say 'sh Configure', not 'sh <Configure'"
1655                         exit 1
1656                 fi
1657                 ;;
1658         esac
1659         ;;
1660 esac
1661
1662 exec 4>&1
1663 case "$silent" in
1664 true) exec 1>/dev/null;;
1665 esac
1666
1667 : run the defines and the undefines, if any, but leave the file out there...
1668 touch optdef.sh
1669 . ./optdef.sh
1670 : create the posthint manipulation script and leave the file out there...
1671 touch posthint.sh
1672
1673 : set package name
1674 package=perl5
1675 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1676 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1677 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1678 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1679 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1680 esac
1681
1682 : Some greps do not return status, grrr.
1683 echo "grimblepritz" >grimble
1684 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1685         contains=contains
1686 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1687         contains=grep
1688 else
1689         contains=contains
1690 fi
1691 rm -f grimble
1692 : the following should work in any shell
1693 case "$contains" in
1694 contains*)
1695         echo " "
1696         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1697         cat >contains <<'EOSS'
1698 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1699 EOSS
1700 chmod +x contains
1701 esac
1702
1703 : Find the path to the source tree
1704 case "$src" in
1705 '') case "$0" in
1706     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1707          case "$src" in
1708          /*)    ;;
1709          .)     ;;
1710          *)     src=`cd ../$src && pwd` ;;
1711          esac
1712          ;;
1713     *)   src='.';;
1714     esac;;
1715 esac
1716 case "$src" in
1717 '')     src=/
1718         rsrc=/
1719         ;;
1720 /*) rsrc="$src";;
1721 *) rsrc="../$src";;
1722 esac
1723 if test -f $rsrc/Configure && \
1724         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1725 then
1726    : found it, so we are ok.
1727 else
1728         rsrc=''
1729         for src in . .. ../.. ../../.. ../../../..; do
1730                 if test -f ../$src/Configure && \
1731                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1732                 then
1733                         rsrc=../$src
1734                         break
1735                 fi
1736         done
1737 fi
1738 case "$rsrc" in
1739 '')
1740         cat <<EOM >&4
1741
1742 Sorry, I can't seem to locate the source dir for $package.  Please start
1743 Configure with an explicit path -- i.e. /some/path/Configure.
1744
1745 EOM
1746         exit 1
1747         ;;
1748 ../.)   rsrc='..';;
1749 *)
1750         echo " "
1751         echo "Sources for $package found in \"$src\"." >&4
1752         ;;
1753 esac
1754
1755 : script used to extract .SH files with variable substitutions
1756 cat >extract <<'EOS'
1757 PERL_CONFIG_SH=true
1758 echo "Doing variable substitutions on .SH files..."
1759 if test -f MANIFEST; then
1760         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1761 else
1762         echo "(Looking for .SH files under the source directory.)"
1763         set x `(cd "$src"; find . -name "*.SH" -print)`
1764 fi
1765 shift
1766 case $# in
1767 0) set x `(cd "$src"; echo *.SH)`; shift;;
1768 esac
1769 if test ! -f "$src/$1"; then
1770         shift
1771 fi
1772 mkdir_p='
1773 name=$1;
1774 create="";
1775 while test $name; do
1776         if test ! -d "$name"; then
1777                 create="$name $create";
1778                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1779                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1780         else
1781                 name="";
1782         fi;
1783 done;
1784 for file in $create; do
1785         mkdir $file;
1786 done
1787 '
1788 for file in $*; do
1789         case "$src" in
1790         ".")
1791                 case "$file" in
1792                 */*)
1793                         dir=`expr X$file : 'X\(.*\)/'`
1794                         file=`expr X$file : 'X.*/\(.*\)'`
1795                         (cd "$dir" && . ./$file)
1796                         ;;
1797                 *)
1798                         . ./$file
1799                         ;;
1800                 esac
1801                 ;;
1802         *)
1803                 case "$file" in
1804                 */*)
1805                         dir=`expr X$file : 'X\(.*\)/'`
1806                         file=`expr X$file : 'X.*/\(.*\)'`
1807                         (set x $dir; shift; eval $mkdir_p)
1808                         sh <"$src/$dir/$file"
1809                         ;;
1810                 *)
1811                         sh <"$src/$file"
1812                         ;;
1813                 esac
1814                 ;;
1815         esac
1816 done
1817 if test -f "$src/config_h.SH"; then
1818         if test ! -f config.h; then
1819         : oops, they left it out of MANIFEST, probably, so do it anyway.
1820         . "$src/config_h.SH"
1821         fi
1822 fi
1823 EOS
1824
1825 : extract files and exit if asked to do so
1826 case "$extractsh" in
1827 true)
1828         case "$realsilent" in
1829         true) ;;
1830         *) exec 1>&4;;
1831         esac
1832         case "$config_sh" in
1833         '') config_sh='config.sh';;
1834         esac
1835         echo " "
1836         echo "Fetching answers from $config_sh..."
1837         cd ..
1838         . $config_sh
1839         test "$override" && . ./optdef.sh
1840         echo " "
1841         . UU/extract
1842         rm -rf UU
1843         echo "Extraction done."
1844         exit 0
1845         ;;
1846 esac
1847
1848 : Eunice requires " " instead of "", can you believe it
1849 echo " "
1850 : Here we go...
1851 echo "Beginning of configuration questions for $package."
1852
1853 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1854
1855 : first determine how to suppress newline on echo command
1856 echo " "
1857 echo "Checking echo to see how to suppress newlines..."
1858 (echo "hi there\c" ; echo " ") >.echotmp
1859 if $contains c .echotmp >/dev/null 2>&1 ; then
1860         echo "...using -n."
1861         n='-n'
1862         c=''
1863 else
1864         cat <<'EOM'
1865 ...using \c
1866 EOM
1867         n=''
1868         c='\c'
1869 fi
1870 echo $n "The star should be here-->$c"
1871 echo '*'
1872 rm -f .echotmp
1873
1874 : Now test for existence of everything in MANIFEST
1875 echo " "
1876 if test -f "$rsrc/MANIFEST"; then
1877         echo "First let's make sure your kit is complete.  Checking..." >&4
1878         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1879         rm -f missing
1880         tmppwd=`pwd`
1881         for filelist in x??; do
1882                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1883         done
1884         if test -s missing; then
1885                 cat missing >&4
1886                 cat >&4 <<'EOM'
1887
1888 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1889
1890 You have the option of continuing the configuration process, despite the
1891 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1892 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1893 and contact the author (perlbug@perl.org).
1894
1895 EOM
1896                 echo $n "Continue? [n] $c" >&4
1897                 read ans
1898                 case "$ans" in
1899                 y*)
1900                         echo "Continuing..." >&4
1901                         rm -f missing
1902                         ;;
1903                 *)
1904                         echo "ABORTING..." >&4
1905                         kill $$
1906                         ;;
1907                 esac
1908         else
1909                 echo "Looks good..."
1910         fi
1911 else
1912         echo "There is no MANIFEST file.  I hope your kit is complete !"
1913 fi
1914 rm -f missing x??
1915
1916 echo " "
1917 : Find the appropriate value for a newline for tr
1918 if test -n "$DJGPP"; then
1919        trnl='\012'
1920 fi
1921 if test X"$trnl" = X; then
1922         case "`echo foo|tr '\n' x 2>/dev/null`" in
1923         foox) trnl='\n' ;;
1924         esac
1925 fi
1926 if test X"$trnl" = X; then
1927         case "`echo foo|tr '\012' x 2>/dev/null`" in
1928         foox) trnl='\012' ;;
1929         esac
1930 fi
1931 if test X"$trnl" = X; then
1932        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1933        fooxy) trnl='\n\r' ;;
1934        esac
1935 fi
1936 if test X"$trnl" = X; then
1937         cat <<EOM >&2
1938
1939 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1940
1941 EOM
1942         exit 1
1943 fi
1944
1945 : compute the number of columns on the terminal for proper question formatting
1946 case "$COLUMNS" in
1947 '') COLUMNS='80';;
1948 esac
1949
1950 : set up the echo used in my read
1951 myecho="case \"\$xxxm\" in
1952 '') echo $n \"\$rp $c\" >&4;;
1953 *) case \"\$rp\" in
1954         '') echo $n \"[\$xxxm] $c\";;
1955         *)
1956                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1957                         echo \"\$rp\" >&4
1958                         echo $n \"[\$xxxm] $c\" >&4
1959                 else
1960                         echo $n \"\$rp [\$xxxm] $c\" >&4
1961                 fi
1962                 ;;
1963         esac;;
1964 esac"
1965
1966 : now set up to do reads with possible shell escape and default assignment
1967 cat <<EOSC >myread
1968 $startsh
1969 xxxm=\$dflt
1970 $myecho
1971 ans='!'
1972 case "\$fastread" in
1973 yes) case "\$dflt" in
1974         '') ;;
1975         *) ans='';
1976                 case "\$silent-\$rp" in
1977                 true-) ;;
1978                 *) echo " " >&4;;
1979                 esac;;
1980         esac;;
1981 *) case "\$silent" in
1982         true) case "\$rp" in
1983                 '') ans='';;
1984                 esac;;
1985         esac;;
1986 esac
1987 while expr "X\$ans" : "X!" >/dev/null; do
1988         read answ
1989         set x \$xxxm
1990         shift
1991         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1992         case  "\$answ" in
1993         "!")
1994                 sh 1>&4
1995                 echo " "
1996                 $myecho
1997                 ;;
1998         !*)
1999                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2000                 shift
2001                 sh 1>&4 -c "\$*"
2002                 echo " "
2003                 $myecho
2004                 ;;
2005         "\$ans")
2006                 case "\$ans" in
2007                 \\&*)
2008                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2009                         shift
2010                         case "\$1" in
2011                         -d)
2012                                 fastread=yes
2013                                 echo "(OK, I'll run with -d after this question.)" >&4
2014                                 ;;
2015                         -*)
2016                                 echo "*** Sorry, \$1 not supported yet." >&4
2017                                 ;;
2018                         esac
2019                         $myecho
2020                         ans=!
2021                         ;;
2022                 esac;;
2023         *)
2024                 case "\$aok" in
2025                 y)
2026                         echo "*** Substitution done -- please confirm."
2027                         xxxm="\$ans"
2028                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2029                         xxxm="\$ans"
2030                         ans=!
2031                         ;;
2032                 *)
2033                         echo "*** Error -- try again."
2034                         ans=!
2035                         ;;
2036                 esac
2037                 $myecho
2038                 ;;
2039         esac
2040         case "\$ans\$xxxm\$nostick" in
2041         '')
2042                 ans=!
2043                 $myecho
2044                 ;;
2045         esac
2046 done
2047 case "\$ans" in
2048 '') ans="\$xxxm";;
2049 esac
2050 EOSC
2051
2052 : create .config dir to save info across Configure sessions
2053 test -d ../.config || mkdir ../.config
2054 cat >../.config/README <<EOF
2055 This directory created by Configure to save information that should
2056 persist across sessions for $package.
2057
2058 You may safely delete it if you wish.
2059 EOF
2060
2061 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2062 case "$usedevel" in
2063 $define|true|[yY]*) ;;
2064 *) case "$xversion" in
2065    *[13579])
2066         cat >&4 <<EOH
2067 *** WHOA THERE!!! ***
2068
2069     This is an UNSTABLE DEVELOPMENT release.
2070     The version of this $package distribution is $xversion, that is, odd,
2071     (as opposed to even) and that signifies a development release.
2072     If you want a maintenance release, you want an even-numbered version.
2073
2074     Do ***NOT*** install this into production use.
2075     Data corruption and crashes are possible.
2076
2077     It is most seriously suggested that you do not continue any further
2078     unless you want to help in developing and debugging Perl.
2079
2080     If you *still* want to build perl, you can answer 'y' now,
2081     or pass -Dusedevel to Configure.
2082
2083 EOH
2084         rp='Do you really want to continue?'
2085         dflt='n'
2086         . ./myread
2087         case "$ans" in
2088         [yY]) echo >&4 "Okay, continuing."
2089               usedevel="$define" ;;
2090         *) echo >&4 "Okay, bye."
2091            exit 1
2092            ;;
2093         esac
2094         ;;
2095     esac
2096     ;;
2097 esac
2098 case "$usedevel" in
2099 $define|true|[yY]*)
2100         case "$versiononly" in
2101         '') versiononly="$define" ;;
2102         esac
2103         case "$installusrbinperl" in
2104         '') installusrbinperl="$undef" ;;
2105         esac
2106         ;;
2107 esac
2108
2109 : general instructions
2110 needman=true
2111 firsttime=true
2112 user=`(logname) 2>/dev/null`
2113 case "$user" in
2114 '') user=`whoami 2>&1`;;
2115 esac
2116 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2117         firsttime=false
2118         echo " "
2119         rp='Would you like to see the instructions?'
2120         dflt=n
2121         . ./myread
2122         case "$ans" in
2123         [yY]*) ;;
2124         *) needman=false;;
2125         esac
2126 fi
2127 if $needman; then
2128         cat <<EOH
2129
2130 This installation shell script will examine your system and ask you questions
2131 to determine how the perl5 package should be installed. If you get
2132 stuck on a question, you may use a ! shell escape to start a subshell or
2133 execute a command.  Many of the questions will have default answers in square
2134 brackets; typing carriage return will give you the default.
2135
2136 On some of the questions which ask for file or directory names you are allowed
2137 to use the ~name construct to specify the login directory belonging to "name",
2138 even if you don't have a shell which knows about that.  Questions where this is
2139 allowed will be marked "(~name ok)".
2140
2141 EOH
2142         rp=''
2143         dflt='Type carriage return to continue'
2144         . ./myread
2145         cat <<'EOH'
2146
2147 The prompter used in this script allows you to use shell variables and
2148 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2149 in the default answer, as if the default line was a set of arguments given to a
2150 script shell.  This means you may also use $* to repeat the whole default line,
2151 so you do not have to re-type everything to add something to the default.
2152
2153 Everytime there is a substitution, you will have to confirm.  If there is an
2154 error (e.g. an unmatched backtick), the default answer will remain unchanged
2155 and you will be prompted again.
2156
2157 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2158 the questions and use the computed defaults (or the previous answers if there
2159 was already a config.sh file). Type 'Configure -h' for a list of options.
2160 You may also start interactively and then answer '& -d' at any prompt to turn
2161 on the non-interactive behaviour for the remainder of the execution.
2162
2163 EOH
2164         . ./myread
2165         cat <<EOH
2166
2167 Much effort has been expended to ensure that this shell script will run on any
2168 Unix system.  If despite that it blows up on yours, your best bet is to edit
2169 Configure and run it again.  If you can't run Configure for some reason,
2170 you'll have to generate a config.sh file by hand.  Whatever problems you
2171 have, let me (perlbug@perl.org) know how I blew it.
2172
2173 This installation script affects things in two ways:
2174
2175 1) it may do direct variable substitutions on some of the files included
2176    in this kit.
2177 2) it builds a config.h file for inclusion in C programs.  You may edit
2178    any of these files as the need arises after running this script.
2179
2180 If you make a mistake on a question, there is no easy way to back up to it
2181 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2182 files.  Configure will offer to let you do this before it runs the SH files.
2183
2184 EOH
2185         dflt='Type carriage return to continue'
2186         . ./myread
2187         case "$firsttime" in
2188         true) echo $user >>../.config/instruct;;
2189         esac
2190 fi
2191
2192 : find out where common programs are
2193 echo " "
2194 echo "Locating common programs..." >&4
2195 cat <<EOSC >loc
2196 $startsh
2197 case \$# in
2198 0) exit 1;;
2199 esac
2200 thing=\$1
2201 shift
2202 dflt=\$1
2203 shift
2204 for dir in \$*; do
2205         case "\$thing" in
2206         .)
2207         if test -d \$dir/\$thing; then
2208                 echo \$dir
2209                 exit 0
2210         fi
2211         ;;
2212         *)
2213         for thisthing in \$dir/\$thing; do
2214                 : just loop through to pick last item
2215         done
2216         if test -f \$thisthing; then
2217                 echo \$thisthing
2218                 exit 0
2219         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2220                 echo \$thisthing
2221                 exit 0
2222         elif test -f \$dir/\$thing.exe; then
2223                 if test -n "$DJGPP"; then
2224                         echo \$dir/\$thing.exe
2225                 elif test "$eunicefix" != ":"; then
2226                         : on Eunice apparently
2227                         echo \$dir/\$thing
2228                         exit 0
2229                 fi
2230                 exit 0
2231         fi
2232         ;;
2233         esac
2234 done
2235 echo \$dflt
2236 exit 1
2237 EOSC
2238 chmod +x loc
2239 $eunicefix loc
2240 loclist="
2241 awk
2242 cat
2243 chmod
2244 comm
2245 cp
2246 echo
2247 expr
2248 grep
2249 ls
2250 mkdir
2251 rm
2252 sed
2253 sort
2254 touch
2255 tr
2256 uniq
2257 "
2258 trylist="
2259 Mcc
2260 ar
2261 bison
2262 byacc
2263 cpp
2264 csh
2265 date
2266 egrep
2267 gmake
2268 gzip
2269 less
2270 ln
2271 make
2272 more
2273 nm
2274 nroff
2275 pg
2276 test
2277 uname
2278 zip
2279 "
2280 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2281 pth="$pth /lib /usr/lib"
2282 for file in $loclist; do
2283         eval xxx=\$$file
2284         case "$xxx" in
2285         /*|?:[\\/]*)
2286                 if test -f "$xxx"; then
2287                         : ok
2288                 else
2289                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2290                         xxx=`./loc $file $file $pth`
2291                 fi
2292                 ;;
2293         '') xxx=`./loc $file $file $pth`;;
2294         *) xxx=`./loc $xxx $xxx $pth`;;
2295         esac
2296         eval $file=$xxx$_exe
2297         eval _$file=$xxx
2298         case "$xxx" in
2299         /*)
2300                 echo $file is in $xxx.
2301                 ;;
2302         ?:[\\/]*)
2303                 echo $file is in $xxx.
2304                 ;;
2305         *)
2306                 echo "I don't know where '$file' is, and my life depends on it." >&4
2307                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2308                 exit 1
2309                 ;;
2310         esac
2311 done
2312 echo " "
2313 echo "Don't worry if any of the following aren't found..."
2314 say=offhand
2315 for file in $trylist; do
2316         eval xxx=\$$file
2317         case "$xxx" in
2318         /*|?:[\\/]*)
2319                 if test -f "$xxx"; then
2320                         : ok
2321                 else
2322                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2323                         xxx=`./loc $file $file $pth`
2324                 fi
2325                 ;;
2326         '') xxx=`./loc $file $file $pth`;;
2327         *) xxx=`./loc $xxx $xxx $pth`;;
2328         esac
2329         eval $file=$xxx$_exe
2330         eval _$file=$xxx
2331         case "$xxx" in
2332         /*)
2333                 echo $file is in $xxx.
2334                 ;;
2335         ?:[\\/]*)
2336                 echo $file is in $xxx.
2337                 ;;
2338         *)
2339                 echo "I don't see $file out there, $say."
2340                 say=either
2341                 ;;
2342         esac
2343 done
2344 case "$egrep" in
2345 egrep)
2346         echo "Substituting grep for egrep."
2347         egrep=$grep
2348         _egrep=$grep
2349         ;;
2350 esac
2351 case "$ln" in
2352 ln)
2353         echo "Substituting cp for ln."
2354         ln=$cp
2355         _ln=$cp
2356         ;;
2357 esac
2358 case "$make" in
2359 make)   
2360         case "$gmake" in
2361         gmake)
2362         echo "I can't find make or gmake, and my life depends on it." >&4
2363         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2364         exit 1
2365         ;;
2366         esac
2367         ;;
2368 esac    
2369 case "$gmake" in
2370 gmake)  ;;
2371 *)      # We can't have osname yet.
2372         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2373                 # Assume that gmake, if found, is definitely GNU make
2374                 # and prefer it over the system make.
2375                 echo "Substituting gmake for make."
2376                 make=$gmake
2377                 _make=$gmake
2378         fi
2379         ;;
2380 esac
2381 case "$test" in
2382 test)
2383         echo "Hopefully test is built into your sh."
2384         ;;
2385 *)
2386         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2387                 echo "Using the test built into your sh."
2388                 test=test
2389                 _test=test
2390         fi
2391         ;;
2392 esac
2393 case "$echo" in
2394 echo)
2395         echo "Hopefully echo is built into your sh."
2396         ;;
2397 '') ;;
2398 *)
2399         echo " "
2400 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2401         $echo $n "hi there$c" >foo1
2402         echo $n "hi there$c" >foo2
2403         if cmp foo1 foo2 >/dev/null 2>&1; then
2404                 echo "They are compatible.  In fact, they may be identical."
2405         else
2406                 case "$n" in
2407                 '-n') n='' c='\c';;
2408                 *) n='-n' c='';;
2409                 esac
2410                 cat <<FOO
2411 They are not compatible!  You are probably running ksh on a non-USG system.
2412 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2413 have echo built in and we may have to run some Bourne shell scripts.  That
2414 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2415
2416 FOO
2417                 $echo $n "The star should be here-->$c"
2418                 $echo "*"
2419         fi
2420         $rm -f foo1 foo2
2421         ;;
2422 esac
2423
2424 cat <<EOS >trygcc
2425 $startsh
2426 EOS
2427 cat <<'EOSC' >>trygcc
2428 case "$cc" in
2429 '') ;;
2430 *)  $rm -f try try.*
2431     $cat >try.c <<EOM
2432 int main(int argc, char *argv[]) {
2433   return 0;
2434 }
2435 EOM
2436     if $cc -o try $ccflags $ldflags try.c; then
2437        :
2438     else
2439         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2440         despair=yes
2441         trygcc=yes
2442         case "$cc" in
2443         *gcc*) trygcc=no ;;
2444         esac
2445         case "`$cc -v -c try.c 2>&1`" in
2446         *gcc*) trygcc=no ;;
2447         esac
2448         if $test X"$trygcc" = Xyes; then
2449             if gcc -o try -c try.c; then
2450                 echo " "
2451                 echo "You seem to have a working gcc, though." >&4
2452                 rp="Would you like to use it?"
2453                 dflt=y
2454                 if $test -f myread; then
2455                     . ./myread
2456                 else
2457                     if $test -f UU/myread; then
2458                         . ./UU/myread
2459                     else
2460                         echo "Cannot find myread, sorry.  Aborting." >&2
2461                         exit 1
2462                     fi
2463                 fi  
2464                 case "$ans" in
2465                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2466                        if $test -f usethreads.cbu; then
2467                            $cat >&4 <<EOM 
2468
2469 *** However, any setting of the C compiler flags (e.g. for thread support)
2470 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2471 *** (together with e.g. -Dusethreads).
2472
2473 EOM
2474                        fi;;
2475                 esac
2476             fi
2477         fi
2478     fi
2479     $rm -f try try.*
2480     ;;
2481 esac
2482 EOSC
2483
2484 cat <<EOS >checkcc
2485 $startsh
2486 EOS
2487 cat <<'EOSC' >>checkcc
2488 case "$cc" in        
2489 '') ;;
2490 *)  $rm -f try try.*              
2491     $cat >try.c <<EOM
2492 int main(int argc, char *argv[]) {
2493   return 0;
2494 }
2495 EOM
2496     if $cc -o try $ccflags $ldflags try.c; then
2497        :
2498     else
2499         if $test X"$despair" = Xyes; then
2500            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2501         fi
2502         $cat >&4 <<EOM         
2503 You need to find a working C compiler.
2504 Either (purchase and) install the C compiler supplied by your OS vendor,
2505 or for a free C compiler try http://gcc.gnu.org/
2506 I cannot continue any further, aborting.
2507 EOM
2508         exit 1
2509     fi
2510     $rm -f try try.*
2511     ;;
2512 esac
2513 EOSC
2514
2515 : determine whether symbolic links are supported
2516 echo " "
2517 $touch blurfl
2518 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2519         echo "Symbolic links are supported." >&4
2520         lns="$ln -s"
2521 else
2522         echo "Symbolic links are NOT supported." >&4
2523         lns="$ln"
2524 fi
2525 $rm -f blurfl sym
2526
2527 : determine whether symbolic links are supported
2528 echo " "
2529 case "$lns" in
2530 *"ln"*" -s")
2531         echo "Checking how to test for symbolic links..." >&4
2532         $lns blurfl sym
2533         if $test "X$issymlink" = X; then
2534                 case "$newsh" in
2535                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2536                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2537                 esac
2538                 if test $? = 0; then
2539                         issymlink="test -h"
2540                 else
2541                         echo "Your builtin 'test -h' may be broken." >&4
2542                         case "$test" in
2543                         /*)     ;;
2544                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2545                                 for p in $pth
2546                                 do
2547                                         if test -f "$p/$test"; then
2548                                                 test="$p/$test"
2549                                                 break
2550                                         fi
2551                                 done
2552                                 ;;
2553                         esac
2554                         case "$test" in
2555                         /*)
2556                                 echo "Trying external '$test -h'." >&4
2557                                 issymlink="$test -h"
2558                                 if $test ! -h sym >/dev/null 2>&1; then
2559                                         echo "External '$test -h' is broken, too." >&4
2560                                         issymlink=''
2561                                 fi
2562                                 ;;
2563                         *)      issymlink='' ;;
2564                         esac
2565                 fi              
2566         fi
2567         if $test "X$issymlink" = X; then
2568                 if $test -L sym 2>/dev/null; then
2569                         issymlink="$test -L"
2570                         echo "The builtin '$test -L' worked." >&4
2571                 fi
2572         fi
2573         if $test "X$issymlink" != X; then
2574                 echo "You can test for symbolic links with '$issymlink'." >&4
2575         else
2576                 echo "I do not know how you can test for symbolic links." >&4
2577         fi
2578         $rm -f blurfl sym
2579         ;;
2580 *)      echo "No symbolic links, so not testing for their testing..." >&4
2581         ;;
2582 esac
2583 echo " "
2584
2585
2586 case "$mksymlinks" in
2587 $define|true|[yY]*)
2588         case "$src" in
2589         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2590                 exit 1
2591                 ;;
2592         *)      case "$lns:$issymlink" in
2593                 *"ln"*" -s:"*"test -"?)
2594                         echo "Creating the symbolic links..." >&4
2595                         echo "(First creating the subdirectories...)" >&4
2596                         cd ..
2597                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2598                                 read directory
2599                                 test -z "$directory" && break
2600                                 mkdir -p $directory
2601                         done
2602                         # Sanity check 1.
2603                         if test ! -d t/base; then
2604                                 echo "Failed to create the subdirectories.  Aborting." >&4
2605                                 exit 1
2606                         fi
2607                         echo "(Then creating the symlinks...)" >&4
2608                         awk '{print $1}' $src/MANIFEST | while true; do
2609                                 read filename
2610                                 test -z "$filename" && break
2611                                 if test -f $filename; then
2612                                         if $issymlink $filename; then
2613                                                 rm -f $filename
2614                                         fi
2615                                 fi
2616                                 if test -f $filename; then
2617                                         echo "$filename already exists, not symlinking."
2618                                 else
2619                                         ln -s $src/$filename $filename
2620                                 fi
2621                         done
2622                         # Sanity check 2.
2623                         if test ! -f t/base/lex.t; then
2624                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2625                                 exit 1
2626                         fi
2627                         cd UU
2628                         ;;
2629                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2630                         ;;
2631                 esac
2632                 ;;
2633         esac
2634         ;;
2635 esac
2636
2637
2638 case "$usecrosscompile" in
2639 $define|true|[yY]*)
2640         $echo "Cross-compiling..."
2641         croak=''
2642         case "$cc" in
2643         *-*-gcc) # A cross-compiling gcc, probably.
2644             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2645             ar=$targetarch-ar
2646             # leave out ld, choosing it is more complex
2647             nm=$targetarch-nm
2648             ranlib=$targetarch-ranlib
2649             $echo 'extern int foo;' > try.c
2650             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2651             shift
2652             if $test $# -gt 0; then
2653                 incpth="$incpth $*"
2654                 incpth="`$echo $incpth|$sed 's/^ //'`"
2655                 echo "Guessing incpth '$incpth'." >&4
2656                 for i in $*; do
2657                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2658                     if $test -d $j; then
2659                         libpth="$libpth $j"
2660                     fi
2661                 done   
2662                 libpth="`$echo $libpth|$sed 's/^ //'`"
2663                 echo "Guessing libpth '$libpth'." >&4
2664             fi
2665             $rm -f try.c
2666             ;;
2667         esac
2668         case "$targetarch" in
2669         '') echo "Targetarch not defined." >&4; croak=y ;;
2670         *)  echo "Using targetarch $targetarch." >&4 ;;
2671         esac
2672         case "$incpth" in
2673         '') echo "Incpth not defined." >&4; croak=y ;;
2674         *)  echo "Using incpth '$incpth'." >&4 ;;
2675         esac
2676         case "$libpth" in
2677         '') echo "Libpth not defined." >&4; croak=y ;;
2678         *)  echo "Using libpth '$libpth'." >&4 ;;
2679         esac
2680         case "$usrinc" in
2681         '') for i in $incpth; do
2682                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2683                     usrinc=$i
2684                     echo "Guessing usrinc $usrinc." >&4
2685                     break
2686                 fi
2687             done
2688             case "$usrinc" in
2689             '') echo "Usrinc not defined." >&4; croak=y ;;
2690             esac
2691             ;;
2692         *)  echo "Using usrinc $usrinc." >&4 ;;
2693         esac
2694         case "$targethost" in
2695         '') echo "Targethost not defined." >&4; croak=y ;;
2696         *)  echo "Using targethost $targethost." >&4
2697         esac
2698         locincpth=' '
2699         loclibpth=' '
2700         case "$croak" in
2701         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2702         esac
2703         case "$src" in
2704         /*) run=$src/Cross/run
2705             targetmkdir=$src/Cross/mkdir
2706             to=$src/Cross/to
2707             from=$src/Cross/from
2708             ;;
2709         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2710             run=$pwd/Cross/run
2711             targetmkdir=$pwd/Cross/mkdir
2712             to=$pwd/Cross/to
2713             from=$pwd/Cross/from
2714             ;;
2715         esac
2716         case "$targetrun" in
2717         '') targetrun=ssh ;;
2718         esac
2719         case "$targetto" in
2720         '') targetto=scp ;;
2721         esac
2722         case "$targetfrom" in
2723         '') targetfrom=scp ;;
2724         esac
2725         run=$run-$targetrun
2726         to=$to-$targetto
2727         from=$from-$targetfrom
2728         case "$targetdir" in
2729         '')  targetdir=/tmp
2730              echo "Guessing targetdir $targetdir." >&4
2731              ;;
2732         esac
2733         case "$targetuser" in
2734         '')  targetuser=root
2735              echo "Guessing targetuser $targetuser." >&4
2736              ;;
2737         esac
2738         case "$targetfrom" in
2739         scp)    q=-q ;;
2740         *)      q='' ;;
2741         esac
2742         case "$targetrun" in
2743         ssh|rsh)
2744             cat >$run <<EOF
2745 #!/bin/sh
2746 case "\$1" in
2747 -cwd)
2748   shift
2749   cwd=\$1
2750   shift
2751   ;;
2752 esac
2753 case "\$cwd" in
2754 '') cwd=$targetdir ;;
2755 esac
2756 exe=\$1
2757 shift
2758 if $test ! -f \$exe.xok; then
2759   $to \$exe
2760   $touch \$exe.xok
2761 fi
2762 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2763 EOF
2764             ;;
2765         *)  echo "Unknown targetrun '$targetrun'" >&4
2766             exit 1
2767             ;;
2768         esac
2769         case "$targetmkdir" in
2770         */Cross/mkdir)
2771             cat >$targetmkdir <<EOF
2772 #!/bin/sh
2773 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2774 EOF
2775             $chmod a+rx $targetmkdir
2776             ;;
2777         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2778             exit 1
2779             ;;
2780         esac
2781         case "$targetto" in
2782         scp|rcp)
2783             cat >$to <<EOF
2784 #!/bin/sh
2785 for f in \$@
2786 do
2787   case "\$f" in
2788   /*)
2789     $targetmkdir \`dirname \$f\`
2790     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2791     ;;
2792   *)
2793     $targetmkdir $targetdir/\`dirname \$f\`
2794     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2795     ;;
2796   esac
2797 done
2798 exit 0
2799 EOF
2800             ;;
2801         cp) cat >$to <<EOF
2802 #!/bin/sh
2803 for f in \$@
2804 do
2805   case "\$f" in
2806   /*)
2807     $mkdir -p $targetdir/\`dirname \$f\`
2808     $cp \$f $targetdir/\$f || exit 1
2809     ;;
2810   *)
2811     $targetmkdir $targetdir/\`dirname \$f\`
2812     $cp \$f $targetdir/\$f || exit 1
2813     ;;
2814   esac
2815 done
2816 exit 0
2817 EOF
2818             ;;
2819         *)  echo "Unknown targetto '$targetto'" >&4
2820             exit 1
2821             ;;
2822         esac
2823         case "$targetfrom" in
2824         scp|rcp)
2825           cat >$from <<EOF
2826 #!/bin/sh
2827 for f in \$@
2828 do
2829   $rm -f \$f
2830   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2831 done
2832 exit 0
2833 EOF
2834             ;;
2835         cp) cat >$from <<EOF
2836 #!/bin/sh
2837 for f in \$@
2838 do
2839   $rm -f \$f
2840   cp $targetdir/\$f . || exit 1
2841 done
2842 exit 0
2843 EOF
2844             ;;
2845         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2846             exit 1
2847             ;;
2848         esac
2849         if $test ! -f $run; then
2850             echo "Target 'run' script '$run' not found." >&4
2851         else
2852             $chmod a+rx $run
2853         fi
2854         if $test ! -f $to; then
2855             echo "Target 'to' script '$to' not found." >&4
2856         else
2857             $chmod a+rx $to
2858         fi
2859         if $test ! -f $from; then
2860             echo "Target 'from' script '$from' not found." >&4
2861         else
2862             $chmod a+rx $from
2863         fi
2864         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2865             exit 1
2866         fi
2867         cat >&4 <<EOF
2868 Using '$run' for remote execution,
2869 and '$from' and '$to'
2870 for remote file transfer.
2871 EOF
2872         ;;
2873 *)      run=''
2874         to=:
2875         from=:
2876         usecrosscompile='undef'
2877         targetarch=''
2878         ;;
2879 esac
2880
2881 : see whether [:lower:] and [:upper:] are supported character classes
2882 echo " "
2883 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2884 ABYZ)
2885         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2886         up='[:upper:]'
2887         low='[:lower:]'
2888         ;;
2889 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2890         # (0xd9 and 0xe2), therefore that is a nice testing point.
2891         if test "X$up" = X -o "X$low" = X; then
2892             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2893             rs) up='[A-Z]'
2894                 low='[a-z]'
2895                 ;;
2896             esac
2897         fi
2898         if test "X$up" = X -o "X$low" = X; then
2899             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2900             rs) up='A-Z'
2901                 low='a-z'
2902                 ;;
2903             esac
2904         fi
2905         if test "X$up" = X -o "X$low" = X; then
2906             case "`echo RS | od -x 2>/dev/null`" in
2907             *D9E2*|*d9e2*)
2908                 echo "Hey, this might be EBCDIC." >&4
2909                 if test "X$up" = X -o "X$low" = X; then
2910                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2911                     rs) up='[A-IJ-RS-Z]'
2912                         low='[a-ij-rs-z]'
2913                         ;;
2914                     esac
2915                 fi
2916                 if test "X$up" = X -o "X$low" = X; then
2917                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2918                     rs) up='A-IJ-RS-Z'
2919                         low='a-ij-rs-z'
2920                         ;;
2921                     esac
2922                 fi
2923                 ;;
2924             esac
2925         fi
2926 esac
2927 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2928 rs)
2929     echo "Using $up and $low to convert case." >&4
2930     ;;
2931 *)
2932     echo "I don't know how to translate letters from upper to lower case." >&4
2933     echo "Your tr is not acting any way I know of." >&4
2934     exit 1
2935     ;;
2936 esac
2937 : set up the translation script tr, must be called with ./tr of course
2938 cat >tr <<EOSC
2939 $startsh
2940 case "\$1\$2" in
2941 '[A-Z][a-z]') exec $tr '$up' '$low';;
2942 '[a-z][A-Z]') exec $tr '$low' '$up';;
2943 esac
2944 exec $tr "\$@"
2945 EOSC
2946 chmod +x tr
2947 $eunicefix tr
2948
2949 : Try to determine whether config.sh was made on this system
2950 case "$config_sh" in
2951 '')
2952 myuname=`$uname -a 2>/dev/null`
2953 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2954 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2955 # because the A-Z/a-z are not consecutive.
2956 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2957         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2958 newmyuname="$myuname"
2959 dflt=n
2960 case "$knowitall" in
2961 '')
2962         if test -f ../config.sh; then
2963                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2964                         eval "`grep myuname= ../config.sh`"
2965                 fi
2966                 if test "X$myuname" = "X$newmyuname"; then
2967                         dflt=y
2968                 fi
2969         fi
2970         ;;
2971 *) dflt=y;;
2972 esac
2973
2974 : Get old answers from old config file if Configure was run on the
2975 : same system, otherwise use the hints.
2976 hint=default
2977 cd ..
2978 if test -f config.sh; then
2979         echo " "
2980         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2981         . UU/myread
2982         case "$ans" in
2983         n*|N*) echo "OK, I'll ignore it."
2984                 mv config.sh config.sh.old
2985                 myuname="$newmyuname"
2986                 ;;
2987         *)  echo "Fetching default answers from your old config.sh file..." >&4
2988                 tmp_n="$n"
2989                 tmp_c="$c"
2990                 tmp_sh="$sh"
2991                 . ./config.sh
2992                 cp config.sh UU
2993                 n="$tmp_n"
2994                 c="$tmp_c"
2995                 : Older versions did not always set $sh.  Catch re-use of such
2996                 : an old config.sh.
2997                 case "$sh" in
2998                 '') sh="$tmp_sh" ;;
2999                 esac
3000                 hint=previous
3001                 ;;
3002         esac
3003 fi
3004 . ./UU/checkcc
3005 if test ! -f config.sh; then
3006         $cat <<EOM
3007
3008 First time through, eh?  I have some defaults handy for some systems
3009 that need some extra help getting the Configure answers right:
3010
3011 EOM
3012         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3013         dflt=''
3014         : Half the following guesses are probably wrong... If you have better
3015         : tests or hints, please send them to perlbug@perl.org
3016         : The metaconfig authors would also appreciate a copy...
3017         $test -f /irix && osname=irix
3018         $test -f /xenix && osname=sco_xenix
3019         $test -f /dynix && osname=dynix
3020         $test -f /dnix && osname=dnix
3021         $test -f /lynx.os && osname=lynxos
3022         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3023         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3024         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3025         $test -f /bin/mips && /bin/mips && osname=mips
3026         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3027                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3028         $test -d /usr/apollo/bin && osname=apollo
3029         $test -f /etc/saf/_sactab && osname=svr4
3030         $test -d /usr/include/minix && osname=minix
3031         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3032         if $test -d /MachTen -o -d /MachTen_Folder; then
3033                 osname=machten
3034                 if $test -x /sbin/version; then
3035                         osvers=`/sbin/version | $awk '{print $2}' |
3036                         $sed -e 's/[A-Za-z]$//'`
3037                 elif $test -x /usr/etc/version; then
3038                         osvers=`/usr/etc/version | $awk '{print $2}' |
3039                         $sed -e 's/[A-Za-z]$//'`
3040                 else
3041                         osvers="$2.$3"
3042                 fi
3043         fi
3044
3045         $test -f /sys/posix.dll &&
3046                 $test -f /usr/bin/what &&
3047                 set X `/usr/bin/what /sys/posix.dll` &&
3048                 $test "$3" = UWIN &&
3049                 osname=uwin &&
3050                 osvers="$5"
3051
3052         if $test -f $uname; then
3053                 set X $myuname
3054                 shift
3055
3056                 case "$5" in
3057                 fps*) osname=fps ;;
3058                 mips*)
3059                         case "$4" in
3060                         umips) osname=umips ;;
3061                         *) osname=mips ;;
3062                         esac;;
3063                 [23]100) osname=mips ;;
3064                 next*) osname=next ;;
3065                 i386*)
3066                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3067                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3068                                 osname='sco'
3069                                 osvers=$tmp
3070                         elif $test -f /etc/kconfig; then
3071                                 osname=isc
3072                                 if test "$lns" = "$ln -s"; then
3073                                         osvers=4
3074                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3075                                         osvers=3
3076                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3077                                         osvers=2
3078                                 fi
3079                         fi
3080                         tmp=''
3081                         ;;
3082                 pc*)
3083                         if test -n "$DJGPP"; then
3084                                 osname=dos
3085                                 osvers=djgpp
3086                         fi
3087                         ;;
3088                 esac
3089
3090                 case "$1" in
3091                 aix) osname=aix
3092                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3093                         case "$tmp" in
3094                         # oslevel can fail with:
3095                         # oslevel: Unable to acquire lock.
3096                         *not\ found) osvers="$4"."$3" ;;
3097                         '<3240'|'<>3240') osvers=3.2.0 ;;
3098                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3099                         '=3250'|'>3250') osvers=3.2.5 ;;
3100                         *) osvers=$tmp;;
3101                         esac
3102                         ;;
3103                 bsd386) osname=bsd386
3104                         osvers=`$uname -r`
3105                         ;;
3106                 cygwin*) osname=cygwin
3107                         osvers="$3"
3108                         ;;
3109                 *dc.osx) osname=dcosx
3110                         osvers="$3"
3111                         ;;
3112                 dnix) osname=dnix
3113                         osvers="$3"
3114                         ;;
3115                 domainos) osname=apollo
3116                         osvers="$3"
3117                         ;;
3118                 dgux)   osname=dgux 
3119                         osvers="$3"
3120                         ;;
3121                 dynixptx*) osname=dynixptx
3122                         osvers=`echo "$4"|sed 's/^v//'`
3123                         ;;
3124                 freebsd) osname=freebsd 
3125                         osvers="$3" ;;
3126                 genix)  osname=genix ;;
3127                 gnu)    osname=gnu
3128                         osvers="$3" ;;
3129                 hp*)    osname=hpux 
3130                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3131                         ;;
3132                 irix*)  osname=irix
3133                         case "$3" in
3134                         4*) osvers=4 ;;
3135                         5*) osvers=5 ;;
3136                         *)      osvers="$3" ;;
3137                         esac
3138                         ;;
3139                 linux)  osname=linux
3140                         case "$3" in
3141                         *)      osvers="$3" ;;
3142                         esac
3143                         ;;
3144                 MiNT)   osname=mint
3145                         ;;
3146                 netbsd*) osname=netbsd
3147                         osvers="$3"
3148                         ;;
3149                 news-os) osvers="$3"
3150                         case "$3" in
3151                         4*) osname=newsos4 ;;
3152                         *) osname=newsos ;;
3153                         esac
3154                         ;;
3155                 next*) osname=next ;;
3156                 nonstop-ux) osname=nonstopux ;;
3157                 openbsd) osname=openbsd
3158                         osvers="$3"
3159                         ;;
3160                 os2)    osname=os2
3161                         osvers="$4"
3162                         ;;
3163                 POSIX-BC | posix-bc ) osname=posix-bc
3164                         osvers="$3"
3165                         ;;
3166                 powerux | power_ux | powermax_os | powermaxos | \
3167                 powerunix | power_unix) osname=powerux
3168                         osvers="$3"
3169                         ;;
3170                 qnx) osname=qnx
3171                         osvers="$4"
3172                         ;;
3173                 solaris) osname=solaris
3174                         case "$3" in
3175                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3176                         *)      osvers="$3" ;;
3177                         esac
3178                         ;;
3179                 sunos) osname=sunos
3180                         case "$3" in
3181                         5*) osname=solaris
3182                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3183                         *)      osvers="$3" ;;
3184                         esac
3185                         ;;
3186                 titanos) osname=titanos
3187                         case "$3" in
3188                         1*) osvers=1 ;;
3189                         2*) osvers=2 ;;
3190                         3*) osvers=3 ;;
3191                         4*) osvers=4 ;;
3192                         *)      osvers="$3" ;;
3193                         esac
3194                         ;;
3195                 ultrix) osname=ultrix
3196                         osvers="$3"
3197                         ;;
3198                 osf1|mls+)      case "$5" in
3199                                 alpha)
3200                                         osname=dec_osf
3201                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3202                                         case "$osvers" in
3203                                         [1-9].[0-9]*) ;;
3204                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3205                                         esac
3206                                         ;;
3207                         hp*)    osname=hp_osf1  ;;
3208                         mips)   osname=mips_osf1 ;;
3209                         esac
3210                         ;;
3211                 # UnixWare 7.1.2 is known as Open UNIX 8
3212                 openunix|unixware) osname=svr5
3213                         osvers="$4"
3214                         ;;
3215                 uts)    osname=uts
3216                         osvers="$3"
3217                         ;;
3218                 vos) osvers="$3"
3219                         ;;
3220                 $2) case "$osname" in
3221                         *isc*) ;;
3222                         *freebsd*) ;;
3223                         svr*)
3224                                 : svr4.x or possibly later
3225                                 case "svr$3" in 
3226                                 ${osname}*)
3227                                         osname=svr$3
3228                                         osvers=$4
3229                                         ;;
3230                                 esac
3231                                 case "$osname" in
3232                                 svr4.0)
3233                                         : Check for ESIX
3234                                         if test -f /stand/boot ; then
3235                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3236                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3237                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3238                                                         if test -n "$isesix"; then
3239                                                                 osname=esix4
3240                                                         fi
3241                                                 fi
3242                                         fi
3243                                         ;;
3244                                 esac
3245                                 ;;
3246                         *)      if test -f /etc/systemid; then
3247                                         osname=sco
3248                                         set `echo $3 | $sed 's/\./ /g'` $4
3249                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3250                                                 osvers=$1.$2.$3
3251                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3252                                                 osvers=$1.$2
3253                                         elif $test -f $src/hints/sco_$1.sh; then
3254                                                 osvers=$1
3255                                         fi
3256                                 else
3257                                         case "$osname" in
3258                                         '') : Still unknown.  Probably a generic Sys V.
3259                                                 osname="sysv"
3260                                                 osvers="$3"
3261                                                 ;;
3262                                         esac
3263                                 fi
3264                                 ;;
3265                         esac
3266                         ;;
3267                 *)      case "$osname" in
3268                         '') : Still unknown.  Probably a generic BSD.
3269                                 osname="$1"
3270                                 osvers="$3"
3271                                 ;;
3272                         esac
3273                         ;;
3274                 esac
3275         else
3276                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3277                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3278                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3279                                 osname=news_os
3280                         fi
3281                         $rm -f UU/kernel.what
3282                 elif test -d c:/. -o -n "$is_os2" ; then
3283                         set X $myuname
3284                         osname=os2
3285                         osvers="$5"
3286                 fi
3287         fi
3288         
3289         case "$targetarch" in
3290         '') ;;
3291         *)  hostarch=$osname
3292             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3293             osvers=''
3294             ;;
3295         esac
3296
3297         : Now look for a hint file osname_osvers, unless one has been
3298         : specified already.
3299         case "$hintfile" in
3300         ''|' ')
3301                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3302                 : Also try without trailing minor version numbers.
3303                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3304                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3305                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3306                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3307                 case "$file" in
3308                 '') dflt=none ;;
3309                 *)  case "$osvers" in
3310                         '') dflt=$file
3311                                 ;;
3312                         *)  if $test -f $src/hints/$file.sh ; then
3313                                         dflt=$file
3314                                 elif $test -f $src/hints/$xfile.sh ; then
3315                                         dflt=$xfile
3316                                 elif $test -f $src/hints/$xxfile.sh ; then
3317                                         dflt=$xxfile
3318                                 elif $test -f $src/hints/$xxxfile.sh ; then
3319                                         dflt=$xxxfile
3320                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3321                                         dflt=$xxxxfile
3322                                 elif $test -f "$src/hints/${osname}.sh" ; then
3323                                         dflt="${osname}"
3324                                 else
3325                                         dflt=none
3326                                 fi
3327                                 ;;
3328                         esac
3329                         ;;
3330                 esac
3331                 if $test -f Policy.sh ; then
3332                         case "$dflt" in
3333                         *Policy*) ;;
3334                         none) dflt="Policy" ;;
3335                         *) dflt="Policy $dflt" ;;
3336                         esac
3337                 fi
3338                 ;;
3339         *)
3340                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3341                 ;;
3342         esac
3343
3344         if $test -f Policy.sh ; then
3345                 $cat <<EOM
3346
3347 There's also a Policy hint file available, which should make the
3348 site-specific (policy) questions easier to answer.
3349 EOM
3350
3351         fi
3352
3353         $cat <<EOM
3354
3355 You may give one or more space-separated answers, or "none" if appropriate.
3356 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3357 is a good thing.  DO NOT give a wrong version or a wrong OS.
3358
3359 EOM
3360
3361         rp="Which of these apply, if any?"
3362         . UU/myread
3363         tans=$ans
3364         for file in $tans; do
3365                 if $test X$file = XPolicy -a -f Policy.sh; then
3366                         . Policy.sh
3367                         $cat Policy.sh >> UU/config.sh
3368                 elif $test -f $src/hints/$file.sh; then
3369                         . $src/hints/$file.sh
3370                         $cat $src/hints/$file.sh >> UU/config.sh
3371                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3372                         : nothing
3373                 else
3374                         : Give one chance to correct a possible typo.
3375                         echo "$file.sh does not exist"
3376                         dflt=$file
3377                         rp="hint to use instead?"
3378                         . UU/myread
3379                         for file in $ans; do
3380                                 if $test -f "$src/hints/$file.sh"; then
3381                                         . $src/hints/$file.sh
3382                                         $cat $src/hints/$file.sh >> UU/config.sh
3383                                 elif $test X$ans = X -o X$ans = Xnone ; then
3384                                         : nothing
3385                                 else
3386                                         echo "$file.sh does not exist -- ignored."
3387                                 fi
3388                         done
3389                 fi
3390         done
3391
3392         hint=recommended
3393         : Remember our hint file for later.
3394         if $test -f "$src/hints/$file.sh" ; then
3395                 hintfile="$file"
3396         else
3397                 hintfile=''
3398         fi
3399 fi
3400 cd UU
3401 ;;
3402 *)
3403         echo " "
3404         echo "Fetching default answers from $config_sh..." >&4
3405         tmp_n="$n"
3406         tmp_c="$c"
3407         cd ..
3408         cp $config_sh config.sh 2>/dev/null
3409         chmod +w config.sh
3410         . ./config.sh
3411         cd UU
3412         cp ../config.sh .
3413         n="$tmp_n"
3414         c="$tmp_c"
3415         hint=previous
3416         ;;
3417 esac
3418 test "$override" && . ./optdef.sh
3419
3420 : Restore computed paths
3421 for file in $loclist $trylist; do
3422         eval $file="\$_$file"
3423 done
3424
3425 cat << EOM
3426
3427 Configure uses the operating system name and version to set some defaults.
3428 The default value is probably right if the name rings a bell. Otherwise,
3429 since spelling matters for me, either accept the default or answer "none"
3430 to leave it blank.
3431
3432 EOM
3433 case "$osname" in
3434         ''|' ')
3435                 case "$hintfile" in
3436                 ''|' '|none) dflt=none ;;
3437                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3438                 esac
3439                 ;;
3440         *) dflt="$osname" ;;
3441 esac
3442 rp="Operating system name?"
3443 . ./myread
3444 case "$ans" in
3445 none)  osname='' ;;
3446 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3447 esac
3448 echo " "
3449 case "$osvers" in
3450         ''|' ')
3451                 case "$hintfile" in
3452                 ''|' '|none) dflt=none ;;
3453                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3454                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3455                         case "$dflt" in
3456                         ''|' ') dflt=none ;;
3457                         esac
3458                         ;;
3459                 esac
3460                 ;;
3461         *) dflt="$osvers" ;;
3462 esac
3463 rp="Operating system version?"
3464 . ./myread
3465 case "$ans" in
3466 none)  osvers='' ;;
3467 *) osvers="$ans" ;;
3468 esac
3469
3470
3471 . ./posthint.sh
3472
3473 : who configured the system
3474 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3475 case "$cf_by" in
3476 "")
3477         cf_by=`(logname) 2>/dev/null`
3478         case "$cf_by" in
3479         "")
3480                 cf_by=`(whoami) 2>/dev/null`
3481                 case "$cf_by" in
3482                 "") cf_by=unknown ;;
3483                 esac ;;
3484         esac ;;
3485 esac
3486
3487 : set up the script used to warn in case of inconsistency
3488 cat <<EOS >whoa
3489 $startsh
3490 EOS
3491 cat <<'EOSC' >>whoa
3492 dflt=y
3493 echo " "
3494 echo "*** WHOA THERE!!! ***" >&4
3495 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3496 rp="    Keep the $hint value?"
3497 . ./myread
3498 case "$ans" in
3499 y) td=$was; tu=$was;;
3500 esac
3501 EOSC
3502
3503 : function used to set $1 to $val
3504 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3505 case "$val$was" in
3506 $define$undef) . ./whoa; eval "$var=\$td";;
3507 $undef$define) . ./whoa; eval "$var=\$tu";;
3508 *) eval "$var=$val";;
3509 esac'
3510
3511 case "$usesocks" in
3512 $define|true|[yY]*)     dflt='y';;
3513 *) dflt='n';;
3514 esac
3515 cat <<EOM
3516
3517 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3518 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3519 to use the PerlIO abstraction layer, this will be implicitly selected.
3520
3521 If this doesn't make any sense to you, just accept the default '$dflt'.
3522 EOM
3523 rp='Build Perl for SOCKS?'
3524 . ./myread
3525 case "$ans" in
3526 y|Y)    val="$define" ;;     
3527 *)      val="$undef" ;;
3528 esac
3529 set usesocks
3530 eval $setvar
3531
3532 case "$usesocks" in
3533 $define|true|[yY]*) useperlio="$define";;
3534 esac
3535
3536 case "$useperlio" in
3537 $define|true|[yY]*|'')  dflt='y';;
3538 *) dflt='n';;
3539 esac
3540 cat <<EOM
3541
3542 Previous version of $package used the standard IO mechanisms as
3543 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3544 alternate IO mechanisms via the PerlIO abstraction layer, but the
3545 stdio mechanism is still available if needed.  The abstraction layer
3546 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3547 Using PerlIO with sfio may cause problems with some extension modules.
3548
3549 If this doesn't make any sense to you, just accept the default '$dflt'.
3550 EOM
3551 rp='Use the PerlIO abstraction layer?'
3552 . ./myread
3553 case "$ans" in
3554 y|Y) 
3555         val="$define"
3556         ;;
3557 *)      
3558         echo "Ok, doing things the stdio way."
3559         val="$undef"
3560         ;;
3561 esac
3562 set useperlio
3563 eval $setvar 
3564
3565 case "$usesocks" in
3566 $define|true|[yY]*)
3567         case "$useperlio" in
3568         $define|true|[yY]*) ;;
3569         *)      cat >&4 <<EOM
3570
3571 You are using the SOCKS proxy protocol library which means that you
3572 should also use the PerlIO layer.  You may be headed for trouble.
3573
3574 EOM
3575                 ;;
3576         esac
3577         ;;
3578 esac
3579
3580         
3581 case "$usethreads" in
3582 $define|true|[yY]*)     dflt='y';;
3583 *)     # Catch case where user specified ithreads or 5005threads but
3584        # forgot -Dusethreads (A.D. 4/2002)
3585        case "$useithreads$use5005threads" in
3586        *$define*)      
3587                 case "$useperlio" in
3588                 "$define")      dflt='y' ;;
3589                 *)              dflt='n' ;;
3590                 esac
3591                 ;;
3592        *)       dflt='n';;
3593        esac
3594        ;;
3595 esac
3596 cat <<EOM
3597
3598 Perl can be built to take advantage of threads on some systems.
3599 To do so, Configure can be run with -Dusethreads.
3600
3601 Note that Perl built with threading support runs slightly slower
3602 and uses more memory than plain Perl. The current implementation
3603 is believed to be stable, but it is fairly new, and so should be
3604 treated with caution.
3605
3606 If this doesn't make any sense to you, just accept the default '$dflt'.
3607 EOM
3608 rp='Build a threading Perl?'
3609 . ./myread
3610 case "$ans" in
3611 y|Y)    val="$define" ;;
3612 *)      val="$undef" ;;
3613 esac
3614 set usethreads
3615 eval $setvar
3616
3617 case "$usethreads" in
3618 $define)
3619         $cat <<EOM
3620
3621 Since release 5.6, Perl has had two different threading implementations,
3622 the newer interpreter-based version (ithreads) with one interpreter per
3623 thread, and the older 5.005 version (5005threads).
3624 The 5005threads version is effectively unmaintained and will probably be
3625 removed in Perl 5.10, so there should be no need to build a Perl using it
3626 unless needed for backwards compatibility with some existing 5.005threads
3627 code.
3628
3629 EOM
3630         : Default to ithreads unless overridden on command line or with
3631         : old config.sh
3632         dflt='y'
3633         case "$use5005threads" in
3634                 $define|true|[yY]*) dflt='n';;
3635         esac
3636         case "$useithreads" in
3637                 $undef|false|[nN]*) dflt='n';;
3638         esac
3639         rp='Use the newer interpreter-based ithreads?'
3640         . ./myread
3641         case "$ans" in
3642         y|Y)    val="$define" ;;
3643         *)      val="$undef" ;;
3644         esac
3645         set useithreads
3646         eval $setvar
3647         : Now set use5005threads to the opposite value.
3648         case "$useithreads" in
3649         $define) val="$undef" ;;
3650         *) val="$define" ;;
3651         esac
3652         set use5005threads
3653         eval $setvar
3654         ;;
3655 *)
3656         useithreads="$undef"
3657         use5005threads="$undef"
3658         ;;
3659 esac
3660
3661 case "$useithreads$use5005threads" in
3662 "$define$define")
3663         $cat >&4 <<EOM
3664
3665 You cannot have both the ithreads and the 5.005 threads enabled
3666 at the same time.  Disabling the 5.005 threads since they are
3667 much less stable than the ithreads.
3668
3669 EOM
3670         use5005threads="$undef"
3671         ;;
3672 esac
3673
3674 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3675         cat >&4 <<EOF
3676 ***
3677 *** To build with ithreads you must also use the PerlIO layer.
3678 *** Cannot continue, aborting.
3679 ***
3680 EOF
3681         exit 1
3682 fi
3683
3684 case "$d_oldpthreads" in
3685 '')     : Configure tests would be welcome here.  For now, assume undef.
3686         val="$undef" ;;
3687 *)      val="$d_oldpthreads" ;;
3688 esac
3689 set d_oldpthreads
3690 eval $setvar
3691
3692
3693 : Look for a hint-file generated 'call-back-unit'.  If the
3694 : user has specified that a threading perl is to be built,
3695 : we may need to set or change some other defaults.
3696 if $test -f usethreads.cbu; then
3697     echo "Your platform has some specific hints regarding threaded builds, using them..."
3698     . ./usethreads.cbu
3699 else
3700     case "$usethreads" in
3701         "$define"|true|[yY]*)
3702                 $cat <<EOM
3703 (Your platform does not have any specific hints for threaded builds.
3704  Assuming POSIX threads, then.)
3705 EOM
3706         ;;
3707     esac
3708 fi
3709
3710 cat <<EOM
3711
3712 Perl can be built so that multiple Perl interpreters can coexist
3713 within the same Perl executable.
3714 EOM
3715
3716 case "$useithreads" in
3717 $define)
3718         cat <<EOM
3719 This multiple interpreter support is required for interpreter-based threads.
3720 EOM
3721         val="$define"
3722         ;;
3723 *)      case "$usemultiplicity" in
3724         $define|true|[yY]*)     dflt='y';;
3725         *) dflt='n';;
3726         esac
3727         echo " "
3728         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3729         rp='Build Perl for multiplicity?'
3730         . ./myread
3731         case "$ans" in
3732         y|Y)    val="$define" ;;
3733         *)      val="$undef" ;;
3734         esac
3735         ;;
3736 esac
3737 set usemultiplicity
3738 eval $setvar
3739
3740
3741 case "$usemorebits" in
3742 "$define"|true|[yY]*)
3743         use64bitint="$define"
3744         uselongdouble="$define"
3745         usemorebits="$define"
3746         ;;
3747 *)      usemorebits="$undef"
3748         ;;
3749 esac
3750
3751 : make some quick guesses about what we are up against
3752 echo " "
3753 $echo $n "Hmm...  $c"
3754 echo exit 1 >bsd
3755 echo exit 1 >usg
3756 echo exit 1 >v7
3757 echo exit 1 >osf1
3758 echo exit 1 >eunice
3759 echo exit 1 >xenix
3760 echo exit 1 >venix
3761 echo exit 1 >os2
3762 d_bsd="$undef"
3763 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3764 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3765 then
3766         echo "Looks kind of like an OSF/1 system, but we'll see..."
3767         echo exit 0 >osf1
3768 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3769         xxx=`./loc addbib blurfl $pth`
3770         if $test -f $xxx; then
3771         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3772                 echo exit 0 >bsd
3773                 echo exit 0 >usg
3774         else
3775                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3776                         echo "Looks kind of like an extended USG system, but we'll see..."
3777                 else
3778                         echo "Looks kind of like a USG system, but we'll see..."
3779                 fi
3780                 echo exit 0 >usg
3781         fi
3782 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3783         echo "Looks kind of like a BSD system, but we'll see..."
3784         d_bsd="$define"
3785         echo exit 0 >bsd
3786 else
3787         echo "Looks kind of like a Version 7 system, but we'll see..."
3788         echo exit 0 >v7
3789 fi
3790 case "$eunicefix" in
3791 *unixtovms*)
3792         $cat <<'EOI'
3793 There is, however, a strange, musty smell in the air that reminds me of
3794 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3795 EOI
3796         echo exit 0 >eunice
3797         d_eunice="$define"
3798 : it so happens the Eunice I know will not run shell scripts in Unix format
3799         ;;
3800 *)
3801         echo " "
3802         echo "Congratulations.  You aren't running Eunice."
3803         d_eunice="$undef"
3804         ;;
3805 esac
3806 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3807 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3808 : semicolon as a patch separator
3809 case "$p_" in
3810 :) ;;
3811 *)
3812         $cat <<'EOI'
3813 I have the feeling something is not exactly right, however...don't tell me...
3814 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3815 (Or you may be running DOS with DJGPP.)
3816 EOI
3817         echo exit 0 >os2
3818         ;;
3819 esac
3820 if test -f /xenix; then
3821         echo "Actually, this looks more like a XENIX system..."
3822         echo exit 0 >xenix
3823         d_xenix="$define"
3824 else
3825         echo " "
3826         echo "It's not Xenix..."
3827         d_xenix="$undef"
3828 fi
3829 chmod +x xenix
3830 $eunicefix xenix
3831 if test -f /venix; then
3832         echo "Actually, this looks more like a VENIX system..."
3833         echo exit 0 >venix
3834 else
3835         echo " "
3836         if ./xenix; then
3837                 : null
3838         else
3839                 echo "Nor is it Venix..."
3840         fi
3841 fi
3842 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3843 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3844 $rm -f foo
3845
3846 case "$cc" in
3847 '') dflt=cc;;
3848 *) dflt="$cc";;
3849 esac
3850 rp="Use which C compiler?"
3851 . ./myread
3852 cc="$ans"
3853
3854 : See if they have not cc but they do have gcc
3855 . ./trygcc
3856 : Look for a hint-file generated 'call-back-unit'.  Now that the
3857 : user has specified the compiler, we may need to set or change some
3858 : other defaults.
3859 if $test -f cc.cbu; then
3860     . ./cc.cbu
3861 fi
3862 . ./checkcc
3863
3864 echo " "
3865 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3866 $cat >try.c <<EOM
3867 #include <stdio.h>
3868 int main() {
3869 #ifdef __GNUC__
3870 #ifdef __VERSION__
3871         printf("%s\n", __VERSION__);
3872 #else
3873         printf("%s\n", "1");
3874 #endif
3875 #endif
3876         return(0);
3877 }
3878 EOM
3879 if $cc -o try $ccflags $ldflags try.c; then
3880         gccversion=`$run ./try`
3881         case "$gccversion" in
3882         '') echo "You are not using GNU cc." ;;
3883         *)  echo "You are using GNU cc $gccversion."
3884             ccname=gcc
3885             ;;
3886         esac
3887 else
3888         echo " "
3889         echo "*** WHOA THERE!!! ***" >&4
3890         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3891         case "$knowitall" in
3892         '')
3893         echo "    You'd better start hunting for one and let me know about it." >&4
3894                 exit 1
3895                 ;;
3896         esac
3897 fi
3898 $rm -f try try.*
3899 case "$gccversion" in
3900 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3901 esac
3902 case "$gccversion" in
3903 '') gccosandvers='' ;;
3904 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3905    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3906    gccshortvers=''
3907    case "$gccosandvers" in
3908    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3909    $osname$osvers) ;; # looking good
3910    $osname*) cat <<EOM >&4
3911
3912 *** WHOA THERE!!! ***
3913
3914     Your gcc has not been compiled for the exact release of
3915     your operating system ($gccosandvers versus $osname$osvers).
3916
3917     In general it is a good idea to keep gcc synchronized with
3918     the operating system because otherwise serious problems
3919     may ensue when trying to compile software, like Perl.
3920
3921     I'm trying to be optimistic here, though, and will continue.
3922     If later during the configuration and build icky compilation
3923     problems appear (headerfile conflicts being the most common
3924     manifestation), I suggest reinstalling the gcc to match
3925     your operating system release.
3926
3927 EOM
3928       ;;
3929    *) gccosandvers='' ;; # failed to parse, better be silent
3930    esac
3931    ;;
3932 esac
3933 case "$ccname" in
3934 '') ccname="$cc" ;;
3935 esac
3936
3937 # gcc 3.* complain about adding -Idirectories that they already know about,
3938 # so we will take those off from locincpth.
3939 case "$gccversion" in
3940 3*)
3941     echo "main(){}">try.c
3942     for incdir in $locincpth; do
3943        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3944              grep '^c[cp]p*[01]: warning: changing search order '`
3945        if test "X$warn" != X; then
3946            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3947        fi
3948     done
3949     $rm -f try try.*
3950 esac
3951
3952 : decide how portable to be.  Allow command line overrides.
3953 case "$d_portable" in
3954 "$undef") ;;
3955 *)      d_portable="$define" ;;
3956 esac
3957
3958 : set up shell script to do ~ expansion
3959 cat >filexp <<EOSS
3960 $startsh
3961 : expand filename
3962 case "\$1" in
3963  ~/*|~)
3964         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3965         ;;
3966  ~*)
3967         if $test -f /bin/csh; then
3968                 /bin/csh -f -c "glob \$1"
3969                 failed=\$?
3970                 echo ""
3971                 exit \$failed
3972         else
3973                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3974                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3975                 if $test ! -d "\$dir"; then
3976                         me=\`basename \$0\`
3977                         echo "\$me: can't locate home directory for: \$name" >&2
3978                         exit 1
3979                 fi
3980                 case "\$1" in
3981                 */*)
3982                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3983                         ;;
3984                 *)
3985                         echo \$dir
3986                         ;;
3987                 esac
3988         fi
3989         ;;
3990 *)
3991         echo \$1
3992         ;;
3993 esac
3994 EOSS
3995 chmod +x filexp
3996 $eunicefix filexp
3997
3998 : now set up to get a file name
3999 cat <<EOS >getfile
4000 $startsh
4001 EOS
4002 cat <<'EOSC' >>getfile
4003 tilde=''
4004 fullpath=''
4005 already=''
4006 skip=''
4007 none_ok=''
4008 exp_file=''
4009 nopath_ok=''
4010 orig_rp="$rp"
4011 orig_dflt="$dflt"
4012 case "$gfpth" in
4013 '') gfpth='.' ;;
4014 esac
4015
4016 case "$fn" in
4017 *\(*)
4018         : getfile will accept an answer from the comma-separated list
4019         : enclosed in parentheses even if it does not meet other criteria.
4020         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4021         fn=`echo $fn | sed 's/(.*)//'`
4022         ;;
4023 esac
4024
4025 case "$fn" in
4026 *:*)
4027         loc_file=`expr $fn : '.*:\(.*\)'`
4028         fn=`expr $fn : '\(.*\):.*'`
4029         ;;
4030 esac
4031
4032 case "$fn" in
4033 *~*) tilde=true;;
4034 esac
4035 case "$fn" in
4036 */*) fullpath=true;;
4037 esac
4038 case "$fn" in
4039 *+*) skip=true;;
4040 esac
4041 case "$fn" in
4042 *n*) none_ok=true;;
4043 esac
4044 case "$fn" in
4045 *e*) exp_file=true;;
4046 esac
4047 case "$fn" in
4048 *p*) nopath_ok=true;;
4049 esac
4050
4051 case "$fn" in
4052 *f*) type='File';;
4053 *d*) type='Directory';;
4054 *l*) type='Locate';;
4055 esac
4056
4057 what="$type"
4058 case "$what" in
4059 Locate) what='File';;
4060 esac
4061
4062 case "$exp_file" in
4063 '')
4064         case "$d_portable" in
4065         "$define") ;;
4066         *) exp_file=true;;
4067         esac
4068         ;;
4069 esac
4070
4071 cd ..
4072 while test "$type"; do
4073         redo=''
4074         rp="$orig_rp"
4075         dflt="$orig_dflt"
4076         case "$tilde" in
4077         true) rp="$rp (~name ok)";;
4078         esac
4079         . UU/myread
4080         if test -f UU/getfile.ok && \
4081                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4082         then
4083                 value="$ans"
4084                 ansexp="$ans"
4085                 break
4086         fi
4087         case "$ans" in
4088         none)
4089                 value=''
4090                 ansexp=''
4091                 case "$none_ok" in
4092                 true) type='';;
4093                 esac
4094                 ;;
4095         *)
4096                 case "$tilde" in
4097                 '') value="$ans"
4098                         ansexp="$ans";;
4099                 *)
4100                         value=`UU/filexp $ans`
4101                         case $? in
4102                         0)
4103                                 if test "$ans" != "$value"; then
4104                                         echo "(That expands to $value on this system.)"
4105                                 fi
4106                                 ;;
4107                         *) value="$ans";;
4108                         esac
4109                         ansexp="$value"
4110                         case "$exp_file" in
4111                         '') value="$ans";;
4112                         esac
4113                         ;;
4114                 esac
4115                 case "$fullpath" in
4116                 true)
4117                         case "$ansexp" in
4118                         /*) value="$ansexp" ;;
4119                         [a-zA-Z]:/*) value="$ansexp" ;;
4120                         *)
4121                                 redo=true
4122                                 case "$already" in
4123                                 true)
4124                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4125                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4126                                         ;;
4127                                 *)
4128                                 echo "Please give a full path name, starting with slash." >&4
4129                                         case "$tilde" in
4130                                         true)
4131                                 echo "Note that using ~name is ok provided it expands well." >&4
4132                                                 already=true
4133                                                 ;;
4134                                         esac
4135                                 esac
4136                                 ;;
4137                         esac
4138                         ;;
4139                 esac
4140                 case "$redo" in
4141                 '')
4142                         case "$type" in
4143                         File)
4144                                 for fp in $gfpth; do
4145                                         if test "X$fp" = X.; then
4146                                             pf="$ansexp"
4147                                         else    
4148                                             pf="$fp/$ansexp"
4149                                         fi
4150                                         if test -f "$pf"; then
4151                                                 type=''
4152                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4153                                         then
4154                                                 echo "($value is not a plain file, but that's ok.)"
4155                                                 type=''
4156                                         fi
4157                                         if test X"$type" = X; then
4158                                             value="$pf"
4159                                             break
4160                                         fi
4161                                 done
4162                                 ;;
4163                         Directory)
4164                                 for fp in $gfpth; do
4165                                         if test "X$fp" = X.; then
4166                                             dir="$ans"
4167                                             direxp="$ansexp"
4168                                         else    
4169                                             dir="$fp/$ansexp"
4170                                             direxp="$fp/$ansexp"
4171                                         fi
4172                                         if test -d "$direxp"; then
4173                                                 type=''
4174                                                 value="$dir"
4175                                                 break
4176                                         fi
4177                                 done
4178                                 ;;
4179                         Locate)
4180                                 if test -d "$ansexp"; then
4181                                         echo "(Looking for $loc_file in directory $value.)"
4182                                         value="$value/$loc_file"
4183                                         ansexp="$ansexp/$loc_file"
4184                                 fi
4185                                 if test -f "$ansexp"; then
4186                                         type=''
4187                                 fi
4188                                 case "$nopath_ok" in
4189                                 true)   case "$value" in
4190                                         */*) ;;
4191                                         *)      echo "Assuming $value will be in people's path."
4192                                                 type=''
4193                                                 ;;
4194                                         esac
4195                                         ;;
4196                                 esac
4197                                 ;;
4198                         esac
4199
4200                         case "$skip" in
4201                         true) type='';
4202                         esac
4203
4204                         case "$type" in
4205                         '') ;;
4206                         *)
4207                                 if test "$fastread" = yes; then
4208                                         dflt=y
4209                                 else
4210                                         dflt=n
4211                                 fi
4212                                 rp="$what $value doesn't exist.  Use that name anyway?"
4213                                 . UU/myread
4214                                 dflt=''
4215                                 case "$ans" in
4216                                 y*) type='';;
4217                                 *) echo " ";;
4218                                 esac
4219                                 ;;
4220                         esac
4221                         ;;
4222                 esac
4223                 ;;
4224         esac
4225 done
4226 cd UU
4227 ans="$value"
4228 rp="$orig_rp"
4229 dflt="$orig_dflt"
4230 rm -f getfile.ok
4231 test "X$gfpthkeep" != Xy && gfpth=""
4232 EOSC
4233
4234 : What should the include directory be ?
4235 echo " "
4236 $echo $n "Hmm...  $c"
4237 dflt='/usr/include'
4238 incpath=''
4239 mips_type=''
4240 if $test -f /bin/mips && /bin/mips; then
4241         echo "Looks like a MIPS system..."
4242         $cat >usr.c <<'EOCP'
4243 #ifdef SYSTYPE_BSD43
4244 /bsd43
4245 #endif
4246 EOCP
4247         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4248                 dflt='/bsd43/usr/include'
4249                 incpath='/bsd43'
4250                 mips_type='BSD 4.3'
4251         else
4252                 mips_type='System V'
4253         fi
4254         $rm -f usr.c usr.out
4255         echo "and you're compiling with the $mips_type compiler and libraries."
4256         xxx_prompt=y
4257         echo "exit 0" >mips
4258 else
4259         echo "Doesn't look like a MIPS system."
4260         xxx_prompt=n
4261         echo "exit 1" >mips
4262 fi
4263 chmod +x mips
4264 $eunicefix mips
4265 case "$usrinc" in
4266 '') ;;
4267 *) dflt="$usrinc";;
4268 esac
4269 case "$xxx_prompt" in
4270 y)      fn=d/
4271         echo " "
4272         rp='Where are the include files you want to use?'
4273         . ./getfile
4274         usrinc="$ans"
4275         ;;
4276 *)      usrinc="$dflt"
4277         ;;
4278 esac
4279
4280 : see how we invoke the C preprocessor
4281 echo " "
4282 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4283 cat <<'EOT' >testcpp.c
4284 #define ABC abc
4285 #define XYZ xyz
4286 ABC.XYZ
4287 EOT
4288 cd ..
4289 if test ! -f cppstdin; then
4290         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4291                 # AIX cc -E doesn't show the absolute headerfile
4292                 # locations but we'll cheat by using the -M flag.
4293                 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
4294         else
4295                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4296         fi
4297 else
4298         echo "Keeping your $hint cppstdin wrapper."
4299 fi
4300 chmod 755 cppstdin
4301 wrapper=`pwd`/cppstdin
4302 ok='false'
4303 cd UU
4304
4305 if $test "X$cppstdin" != "X" && \
4306         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4307         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4308 then
4309         echo "You used to use $cppstdin $cppminus so we'll use that again."
4310         case "$cpprun" in
4311         '') echo "But let's see if we can live without a wrapper..." ;;
4312         *)
4313                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4314                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4315                 then
4316                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4317                         ok='true'
4318                 else
4319                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4320                 fi
4321                 ;;
4322         esac
4323 else
4324         case "$cppstdin" in
4325         '') ;;
4326         *)
4327                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4328                 ;;
4329         esac
4330 fi
4331
4332 if $ok; then
4333         : nothing
4334 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4335         $cc -E <testcpp.c >testcpp.out 2>&1; \
4336         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4337         echo "Yup, it does."
4338         x_cpp="$cc -E"
4339         x_minus='';
4340 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4341         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4342         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4343         echo "Yup, it does."
4344         x_cpp="$cc -E"
4345         x_minus='-';
4346 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4347         $cc -P <testcpp.c >testcpp.out 2>&1; \
4348         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4349         echo "Yipee, that works!"
4350         x_cpp="$cc -P"
4351         x_minus='';
4352 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4353         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4354         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4355         echo "At long last!"
4356         x_cpp="$cc -P"
4357         x_minus='-';
4358 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4359         $cpp <testcpp.c >testcpp.out 2>&1; \
4360         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4361         echo "It works!"
4362         x_cpp="$cpp"
4363         x_minus='';
4364 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4365         $cpp - <testcpp.c >testcpp.out 2>&1; \
4366         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4367         echo "Hooray, it works!  I was beginning to wonder."
4368         x_cpp="$cpp"
4369         x_minus='-';
4370 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4371         $wrapper <testcpp.c >testcpp.out 2>&1; \
4372         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4373         x_cpp="$wrapper"
4374         x_minus=''
4375         echo "Eureka!"
4376 else
4377         dflt=''
4378         rp="No dice.  I can't find a C preprocessor.  Name one:"
4379         . ./myread
4380         x_cpp="$ans"
4381         x_minus=''
4382         $x_cpp <testcpp.c >testcpp.out 2>&1
4383         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4384                 echo "OK, that will do." >&4
4385         else
4386 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4387                 exit 1
4388         fi
4389 fi
4390
4391 case "$ok" in
4392 false)
4393         cppstdin="$x_cpp"
4394         cppminus="$x_minus"
4395         cpprun="$x_cpp"
4396         cpplast="$x_minus"
4397         set X $x_cpp
4398         shift
4399         case "$1" in
4400         "$cpp")
4401                 echo "Perhaps can we force $cc -E using a wrapper..."
4402                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4403                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4404                 then
4405                         echo "Yup, we can."
4406                         cppstdin="$wrapper"
4407                         cppminus='';
4408                 else
4409                         echo "Nope, we'll have to live without it..."
4410                 fi
4411                 ;;
4412         esac
4413         case "$cpprun" in
4414         "$wrapper")
4415                 cpprun=''
4416                 cpplast=''
4417                 ;;
4418         esac
4419         ;;
4420 esac
4421
4422 case "$cppstdin" in
4423 "$wrapper"|'cppstdin') ;;
4424 *) $rm -f $wrapper;;
4425 esac
4426 $rm -f testcpp.c testcpp.out
4427
4428 : Set private lib path
4429 case "$plibpth" in
4430 '') if ./mips; then
4431                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4432         fi;;
4433 esac
4434 case "$libpth" in
4435 ' ') dlist='';;
4436 '') dlist="$loclibpth $plibpth $glibpth";;
4437 *) dlist="$libpth";;
4438 esac
4439
4440 : Now check and see which directories actually exist, avoiding duplicates
4441 libpth=''
4442 for xxx in $dlist
4443 do
4444     if $test -d $xxx; then
4445                 case " $libpth " in
4446                 *" $xxx "*) ;;
4447                 *) libpth="$libpth $xxx";;
4448                 esac
4449     fi
4450 done
4451 $cat <<'EOM'
4452
4453 Some systems have incompatible or broken versions of libraries.  Among
4454 the directories listed in the question below, please remove any you
4455 know not to be holding relevant libraries, and add any that are needed.
4456 Say "none" for none.
4457
4458 EOM
4459 case "$libpth" in
4460 '') dflt='none';;
4461 *)
4462         set X $libpth
4463         shift
4464         dflt=${1+"$@"}
4465         ;;
4466 esac
4467 rp="Directories to use for library searches?"
4468 . ./myread
4469 case "$ans" in
4470 none) libpth=' ';;
4471 *) libpth="$ans";;
4472 esac
4473
4474 : compute shared library extension
4475 case "$so" in
4476 '')
4477         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4478                 dflt='sl'
4479         else
4480                 dflt='so'
4481         fi
4482         ;;
4483 *) dflt="$so";;
4484 esac
4485 $cat <<EOM
4486
4487 On some systems, shared libraries may be available.  Answer 'none' if
4488 you want to suppress searching of shared libraries for the remainder
4489 of this configuration.
4490
4491 EOM
4492 rp='What is the file extension used for shared libraries?'
4493 . ./myread
4494 so="$ans"
4495
4496 : Define several unixisms.
4497 : Hints files or command line option can be used to override them.
4498 : The convoluted testing is in case hints files set either the old
4499 : or the new name.
4500 case "$_exe" in
4501 '')     case "$exe_ext" in
4502         '')     ;;
4503         *)      _exe="$exe_ext" ;;
4504         esac
4505         ;;
4506 esac
4507 case "$_a" in
4508 '')     case "$lib_ext" in
4509     '') _a='.a';;
4510         *)      _a="$lib_ext" ;;
4511         esac
4512         ;;
4513 esac
4514 case "$_o" in
4515 '') case "$obj_ext" in
4516         '')     _o='.o';;
4517         *)      _o="$obj_ext";;
4518         esac
4519         ;;
4520 esac
4521 case "$p_" in
4522 '') case "$path_sep" in
4523         '')     p_=':';;
4524         *)      p_="$path_sep";;
4525         esac
4526         ;;
4527 esac
4528 exe_ext=$_exe
4529 lib_ext=$_a
4530 obj_ext=$_o
4531 path_sep=$p_
4532
4533 : Which makefile gets called first.  This is used by make depend.
4534 case "$firstmakefile" in
4535 '') firstmakefile='makefile';;
4536 esac
4537
4538 case "$ccflags" in
4539 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4540 esac
4541
4542 case "$uselongdouble" in
4543 $define|true|[yY]*)     dflt='y';;
4544 *) dflt='n';;
4545 esac
4546 cat <<EOM
4547
4548 Perl can be built to take advantage of long doubles which
4549 (if available) may give more accuracy and range for floating point numbers.
4550
4551 If this doesn't make any sense to you, just accept the default '$dflt'.
4552 EOM
4553 rp='Try to use long doubles if available?'
4554 . ./myread
4555 case "$ans" in
4556 y|Y)    val="$define"   ;;
4557 *)      val="$undef"    ;;
4558 esac
4559 set uselongdouble
4560 eval $setvar
4561
4562 case "$uselongdouble" in
4563 true|[yY]*) uselongdouble="$define" ;;
4564 esac
4565
4566 : Look for a hint-file generated 'call-back-unit'.  If the
4567 : user has specified that long doubles should be used,
4568 : we may need to set or change some other defaults.
4569 if $test -f uselongdouble.cbu; then
4570     echo "Your platform has some specific hints regarding long doubles, using them..."
4571     . ./uselongdouble.cbu
4572 else
4573     case "$uselongdouble" in
4574         $define)
4575                 $cat <<EOM
4576 (Your platform does not have any specific hints for long doubles.)
4577 EOM
4578         ;;
4579     esac
4580 fi
4581
4582 : Looking for optional libraries
4583 echo " "
4584 echo "Checking for optional libraries..." >&4
4585 case "$libs" in
4586 ' '|'') dflt='';;
4587 *) dflt="$libs";;
4588 esac
4589 case "$libswanted" in
4590 '') libswanted='c_s';;
4591 esac
4592 case "$usesocks" in
4593 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4594 esac
4595 libsfound=''
4596 libsfiles=''
4597 libsdirs=''
4598 libspath=''
4599 for thisdir in $libpth $xlibpth; do
4600   test -d $thisdir && libspath="$libspath $thisdir"
4601 done
4602 for thislib in $libswanted; do
4603         for thisdir in $libspath; do
4604             xxx=''
4605             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4606                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4607                 $test -f "$xxx" && eval $libscheck
4608                 $test -f "$xxx" && libstyle=shared
4609             fi
4610             if test ! -f "$xxx"; then
4611                 xxx=$thisdir/lib$thislib.$so
4612                 $test -f "$xxx" && eval $libscheck
4613                 $test -f "$xxx" && libstyle=shared
4614             fi  
4615             if test ! -f "$xxx"; then
4616                 xxx=$thisdir/lib$thislib$_a
4617                 $test -f "$xxx" && eval $libscheck
4618                 $test -f "$xxx" && libstyle=static
4619             fi
4620             if test ! -f "$xxx"; then
4621                 xxx=$thisdir/$thislib$_a
4622                 $test -f "$xxx" && eval $libscheck
4623                 $test -f "$xxx" && libstyle=static
4624             fi
4625             if test ! -f "$xxx"; then
4626                 xxx=$thisdir/lib${thislib}_s$_a
4627                 $test -f "$xxx" && eval $libscheck
4628                 $test -f "$xxx" && libstyle=static
4629                 $test -f "$xxx" && thislib=${thislib}_s
4630             fi
4631             if test ! -f "$xxx"; then
4632                 xxx=$thisdir/Slib$thislib$_a
4633                 $test -f "$xxx" && eval $libscheck
4634                 $test -f "$xxx" && libstyle=static
4635             fi
4636             if $test -f "$xxx"; then
4637                 case "$libstyle" in
4638                 shared) echo "Found -l$thislib (shared)." ;;
4639                 static) echo "Found -l$thislib." ;;
4640                 *)      echo "Found -l$thislib ($libstyle)." ;;
4641                 esac
4642                 case " $dflt " in
4643                 *"-l$thislib "*);;
4644                 *) dflt="$dflt -l$thislib"
4645                    libsfound="$libsfound $xxx"
4646                    yyy=`basename $xxx`
4647                    libsfiles="$libsfiles $yyy"
4648                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4649                    case " $libsdirs " in
4650                    *" $yyy "*) ;;
4651                    *) libsdirs="$libsdirs $yyy" ;;
4652                    esac
4653                    ;;
4654                 esac
4655                 break
4656             fi  
4657         done
4658         if $test ! -f "$xxx"; then
4659             echo "No -l$thislib."
4660         fi
4661 done
4662 set X $dflt
4663 shift
4664 dflt="$*"
4665 case "$libs" in
4666 '') dflt="$dflt";;
4667 *) dflt="$libs";;
4668 esac
4669 case "$dflt" in
4670 ' '|'') dflt='none';;
4671 esac
4672
4673 $cat <<EOM
4674
4675 In order to compile $package on your machine, a number of libraries
4676 are usually needed.  Include any other special libraries here as well.
4677 Say "none" for none.  The default list is almost always right.
4678 EOM
4679
4680 echo " "
4681 rp="What libraries to use?"
4682 . ./myread
4683 case "$ans" in
4684 none) libs=' ';;
4685 *) libs="$ans";;
4686 esac
4687
4688 : determine optimization, if desired, or use for debug flag also
4689 case "$optimize" in
4690 ' '|$undef) dflt='none';;
4691 '') dflt='-O';;
4692 *) dflt="$optimize";;
4693 esac
4694 $cat <<EOH
4695
4696 By default, $package compiles with the -O flag to use the optimizer.
4697 Alternately, you might want to use the symbolic debugger, which uses
4698 the -g flag (on traditional Unix systems).  Either flag can be
4699 specified here.  To use neither flag, specify the word "none".
4700
4701 EOH
4702 rp="What optimizer/debugger flag should be used?"
4703 . ./myread
4704 optimize="$ans"
4705 case "$optimize" in
4706 'none') optimize=" ";;
4707 esac
4708
4709 dflt=''
4710 : We will not override a previous value, but we might want to
4711 : augment a hint file
4712 case "$hint" in
4713 default|recommended)
4714         case "$gccversion" in
4715         1*) dflt='-fpcc-struct-return' ;;
4716         esac
4717         case "$optimize" in
4718         *-g*) dflt="$dflt -DDEBUGGING";;
4719         esac
4720         case "$gccversion" in
4721         2*) if test -d /etc/conf/kconfig.d &&
4722                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4723                 then
4724                         # Interactive Systems (ISC) POSIX mode.
4725                         dflt="$dflt -posix"
4726                 fi
4727                 ;;
4728         esac
4729         case "$gccversion" in
4730         1*) ;;
4731         2.[0-8]*) ;;
4732         ?*)     echo " "
4733                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4734                 echo 'int main(void) { return 0; }' > gcctest.c
4735                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4736                         echo "Yes, it does." 2>&1
4737                         case "$ccflags" in
4738                         *strict-aliasing*)
4739                                 echo "Leaving current flags $ccflags alone." 2>&1
4740                                 ;;
4741                         *) dflt="$dflt -fno-strict-aliasing" ;;
4742                         esac
4743                 else
4744                         echo "Nope, it doesn't, but that's ok." 2>&1
4745                 fi
4746                 ;;
4747         esac
4748         # For gcc, adding -pipe speeds up compilations for some, but apparently
4749         # some assemblers can't read from stdin.  (It also slows down compilations
4750         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4751         case "$gccversion" in
4752         ?*)     echo " "
4753                 echo "Checking if your compiler accepts -pipe" 2>&1
4754                 echo 'int main(void) { return 0; }' > gcctest.c
4755                 if $cc -pipe -o gcctest gcctest.c; then
4756                         echo "Yes, it does." 2>&1
4757                         case "$ccflags" in
4758                         *-pipe*)
4759                                 echo "Leaving current flags $ccflags alone." 2>&1
4760                                 ;;
4761                         *) dflt="$dflt -pipe" ;;
4762                         esac
4763                 else
4764                         echo "Nope, it doesn't, but that's ok." 2>&1
4765                 fi
4766
4767                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4768                 echo 'int main(void) { return 0; }' > gcctest.c
4769                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4770                         echo "Yes, it does." 2>&1
4771                         case "$ccflags" in
4772                         *-Wdeclaration-after-statement*)
4773                                 echo "Leaving current flags $ccflags alone." 2>&1
4774                                 ;;
4775                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4776                         esac
4777                 else
4778                         echo "Nope, it doesn't, but that's ok." 2>&1
4779                 fi
4780                 ;;
4781         esac
4782         ;;
4783 esac
4784
4785 case "$mips_type" in
4786 *BSD*|'') inclwanted="$locincpth $usrinc";;
4787 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4788 esac
4789 for thisincl in $inclwanted; do
4790         if $test -d $thisincl; then
4791                 if $test x$thisincl != x$usrinc; then
4792                         case "$dflt" in
4793                         *" -I$thisincl "*);;
4794                         *) dflt="$dflt -I$thisincl ";;
4795                         esac
4796                 fi
4797         fi
4798 done
4799
4800 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4801         xxx=true;
4802 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4803         xxx=true;
4804 else
4805         xxx=false;
4806 fi;
4807 if $xxx; then
4808         case "$dflt" in
4809         *$2*);;
4810         *) dflt="$dflt -D$2";;
4811         esac;
4812 fi'
4813
4814 set signal.h LANGUAGE_C; eval $inctest
4815
4816 case "$usesocks" in
4817 $define)
4818         ccflags="$ccflags -DSOCKS"
4819         ;;
4820 esac
4821
4822 case "$hint" in
4823 default|recommended) dflt="$ccflags $dflt" ;;
4824 *) dflt="$ccflags";;
4825 esac
4826
4827 case "$dflt" in
4828 ''|' ') dflt=none;;
4829 esac
4830
4831 $cat <<EOH
4832
4833 Your C compiler may want other flags.  For this question you should include
4834 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4835 but you should NOT include libraries or ld flags like -lwhatever.  If you
4836 want $package to honor its debug switch, you should include -DDEBUGGING here.
4837 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4838
4839 To use no flags, specify the word "none".
4840
4841 EOH
4842 set X $dflt
4843 shift
4844 dflt=${1+"$@"}
4845 rp="Any additional cc flags?"
4846 . ./myread
4847 case "$ans" in
4848 none) ccflags='';;
4849 *) ccflags="$ans";;
4850 esac
4851
4852 : the following weeds options from ccflags that are of no interest to cpp
4853 case "$cppflags" in
4854 '') cppflags="$ccflags" ;;
4855 *)  cppflags="$cppflags $ccflags" ;;
4856 esac
4857 case "$gccversion" in
4858 1*) cppflags="$cppflags -D__GNUC__"
4859 esac
4860 case "$mips_type" in
4861 '');;
4862 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4863 esac
4864 case "$cppflags" in
4865 '');;
4866 *)
4867         echo " "
4868         echo "Let me guess what the preprocessor flags are..." >&4
4869         set X $cppflags
4870         shift
4871         cppflags=''
4872         $cat >cpp.c <<'EOM'
4873 #define BLURFL foo
4874
4875 BLURFL xx LFRULB
4876 EOM
4877         previous=''
4878         for flag in $*
4879         do
4880                 case "$flag" in
4881                 -*) ftry="$flag";;
4882                 *) ftry="$previous $flag";;
4883                 esac
4884                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4885                         >cpp1.out 2>/dev/null && \
4886                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4887                         >cpp2.out 2>/dev/null && \
4888                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4889                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4890                 then
4891                         cppflags="$cppflags $ftry"
4892                         previous=''
4893                 else
4894                         previous="$flag"
4895                 fi
4896         done
4897         set X $cppflags
4898         shift
4899         cppflags=${1+"$@"}
4900         case "$cppflags" in
4901         *-*)  echo "They appear to be: $cppflags";;
4902         esac
4903         $rm -f cpp.c cpp?.out
4904         ;;
4905 esac
4906
4907 : flags used in final linking phase
4908 case "$ldflags" in
4909 '') if ./venix; then
4910                 dflt='-i -z'
4911         else
4912                 dflt=''
4913         fi
4914         case "$ccflags" in
4915         *-posix*) dflt="$dflt -posix" ;;
4916         esac
4917         ;;
4918 *) dflt="$ldflags";;
4919 esac
4920
4921 : Try to guess additional flags to pick up local libraries.
4922 for thislibdir in $libpth; do
4923         case " $loclibpth " in
4924         *" $thislibdir "*)
4925                 case "$dflt " in
4926                 *"-L$thislibdir "*) ;;
4927                 *)  dflt="$dflt -L$thislibdir" ;;
4928                 esac
4929                 ;;
4930         esac
4931 done
4932
4933 case "$dflt" in
4934 '') dflt='none' ;;
4935 esac
4936
4937 $cat <<EOH
4938
4939 Your C linker may need flags.  For this question you should
4940 include -L/whatever and any other flags used by the C linker, but you
4941 should NOT include libraries like -lwhatever.
4942
4943 Make sure you include the appropriate -L/path flags if your C linker
4944 does not normally search all of the directories you specified above,
4945 namely
4946         $libpth
4947 To use no flags, specify the word "none".
4948
4949 EOH
4950
4951 rp="Any additional ld flags (NOT including libraries)?"
4952 . ./myread
4953 case "$ans" in
4954 none) ldflags='';;
4955 *) ldflags="$ans";;
4956 esac
4957 rmlist="$rmlist pdp11"
4958
4959 : coherency check
4960 echo " "
4961 echo "Checking your choice of C compiler and flags for coherency..." >&4
4962 $cat > try.c <<'EOF'
4963 #include <stdio.h>
4964 int main() { printf("Ok\n"); return(0); }
4965 EOF
4966 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4967 shift
4968 $cat >try.msg <<'EOM'
4969 I've tried to compile and run the following simple program:
4970
4971 EOM
4972 $cat try.c >> try.msg
4973
4974 $cat >> try.msg <<EOM
4975
4976 I used the command:
4977
4978         $*
4979         $run ./try
4980
4981 and I got the following output:
4982
4983 EOM
4984 dflt=y
4985 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4986         if $sh -c "$run ./try" >>try.msg 2>&1; then
4987                 xxx=`$run ./try`
4988                 case "$xxx" in
4989                 "Ok") dflt=n ;;
4990                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4991                         case " $libs " in
4992                         *" -lsfio "*)
4993                                 cat >> try.msg <<'EOQS'
4994 If $libs contains -lsfio, and sfio is mis-configured, then it
4995 sometimes (apparently) runs and exits with a 0 status, but with no
4996 output!  It may have to do with sfio's use of _exit vs. exit.
4997
4998 EOQS
4999                                 rp="You have a big problem.  Shall I abort Configure"
5000                                 dflt=y
5001                                 ;;
5002                         esac
5003                         ;;
5004                 esac
5005         else
5006                 echo "The program compiled OK, but exited with status $?." >>try.msg
5007                 rp="You have a problem.  Shall I abort Configure"
5008                 dflt=y
5009         fi
5010 else
5011         echo "I can't compile the test program." >>try.msg
5012         rp="You have a BIG problem.  Shall I abort Configure"
5013         dflt=y
5014 fi
5015 case "$dflt" in
5016 y)
5017         $cat try.msg >&4
5018         case "$knowitall" in
5019         '')
5020                 echo "(The supplied flags or libraries might be incorrect.)"
5021                 ;;
5022         *) dflt=n;;
5023         esac
5024         echo " "
5025         . ./myread
5026         case "$ans" in
5027         n*|N*) ;;
5028         *)      echo "Ok.  Stopping Configure." >&4
5029                 exit 1
5030                 ;;
5031         esac
5032         ;;
5033 n) echo "OK, that should do.";;
5034 esac
5035 $rm -f try try.* core
5036
5037 : define a shorthand compile call
5038 compile='
5039 mc_file=$1;
5040 shift;
5041 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5042 : define a shorthand compile call for compilations that should be ok.
5043 compile_ok='
5044 mc_file=$1;
5045 shift;
5046 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5047
5048 : determine filename position in cpp output
5049 echo " "
5050 echo "Computing filename position in cpp output for #include directives..." >&4
5051 case "$osname" in
5052 vos) testaccess=-e ;;
5053 *)   testaccess=-r ;;
5054 esac
5055 echo '#include <stdio.h>' > foo.c
5056 $cat >fieldn <<EOF
5057 $startsh
5058 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5059 $grep '^[       ]*#.*stdio\.h' | \
5060 while read cline; do
5061         pos=1
5062         set \$cline
5063         while $test \$# -gt 0; do
5064                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5065                         echo "\$pos"
5066                         exit 0
5067                 fi
5068                 shift
5069                 pos=\`expr \$pos + 1\`
5070         done
5071 done
5072 EOF
5073 chmod +x fieldn
5074 fieldn=`./fieldn`
5075 $rm -f foo.c fieldn
5076 case $fieldn in
5077 '') pos='???';;
5078 1) pos=first;;
5079 2) pos=second;;
5080 3) pos=third;;
5081 *) pos="${fieldn}th";;
5082 esac
5083 echo "Your cpp writes the filename in the $pos field of the line."
5084
5085 case "$osname" in
5086 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5087 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5088 *)   cppfilter='' ;;
5089 esac
5090 : locate header file
5091 $cat >findhdr <<EOF
5092 $startsh
5093 wanted=\$1
5094 name=''
5095 for usrincdir in $usrinc
5096 do
5097         if test -f \$usrincdir/\$wanted; then
5098                 echo "\$usrincdir/\$wanted"
5099                 exit 0
5100         fi
5101 done
5102 awkprg='{ print \$$fieldn }'
5103 echo "#include <\$wanted>" > foo\$\$.c
5104 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5105 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5106 while read cline; do
5107         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5108         case "\$name" in
5109         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5110         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5111         *) exit 2;;
5112         esac;
5113 done;
5114 #
5115 # status = 0: grep returned 0 lines, case statement not executed
5116 # status = 1: headerfile found
5117 # status = 2: while loop executed, no headerfile found
5118 #
5119 status=\$?
5120 $rm -f foo\$\$.c;
5121 if test \$status -eq 1; then
5122         exit 0;
5123 fi
5124 exit 1
5125 EOF
5126 chmod +x findhdr
5127
5128 : define an alternate in-header-list? function
5129 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5130 cont=true; xxf="echo \"<\$1> found.\" >&4";
5131 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5132 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5133 esac;
5134 case $# in 4) instead=instead;; *) instead="at last";; esac;
5135 while $test "$cont"; do
5136         xxx=`./findhdr $1`
5137         var=$2; eval "was=\$$2";
5138         if $test "$xxx" && $test -r "$xxx";
5139         then eval $xxf;
5140         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5141                 cont="";
5142         else eval $xxnf;
5143         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5144         set $yyy; shift; shift; yyy=$@;
5145         case $# in 0) cont="";;
5146         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5147                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5148         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5149                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5150         esac;
5151 done;
5152 while $test "$yyy";
5153 do set $yyy; var=$2; eval "was=\$$2";
5154         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5155         set $yyy; shift; shift; yyy=$@;
5156 done'
5157
5158 : see if stdlib is available
5159 set stdlib.h i_stdlib
5160 eval $inhdr
5161
5162 : check for lengths of integral types
5163 echo " "
5164 case "$intsize" in
5165 '')
5166         echo "Checking to see how big your integers are..." >&4
5167         $cat >try.c <<EOCP
5168 #include <stdio.h>
5169 #$i_stdlib I_STDLIB
5170 #ifdef I_STDLIB
5171 #include <stdlib.h>
5172 #endif
5173 int main()
5174 {
5175         printf("intsize=%d;\n", (int)sizeof(int));
5176         printf("longsize=%d;\n", (int)sizeof(long));
5177         printf("shortsize=%d;\n", (int)sizeof(short));
5178         exit(0);
5179 }
5180 EOCP
5181         set try
5182         if eval $compile_ok && $run ./try > /dev/null; then
5183                 eval `$run ./try`
5184                 echo "Your integers are $intsize bytes long."
5185                 echo "Your long integers are $longsize bytes long."
5186                 echo "Your short integers are $shortsize bytes long."
5187         else
5188                 $cat >&4 <<EOM
5189 !
5190 Help! I can't compile and run the intsize test program: please enlighten me!
5191 (This is probably a misconfiguration in your system or libraries, and
5192 you really ought to fix it.  Still, I'll try anyway.)
5193 !
5194 EOM
5195                 dflt=4
5196                 rp="What is the size of an integer (in bytes)?"
5197                 . ./myread
5198                 intsize="$ans"
5199                 dflt=$intsize
5200                 rp="What is the size of a long integer (in bytes)?"
5201                 . ./myread
5202                 longsize="$ans"
5203                 dflt=2
5204                 rp="What is the size of a short integer (in bytes)?"
5205                 . ./myread
5206                 shortsize="$ans"
5207         fi
5208         ;;
5209 esac
5210 $rm -f try try.*
5211
5212 : check for long long
5213 echo " "
5214 echo "Checking to see if you have long long..." >&4
5215 echo 'int main() { long long x = 7; return 0; }' > try.c
5216 set try
5217 if eval $compile; then
5218         val="$define"
5219         echo "You have long long."
5220 else
5221         val="$undef"
5222         echo "You do not have long long."
5223 fi
5224 $rm try.*
5225 set d_longlong
5226 eval $setvar
5227
5228 : check for length of long long
5229 case "${d_longlong}${longlongsize}" in
5230 $define)
5231         echo " "
5232         echo "Checking to see how big your long longs are..." >&4
5233         $cat >try.c <<'EOCP'
5234 #include <stdio.h>
5235 int main()
5236 {
5237     printf("%d\n", (int)sizeof(long long));
5238     return(0);
5239 }
5240 EOCP
5241         set try
5242         if eval $compile_ok; then
5243                 longlongsize=`$run ./try`
5244                 echo "Your long longs are $longlongsize bytes long."
5245         else
5246                 dflt='8'
5247                 echo " "
5248                 echo "(I can't seem to compile the test program.  Guessing...)"
5249                 rp="What is the size of a long long (in bytes)?"
5250                 . ./myread
5251                 longlongsize="$ans"
5252         fi
5253         if $test "X$longsize" = "X$longlongsize"; then
5254                 echo "(That isn't any different from an ordinary long.)"
5255         fi      
5256         ;;
5257 esac
5258 $rm -f try.* try
5259
5260 : see if inttypes.h is available
5261 : we want a real compile instead of Inhdr because some systems
5262 : have an inttypes.h which includes non-existent headers
5263 echo " "
5264 $cat >try.c <<EOCP
5265 #include <inttypes.h>
5266 int main() {
5267         static int32_t foo32 = 0x12345678;
5268 }
5269 EOCP
5270 set try
5271 if eval $compile; then
5272         echo "<inttypes.h> found." >&4
5273         val="$define"
5274 else
5275         echo "<inttypes.h> NOT found." >&4
5276         val="$undef"
5277 fi
5278 $rm -f try.c try
5279 set i_inttypes
5280 eval $setvar
5281
5282 : check for int64_t
5283 echo " "
5284 echo "Checking to see if you have int64_t..." >&4
5285 $cat >try.c <<EOCP
5286 #include <sys/types.h>
5287 #$i_inttypes I_INTTYPES
5288 #ifdef I_INTTYPES
5289 #include <inttypes.h>
5290 #endif
5291 int main() { int64_t x = 7; }
5292 EOCP
5293 set try
5294 if eval $compile; then
5295         val="$define"
5296         echo "You have int64_t."
5297 else
5298         val="$undef"
5299         echo "You do not have int64_t."
5300 fi
5301 $rm -f try try.*
5302 set d_int64_t
5303 eval $setvar
5304
5305
5306 echo " "
5307 echo "Checking which 64-bit integer type we could use..." >&4
5308
5309 case "$intsize" in
5310 8) val=int
5311    set quadtype
5312    eval $setvar
5313    val='"unsigned int"'
5314    set uquadtype
5315    eval $setvar
5316    quadkind=1
5317    ;;
5318 *) case "$longsize" in
5319    8) val=long
5320       set quadtype
5321       eval $setvar
5322       val='"unsigned long"'
5323       set uquadtype
5324       eval $setvar
5325       quadkind=2
5326       ;;
5327    *) case "$d_longlong:$longlongsize" in
5328       define:8)
5329         val='"long long"'
5330         set quadtype
5331         eval $setvar
5332         val='"unsigned long long"'
5333         set uquadtype
5334         eval $setvar
5335         quadkind=3
5336         ;;
5337       *) case "$d_int64_t" in
5338          define)
5339            val=int64_t
5340            set quadtype
5341            eval $setvar
5342            val=uint64_t
5343            set uquadtype
5344            eval $setvar
5345            quadkind=4
5346            ;;
5347          esac
5348          ;;
5349       esac
5350       ;;
5351    esac
5352    ;;
5353 esac
5354
5355 case "$quadtype" in
5356 '')     echo "Alas, no 64-bit integer types in sight." >&4
5357         d_quad="$undef"
5358         ;;
5359 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5360         d_quad="$define"
5361         ;;
5362 esac
5363
5364
5365 case "$uselonglong" in
5366 "$define"|true|[yY]*)
5367         cat <<EOM >&4
5368
5369 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5370 EOM
5371         use64bitint="$define"
5372         ;;
5373 esac                          
5374 case "$use64bits" in
5375 "$define"|true|[yY]*)
5376         cat <<EOM >&4
5377
5378 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5379 EOM
5380         use64bitint="$define"
5381         ;;
5382 esac                          
5383 case "$use64bitints" in
5384 "$define"|true|[yY]*)
5385         cat <<EOM >&4
5386
5387 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5388 EOM
5389         use64bitint="$define"
5390         ;;
5391 esac                          
5392 case "$use64bitsint" in
5393 "$define"|true|[yY]*)
5394         cat <<EOM >&4
5395
5396 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5397 EOM
5398         use64bitint="$define"
5399         ;;
5400 esac                          
5401 case "$uselonglongs" in
5402 "$define"|true|[yY]*)
5403         cat <<EOM >&4
5404
5405 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5406 EOM
5407         use64bitint="$define"
5408         ;;
5409 esac                          
5410 case "$use64bitsall" in
5411 "$define"|true|[yY]*)
5412         cat <<EOM >&4
5413
5414 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5415 EOM
5416         use64bitall="$define"
5417         ;;
5418 esac                          
5419
5420 case "$ccflags" in
5421 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5422 esac
5423 case "$use64bitall" in
5424 "$define"|true|[yY]*) use64bitint="$define" ;;
5425 esac
5426
5427 case "$longsize" in
5428 8) cat <<EOM
5429
5430 You have natively 64-bit long integers.
5431 EOM
5432    val="$define"
5433    ;;
5434 *) case "$use64bitint" in
5435    "$define"|true|[yY]*) dflt='y';;
5436    *) dflt='n';;
5437    esac
5438    case "$d_quad" in
5439    "$define") ;;
5440    *) dflt='n' ;;
5441    esac
5442    cat <<EOM
5443
5444 Perl can be built to take advantage of 64-bit integer types
5445 on some systems.  To do so, Configure can be run with -Duse64bitint.
5446 Choosing this option will most probably introduce binary incompatibilities.
5447
5448 If this doesn't make any sense to you, just accept the default '$dflt'.
5449 (The default has been chosen based on your configuration.)
5450 EOM
5451    rp='Try to use 64-bit integers, if available?'
5452    . ./myread
5453    case "$ans" in
5454    [yY]*) val="$define" ;;
5455    *)     val="$undef"  ;;
5456    esac
5457    ;;
5458 esac
5459 set use64bitint
5460 eval $setvar
5461
5462 case "$use64bitall" in
5463 "$define"|true|[yY]*) dflt='y' ;;
5464 *) case "$longsize" in
5465    8) dflt='y' ;;
5466    *) dflt='n' ;;
5467    esac
5468    ;;
5469 esac    
5470 cat <<EOM
5471
5472 You may also choose to try maximal 64-bitness.  It means using as much
5473 64-bitness as possible on the platform.  This in turn means even more
5474 binary incompatibilities.  On the other hand, your platform may not
5475 have any more 64-bitness available than what you already have chosen.
5476
5477 If this doesn't make any sense to you, just accept the default '$dflt'.
5478 (The default has been chosen based on your configuration.)
5479 EOM
5480 rp='Try to use maximal 64-bit support, if available?'
5481 . ./myread
5482 case "$ans" in
5483 [yY]*) val="$define" ;;
5484 *)     val="$undef"  ;;
5485 esac
5486 set use64bitall
5487 eval $setvar
5488 case "$use64bitall" in
5489 "$define")
5490         case "$use64bitint" in
5491         "$undef")
5492                 cat <<EOM
5493
5494 Since you have chosen a maximally 64-bit build, I'm also turning on
5495 the use of 64-bit integers.
5496 EOM
5497                 use64bitint="$define" ;;
5498         esac
5499         ;;
5500 esac
5501
5502 : Look for a hint-file generated 'call-back-unit'.  If the
5503 : user has specified that a 64-bit perl is to be built,
5504 : we may need to set or change some other defaults.
5505 if $test -f use64bitint.cbu; then
5506         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5507         . ./use64bitint.cbu
5508 fi
5509 case "$use64bitint" in
5510 "$define"|true|[yY]*)
5511         case "$longsize" in
5512         4) case "$archname64" in
5513            '') archname64=64int ;;
5514            esac
5515            ;;
5516         esac
5517         ;;
5518 esac
5519
5520 : Look for a hint-file generated 'call-back-unit'.  If the
5521 : user has specified that a maximally 64-bit perl is to be built,
5522 : we may need to set or change some other defaults.
5523 if $test -f use64bitall.cbu; then
5524         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5525         . ./use64bitall.cbu
5526 fi
5527 case "$use64bitall" in
5528 "$define"|true|[yY]*)
5529         case "$longsize" in
5530         4) case "$archname64" in
5531            ''|64int) archname64=64all ;;
5532            esac
5533            ;;
5534         esac
5535         ;;
5536 esac
5537
5538 case "$d_quad:$use64bitint" in
5539 $undef:$define)
5540         cat >&4 <<EOF
5541
5542 *** You have chosen to use 64-bit integers,
5543 *** but none can be found.
5544 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5545 *** Cannot continue, aborting.
5546
5547 EOF
5548         exit 1
5549         ;;
5550 esac
5551
5552 : check for length of double
5553 echo " "
5554 case "$doublesize" in
5555 '')
5556         echo "Checking to see how big your double precision numbers are..." >&4
5557         $cat >try.c <<EOCP
5558 #include <stdio.h>
5559 #$i_stdlib I_STDLIB
5560 #ifdef I_STDLIB
5561 #include <stdlib.h>
5562 #endif
5563 int main()
5564 {
5565     printf("%d\n", (int)sizeof(double));
5566     exit(0);
5567 }
5568 EOCP
5569         set try
5570         if eval $compile_ok; then
5571                 doublesize=`$run ./try`
5572                 echo "Your double is $doublesize bytes long."
5573         else
5574                 dflt='8'
5575                 echo "(I can't seem to compile the test program.  Guessing...)"
5576                 rp="What is the size of a double precision number (in bytes)?"
5577                 . ./myread
5578                 doublesize="$ans"
5579         fi
5580         ;;
5581 esac
5582 $rm -f try.c try
5583
5584 : check for long doubles
5585 echo " "
5586 echo "Checking to see if you have long double..." >&4
5587 echo 'int main() { long double x = 7.0; }' > try.c
5588 set try
5589 if eval $compile; then
5590         val="$define"
5591         echo "You have long double."
5592 else
5593         val="$undef"
5594         echo "You do not have long double."
5595 fi
5596 $rm try.*
5597 set d_longdbl
5598 eval $setvar
5599
5600 : check for length of long double
5601 case "${d_longdbl}${longdblsize}" in
5602 $define)
5603         echo " "
5604         echo "Checking to see how big your long doubles are..." >&4
5605         $cat >try.c <<'EOCP'
5606 #include <stdio.h>
5607 int main()
5608 {
5609         printf("%d\n", sizeof(long double));
5610 }
5611 EOCP
5612         set try
5613         set try
5614         if eval $compile; then
5615                 longdblsize=`$run ./try`
5616                 echo "Your long doubles are $longdblsize bytes long."
5617         else
5618                 dflt='8'
5619                 echo " "
5620                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5621                 rp="What is the size of a long double (in bytes)?"
5622                 . ./myread
5623                 longdblsize="$ans"
5624         fi
5625         if $test "X$doublesize" = "X$longdblsize"; then
5626                 echo "That isn't any different from an ordinary double."
5627                 echo "I'll keep your setting anyway, but you may see some"
5628                 echo "harmless compilation warnings."
5629         fi      
5630         ;;
5631 esac
5632 $rm -f try.* try
5633
5634 : determine the architecture name
5635 echo " "
5636 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5637         tarch=`arch`"-$osname"
5638 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5639         if uname -m > tmparch 2>&1 ; then
5640                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5641                         -e 's/$/'"-$osname/" tmparch`
5642         else
5643                 tarch="$osname"
5644         fi
5645         $rm -f tmparch
5646 else
5647         tarch="$osname"
5648 fi
5649 case "$myarchname" in
5650 ''|"$tarch") ;;
5651 *)
5652         echo "(Your architecture name used to be $myarchname.)"
5653         archname=''
5654         ;;
5655 esac
5656 case "$targetarch" in
5657 '') ;;
5658 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5659 esac
5660 myarchname="$tarch"
5661 case "$archname" in
5662 '') dflt="$tarch";;
5663 *) dflt="$archname";;
5664 esac
5665 rp='What is your architecture name'
5666 . ./myread
5667 archname="$ans"
5668 case "$usethreads" in
5669 $define)
5670         echo "Threads selected." >&4
5671         case "$archname" in
5672         *-thread*) echo "...and architecture name already has -thread." >&4
5673                 ;;
5674         *)      archname="$archname-thread"
5675                 echo "...setting architecture name to $archname." >&4
5676                 ;;
5677         esac
5678         ;;
5679 esac
5680 case "$usemultiplicity" in
5681 $define)
5682         echo "Multiplicity selected." >&4
5683         case "$archname" in
5684         *-multi*) echo "...and architecture name already has -multi." >&4
5685                 ;;
5686         *)      archname="$archname-multi"
5687                 echo "...setting architecture name to $archname." >&4
5688                 ;;
5689         esac
5690         ;;
5691 esac
5692 case "$use64bitint$use64bitall" in
5693 *"$define"*)
5694         case "$archname64" in
5695         '')
5696                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5697                 ;;
5698         *)
5699                 case "$use64bitint" in
5700                 "$define") echo "64 bit integers selected." >&4 ;;
5701                 esac
5702                 case "$use64bitall" in
5703                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5704                 esac
5705                 case "$archname" in
5706                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5707                         ;;
5708                 *)      archname="$archname-$archname64"
5709                         echo "...setting architecture name to $archname." >&4
5710                         ;;
5711                 esac
5712                 ;;
5713         esac
5714 esac
5715 case "$uselongdouble" in
5716 $define)
5717         echo "Long doubles selected." >&4
5718         case "$longdblsize" in
5719         $doublesize)
5720                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5721                 ;;
5722         *)
5723                 case "$archname" in
5724                 *-ld*) echo "...and architecture name already has -ld." >&4
5725                         ;;
5726                 *)      archname="$archname-ld"
5727                         echo "...setting architecture name to $archname." >&4
5728                         ;;
5729                 esac
5730                 ;;
5731         esac
5732         ;;
5733 esac
5734 case "$useperlio" in
5735 $define)
5736         echo "Perlio selected." >&4
5737         ;;
5738 *)
5739         echo "Perlio not selected, using stdio." >&4
5740         case "$archname" in
5741         *-stdio*) echo "...and architecture name already has -stdio." >&4
5742                 ;;
5743         *)      archname="$archname-stdio"
5744                 echo "...setting architecture name to $archname." >&4
5745                 ;;
5746         esac
5747         ;;
5748 esac
5749 if $test -f archname.cbu; then
5750         echo "Your platform has some specific hints for architecture name, using them..."
5751         . ./archname.cbu
5752 fi
5753
5754 : determine root of directory hierarchy where package will be installed.
5755 case "$prefix" in
5756 '')
5757         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5758         ;;
5759 *?/)
5760         dflt=`echo "$prefix" | sed 's/.$//'`
5761         ;;
5762 *)
5763         dflt="$prefix"
5764         ;;
5765 esac
5766 $cat <<EOM
5767
5768 By default, $package will be installed in $dflt/bin, manual pages
5769 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5770 installation directories. Typically this is something like /usr/local.
5771 If you wish to have binaries under /usr/bin but other parts of the
5772 installation under /usr/local, that's ok: you will be prompted
5773 separately for each of the installation directories, the prefix being
5774 only used to set the defaults.
5775
5776 EOM
5777 fn=d~
5778 rp='Installation prefix to use?'
5779 . ./getfile
5780 oldprefix=''
5781 case "$prefix" in
5782 '') ;;
5783 *)
5784         case "$ans" in
5785         "$prefix") ;;
5786         *) oldprefix="$prefix";;
5787         esac
5788         ;;
5789 esac
5790 prefix="$ans"
5791 prefixexp="$ansexp"
5792
5793 case "$afsroot" in
5794 '')     afsroot=/afs ;;
5795 *)      afsroot=$afsroot ;;
5796 esac
5797
5798 : is AFS running?
5799 echo " "
5800 case "$afs" in
5801 $define|true)   afs=true ;;
5802 $undef|false)   afs=false ;;
5803 *)      if test -d $afsroot; then
5804                 afs=true
5805         else
5806                 afs=false
5807         fi
5808         ;;
5809 esac
5810 if $afs; then
5811         echo "AFS may be running... I'll be extra cautious then..." >&4
5812 else
5813         echo "AFS does not seem to be running..." >&4
5814 fi
5815
5816 : determine installation prefix for where package is to be installed.
5817 if $afs; then 
5818 $cat <<EOM
5819
5820 Since you are running AFS, I need to distinguish the directory in which
5821 files will reside from the directory in which they are installed (and from
5822 which they are presumably copied to the former directory by occult means).
5823
5824 EOM
5825         case "$installprefix" in
5826         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5827         *) dflt="$installprefix";;
5828         esac
5829 else
5830 $cat <<EOM
5831
5832 In some special cases, particularly when building $package for distribution,
5833 it is convenient to distinguish the directory in which files should be
5834 installed from the directory ($prefix) in which they will
5835 eventually reside.  For most users, these two directories are the same.
5836
5837 EOM
5838         case "$installprefix" in
5839         '') dflt=$prefix ;;
5840         *) dflt=$installprefix;;
5841         esac
5842 fi
5843 fn=d~
5844 rp='What installation prefix should I use for installing files?'
5845 . ./getfile
5846 installprefix="$ans"
5847 installprefixexp="$ansexp"
5848
5849 : set the prefixit variable, to compute a suitable default value
5850 prefixit='case "$3" in
5851 ""|none)
5852         case "$oldprefix" in
5853         "") eval "$1=\"\$$2\"";;
5854         *)
5855                 case "$3" in
5856                 "") eval "$1=";;
5857                 none)
5858                         eval "tp=\"\$$2\"";
5859                         case "$tp" in
5860                         ""|" ") eval "$1=\"\$$2\"";;
5861                         *) eval "$1=";;
5862                         esac;;
5863                 esac;;
5864         esac;;
5865 *)
5866         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5867         case "$tp" in
5868         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5869         /*-$oldprefix/*|\~*-$oldprefix/*)
5870                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5871         *) eval "$1=\"\$$2\"";;
5872         esac;;
5873 esac'
5874
5875 : get the patchlevel
5876 echo " "
5877 echo "Getting the current patchlevel..." >&4
5878 if $test -r $rsrc/patchlevel.h;then
5879         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5880         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5881         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5882         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5883         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5884         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5885        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5886 else
5887         revision=0
5888         patchlevel=0
5889         subversion=0
5890         api_revision=0
5891         api_version=0
5892         api_subversion=0
5893         perl_patchlevel=0
5894         $echo "(You do not have patchlevel.h.  Eek.)"
5895 fi
5896 if $test -r $rsrc/.patch ; then  
5897         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5898                 perl_patchlevel=`cat $rsrc/.patch`
5899         fi
5900 fi
5901 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5902 version_patchlevel_string="version $patchlevel subversion $subversion"
5903 case "$perl_patchlevel" in
5904 0|'') ;;
5905 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5906 esac
5907
5908 $echo "(You have $package $version_patchlevel_string.)"
5909
5910 case "$osname" in
5911 dos|vms)
5912         : XXX Should be a Configure test for double-dots in filenames.
5913         version=`echo $revision $patchlevel $subversion | \
5914                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5915         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5916                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5917         ;;
5918 *)
5919         version=`echo $revision $patchlevel $subversion | \
5920                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5921         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5922                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5923         ;;
5924 esac
5925 : Special case the 5.005_xx maintenance series, which used 5.005
5926 : without any subversion label as a subdirectory in $sitelib
5927 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5928         api_versionstring='5.005'
5929 fi
5930
5931 : determine installation style
5932 : For now, try to deduce it from prefix unless it is already set.
5933 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5934 case "$installstyle" in
5935 '')     case "$prefix" in
5936                 *perl*) dflt='lib';;
5937                 *) dflt='lib/perl5' ;;
5938         esac
5939         ;;
5940 *)      dflt="$installstyle" ;;
5941 esac
5942 : Probably not worth prompting for this since we prompt for all
5943 : the directories individually, and the prompt would be too long and
5944 : confusing anyway.
5945 installstyle=$dflt
5946
5947 : determine where private library files go
5948 : Usual default is /usr/local/lib/perl5/$version.
5949 : Also allow things like /opt/perl/lib/$version, since 
5950 : /opt/perl/lib/perl5... would be redundant.
5951 : The default "style" setting is made in installstyle.U
5952 case "$installstyle" in
5953 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5954 *)       set dflt privlib lib/$version ;;
5955 esac
5956 eval $prefixit
5957 $cat <<EOM
5958
5959 There are some auxiliary files for $package that need to be put into a
5960 private library directory that is accessible by everyone.
5961
5962 EOM
5963 fn=d~+
5964 rp='Pathname where the private library files will reside?'
5965 . ./getfile
5966 privlib="$ans"
5967 privlibexp="$ansexp"
5968 : Change installation prefix, if necessary.
5969 if $test X"$prefix" != X"$installprefix"; then
5970         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5971 else
5972         installprivlib="$privlibexp"
5973 fi
5974
5975 : set the prefixup variable, to restore leading tilda escape
5976 prefixup='case "$prefixexp" in
5977 "$prefix") ;;
5978 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5979 esac'
5980
5981 : determine where public architecture dependent libraries go
5982 set archlib archlib
5983 eval $prefixit
5984 : privlib default is /usr/local/lib/$package/$version
5985 : archlib default is /usr/local/lib/$package/$version/$archname
5986 : privlib may have an optional trailing /share.
5987 tdflt=`echo $privlib | $sed 's,/share$,,'`
5988 tdflt=$tdflt/$archname
5989 case "$archlib" in
5990 '')     dflt=$tdflt
5991         ;;
5992 *)      dflt="$archlib"
5993     ;;
5994 esac
5995 $cat <<EOM
5996
5997 $spackage contains architecture-dependent library files.  If you are
5998 sharing libraries in a heterogeneous environment, you might store
5999 these files in a separate location.  Otherwise, you can just include
6000 them with the rest of the public library files.
6001
6002 EOM
6003 fn=d+~
6004 rp='Where do you want to put the public architecture-dependent libraries?'
6005 . ./getfile
6006 archlib="$ans"
6007 archlibexp="$ansexp"
6008 if $test X"$archlib" = X"$privlib"; then
6009         d_archlib="$undef"
6010 else
6011         d_archlib="$define"
6012 fi
6013 : Change installation prefix, if necessary.
6014 if $test X"$prefix" != X"$installprefix"; then
6015         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6016 else
6017         installarchlib="$archlibexp"
6018 fi
6019
6020 : see if setuid scripts can be secure
6021 $cat <<EOM
6022
6023 Some kernels have a bug that prevents setuid #! scripts from being
6024 secure.  Some sites have disabled setuid #! scripts because of this.
6025
6026 First let's decide if your kernel supports secure setuid #! scripts.
6027 (If setuid #! scripts would be secure but have been disabled anyway,
6028 don't say that they are secure if asked.)
6029
6030 EOM
6031
6032 val="$undef"
6033 if $test -d /dev/fd; then
6034         echo "#!$ls" >reflect
6035         chmod +x,u+s reflect
6036         ./reflect >flect 2>&1
6037         if $contains "/dev/fd" flect >/dev/null; then
6038                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6039                 val="$define"
6040         else
6041                 $cat <<EOM
6042 If you are not sure if they are secure, I can check but I'll need a
6043 username and password different from the one you are using right now.
6044 If you don't have such a username or don't want me to test, simply
6045 enter 'none'.
6046
6047 EOM
6048                 rp='Other username to test security of setuid scripts with?'
6049                 dflt='none'
6050                 . ./myread
6051                 case "$ans" in
6052                 n|none)
6053                         case "$d_suidsafe" in
6054                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6055                                 dflt=n;;
6056                         "$undef")
6057                                 echo "Well, the $hint value is *not* secure." >&4
6058                                 dflt=n;;
6059                         *)      echo "Well, the $hint value *is* secure." >&4
6060                                 dflt=y;;
6061                         esac
6062                         ;;
6063                 *)
6064                         $rm -f reflect flect
6065                         echo "#!$ls" >reflect
6066                         chmod +x,u+s reflect
6067                         echo >flect
6068                         chmod a+w flect
6069                         echo '"su" will (probably) prompt you for '"$ans's password."
6070                         su $ans -c './reflect >flect'
6071                         if $contains "/dev/fd" flect >/dev/null; then
6072                                 echo "Okay, it looks like setuid scripts are secure." >&4
6073                                 dflt=y
6074                         else
6075                                 echo "I don't think setuid scripts are secure." >&4
6076                                 dflt=n
6077                         fi
6078                         ;;
6079                 esac
6080                 rp='Does your kernel have *secure* setuid scripts?'
6081                 . ./myread
6082                 case "$ans" in
6083                 [yY]*)  val="$define";;
6084                 *)      val="$undef";;
6085                 esac
6086         fi
6087 else
6088         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6089         echo "(That's for file descriptors, not floppy disks.)"
6090         val="$undef"
6091 fi
6092 set d_suidsafe
6093 eval $setvar
6094
6095 $rm -f reflect flect
6096
6097 : now see if they want to do setuid emulation
6098 echo " "
6099 val="$undef"
6100 case "$d_suidsafe" in
6101 "$define")
6102         val="$undef"
6103         echo "No need to emulate SUID scripts since they are secure here." >&4
6104         ;;
6105 *)
6106         $cat <<EOM
6107 Some systems have disabled setuid scripts, especially systems where
6108 setuid scripts cannot be secure.  On systems where setuid scripts have
6109 been disabled, the setuid/setgid bits on scripts are currently
6110 useless.  It is possible for $package to detect those bits and emulate
6111 setuid/setgid in a secure fashion.  This emulation will only work if
6112 setuid scripts have been disabled in your kernel.
6113
6114 EOM
6115         case "$d_dosuid" in
6116         "$define") dflt=y ;;
6117         *) dflt=n ;;
6118         esac
6119         rp="Do you want to do setuid/setgid emulation?"
6120         . ./myread
6121         case "$ans" in
6122         [yY]*)  val="$define";;
6123         *)      val="$undef";;
6124         esac
6125         ;;
6126 esac
6127 set d_dosuid
6128 eval $setvar
6129
6130 : see if this is a malloc.h system
6131 : we want a real compile instead of Inhdr because some systems have a
6132 : malloc.h that just gives a compile error saying to use stdlib.h instead
6133 echo " "
6134 $cat >try.c <<EOCP
6135 #include <stdlib.h>
6136 #include <malloc.h>
6137 int main () { return 0; }
6138 EOCP
6139 set try
6140 if eval $compile; then
6141     echo "<malloc.h> found." >&4
6142     val="$define"
6143 else
6144     echo "<malloc.h> NOT found." >&4
6145     val="$undef"
6146 fi
6147 $rm -f try.c try
6148 set i_malloc
6149 eval $setvar
6150
6151 : check for void type
6152 echo " "
6153 echo "Checking to see how well your C compiler groks the void type..." >&4
6154 case "$voidflags" in
6155 '')
6156         $cat >try.c <<EOCP
6157 #$i_stdlib I_STDLIB
6158 #ifdef I_STDLIB
6159 #include <stdlib.h>
6160 #endif
6161 #if TRY & 1
6162 void sub() {
6163 #else
6164 sub() {
6165 #endif
6166         extern void moo();      /* function returning void */
6167         void (*goo)();          /* ptr to func returning void */
6168 #if TRY & 8
6169         void *hue;              /* generic ptr */
6170 #endif
6171 #if TRY & 2
6172         void (*foo[10])();
6173 #endif
6174
6175 #if TRY & 4
6176         if(goo == moo) {
6177                 exit(0);
6178         }
6179 #endif
6180         exit(0);
6181 }
6182 int main() { sub(); }
6183 EOCP
6184         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6185                 voidflags=$defvoidused
6186         echo "Good.  It appears to support void to the level $package wants.">&4
6187                 if $contains warning .out >/dev/null 2>&1; then
6188                         echo "However, you might get some warnings that look like this:"
6189                         $cat .out
6190                 fi
6191         else
6192 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6193                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6194                         echo "It supports 1..."
6195                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6196                                 echo "It also supports 2..."
6197                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6198                                         voidflags=7
6199                                         echo "And it supports 4 but not 8 definitely."
6200                                 else
6201                                         echo "It doesn't support 4..."
6202                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6203                                                 voidflags=11
6204                                                 echo "But it supports 8."
6205                                         else
6206                                                 voidflags=3
6207                                                 echo "Neither does it support 8."
6208                                         fi
6209                                 fi
6210                         else
6211                                 echo "It does not support 2..."
6212                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6213                                         voidflags=13
6214                                         echo "But it supports 4 and 8."
6215                                 else
6216                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6217                                                 voidflags=5
6218                                                 echo "And it supports 4 but has not heard about 8."
6219                                         else
6220                                                 echo "However it supports 8 but not 4."
6221                                         fi
6222                                 fi
6223                         fi
6224                 else
6225                         echo "There is no support at all for void."
6226                         voidflags=0
6227                 fi
6228         fi
6229 esac
6230 case "$voidflags" in
6231 "$defvoidused") ;;
6232 *)      $cat >&4 <<'EOM'
6233   Support flag bits are:
6234     1: basic void declarations.
6235     2: arrays of pointers to functions returning void.
6236     4: operations between pointers to and addresses of void functions.
6237     8: generic void pointers.
6238 EOM
6239         dflt="$voidflags";
6240         rp="Your void support flags add up to what?"
6241         . ./myread
6242         voidflags="$ans"
6243         ;;
6244 esac
6245 $rm -f try.* .out
6246
6247 : check for length of pointer
6248 echo " "
6249 case "$ptrsize" in
6250 '')
6251         echo "Checking to see how big your pointers are..." >&4
6252         if test "$voidflags" -gt 7; then
6253                 echo '#define VOID_PTR char *' > try.c
6254         else
6255                 echo '#define VOID_PTR void *' > try.c
6256         fi
6257         $cat >>try.c <<EOCP
6258 #include <stdio.h>
6259 #$i_stdlib I_STDLIB
6260 #ifdef I_STDLIB
6261 #include <stdlib.h>
6262 #endif
6263 int main()
6264 {
6265     printf("%d\n", (int)sizeof(VOID_PTR));
6266     exit(0);
6267 }
6268 EOCP
6269         set try
6270         if eval $compile_ok; then
6271                 ptrsize=`$run ./try`
6272                 echo "Your pointers are $ptrsize bytes long."
6273         else
6274                 dflt='4'
6275                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6276                 rp="What is the size of a pointer (in bytes)?"
6277                 . ./myread
6278                 ptrsize="$ans"
6279         fi
6280         ;;
6281 esac
6282 $rm -f try.c try
6283 case "$use64bitall" in
6284 "$define"|true|[yY]*)
6285         case "$ptrsize" in
6286         4)      cat <<EOM >&4
6287
6288 *** You have chosen a maximally 64-bit build,
6289 *** but your pointers are only 4 bytes wide.
6290 *** Please rerun Configure without -Duse64bitall.
6291 EOM
6292                 case "$d_quad" in
6293                 define)
6294                         cat <<EOM >&4
6295 *** Since you have quads, you could possibly try with -Duse64bitint.
6296 EOM
6297                         ;;
6298                 esac
6299                 cat <<EOM >&4
6300 *** Cannot continue, aborting.
6301
6302 EOM
6303
6304                 exit 1
6305                 ;;
6306         esac
6307         ;;
6308 esac
6309
6310
6311 : determine whether to use malloc wrapping
6312 echo " "
6313 case "$usemallocwrap" in
6314 [yY]*|true|$define)     dflt='y' ;;
6315 [nN]*|false|$undef)     dflt='n' ;;
6316 *)      case "$usedevel" in
6317         [yY]*|true|$define)     dflt='y' ;;
6318         *) dflt='n' ;;
6319         esac
6320         ;;
6321 esac
6322 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6323 . ./myread
6324 usemallocwrap="$ans"
6325 case "$ans" in
6326 y*|true)
6327         usemallocwrap="$define" ;;
6328 *)
6329         usemallocwrap="$undef" ;;
6330 esac
6331
6332 : determine which malloc to compile in
6333 echo " "
6334 case "$usemymalloc" in
6335 [yY]*|true|$define)     dflt='y' ;;
6336 [nN]*|false|$undef)     dflt='n' ;;
6337 *)      case "$ptrsize" in
6338         4) dflt='y' ;;
6339         *) dflt='n' ;;
6340         esac
6341         ;;
6342 esac
6343 rp="Do you wish to attempt to use the malloc that comes with $package?"
6344 . ./myread
6345 usemymalloc="$ans"
6346 case "$ans" in
6347 y*|true)
6348         usemymalloc='y'
6349         mallocsrc='malloc.c'
6350         mallocobj="malloc$_o"
6351         d_mymalloc="$define"
6352         case "$libs" in
6353         *-lmalloc*)
6354                 : Remove malloc from list of libraries to use
6355                 echo "Removing unneeded -lmalloc from library list" >&4
6356                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6357                 shift
6358                 libs="$*"
6359                 echo "libs = $libs" >&4
6360                 ;;
6361         esac
6362         ;;
6363 *)
6364         usemymalloc='n'
6365         mallocsrc=''
6366         mallocobj=''
6367         d_mymalloc="$undef"
6368         ;;
6369 esac
6370
6371 : compute the return types of malloc and free
6372 echo " "
6373 $cat >malloc.c <<END
6374 #$i_malloc I_MALLOC
6375 #$i_stdlib I_STDLIB
6376 #include <stdio.h>
6377 #include <sys/types.h>
6378 #ifdef I_MALLOC
6379 #include <malloc.h>
6380 #endif
6381 #ifdef I_STDLIB
6382 #include <stdlib.h>
6383 #endif
6384 #ifdef TRY_MALLOC
6385 void *malloc();
6386 #endif
6387 #ifdef TRY_FREE
6388 void free();
6389 #endif
6390 END
6391 case "$malloctype" in
6392 '')
6393         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6394                 malloctype='void *'
6395         else
6396                 malloctype='char *'
6397         fi
6398         ;;
6399 esac
6400 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6401
6402 case "$freetype" in
6403 '')
6404         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6405                 freetype='void'
6406         else
6407                 freetype='int'
6408         fi
6409         ;;
6410 esac
6411 echo "Your system uses $freetype free(), it would seem." >&4
6412 $rm -f malloc.[co]
6413 $cat <<EOM
6414
6415 After $package is installed, you may wish to install various
6416 add-on modules and utilities.  Typically, these add-ons will
6417 be installed under $prefix with the rest
6418 of this package.  However, you may wish to install such add-ons
6419 elsewhere under a different prefix.
6420
6421 If you do not wish to put everything under a single prefix, that's
6422 ok.  You will be prompted for the individual locations; this siteprefix
6423 is only used to suggest the defaults.
6424
6425 The default should be fine for most people.
6426
6427 EOM
6428 fn=d~+
6429 rp='Installation prefix to use for add-on modules and utilities?'
6430 : XXX Here might be another good place for an installstyle setting.
6431 case "$siteprefix" in
6432 '') dflt=$prefix ;;
6433 *)  dflt=$siteprefix ;;
6434 esac
6435 . ./getfile
6436 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6437 oldsiteprefix=''
6438 case "$siteprefix" in
6439 '') ;;
6440 *)      case "$ans" in
6441         "$prefix") ;;
6442         *) oldsiteprefix="$prefix";;
6443         esac
6444         ;;
6445 esac
6446 siteprefix="$ans"
6447 siteprefixexp="$ansexp"
6448
6449 : determine where site specific libraries go.
6450 : Usual default is /usr/local/lib/perl5/site_perl/$version
6451 : The default "style" setting is made in installstyle.U
6452 : XXX No longer works with Prefixit stuff.
6453 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6454 case "$sitelib" in
6455 '') case "$installstyle" in
6456         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6457         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6458         esac
6459         ;;
6460 *)      dflt="$sitelib"
6461         ;;
6462 esac
6463 $cat <<EOM
6464
6465 The installation process will create a directory for
6466 site-specific extensions and modules.  Most users find it convenient
6467 to place all site-specific files in this directory rather than in the
6468 main distribution directory.
6469
6470 EOM
6471 fn=d~+
6472 rp='Pathname for the site-specific library files?'
6473 . ./getfile
6474 sitelib="$ans"
6475 sitelibexp="$ansexp"
6476 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6477 : Change installation prefix, if necessary.
6478 if $test X"$prefix" != X"$installprefix"; then
6479         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6480 else
6481         installsitelib="$sitelibexp"
6482 fi
6483
6484 : determine where site specific architecture-dependent libraries go.
6485 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6486 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6487 : sitelib may have an optional trailing /share.
6488 case "$sitearch" in
6489 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6490         dflt="$dflt/$archname"
6491         ;;
6492 *)      dflt="$sitearch"
6493         ;;
6494 esac
6495 set sitearch sitearch none
6496 eval $prefixit
6497 $cat <<EOM
6498
6499 The installation process will also create a directory for
6500 architecture-dependent site-specific extensions and modules.
6501
6502 EOM
6503 fn=d~+
6504 rp='Pathname for the site-specific architecture-dependent library files?'
6505 . ./getfile
6506 sitearch="$ans"
6507 sitearchexp="$ansexp"
6508 : Change installation prefix, if necessary.
6509 if $test X"$prefix" != X"$installprefix"; then
6510         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6511 else
6512         installsitearch="$sitearchexp"
6513 fi
6514
6515 $cat <<EOM
6516
6517 The installation process will also create a directory for
6518 vendor-supplied add-ons.  Vendors who supply perl with their system
6519 may find it convenient to place all vendor-supplied files in this
6520 directory rather than in the main distribution directory.  This will
6521 ease upgrades between binary-compatible maintenance versions of perl.
6522
6523 Of course you may also use these directories in whatever way you see
6524 fit.  For example, you might use them to access modules shared over a
6525 company-wide network.
6526
6527 The default answer should be fine for most people.
6528 This causes further questions about vendor add-ons to be skipped
6529 and no vendor-specific directories will be configured for perl.
6530
6531 EOM
6532 rp='Do you want to configure vendor-specific add-on directories?'
6533 case "$usevendorprefix" in
6534 define|true|[yY]*) dflt=y ;;
6535 *)      : User may have set vendorprefix directly on Configure command line.
6536         case "$vendorprefix" in
6537         ''|' ') dflt=n ;;
6538         *)      dflt=y ;;
6539         esac
6540         ;;
6541 esac
6542 . ./myread
6543 case "$ans" in
6544 [yY]*)  fn=d~+
6545         rp='Installation prefix to use for vendor-supplied add-ons?'
6546         case "$vendorprefix" in
6547         '') dflt='' ;;
6548         *)  dflt=$vendorprefix ;;
6549         esac
6550         . ./getfile
6551         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6552         oldvendorprefix=''
6553         case "$vendorprefix" in
6554         '') ;;
6555         *)      case "$ans" in
6556                 "$prefix") ;;
6557                 *) oldvendorprefix="$prefix";;
6558                 esac
6559                 ;;
6560         esac
6561         usevendorprefix="$define"
6562         vendorprefix="$ans"
6563         vendorprefixexp="$ansexp"
6564         ;;
6565 *)      usevendorprefix="$undef"
6566         vendorprefix=''
6567         vendorprefixexp=''
6568         ;;
6569 esac
6570
6571 case "$vendorprefix" in
6572 '')     d_vendorlib="$undef"
6573         vendorlib=''
6574         vendorlibexp=''
6575         ;;
6576 *)      d_vendorlib="$define"
6577         : determine where vendor-supplied modules go.
6578         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6579         case "$vendorlib" in
6580         '')
6581                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6582                 case "$installstyle" in
6583                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6584                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6585                 esac
6586                 ;;
6587         *)      dflt="$vendorlib"
6588                 ;;
6589         esac
6590         fn=d~+
6591         rp='Pathname for the vendor-supplied library files?'
6592         . ./getfile
6593         vendorlib="$ans"
6594         vendorlibexp="$ansexp"
6595         ;;
6596 esac
6597 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6598 : Change installation prefix, if necessary.
6599 if $test X"$prefix" != X"$installprefix"; then
6600         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6601 else
6602         installvendorlib="$vendorlibexp"
6603 fi
6604
6605 case "$vendorprefix" in
6606 '')     d_vendorarch="$undef"
6607         vendorarch=''
6608         vendorarchexp=''
6609         ;;
6610 *)      d_vendorarch="$define"
6611         : determine where vendor-supplied architecture-dependent libraries go.
6612         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6613         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6614         : vendorlib may have an optional trailing /share.
6615         case "$vendorarch" in
6616         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6617                 dflt="$dflt/$archname"
6618                 ;;
6619         *)      dflt="$vendorarch" ;;
6620         esac
6621         fn=d~+
6622         rp='Pathname for vendor-supplied architecture-dependent files?'
6623         . ./getfile
6624         vendorarch="$ans"
6625         vendorarchexp="$ansexp"
6626         ;;
6627 esac
6628 : Change installation prefix, if necessary.
6629 if $test X"$prefix" != X"$installprefix"; then
6630         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6631 else
6632         installvendorarch="$vendorarchexp"
6633 fi
6634
6635 : Final catch-all directories to search
6636 $cat <<EOM
6637
6638 Lastly, you can have perl look in other directories for extensions and
6639 modules in addition to those already specified.
6640 These directories will be searched after 
6641         $sitearch 
6642         $sitelib 
6643 EOM
6644 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6645 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6646 echo ' '
6647 case "$otherlibdirs" in
6648 ''|' ') dflt='none' ;;
6649 *)      dflt="$otherlibdirs" ;;
6650 esac
6651 $cat <<EOM
6652 Enter a colon-separated set of extra paths to include in perl's @INC
6653 search path, or enter 'none' for no extra paths.
6654
6655 EOM
6656
6657 rp='Colon-separated list of additional directories for perl to search?'
6658 . ./myread
6659 case "$ans" in
6660 ' '|''|none)    otherlibdirs=' ' ;;     
6661 *)      otherlibdirs="$ans" ;;
6662 esac
6663 case "$otherlibdirs" in
6664 ' ') val=$undef ;;
6665 *)      val=$define ;;
6666 esac
6667 set d_perl_otherlibdirs
6668 eval $setvar
6669
6670 : Cruising for prototypes
6671 echo " "
6672 echo "Checking out function prototypes..." >&4
6673 $cat >prototype.c <<EOCP
6674 #$i_stdlib I_STDLIB
6675 #ifdef I_STDLIB
6676 #include <stdlib.h>
6677 #endif
6678 int main(int argc, char *argv[]) {
6679         exit(0);}
6680 EOCP
6681 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6682         echo "Your C compiler appears to support function prototypes."
6683         val="$define"
6684 else
6685         echo "Your C compiler doesn't seem to understand function prototypes."
6686         val="$undef"
6687 fi
6688 set prototype
6689 eval $setvar
6690 $rm -f prototype*
6691
6692 case "$prototype" in
6693 "$define") ;;
6694 *)      ansi2knr='ansi2knr'
6695         echo " "
6696         cat <<EOM >&4
6697
6698 $me:  FATAL ERROR:
6699 This version of $package can only be compiled by a compiler that 
6700 understands function prototypes.  Unfortunately, your C compiler 
6701         $cc $ccflags
6702 doesn't seem to understand them.  Sorry about that.
6703
6704 If GNU cc is available for your system, perhaps you could try that instead.  
6705
6706 Eventually, we hope to support building Perl with pre-ANSI compilers.
6707 If you would like to help in that effort, please contact <perlbug@perl.org>.
6708
6709 Aborting Configure now.
6710 EOM
6711         exit 2
6712         ;;
6713 esac
6714
6715 : determine where public executables go
6716 echo " "
6717 set dflt bin bin
6718 eval $prefixit
6719 fn=d~
6720 rp='Pathname where the public executables will reside?'
6721 . ./getfile
6722 if $test "X$ansexp" != "X$binexp"; then
6723         installbin=''
6724 fi
6725 bin="$ans"
6726 binexp="$ansexp"
6727 : Change installation prefix, if necessary.
6728 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6729 if $test X"$prefix" != X"$installprefix"; then
6730         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6731 else
6732         installbin="$binexp"
6733 fi
6734
6735 echo " "
6736 case "$extras" in
6737 '') dflt='n';;
6738 *) dflt='y';;
6739 esac
6740 cat <<EOM
6741 Perl can be built with extra modules or bundles of modules which
6742 will be fetched from the CPAN and installed alongside Perl.
6743
6744 Notice that you will need access to the CPAN; either via the Internet,
6745 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6746 be asked later to configure the CPAN.pm module which will in turn do
6747 the installation of the rest of the extra modules or bundles.)
6748
6749 Notice also that if the modules require any external software such as
6750 libraries and headers (the libz library and the zlib.h header for the
6751 Compress::Zlib module, for example) you MUST have any such software
6752 already installed, this configuration process will NOT install such
6753 things for you.
6754
6755 If this doesn't make any sense to you, just accept the default '$dflt'.
6756 EOM
6757 rp='Install any extra modules (y or n)?'
6758 . ./myread
6759 case "$ans" in
6760 y|Y)
6761         cat <<EOM
6762
6763 Please list any extra modules or bundles to be installed from CPAN,
6764 with spaces between the names.  The names can be in any format the
6765 'install' command of CPAN.pm will understand.  (Answer 'none',
6766 without the quotes, to install no extra modules or bundles.)
6767 EOM
6768         rp='Extras?'
6769         dflt="$extras"
6770         . ./myread
6771         extras="$ans"
6772 esac
6773 case "$extras" in
6774 ''|'none')
6775         val=''
6776         $rm -f ../extras.lst
6777         ;;
6778 *)      echo "(Saving the list of extras for later...)"
6779         echo "$extras" > ../extras.lst
6780         val="'$extras'"
6781         ;;
6782 esac
6783 set extras
6784 eval $setvar
6785 echo " "
6786
6787 : determine where html pages for programs go
6788 set html1dir html1dir none
6789 eval $prefixit
6790 $cat <<EOM
6791
6792 If you wish to install html files for programs in $spackage, indicate 
6793 the appropriate directory here.  To skip installing html files,
6794 answer "none".
6795 EOM
6796 case "$html1dir" in
6797 ''|none|$undef|' ') dflt=none ;;
6798 *) dflt=$html1dir ;;
6799 esac
6800 fn=dn+~
6801 rp="Directory for the main $spackage html pages?"
6802 . ./getfile
6803 html1dir="$ans"
6804 html1direxp="$ansexp"
6805 : Use ' ' for none so value is preserved next time through Configure
6806 $test X"$html1dir" = "X" && html1dir=' '
6807 : Change installation prefix, if necessary.
6808 if $test X"$prefix" != X"$installprefix"; then
6809         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6810 else
6811         installhtml1dir="$html1direxp"
6812 fi
6813
6814 : determine where html pages for libraries and modules go
6815 set html3dir html3dir none
6816 eval $prefixit
6817 $cat <<EOM
6818
6819 If you wish to install html files for modules associated with $spackage,
6820 indicate the appropriate directory here.  To skip installing html files,
6821 answer "none".
6822 EOM
6823 : There is no obvious default.  If they have specified html1dir, then
6824 : try to key off that, possibly changing .../html1 into .../html3.
6825 case "$html3dir" in
6826 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6827 *) dflt=$html3dir ;;
6828 esac
6829 fn=dn+~
6830 rp="Directory for the $spackage module html pages?"
6831 . ./getfile
6832 html3dir="$ans"
6833 html3direxp="$ansexp"
6834 : Use ' ' for none so value is preserved next time through Configure
6835 $test X"$html3dir" = "X" && html3dir=' '
6836 : Change installation prefix, if necessary.
6837 if $test X"$prefix" != X"$installprefix"; then
6838         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6839 else
6840         installhtml3dir="$html3direxp"
6841 fi
6842
6843 : Find perl5.005 or later.
6844 echo "Looking for a previously installed perl5.005 or later... "
6845 case "$perl5" in
6846 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6847                 : Check if this perl is recent and can load a simple module
6848                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6849                         perl5=$tdir/perl
6850                         break;
6851                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6852                         perl5=$tdir/perl5
6853                         break;
6854                 fi
6855         done
6856         ;;
6857 *)      perl5="$perl5"
6858         ;;
6859 esac
6860 case "$perl5" in
6861 '')     echo "None found.  That's ok.";;
6862 *)      echo "Using $perl5." ;;
6863 esac
6864
6865 : Determine list of previous versions to include in @INC
6866 $cat > getverlist <<EOPL
6867 #!$perl5 -w
6868 use File::Basename;
6869 \$api_versionstring = "$api_versionstring";
6870 \$version = "$version";
6871 \$stem = "$sitelib_stem";
6872 \$archname = "$archname";
6873 EOPL
6874         $cat >> getverlist <<'EOPL'
6875 # Can't have leading @ because metaconfig interprets it as a command!
6876 ;@inc_version_list=();
6877 # XXX Redo to do opendir/readdir? 
6878 if (-d $stem) {
6879     chdir($stem);
6880     ;@candidates = glob("5.*");
6881 }
6882 else {
6883     ;@candidates = ();
6884 }
6885
6886 # XXX ToDo:  These comparisons must be reworked when two-digit
6887 # subversions come along, so that 5.7.10 compares as greater than
6888 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6889 # widespread that we can use the built-in version vectors rather
6890 # than reinventing them here.  For 5.6.0, however, we must
6891 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6892 foreach $d (@candidates) {
6893     if ($d lt $version) {
6894         if ($d ge $api_versionstring) {
6895             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6896         }
6897         elsif ($d ge "5.005") {
6898             unshift(@inc_version_list, grep { -d } $d);
6899         }
6900     }
6901     else {
6902         # Skip newer version.  I.e. don't look in
6903         # 5.7.0 if we're installing 5.6.1.
6904     }
6905 }
6906
6907 if (@inc_version_list) {
6908     print join(' ', @inc_version_list);
6909 }
6910 else {
6911     # Blank space to preserve value for next Configure run.
6912     print " ";
6913 }
6914 EOPL
6915 chmod +x getverlist
6916 case "$inc_version_list" in
6917 '')     if test -x "$perl5$exe_ext"; then
6918                 dflt=`$perl5 getverlist`
6919         else
6920                 dflt='none'
6921         fi
6922         ;;
6923 $undef) dflt='none' ;;
6924 *)  eval dflt=\"$inc_version_list\" ;;
6925 esac
6926 case "$dflt" in
6927 ''|' ') dflt=none ;;
6928 esac
6929 case "$dflt" in
6930 5.005) dflt=none ;;
6931 esac
6932 $cat <<EOM
6933
6934 In order to ease the process of upgrading, this version of perl 
6935 can be configured to use modules built and installed with earlier 
6936 versions of perl that were installed under $prefix.  Specify here
6937 the list of earlier versions that this version of perl should check.
6938 If Configure detected no earlier versions of perl installed under
6939 $prefix, then the list will be empty.  Answer 'none' to tell perl
6940 to not search earlier versions.
6941
6942 The default should almost always be sensible, so if you're not sure,
6943 just accept the default.
6944 EOM
6945
6946 rp='List of earlier versions to include in @INC?'
6947 . ./myread
6948 case "$ans" in
6949 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6950 *) inc_version_list="$ans" ;;
6951 esac
6952 case "$inc_version_list" in
6953 ''|' ') 
6954         inc_version_list_init='0';;
6955 *)      inc_version_list_init=`echo $inc_version_list |
6956                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6957         ;;
6958 esac
6959 $rm -f getverlist
6960
6961 : determine whether to install perl also as /usr/bin/perl
6962
6963 echo " "
6964 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6965         $cat <<EOM
6966 Many scripts expect perl to be installed as /usr/bin/perl.
6967
6968 If you want to, I can install the perl you are about to compile
6969 as /usr/bin/perl (in addition to $bin/perl).
6970 EOM
6971         if test -f /usr/bin/perl; then
6972             $cat <<EOM
6973
6974 However, please note that because you already have a /usr/bin/perl,
6975 overwriting that with a new Perl would very probably cause problems.
6976 Therefore I'm assuming you don't want to do that (unless you insist).
6977
6978 EOM
6979             case "$installusrbinperl" in
6980             "$define"|[yY]*)    dflt='y';;
6981             *)                  dflt='n';;
6982             esac
6983         else
6984             $cat <<EOM
6985
6986 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6987
6988 EOM
6989             case "$installusrbinperl" in
6990             "$undef"|[nN]*)     dflt='n';;
6991             *)                  dflt='y';;
6992             esac
6993         fi
6994         rp="Do you want to install perl as /usr/bin/perl?"
6995         . ./myread
6996         case "$ans" in
6997         [yY]*)  val="$define";;
6998         *)      val="$undef" ;;
6999         esac
7000 else
7001         val="$undef"
7002 fi
7003 set installusrbinperl
7004 eval $setvar
7005
7006 echo " "
7007 echo "Checking for GNU C Library..." >&4
7008 cat >try.c <<'EOCP'
7009 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7010    alone are insufficient to distinguish different versions, such as
7011    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7012    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7013 */
7014 #include <stdio.h>
7015 int main(void)
7016 {
7017 #ifdef __GLIBC__
7018 #   ifdef __GLIBC_MINOR__
7019 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7020 #           include <gnu/libc-version.h>
7021             printf("%s\n",  gnu_get_libc_version());
7022 #       else
7023             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7024 #       endif
7025 #   else
7026         printf("%d\n",  __GLIBC__);
7027 #   endif
7028     return 0;
7029 #else
7030     return 1;
7031 #endif
7032 }
7033 EOCP
7034 set try
7035 if eval $compile_ok && $run ./try > glibc.ver; then
7036         val="$define"
7037         gnulibc_version=`$cat glibc.ver`
7038         echo "You are using the GNU C Library version $gnulibc_version"
7039 else
7040         val="$undef"
7041         gnulibc_version=''
7042         echo "You are not using the GNU C Library"
7043 fi
7044 $rm -f try try.* glibc.ver
7045 set d_gnulibc
7046 eval $setvar
7047
7048 : see if nm is to be used to determine whether a symbol is defined or not
7049 case "$usenm" in
7050 '')
7051         dflt=''
7052         case "$d_gnulibc" in
7053         "$define")
7054                 echo " "
7055                 echo "nm probably won't work on the GNU C Library." >&4
7056                 dflt=n
7057                 ;;
7058         esac
7059         case "$dflt" in
7060         '') 
7061                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7062                         echo " "
7063                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7064                         echo "'nm' won't be sufficient on this sytem." >&4
7065                         dflt=n
7066                 fi
7067                 ;;
7068         esac
7069         case "$dflt" in
7070         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7071                 if $test $dflt -gt 20; then
7072                         dflt=y
7073                 else
7074                         dflt=n
7075                 fi
7076                 ;;
7077         esac
7078         ;;
7079 *)
7080         case "$usenm" in
7081         true|$define) dflt=y;;
7082         *) dflt=n;;
7083         esac
7084         ;;
7085 esac
7086 $cat <<EOM
7087
7088 I can use $nm to extract the symbols from your C libraries. This
7089 is a time consuming task which may generate huge output on the disk (up
7090 to 3 megabytes) but that should make the symbols extraction faster. The
7091 alternative is to skip the 'nm' extraction part and to compile a small
7092 test program instead to determine whether each symbol is present. If
7093 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7094 this may be the best solution.
7095
7096 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7097
7098 EOM
7099 rp="Shall I use $nm to extract C symbols from the libraries?"
7100 . ./myread
7101 case "$ans" in
7102 [Nn]*) usenm=false;;
7103 *) usenm=true;;
7104 esac
7105
7106 runnm=$usenm
7107 case "$reuseval" in
7108 true) runnm=false;;
7109 esac
7110
7111 : nm options which may be necessary
7112 case "$nm_opt" in
7113 '') if $test -f /mach_boot; then
7114                 nm_opt=''       # Mach
7115         elif $test -d /usr/ccs/lib; then
7116                 nm_opt='-p'     # Solaris (and SunOS?)
7117         elif $test -f /dgux; then
7118                 nm_opt='-p'     # DG-UX
7119         elif $test -f /lib64/rld; then
7120                 nm_opt='-p'     # 64-bit Irix
7121         else
7122                 nm_opt=''
7123         fi;;
7124 esac
7125
7126 : nm options which may be necessary for shared libraries but illegal
7127 : for archive libraries.  Thank you, Linux.
7128 case "$nm_so_opt" in
7129 '')     case "$myuname" in
7130         *linux*|gnu*)
7131                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7132                         nm_so_opt='--dynamic'
7133                 fi
7134                 ;;
7135         esac
7136         ;;
7137 esac
7138
7139 case "$runnm" in
7140 true)
7141 : get list of predefined functions in a handy place
7142 echo " "
7143 case "$libc" in
7144 '') libc=unknown
7145         case "$libs" in
7146         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7147         esac
7148         ;;
7149 esac
7150 case "$libs" in
7151 '') ;;
7152 *)  for thislib in $libs; do
7153         case "$thislib" in
7154         -lc|-lc_s)
7155                 : Handle C library specially below.
7156                 ;;
7157         -l*)
7158                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7159                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7160                         :
7161                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7162                         :
7163                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7164                         :
7165                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7166                         :
7167                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7168                         :
7169                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7170                         :
7171                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7172                         :
7173                 else
7174                         try=''
7175                 fi
7176                 libnames="$libnames $try"
7177                 ;;
7178         *) libnames="$libnames $thislib" ;;
7179         esac
7180         done
7181         ;;
7182 esac
7183 xxx=normal
7184 case "$libc" in
7185 unknown)
7186         set /lib/libc.$so
7187         for xxx in $libpth; do
7188                 $test -r $1 || set $xxx/libc.$so
7189                 : The messy sed command sorts on library version numbers.
7190                 $test -r $1 || \
7191                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7192                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7193                                 h
7194                                 s/[0-9][0-9]*/0000&/g
7195                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7196                                 G
7197                                 s/\n/ /' | \
7198                          $sort | $sed -e 's/^.* //'`
7199                 eval set \$$#
7200         done
7201         $test -r $1 || set /usr/ccs/lib/libc.$so
7202         $test -r $1 || set /lib/libsys_s$_a
7203         ;;
7204 *)
7205         set blurfl
7206         ;;
7207 esac
7208 if $test -r "$1"; then
7209         echo "Your (shared) C library seems to be in $1."
7210         libc="$1"
7211 elif $test -r /lib/libc && $test -r /lib/clib; then
7212         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7213         xxx=apollo
7214         libc='/lib/clib /lib/libc'
7215         if $test -r /lib/syslib; then
7216                 echo "(Your math library is in /lib/syslib.)"
7217                 libc="$libc /lib/syslib"
7218         fi
7219 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7220         echo "Your C library seems to be in $libc, as you said before."
7221 elif $test -r $incpath/usr/lib/libc$_a; then
7222         libc=$incpath/usr/lib/libc$_a;
7223         echo "Your C library seems to be in $libc.  That's fine."
7224 elif $test -r /lib/libc$_a; then
7225         libc=/lib/libc$_a;
7226         echo "Your C library seems to be in $libc.  You're normal."
7227 else
7228         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7229                 :
7230         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7231                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7232         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7233                 :
7234         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7235                 :
7236         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7237                 :
7238         else
7239                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7240         fi
7241         if $test -r "$tans"; then
7242                 echo "Your C library seems to be in $tans, of all places."
7243                 libc=$tans
7244         else
7245                 libc='blurfl'
7246         fi
7247 fi
7248 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7249         dflt="$libc"
7250         cat <<EOM
7251
7252 If the guess above is wrong (which it might be if you're using a strange
7253 compiler, or your machine supports multiple models), you can override it here.
7254
7255 EOM
7256 else
7257         dflt=''
7258         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7259         cat >&4 <<EOM
7260 I can't seem to find your C library.  I've looked in the following places:
7261
7262 EOM
7263         $sed 's/^/      /' libpath
7264         cat <<EOM
7265
7266 None of these seems to contain your C library. I need to get its name...
7267
7268 EOM
7269 fi
7270 fn=f
7271 rp='Where is your C library?'
7272 . ./getfile
7273 libc="$ans"
7274
7275 echo " "
7276 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7277 set X `cat libnames`
7278 shift
7279 xxx=files
7280 case $# in 1) xxx=file; esac
7281 echo "Extracting names from the following $xxx for later perusal:" >&4
7282 echo " "
7283 $sed 's/^/      /' libnames >&4
7284 echo " "
7285 $echo $n "This may take a while...$c" >&4
7286
7287 for file in $*; do
7288         case $file in
7289         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7290         *) $nm $nm_opt $file 2>/dev/null;;
7291         esac
7292 done >libc.tmp
7293
7294 $echo $n ".$c"
7295 $grep fprintf libc.tmp > libc.ptf
7296 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7297 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7298 xxx='[ADTSIW]'
7299 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7300         eval $xscan;\
7301         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7302                 eval $xrun
7303 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7304         eval $xscan;\
7305         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7306                 eval $xrun
7307 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/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/^.* D __*//p' -e 's/^.* D //p'";\
7312         eval $xscan;\
7313         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7314                 eval $xrun
7315 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\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/^.*|FUNC |GLOB .*|//p'";\
7320         eval $xscan;\
7321         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7322                 eval $xrun
7323 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7324                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7325         eval $xscan;\
7326         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7327                 eval $xrun
7328 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7329         eval $xscan;\
7330         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7331                 eval $xrun
7332 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7333         eval $xscan;\
7334         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7335                 eval $xrun
7336 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7337         eval $xscan;\
7338         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7339                 eval $xrun
7340 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7341         eval $xscan;\
7342         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7343                 eval $xrun
7344 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7345         eval $xscan;\
7346         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7347                 eval $xrun
7348 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7349         eval $xscan;\
7350         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7351                 eval $xrun
7352 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7353         eval $xscan;\
7354         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7355                 eval $xrun
7356 else
7357         $nm -p $* 2>/dev/null >libc.tmp
7358         $grep fprintf libc.tmp > libc.ptf
7359         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7360                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7361         then
7362                 nm_opt='-p'
7363                 eval $xrun
7364         else
7365                 echo " "
7366                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7367                 com=''
7368                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7369                         for thisname in $libnames $libc; do
7370                                 $ar t $thisname >>libc.tmp
7371                         done
7372                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7373                         echo "Ok." >&4
7374                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7375                         # Repeat libc to extract forwarders to DLL entries too
7376                         for thisname in $libnames $libc; do
7377                                 $ar tv $thisname >>libc.tmp
7378                                 # Revision 50 of EMX has bug in $ar.
7379                                 # it will not extract forwarders to DLL entries
7380                                 # Use emximp which will extract exactly them.
7381                                 emximp -o tmp.imp $thisname \
7382                                     2>/dev/null && \
7383                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7384                                     < tmp.imp >>libc.tmp
7385                                 $rm tmp.imp
7386                         done
7387                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7388                         echo "Ok." >&4
7389                 else
7390                         echo "$ar didn't seem to work right." >&4
7391                         echo "Maybe this is a Cray...trying bld instead..." >&4
7392                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7393                         then
7394                                 for thisname in $libnames; do
7395                                         bld t $libnames | \
7396                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7397                                         $ar t $thisname >>libc.tmp
7398                                 done
7399                                 echo "Ok." >&4
7400                         else
7401                                 echo "That didn't work either.  Giving up." >&4
7402                                 exit 1
7403                         fi
7404                 fi
7405         fi
7406 fi
7407 nm_extract="$com"
7408 case "$PASE" in
7409 define)
7410     echo " "
7411     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7412     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7413     ;;
7414 *)  if $test -f /lib/syscalls.exp; then
7415         echo " "
7416         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7417         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7418     fi
7419     ;;
7420 esac
7421 ;;
7422 esac
7423 $rm -f libnames libpath
7424
7425 : see if dld is available
7426 set dld.h i_dld
7427 eval $inhdr
7428
7429 : is a C symbol defined?
7430 csym='tlook=$1;
7431 case "$3" in
7432 -v) tf=libc.tmp; tdc="";;
7433 -a) tf=libc.tmp; tdc="[]";;
7434 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7435 esac;
7436 tx=yes;
7437 case "$reuseval-$4" in
7438 true-) ;;
7439 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7440 esac;
7441 case "$tx" in
7442 yes)
7443         tval=false;
7444         if $test "$runnm" = true; then
7445                 if $contains $tlook $tf >/dev/null 2>&1; then
7446                         tval=true;
7447                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7448                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7449                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7450                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7451                         $rm -f try$_exe try.c core core.* try.core;
7452                 fi;
7453         else
7454                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7455                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7456                 $rm -f try$_exe try.c;
7457         fi;
7458         ;;
7459 *)
7460         case "$tval" in
7461         $define) tval=true;;
7462         *) tval=false;;
7463         esac;
7464         ;;
7465 esac;
7466 eval "$2=$tval"'
7467
7468 : define an is-in-libc? function
7469 inlibc='echo " "; td=$define; tu=$undef;
7470 sym=$1; var=$2; eval "was=\$$2";
7471 tx=yes;
7472 case "$reuseval$was" in
7473 true) ;;
7474 true*) tx=no;;
7475 esac;
7476 case "$tx" in
7477 yes)
7478         set $sym tres -f;
7479         eval $csym;
7480         case "$tres" in
7481         true)
7482                 echo "$sym() found." >&4;
7483                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7484         *)
7485                 echo "$sym() NOT found." >&4;
7486                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7487         esac;;
7488 *)
7489         case "$was" in
7490         $define) echo "$sym() found." >&4;;
7491         *) echo "$sym() NOT found." >&4;;
7492         esac;;
7493 esac'
7494
7495 : see if dlopen exists
7496 xxx_runnm="$runnm"
7497 runnm=false
7498 set dlopen d_dlopen
7499 eval $inlibc
7500 runnm="$xxx_runnm"
7501
7502 : determine which dynamic loading, if any, to compile in
7503 echo " "
7504 dldir="ext/DynaLoader"
7505 case "$usedl" in
7506 $define|y|true)
7507         dflt='y'
7508         usedl="$define"
7509         ;;
7510 $undef|n|false)
7511         dflt='n'
7512         usedl="$undef"
7513         ;;
7514 *) 
7515         dflt='n'
7516         case "$d_dlopen" in
7517             $define) dflt='y' ;;
7518         esac
7519         case "$i_dld" in
7520             $define) dflt='y' ;;
7521         esac
7522         : Does a dl_xxx.xs file exist for this operating system
7523         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7524         ;;
7525 esac
7526 rp="Do you wish to use dynamic loading?"
7527 . ./myread
7528 usedl="$ans"
7529 case "$ans" in
7530 y*) usedl="$define"
7531         case "$dlsrc" in
7532         '')
7533                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7534                         dflt="$dldir/dl_${osname}.xs"
7535                 elif $test "$d_dlopen" = "$define" ; then
7536                         dflt="$dldir/dl_dlopen.xs"
7537                 elif $test "$i_dld" = "$define" ; then
7538                         dflt="$dldir/dl_dld.xs"
7539                 else
7540                         dflt=''
7541                 fi
7542                 ;;
7543         *)      dflt="$dldir/$dlsrc"
7544                 ;;
7545         esac
7546     echo "The following dynamic loading files are available:"
7547         : Can not go over to $dldir because getfile has path hard-coded in.
7548         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7549         rp="Source file to use for dynamic loading"
7550         fn="fne"
7551         gfpth="$src"
7552         . ./getfile
7553         usedl="$define"
7554         : emulate basename
7555         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7556
7557         $cat << EOM
7558
7559 Some systems may require passing special flags to $cc -c to
7560 compile modules that will be used to create a shared library.
7561 To use no flags, say "none".
7562
7563 EOM
7564     case "$cccdlflags" in
7565     '') case "$gccversion" in
7566                 '') case "$osname" in
7567                         hpux)   dflt='+z' ;;
7568                         next)   dflt='none' ;;
7569                         irix*)  dflt='-KPIC' ;;
7570                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7571                         sunos)  dflt='-pic' ;;
7572                         *)      dflt='none' ;;
7573                     esac
7574                         ;;
7575                 *)  case "$osname" in
7576                         darwin) dflt='none' ;;
7577                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7578                         *)      dflt='-fpic' ;;
7579                     esac ;;
7580             esac ;;
7581         ' ') dflt='none' ;;
7582     *)  dflt="$cccdlflags" ;;
7583     esac
7584     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7585     . ./myread
7586     case "$ans" in
7587     none) cccdlflags=' ' ;;
7588     *) cccdlflags="$ans" ;;
7589     esac
7590
7591     cat << EOM
7592
7593 Some systems use ld to create libraries that can be dynamically loaded,
7594 while other systems (such as those using ELF) use $cc.
7595
7596 EOM
7597         case "$ld" in
7598         '')     $cat >try.c <<EOM
7599 /* Test for whether ELF binaries are produced */
7600 #include <fcntl.h>
7601 #$i_stdlib I_STDLIB
7602 #ifdef I_STDLIB
7603 #include <stdlib.h>
7604 #endif
7605 int main() {
7606         char b[4];
7607         int i = open("a.out",O_RDONLY);
7608         if(i == -1) 
7609                 exit(1); /* fail */
7610         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7611                 exit(0); /* succeed (yes, it's ELF) */
7612         else
7613                 exit(1); /* fail */
7614 }
7615 EOM
7616                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7617                         cat <<EOM
7618 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7619 EOM
7620                         dflt="$cc"
7621                 else
7622                         echo "I'll use ld to build dynamic libraries."
7623                         dflt='ld'
7624                 fi
7625                 rm -f try.c a.out
7626                 ;;
7627         *)      dflt="$ld"
7628                 ;;
7629         esac
7630
7631     rp="What command should be used to create dynamic libraries?"
7632     . ./myread
7633         ld="$ans"
7634
7635     cat << EOM
7636
7637 Some systems may require passing special flags to $ld to create a
7638 library that can be dynamically loaded.  If your ld flags include
7639 -L/other/path options to locate libraries outside your loader's normal
7640 search path, you may need to specify those -L options here as well.  To
7641 use no flags, say "none".
7642
7643 EOM
7644     case "$lddlflags" in
7645     '') case "$osname" in
7646                         beos) dflt='-nostart' ;;
7647                         hpux) dflt='-b';
7648                               case "$gccversion" in
7649                               '') dflt="$dflt +vnocompatwarnings" ;;
7650                               esac
7651                               ;;        
7652                         linux|irix*|gnu*)       dflt='-shared' ;;
7653                         next)  dflt='none' ;;
7654                         solaris) dflt='-G' ;;
7655                         sunos) dflt='-assert nodefinitions' ;;
7656                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7657                 *)     dflt='none' ;;
7658                         esac
7659                         ;;
7660     *) dflt="$lddlflags" ;;
7661     esac
7662
7663         : Try to guess additional flags to pick up local libraries.
7664         : Be careful not to append to a plain 'none'
7665         case "$dflt" in
7666         none) dflt='' ;;
7667         esac
7668         for thisflag in $ldflags; do
7669                 case "$thisflag" in
7670                 -L*|-R*|-Wl,-R*)
7671                         case " $dflt " in
7672                         *" $thisflag "*) ;;
7673                         *) dflt="$dflt $thisflag" ;;
7674                         esac
7675                         ;;
7676                 esac
7677         done
7678
7679         case "$dflt" in
7680         ''|' ') dflt='none' ;;
7681         esac
7682
7683     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7684     . ./myread
7685     case "$ans" in
7686     none) lddlflags=' ' ;;
7687     *) lddlflags="$ans" ;;
7688     esac
7689
7690         cat <<EOM
7691
7692 Some systems may require passing special flags to $cc to indicate that
7693 the resulting executable will use dynamic linking.  To use no flags,
7694 say "none".
7695
7696 EOM
7697     case "$ccdlflags" in
7698     '') case "$osname" in
7699             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7700             next|sunos) dflt='none' ;;
7701             *)          dflt='none' ;;
7702             esac ;;
7703     ' ')  dflt='none' ;;
7704     *)  dflt="$ccdlflags" ;;
7705     esac
7706     rp="Any special flags to pass to $cc to use dynamic linking?"
7707     . ./myread
7708     case "$ans" in
7709     none) ccdlflags=' ' ;;
7710     *) ccdlflags="$ans" ;;
7711     esac
7712     ;;
7713 *)  usedl="$undef"
7714         ld='ld'
7715     dlsrc='dl_none.xs'
7716     lddlflags=''
7717     ccdlflags=''
7718     ;;
7719 esac
7720
7721 also=''
7722 case "$usedl" in
7723 $undef)
7724         # No dynamic loading being used, so don't bother even to prompt.
7725         useshrplib='false'
7726         ;;
7727 *)      case "$useshrplib" in
7728         '')     case "$osname" in
7729                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7730                         dflt=y
7731                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7732                         ;;
7733                 next*)
7734                         case "$osvers" in
7735                         4*)     dflt=y
7736                                 also='Building a shared libperl is needed for MAB support.'
7737                                 ;;
7738                         *)      dflt=n
7739                                 ;;
7740                         esac
7741                         ;;
7742                 *)      dflt=n
7743                         ;;
7744                 esac
7745                 ;;
7746         $define|true|[Yy]*)
7747                 dflt=y
7748                 ;;
7749         *)      dflt=n
7750                 ;;
7751         esac
7752         $cat << EOM
7753
7754 The perl executable is normally obtained by linking perlmain.c with
7755 libperl${_a}, any static extensions (usually just DynaLoader), and
7756 any other libraries needed on this system (such as -lm, etc.).  Since
7757 your system supports dynamic loading, it is probably possible to build
7758 a shared libperl.$so.  If you will have more than one executable linked
7759 to libperl.$so, this will significantly reduce the size of each
7760 executable, but it may have a noticeable affect on performance.  The
7761 default is probably sensible for your system.
7762 $also
7763
7764 EOM
7765         rp="Build a shared libperl.$so (y/n)"
7766         . ./myread
7767         case "$ans" in
7768         true|$define|[Yy]*)
7769                 useshrplib='true'  ;;
7770         *)      useshrplib='false' ;;
7771         esac
7772         ;;
7773 esac
7774
7775 case "$useshrplib" in
7776 true)
7777         case "$libperl" in
7778         '')
7779                 # Figure out a good name for libperl.so.  Since it gets stored in
7780                 # a version-specific architecture-dependent library, the version
7781                 # number isn't really that important, except for making cc/ld happy.
7782                 #
7783                 # A name such as libperl.so.3.1
7784                 majmin="libperl.$so.$patchlevel.$subversion"
7785                 # A name such as libperl.so.301
7786                 majonly=`echo $patchlevel $subversion |
7787                         $awk '{printf "%d%02d", $1, $2}'`
7788                 majonly=libperl.$so.$majonly
7789                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7790                 # rely on figuring it out from the naming of libc.
7791                 case "${osname}${osvers}" in
7792                 next4*)
7793                         dflt=libperl.5.$so
7794                         # XXX How handle the --version stuff for MAB?
7795                         ;;
7796                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7797                         dflt=libperl.$so
7798                         ;;
7799                 cygwin*) # ld links against an importlib
7800                         dflt=libperl$lib_ext
7801                         ;;
7802                 *)      # Try to guess based on whether libc has major.minor.
7803                         case "$libc" in
7804                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7805                         *libc.$so.[0-9]*) dflt=$majonly ;;
7806                         *)      dflt=libperl.$so ;;
7807                         esac
7808                         ;;
7809                 esac
7810                 ;;
7811         *)      dflt=$libperl
7812                 ;;
7813         esac
7814         cat << EOM
7815
7816 I need to select a good name for the shared libperl.  If your system uses
7817 library names with major and minor numbers, then you might want something
7818 like $majmin.  Alternatively, if your system uses a single version
7819 number for shared libraries, then you might want to use $majonly.
7820 Or, your system might be quite happy with a simple libperl.$so.
7821
7822 Since the shared libperl will get installed into a version-specific
7823 architecture-dependent directory, the version number of the shared perl
7824 library probably isn't important, so the default should be o.k.
7825
7826 EOM
7827         rp='What name do you want to give to the shared libperl?'
7828         . ./myread
7829         libperl=$ans
7830         echo "Ok, I'll use $libperl"
7831         ;;
7832 *)
7833         libperl="libperl${_a}"
7834         ;;
7835 esac
7836
7837 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7838 case "$shrpdir" in
7839 '') ;;
7840 *)      $cat >&4 <<EOM
7841 WARNING:  Use of the shrpdir variable for the installation location of
7842 the shared $libperl is not supported.  It was never documented and
7843 will not work in this version.  Let me (perlbug@perl.org)
7844 know of any problems this may cause.
7845
7846 EOM
7847         case "$shrpdir" in
7848         "$archlibexp/CORE")
7849                 $cat >&4 <<EOM
7850 But your current setting of $shrpdir is
7851 the default anyway, so it's harmless.
7852 EOM
7853                 ;;
7854         *)
7855                 $cat >&4 <<EOM
7856 Further, your current attempted setting of $shrpdir
7857 conflicts with the value of $archlibexp/CORE
7858 that installperl will use.
7859 EOM
7860                 ;;
7861         esac
7862         ;;
7863 esac
7864
7865 # How will the perl executable find the installed shared $libperl?
7866 # Add $xxx to ccdlflags.
7867 # If we can't figure out a command-line option, use $shrpenv to
7868 # set env LD_RUN_PATH.  The main perl makefile uses this.
7869 shrpdir=$archlibexp/CORE
7870 xxx=''
7871 tmp_shrpenv=''
7872 if "$useshrplib"; then
7873     case "$osname" in 
7874         aix)
7875                 # We'll set it in Makefile.SH...
7876                 ;;
7877         solaris)
7878                 xxx="-R $shrpdir"
7879                 ;;
7880         freebsd|netbsd|openbsd|interix)
7881                 xxx="-Wl,-R$shrpdir"
7882                 ;;
7883         bsdos|linux|irix*|dec_osf|gnu*)
7884                 xxx="-Wl,-rpath,$shrpdir"
7885                 ;;
7886         next)
7887                 # next doesn't like the default...
7888                 ;;
7889         beos)
7890                 # beos doesn't like the default, either.
7891                 ;;
7892         hpux*)
7893                 # hpux doesn't like the default, either.
7894                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7895                 ;;
7896         *)
7897                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7898                 ;;
7899         esac
7900         case "$xxx" in
7901         '') ;;
7902         *)      
7903                 # Only add $xxx if it isn't already in ccdlflags.
7904                 case " $ccdlflags " in
7905                 *" $xxx "*)     ;;
7906                 *)      ccdlflags="$ccdlflags $xxx"
7907                         cat <<EOM >&4
7908
7909 Adding $xxx to the flags
7910 passed to $ld so that the perl executable will find the 
7911 installed shared $libperl.
7912
7913 EOM
7914                         ;;
7915                 esac
7916                 ;;
7917         esac
7918 fi
7919 # Fix ccdlflags in AIX for building external extensions.
7920 # (For building Perl itself bare -bE:perl.exp is needed,
7921 #  Makefile.SH takes care of this.)
7922 case "$osname" in
7923 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7924 esac
7925 # Respect a hint or command-line value.
7926 case "$shrpenv" in
7927 '') shrpenv="$tmp_shrpenv" ;;
7928 esac
7929 case "$ldlibpthname" in
7930 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7931 none)   ldlibpthname='' ;;
7932 esac
7933
7934 : determine where manual pages are on this system
7935 echo " "
7936 case "$sysman" in
7937 '') 
7938         syspath='/usr/share/man/man1 /usr/man/man1'
7939         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7940         syspath="$syspath /usr/man/u_man/man1"
7941         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7942         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7943         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7944         sysman=`./loc . /usr/man/man1 $syspath`
7945         ;;
7946 esac
7947 if $test -d "$sysman"; then
7948         echo "System manual is in $sysman." >&4
7949 else
7950         echo "Could not find manual pages in source form." >&4
7951 fi
7952
7953 : determine where manual pages go
7954 set man1dir man1dir none
7955 eval $prefixit
7956 $cat <<EOM
7957
7958 $spackage has manual pages available in source form.
7959 EOM
7960 case "$nroff" in
7961 nroff)
7962         echo "However, you don't have nroff, so they're probably useless to you."
7963         case "$man1dir" in
7964         '') man1dir="none";;
7965         esac;;
7966 esac
7967 echo "If you don't want the manual sources installed, answer 'none'."
7968 case "$man1dir" in
7969 ' ') dflt=none
7970         ;;
7971 '')
7972         lookpath="$prefixexp/share/man/man1"
7973         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7974         lookpath="$lookpath $prefixexp/man/p_man/man1"
7975         lookpath="$lookpath $prefixexp/man/u_man/man1"
7976         lookpath="$lookpath $prefixexp/man/man.1"
7977         case "$sysman" in
7978         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7979         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7980         esac
7981         set dflt
7982         eval $prefixup
7983         ;;
7984 *)  dflt="$man1dir"
7985         ;;
7986 esac
7987 echo " "
7988 fn=dn+~
7989 rp="Where do the main $spackage manual pages (source) go?"
7990 . ./getfile
7991 if $test "X$man1direxp" != "X$ansexp"; then
7992         installman1dir=''
7993 fi
7994 man1dir="$ans"
7995 man1direxp="$ansexp"
7996 case "$man1dir" in
7997 '')     man1dir=' '
7998         installman1dir='';;
7999 esac
8000
8001 : Change installation prefix, if necessary.
8002 if $test X"$prefix" != X"$installprefix"; then
8003         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8004 else
8005         installman1dir="$man1direxp"
8006 fi
8007
8008 : What suffix to use on installed man pages
8009
8010 case "$man1dir" in
8011 ' ')
8012         man1ext='0'
8013         ;;
8014 *)
8015         rp="What suffix should be used for the main $spackage man pages?"
8016         case "$man1ext" in
8017         '')     case "$man1dir" in
8018                 *1)  dflt=1 ;;
8019                 *1p) dflt=1p ;;
8020                 *1pm) dflt=1pm ;;
8021                 *l) dflt=l;;
8022                 *n) dflt=n;;
8023                 *o) dflt=o;;
8024                 *p) dflt=p;;
8025                 *C) dflt=C;;
8026                 *L) dflt=L;;
8027                 *L1) dflt=L1;;
8028                 *) dflt=1;;
8029                 esac
8030                 ;;
8031         *)      dflt="$man1ext";;
8032         esac
8033         . ./myread
8034         man1ext="$ans"
8035         ;;
8036 esac
8037
8038 : see if we can have long filenames
8039 echo " "
8040 first=123456789abcdef
8041 $rm -f $first
8042 if (echo hi >$first) 2>/dev/null; then
8043         if $test -f 123456789abcde; then
8044                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8045                 val="$undef"
8046         else
8047                 echo 'You can have filenames longer than 14 characters.'>&4
8048                 val="$define"
8049         fi
8050 else
8051         $cat <<'EOM'
8052 You can't have filenames longer than 14 chars.
8053 You can't even think about them!
8054 EOM
8055         val="$undef"
8056 fi 
8057 set d_flexfnam
8058 eval $setvar
8059 $rm -rf 123456789abcde*
8060
8061 : determine where library module manual pages go
8062 set man3dir man3dir none
8063 eval $prefixit
8064 $cat <<EOM
8065
8066 $spackage has manual pages for many of the library modules.
8067 EOM
8068
8069 case "$nroff" in
8070 nroff)
8071         $cat <<'EOM'
8072 However, you don't have nroff, so they're probably useless to you.
8073 EOM
8074         case "$man3dir" in
8075         '') man3dir="none";;
8076         esac;;
8077 esac
8078
8079 case "$d_flexfnam" in
8080 undef)
8081         $cat <<'EOM'
8082 However, your system can't handle the long file names like File::Basename.3. 
8083 EOM
8084         case "$man3dir" in
8085         '') man3dir="none";;
8086         esac;;
8087 esac
8088
8089 echo "If you don't want the manual sources installed, answer 'none'."
8090 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8091 case "$man3dir" in
8092 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8093         if $test -d "$privlib/man/man3"; then
8094                 cat <<EOM >&4
8095
8096 WARNING:  Previous versions of perl installed man3 pages into
8097 $privlib/man/man3.  This version will suggest a 
8098 new default of $dflt.  
8099 EOM
8100                 tdflt=$dflt
8101                 dflt='n'
8102                 rp='Do you wish to preserve the old behavior?(y/n)'
8103                 . ./myread
8104                 case "$ans" in
8105                 y*) dflt="$privlib/man/man3" ;;
8106                 *)  dflt=$tdflt ;;
8107                 esac
8108     fi
8109         ;;
8110 *)      dflt="$man3dir" ;;
8111 esac
8112 case "$dflt" in
8113 ' ') dflt=none ;;
8114 esac
8115 echo " "
8116 fn=dn+~
8117 rp="Where do the $package library man pages (source) go?"
8118 . ./getfile
8119 man3dir="$ans"
8120 man3direxp="$ansexp"
8121 case "$man3dir" in
8122 '')     man3dir=' '
8123         installman3dir='';;
8124 esac
8125
8126 : Change installation prefix, if necessary.
8127 if $test X"$prefix" != X"$installprefix"; then
8128         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8129 else
8130         installman3dir="$man3direxp"
8131 fi
8132
8133 : What suffix to use on installed man pages
8134 case "$man3dir" in
8135 ' ')
8136         man3ext='0'
8137         ;;
8138 *)
8139         rp="What suffix should be used for the $package library man pages?"
8140         case "$man3ext" in
8141         '')     case "$man3dir" in
8142                 *3)  dflt=3 ;;
8143                 *3p) dflt=3p ;;
8144                 *3pm) dflt=3pm ;;
8145                 *l) dflt=l;;
8146                 *n) dflt=n;;
8147                 *o) dflt=o;;
8148                 *p) dflt=p;;
8149                 *C) dflt=C;;
8150                 *L) dflt=L;;
8151                 *L3) dflt=L3;;
8152                 *) dflt=3;;
8153                 esac
8154                 ;;
8155         *)      dflt="$man3ext";;
8156         esac
8157         . ./myread
8158         man3ext="$ans"
8159         ;;
8160 esac
8161
8162 : see if we have to deal with yellow pages, now NIS.
8163 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8164         if $test -f /usr/etc/nibindd; then
8165                 echo " "
8166                 echo "I'm fairly confident you're on a NeXT."
8167                 echo " "
8168                 rp='Do you get the hosts file via NetInfo?'
8169                 dflt=y
8170                 case "$hostcat" in
8171                 nidump*) ;;
8172                 '') ;;
8173                 *) dflt=n;;
8174                 esac
8175                 . ./myread
8176                 case "$ans" in
8177                 y*) hostcat='nidump hosts .';;
8178                 *)      case "$hostcat" in
8179                         nidump*) hostcat='';;
8180                         esac
8181                         ;;
8182                 esac
8183         fi
8184         case "$hostcat" in
8185         nidump*) ;;
8186         *)
8187                 case "$hostcat" in
8188                 *ypcat*) dflt=y;;
8189                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8190                                 dflt=y
8191                         else
8192                                 dflt=n
8193                         fi;;
8194                 *) dflt=n;;
8195                 esac
8196                 echo " "
8197                 rp='Are you getting the hosts file via yellow pages?'
8198                 . ./myread
8199                 case "$ans" in
8200                 y*) hostcat='ypcat hosts';;
8201                 *) hostcat='cat /etc/hosts';;
8202                 esac
8203                 ;;
8204         esac
8205 fi
8206 case "$hostcat" in
8207 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8208 esac
8209 case "$groupcat" in
8210 '') test -f /etc/group && groupcat='cat /etc/group';;
8211 esac
8212 case "$passcat" in
8213 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8214 esac
8215
8216 : now get the host name
8217 echo " "
8218 echo "Figuring out host name..." >&4
8219 case "$myhostname" in
8220 '') cont=true
8221         echo 'Maybe "hostname" will work...'
8222         if tans=`sh -c hostname 2>&1` ; then
8223                 myhostname=$tans
8224                 phostname=hostname
8225                 cont=''
8226         fi
8227         ;;
8228 *) cont='';;
8229 esac
8230 if $test "$cont"; then
8231         if ./xenix; then
8232                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8233                 if tans=`cat /etc/systemid 2>&1` ; then
8234                         myhostname=$tans
8235                         phostname='cat /etc/systemid'
8236                         echo "Whadyaknow.  Xenix always was a bit strange..."
8237                         cont=''
8238                 fi
8239         elif $test -r /etc/systemid; then
8240                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8241         fi
8242 fi
8243 if $test "$cont"; then
8244         echo 'No, maybe "uuname -l" will work...'
8245         if tans=`sh -c 'uuname -l' 2>&1` ; then
8246                 myhostname=$tans
8247                 phostname='uuname -l'
8248         else
8249                 echo 'Strange.  Maybe "uname -n" will work...'
8250                 if tans=`sh -c 'uname -n' 2>&1` ; then
8251                         myhostname=$tans
8252                         phostname='uname -n'
8253                 else
8254                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8255                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8256                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8257                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8258                         else
8259                                 case "$myhostname" in
8260                                 '') echo "Does this machine have an identity crisis or something?"
8261                                         phostname='';;
8262                                 *)
8263                                         echo "Well, you said $myhostname before..."
8264                                         phostname='echo $myhostname';;
8265                                 esac
8266                         fi
8267                 fi
8268         fi
8269 fi
8270 case "$myhostname" in
8271 '') myhostname=noname ;;
8272 esac
8273 : you do not want to know about this
8274 set $myhostname
8275 myhostname=$1
8276
8277 : verify guess
8278 if $test "$myhostname" ; then
8279         dflt=y
8280         rp='Your host name appears to be "'$myhostname'".'" Right?"
8281         . ./myread
8282         case "$ans" in
8283         y*) ;;
8284         *) myhostname='';;
8285         esac
8286 fi
8287
8288 : bad guess or no guess
8289 while $test "X$myhostname" = X ; do
8290         dflt=''
8291         rp="Please type the (one word) name of your host:"
8292         . ./myread
8293         myhostname="$ans"
8294 done
8295
8296 : translate upper to lower if necessary
8297 case "$myhostname" in
8298 *[A-Z]*)
8299         echo "(Normalizing case in your host name)"
8300         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8301         ;;
8302 esac
8303
8304 case "$myhostname" in
8305 *.*)
8306         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8307         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8308         echo "(Trimming domain name from host name--host name is now $myhostname)"
8309         ;;
8310 *) case "$mydomain" in
8311         '')
8312                 {
8313                         test "X$hostcat" = "Xypcat hosts" &&
8314                         ypmatch "$myhostname" hosts 2>/dev/null |\
8315                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8316                         $test -s hosts
8317                 } || {
8318                         test "X$hostcat" != "X" &&
8319                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8320                                         /[       ]$myhostname[  . ]/p" > hosts
8321                 }
8322                 tmp_re="[       . ]"
8323                 if $test -f hosts; then
8324                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8325                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8326                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8327                                 hosts | $sort | $uniq | \
8328                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8329                         case `$echo X$dflt` in
8330                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8331                                 dflt=.
8332                                 ;;
8333                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8334                                 ;;
8335                         esac
8336                 else
8337                         echo "(I cannot locate a hosts database anywhere)"
8338                         dflt=.
8339                 fi
8340                 case "$dflt" in
8341                 .)
8342                         tans=`./loc resolv.conf X /etc /usr/etc`
8343                         if $test -f "$tans"; then
8344                                 echo "(Attempting domain name extraction from $tans)"
8345                                 dflt=.`$sed -n -e 's/   / /g' \
8346                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8347                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8348                                 case "$dflt" in
8349                                 .) dflt=.`$sed -n -e 's/        / /g' \
8350                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8351                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8352                                         ;;
8353                                 esac
8354                         fi
8355                         ;;
8356                 esac
8357                 case "$dflt" in
8358                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8359                         dflt=.`sh -c domainname 2>/dev/null`
8360                         case "$dflt" in
8361                         '') dflt='.';;
8362                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8363                         esac
8364                         ;;
8365                 esac
8366                 case "$dflt$osname" in
8367                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8368                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8369                         ;;
8370                 esac
8371                 case "$dflt" in
8372                 .) echo "(Lost all hope -- silly guess then)"
8373                         dflt='.nonet'
8374                         ;;
8375                 esac
8376                 $rm -f hosts
8377                 ;;
8378         *) dflt="$mydomain";;
8379         esac;;
8380 esac
8381 echo " "
8382 rp="What is your domain name?"
8383 . ./myread
8384 tans="$ans"
8385 case "$ans" in
8386 '') ;;
8387 .*) ;;
8388 *) tans=".$tans";;
8389 esac
8390 mydomain="$tans"
8391
8392 : translate upper to lower if necessary
8393 case "$mydomain" in
8394 *[A-Z]*)
8395         echo "(Normalizing case in your domain name)"
8396         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8397         ;;
8398 esac
8399
8400 : a little sanity check here
8401 case "$phostname" in
8402 '') ;;
8403 *)
8404         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8405         $myhostname$mydomain|$myhostname) ;;
8406         *)
8407                 case "$phostname" in
8408                 sed*)
8409                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8410                         ;;
8411                 *)
8412                         echo "(That doesn't agree with your $phostname command, by the way.)"
8413                         ;;
8414                 esac
8415         ;;
8416         esac
8417         ;;
8418 esac
8419
8420 $cat <<EOM
8421
8422 I need to get your e-mail address in Internet format if possible, i.e.
8423 something like user@host.domain. Please answer accurately since I have
8424 no easy means to double check it. The default value provided below
8425 is most probably close to reality but may not be valid from outside
8426 your organization...
8427
8428 EOM
8429 cont=x
8430 while test "$cont"; do
8431         case "$cf_email" in
8432         '') dflt="$cf_by@$myhostname$mydomain";;
8433         *) dflt="$cf_email";;
8434         esac
8435         rp='What is your e-mail address?'
8436         . ./myread
8437         cf_email="$ans"
8438         case "$cf_email" in
8439         *@*.*) cont='' ;;
8440         *)
8441                 rp='Address does not look like an Internet one.  Use it anyway?'
8442                 case "$fastread" in
8443                 yes) dflt=y ;;
8444                 *) dflt=n ;;
8445                 esac
8446                 . ./myread
8447                 case "$ans" in
8448                 y*) cont='' ;;
8449                 *) echo " " ;;
8450                 esac
8451                 ;;
8452         esac
8453 done
8454
8455 $cat <<EOM
8456
8457 If you or somebody else will be maintaining perl at your site, please
8458 fill in the correct e-mail address here so that they may be contacted
8459 if necessary. Currently, the "perlbug" program included with perl
8460 will send mail to this address in addition to perlbug@perl.org. You may
8461 enter "none" for no administrator.
8462
8463 EOM
8464 case "$perladmin" in
8465 '') dflt="$cf_email";;
8466 *) dflt="$perladmin";;
8467 esac
8468 rp='Perl administrator e-mail address'
8469 . ./myread
8470 perladmin="$ans"
8471
8472 : determine whether to only install version-specific parts.
8473 echo " "
8474 $cat <<EOM
8475 Do you want to install only the version-specific parts of the perl
8476 distribution?  Usually you do *not* want to do this.
8477 EOM
8478 case "$versiononly" in
8479 "$define"|[Yy]*|true) dflt='y' ;;
8480 *) dflt='n';
8481 esac
8482 rp="Do you want to install only the version-specific parts of perl?"
8483 . ./myread
8484 case "$ans" in
8485 [yY]*)  val="$define";;
8486 *)      val="$undef" ;;
8487 esac
8488 set versiononly
8489 eval $setvar
8490
8491 case "$versiononly" in
8492 "$define") inc_version_list=''
8493            inc_version_list_init=0
8494            ;;
8495 esac
8496
8497 : figure out how to guarantee perl startup
8498 case "$startperl" in
8499 '')
8500         case "$sharpbang" in
8501         *!)
8502                 $cat <<EOH
8503
8504 I can use the #! construct to start perl on your system. This will
8505 make startup of perl scripts faster, but may cause problems if you
8506 want to share those scripts and perl is not in a standard place
8507 ($binexp/perl) on all your platforms. The alternative is to force
8508 a shell by starting the script with a single ':' character.
8509
8510 EOH
8511                 case "$versiononly" in
8512                 "$define")      dflt="$binexp/perl$version";;  
8513                 *)              dflt="$binexp/perl";;
8514                 esac
8515                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8516                 . ./myread
8517                 case "$ans" in
8518                 none)   startperl=": # use perl";;
8519                 *)      startperl="#!$ans"
8520                         if $test 30 -lt `echo "$ans" | wc -c`; then
8521                                 $cat >&4 <<EOM
8522
8523 WARNING:  Some systems limit the #! command to 32 characters.
8524 If you experience difficulty running Perl scripts with #!, try
8525 installing Perl in a directory with a shorter pathname.
8526
8527 EOM
8528                         fi ;;
8529                 esac
8530                 ;;
8531         *) startperl=": # use perl"
8532                 ;;
8533         esac
8534         ;;
8535 esac
8536 echo "I'll use $startperl to start perl scripts."
8537
8538 : figure best path for perl in scripts
8539 case "$perlpath" in
8540 '')
8541         case "$versiononly" in
8542         "$define")      perlpath="$binexp/perl$version";;
8543         *)              perlpath="$binexp/perl";;
8544         esac
8545         case "$startperl" in
8546         *!*) ;;
8547         *)
8548                 $cat <<EOH
8549
8550 I will use the "eval 'exec'" idiom to start Perl on your system.
8551 I can use the full path of your Perl binary for this purpose, but
8552 doing so may cause problems if you want to share those scripts and
8553 Perl is not always in a standard place ($binexp/perl).
8554
8555 EOH
8556                 dflt="$binexp/perl"
8557                 rp="What path shall I use in \"eval 'exec'\"?"
8558                 . ./myread
8559                 perlpath="$ans"
8560                 ;;
8561         esac
8562         ;;
8563 esac
8564 case "$startperl" in
8565 *!*)    ;;
8566 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8567 esac
8568
8569 : determine where public executable scripts go
8570 set scriptdir scriptdir
8571 eval $prefixit
8572 case "$scriptdir" in
8573 '')
8574         dflt="$bin"
8575         : guess some guesses
8576         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8577         $test -d /usr/share/bin     && dflt=/usr/share/bin
8578         $test -d /usr/local/script  && dflt=/usr/local/script
8579         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8580         $test -d $prefixexp/script  && dflt=$prefixexp/script
8581         set dflt
8582         eval $prefixup
8583         ;;
8584 *)  dflt="$scriptdir"
8585         ;;
8586 esac
8587 $cat <<EOM
8588  
8589 Some installations have a separate directory just for executable scripts so
8590 that they can mount it across multiple architectures but keep the scripts in
8591 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8592 Or you might just lump your scripts in with all your other executables.
8593  
8594 EOM
8595 fn=d~
8596 rp='Where do you keep publicly executable scripts?'
8597 . ./getfile
8598 if $test "X$ansexp" != "X$scriptdirexp"; then
8599         installscript=''
8600 fi
8601 scriptdir="$ans"
8602 scriptdirexp="$ansexp"
8603 : Change installation prefix, if necessary.
8604 if $test X"$prefix" != X"$installprefix"; then
8605         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8606 else
8607         installscript="$scriptdirexp"
8608 fi
8609
8610 : determine where add-on public executables go
8611 case "$sitebin" in
8612 '')     dflt=$siteprefix/bin ;;
8613 *)      dflt=$sitebin ;;
8614 esac
8615 fn=d~
8616 rp='Pathname where the add-on public executables should be installed?'
8617 . ./getfile
8618 sitebin="$ans"
8619 sitebinexp="$ansexp"
8620 : Change installation prefix, if necessary.
8621 if $test X"$prefix" != X"$installprefix"; then
8622         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8623 else
8624         installsitebin="$sitebinexp"
8625 fi
8626
8627 : determine where add-on html pages go
8628 : There is no standard location, so try to copy the previously-selected
8629 : directory structure for the core html pages.
8630 case "$sitehtml1dir" in
8631 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8632 *)     dflt=$sitehtml1dir ;;
8633 esac
8634 case "$dflt" in
8635 ''|' ') dflt=none ;;
8636 esac
8637 fn=dn+~
8638 rp='Pathname where the site-specific html pages should be installed?'
8639 . ./getfile
8640 sitehtml1dir="$ans"
8641 sitehtml1direxp="$ansexp"
8642 : Change installation prefix, if necessary.
8643 if $test X"$prefix" != X"$installprefix"; then
8644         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8645 else
8646         installsitehtml1dir="$sitehtml1direxp"
8647 fi
8648
8649 : determine where add-on library html pages go
8650 : There is no standard location, so try to copy the previously-selected
8651 : directory structure for the core html pages.
8652 case "$sitehtml3dir" in
8653 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8654 *)     dflt=$sitehtml3dir ;;
8655 esac
8656 case "$dflt" in
8657 ''|' ') dflt=none ;;
8658 esac
8659 fn=dn+~
8660 rp='Pathname where the site-specific library html pages should be installed?'
8661 . ./getfile
8662 sitehtml3dir="$ans"
8663 sitehtml3direxp="$ansexp"
8664 : Change installation prefix, if necessary.
8665 if $test X"$prefix" != X"$installprefix"; then
8666         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8667 else
8668         installsitehtml3dir="$sitehtml3direxp"
8669 fi
8670
8671 : determine where add-on manual pages go
8672 case "$siteman1dir" in
8673 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8674 *)      dflt=$siteman1dir ;;
8675 esac
8676 case "$dflt" in
8677 ''|' ') dflt=none ;;
8678 esac
8679 fn=dn+~
8680 rp='Pathname where the site-specific manual pages should be installed?'
8681 . ./getfile
8682 siteman1dir="$ans"
8683 siteman1direxp="$ansexp"
8684 : Change installation prefix, if necessary.
8685 if $test X"$prefix" != X"$installprefix"; then
8686         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8687 else
8688         installsiteman1dir="$siteman1direxp"
8689 fi
8690
8691 : determine where add-on library man pages go
8692 case "$siteman3dir" in
8693 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8694 *)      dflt=$siteman3dir ;;
8695 esac
8696 case "$dflt" in
8697 ''|' ') dflt=none ;;
8698 esac
8699 fn=dn+~
8700 rp='Pathname where the site-specific library manual pages should be installed?'
8701 . ./getfile
8702 siteman3dir="$ans"
8703 siteman3direxp="$ansexp"
8704 : Change installation prefix, if necessary.
8705 if $test X"$prefix" != X"$installprefix"; then
8706         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8707 else
8708         installsiteman3dir="$siteman3direxp"
8709 fi
8710
8711 : determine where add-on public executable scripts go
8712 case "$sitescript" in
8713 '')     dflt=$siteprefix/script
8714         $test -d $dflt || dflt=$sitebin ;;
8715 *)  dflt="$sitescript" ;;
8716 esac
8717 fn=d~+
8718 rp='Pathname where add-on public executable scripts should be installed?'
8719 . ./getfile
8720 sitescript="$ans"
8721 sitescriptexp="$ansexp"
8722 : Change installation prefix, if necessary.
8723 if $test X"$prefix" != X"$installprefix"; then
8724         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8725 else
8726         installsitescript="$sitescriptexp"
8727 fi
8728
8729 case "$usefaststdio" in
8730 $define|true|[yY]*|'')
8731         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8732         case "$xversion" in
8733         [68])   dflt='y' ;;
8734         *)      dflt='n' ;;
8735         esac
8736         ;;
8737 *) dflt='n';;
8738 esac
8739 cat <<EOM
8740
8741 Perl can be built to use 'fast stdio', which means using the stdio
8742 library but also directly manipulating the stdio buffers to enable
8743 faster I/O.  Using stdio is better for backward compatibility (especially
8744 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8745 interface has been preferred instead of stdio.
8746
8747 If this doesn't make any sense to you, just accept the default '$dflt'.
8748 EOM
8749 rp='Use the "fast stdio" if available?'
8750 . ./myread
8751 case "$ans" in
8752 y|Y)    val="$define" ;;     
8753 *)      val="$undef" ;;
8754 esac
8755 set usefaststdio
8756 eval $setvar
8757
8758
8759 : define an is-a-typedef? function
8760 typedef='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         if $contains $type temp.E >/dev/null 2>&1; then
8776                 eval "$var=\$type";
8777         else
8778                 eval "$var=\$def";
8779         fi;
8780         $rm -f temp.?;;
8781 *) eval "$var=\$varval";;
8782 esac'
8783
8784 : define an is-a-typedef? function that prompts if the type is not available.
8785 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8786 case "$inclist" in
8787 "") inclist="sys/types.h";;
8788 esac;
8789 eval "varval=\$$var";
8790 case "$varval" in
8791 "")
8792         $rm -f temp.c;
8793         for inc in $inclist; do
8794                 echo "#include <$inc>" >>temp.c;
8795         done;
8796         echo "#ifdef $type" >> temp.c;
8797         echo "printf(\"We have $type\");" >> temp.c;
8798         echo "#endif" >> temp.c;
8799         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8800         echo " " ;
8801         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8802         if $contains $type temp.E >/dev/null 2>&1; then
8803                 echo "$type found." >&4;
8804                 eval "$var=\$type";
8805         else
8806                 echo "$type NOT found." >&4;
8807                 dflt="$def";
8808                 . ./myread ;
8809                 eval "$var=\$ans";
8810         fi;
8811         $rm -f temp.?;;
8812 *) eval "$var=\$varval";;
8813 esac'
8814
8815 : see what type lseek is declared as in the kernel
8816 rp="What is the type used for lseek's offset on this system?"
8817 set off_t lseektype long stdio.h sys/types.h
8818 eval $typedef_ask
8819
8820 echo " "
8821 echo "Checking to see how big your file offsets are..." >&4
8822 $cat >try.c <<EOCP
8823 #include <sys/types.h>
8824 #include <stdio.h>
8825 int main()
8826 {
8827     printf("%d\n", (int)sizeof($lseektype));
8828     return(0); 
8829 }
8830 EOCP
8831 set try
8832 if eval $compile_ok; then
8833         lseeksize=`$run ./try`
8834         echo "Your file offsets are $lseeksize bytes long."
8835 else
8836         dflt=$longsize
8837         echo " "
8838         echo "(I can't seem to compile the test program.  Guessing...)"
8839         rp="What is the size of your file offsets (in bytes)?"
8840         . ./myread
8841         lseeksize="$ans"
8842 fi
8843 $rm -f try.c try
8844
8845 : see what type file positions are declared as in the library
8846 rp="What is the type for file position used by fsetpos()?"
8847 set fpos_t fpostype long stdio.h sys/types.h
8848 eval $typedef_ask
8849
8850 echo " "
8851 case "$fpostype" in
8852 *_t) zzz="$fpostype"    ;;
8853 *)   zzz="fpos_t"       ;;
8854 esac
8855 echo "Checking the size of $zzz..." >&4 
8856 cat > try.c <<EOCP
8857 #include <sys/types.h>
8858 #include <stdio.h>
8859 #$i_stdlib I_STDLIB
8860 #ifdef I_STDLIB
8861 #include <stdlib.h>
8862 #endif
8863 int main() {
8864     printf("%d\n", (int)sizeof($fpostype));
8865     exit(0);
8866 }
8867 EOCP
8868 set try
8869 if eval $compile_ok; then
8870         yyy=`$run ./try`
8871         case "$yyy" in
8872         '')     fpossize=4
8873                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8874                 ;;
8875         *)      fpossize=$yyy
8876                 echo "Your $zzz is $fpossize bytes long."
8877                 ;;
8878         esac
8879 else
8880         dflt="$longsize"
8881         echo " " >&4
8882         echo "(I can't compile the test program.  Guessing...)" >&4
8883         rp="What is the size of your file positions (in bytes)?"
8884         . ./myread
8885         fpossize="$ans"
8886 fi
8887
8888 # Backward compatibility (uselfs is deprecated).
8889 case "$uselfs" in
8890 "$define"|true|[yY]*)
8891         cat <<EOM >&4
8892
8893 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8894 EOM
8895         uselargefiles="$define"
8896         ;;
8897 esac                          
8898
8899 case "$lseeksize:$fpossize" in
8900 8:8) cat <<EOM
8901
8902 You can have files larger than 2 gigabytes.
8903 EOM
8904    val="$define" ;;
8905 *)    case "$uselargefiles" in
8906    "$undef"|false|[nN]*) dflt='n' ;;
8907    *)   dflt='y' ;;
8908    esac
8909    cat <<EOM
8910
8911 Perl can be built to understand large files (files larger than 2 gigabytes)
8912 on some systems.  To do so, Configure can be run with -Duselargefiles.
8913
8914 If this doesn't make any sense to you, just accept the default '$dflt'.
8915 EOM
8916    rp='Try to understand large files, if available?'
8917    . ./myread
8918    case "$ans" in
8919    y|Y)         val="$define" ;;
8920    *)           val="$undef"  ;;
8921    esac
8922    ;;
8923 esac
8924 set uselargefiles
8925 eval $setvar
8926 : Look for a hint-file generated 'call-back-unit'.  If the
8927 : user has specified that a large files perl is to be built,
8928 : we may need to set or change some other defaults.
8929 if $test -f uselargefiles.cbu; then
8930         echo "Your platform has some specific hints regarding large file builds, using them..."
8931         . ./uselargefiles.cbu
8932 fi
8933 case "$uselargefiles" in
8934 "$define")
8935         if $test -f uselargefiles.cbu; then
8936                 echo " "
8937                 echo "Rechecking to see how big your file offsets are..." >&4
8938                 $cat >try.c <<EOCP
8939 #include <sys/types.h>
8940 #include <stdio.h>
8941 int main()
8942 {
8943     printf("%d\n", (int)sizeof($lseektype));
8944     return(0); 
8945 }
8946 EOCP
8947                 set try
8948                 if eval $compile_ok; then
8949                         lseeksize=`$run ./try`
8950                         $echo "Your file offsets are now $lseeksize bytes long."
8951                 else
8952                         dflt="$lseeksize"
8953                         echo " "
8954                         echo "(I can't seem to compile the test program.  Guessing...)"
8955                         rp="What is the size of your file offsets (in bytes)?"
8956                         . ./myread
8957                         lseeksize="$ans"
8958                 fi
8959                 case "$fpostype" in
8960                 *_t) zzz="$fpostype"    ;;
8961                 *)   zzz="fpos_t"       ;;
8962                 esac
8963                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8964                 $cat > try.c <<EOCP
8965 #include <sys/types.h>
8966 #include <stdio.h>
8967 #$i_stdlib I_STDLIB
8968 #ifdef I_STDLIB
8969 #include <stdlib.h>
8970 #endif
8971 int main() {
8972     printf("%d\n", (int)sizeof($fpostype));
8973     return(0);
8974 }
8975 EOCP
8976                 set try
8977                 if eval $compile_ok; then
8978                         yyy=`$run ./try`
8979                         dflt="$lseeksize"
8980                         case "$yyy" in
8981                         '')     echo " "
8982                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8983                                 ;;
8984                         *)      fpossize=$yyy
8985                                 echo " $fpossize bytes." >&4
8986                                 ;;
8987                         esac
8988                 else
8989                         dflt="$fpossize"
8990                         echo " "
8991                         echo "(I can't compile the test program.  Guessing...)" >&4
8992                         rp="What is the size of your file positions (in bytes)?"
8993                         . ./myread
8994                         fpossize="$ans"
8995                 fi
8996                 $rm -f try.c try
8997         fi
8998         ;;
8999 esac
9000
9001 # probably will refer to
9002 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9003 need_relocation=0
9004 userelocatableinc=undef
9005
9006 case "$vendorprefix" in
9007 '')     d_vendorbin="$undef"
9008         vendorbin=''
9009         vendorbinexp=''
9010         ;;
9011 *)      d_vendorbin="$define"
9012         : determine where vendor-supplied executables go.
9013         case "$vendorbin" in
9014         '') dflt=$vendorprefix/bin ;;
9015         *)      dflt="$vendorbin" ;;
9016         esac
9017         fn=d~+
9018         rp='Pathname for the vendor-supplied executables directory?'
9019         . ./getfile
9020         vendorbin="$ans"
9021         vendorbinexp="$ansexp"
9022         ;;
9023 esac
9024 : Change installation prefix, if necessary.
9025 if $test X"$prefix" != X"$installprefix"; then
9026         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9027 else
9028         installvendorbin="$vendorbinexp"
9029 fi
9030
9031 case "$vendorprefix" in
9032 '')     vendorhtml1dir=''
9033         vendorhtml1direxp=''
9034         ;;
9035 *)      : determine where vendor-supplied html pages go.
9036         : There is no standard location, so try to copy the previously-selected
9037         : directory structure for the core html pages.
9038         : XXX Better default suggestions would be welcome.
9039         case "$vendorhtml1dir" in
9040         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9041         *)      dflt=$vendorhtml1dir ;;
9042         esac
9043         case "$dflt" in
9044         ''|' ') dflt=none ;;
9045         esac
9046         fn=dn+~
9047         rp='Pathname for the vendor-supplied html pages?'
9048         . ./getfile
9049         vendorhtml1dir="$ans"
9050         vendorhtml1direxp="$ansexp"
9051         ;;
9052 esac
9053 : Use ' ' for none so value is preserved next time through Configure
9054 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9055 : Change installation prefix, if necessary.
9056 if $test X"$prefix" != X"$installprefix"; then
9057         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9058 else
9059         installvendorhtml1dir="$vendorhtml1direxp"
9060 fi
9061
9062 case "$vendorprefix" in
9063 '')     vendorhtml3dir=''
9064         vendorhtml3direxp=''
9065         ;;
9066 *)      : determine where vendor-supplied module html pages go.
9067         : There is no standard location, so try to copy the previously-selected
9068         : directory structure for the core html pages.
9069         : XXX Better default suggestions would be welcome.
9070         case "$vendorhtml3dir" in
9071         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9072         *)      dflt=$vendorhtml3dir ;;
9073         esac
9074         case "$dflt" in
9075         ''|' ') dflt=none ;;
9076         esac
9077         fn=dn+~
9078         rp='Pathname for the vendor-supplied html pages?'
9079         . ./getfile
9080         vendorhtml3dir="$ans"
9081         vendorhtml3direxp="$ansexp"
9082         ;;
9083 esac
9084 : Use ' ' for none so value is preserved next time through Configure
9085 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9086 : Change installation prefix, if necessary.
9087 if $test X"$prefix" != X"$installprefix"; then
9088         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9089 else
9090         installvendorhtml3dir="$vendorhtml3direxp"
9091 fi
9092
9093 case "$vendorprefix" in
9094 '')     vendorman1dir=''
9095         vendorman1direxp=''
9096         ;;
9097 *)      : determine where vendor-supplied manual pages go.
9098         case "$vendorman1dir" in
9099         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9100         *)      dflt=$vendorman1dir ;;
9101         esac
9102         case "$dflt" in
9103         ''|' ') dflt=none ;;
9104         esac
9105         fn=nd~+
9106         rp='Pathname for the vendor-supplied manual section 1 pages?'
9107         . ./getfile
9108         vendorman1dir="$ans"
9109         vendorman1direxp="$ansexp"
9110         ;;
9111 esac
9112 : Use ' ' for none so value is preserved next time through Configure
9113 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9114 : Change installation prefix, if necessary.
9115 if $test X"$prefix" != X"$installprefix"; then
9116         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9117 else
9118         installvendorman1dir="$vendorman1direxp"
9119 fi
9120
9121 case "$vendorprefix" in
9122 '')     vendorman3dir=''
9123         vendorman3direxp=''
9124         ;;
9125 *)      : determine where vendor-supplied module manual pages go.
9126         case "$vendorman3dir" in
9127         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9128         *)      dflt=$vendorman3dir ;;
9129         esac
9130         case "$dflt" in
9131         ''|' ') dflt=none ;;
9132         esac
9133         fn=nd~+
9134         rp='Pathname for the vendor-supplied manual section 3 pages?'
9135         . ./getfile
9136         vendorman3dir="$ans"
9137         vendorman3direxp="$ansexp"
9138         ;;
9139 esac
9140 : Use ' ' for none so value is preserved next time through Configure
9141 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9142 : Change installation prefix, if necessary.
9143 if $test X"$prefix" != X"$installprefix"; then
9144         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9145 else
9146         installvendorman3dir="$vendorman3direxp"
9147 fi
9148
9149 case "$vendorprefix" in
9150 '')     d_vendorscript="$undef"
9151         vendorscript=''
9152         vendorscriptexp=''
9153         ;;
9154 *)      d_vendorscript="$define"
9155         : determine where vendor-supplied scripts go.
9156         case "$vendorscript" in
9157         '')     dflt=$vendorprefix/script
9158                 $test -d $dflt || dflt=$vendorbin ;;
9159         *)  dflt="$vendorscript" ;;
9160         esac
9161         $cat <<EOM
9162
9163 The installation process will create a directory for 
9164 vendor-supplied scripts.
9165
9166 EOM
9167         fn=d~+
9168         rp='Pathname for the vendor-supplied scripts directory?'
9169         . ./getfile
9170         vendorscript="$ans"
9171         vendorscriptexp="$ansexp"
9172         ;;
9173 esac
9174 : Change installation prefix, if necessary.
9175 if $test X"$prefix" != X"$installprefix"; then
9176         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9177 else
9178         installvendorscript="$vendorscriptexp"
9179 fi
9180
9181 : see if qgcvt exists
9182 set qgcvt d_qgcvt
9183 eval $inlibc
9184
9185 echo " "
9186
9187 if $test X"$d_longdbl" = X"$define"; then
9188
9189 echo "Checking how to print long doubles..." >&4
9190
9191 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9192         $cat >try.c <<'EOCP'
9193 #include <sys/types.h>
9194 #include <stdio.h>
9195 int main() {
9196   double d = 123.456;
9197   printf("%.3f\n", d);
9198 }
9199 EOCP
9200         set try
9201         if eval $compile; then
9202                 yyy=`$run ./try`
9203                 case "$yyy" in
9204                 123.456)
9205                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9206                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9207                         echo "We will use %f."
9208                         ;;
9209                 esac
9210         fi
9211 fi
9212
9213 if $test X"$sPRIfldbl" = X; then
9214         $cat >try.c <<'EOCP'
9215 #include <sys/types.h>
9216 #include <stdio.h>
9217 int main() {
9218   long double d = 123.456;
9219   printf("%.3Lf\n", d);
9220 }
9221 EOCP
9222         set try
9223         if eval $compile; then
9224                 yyy=`$run ./try`
9225                 case "$yyy" in
9226                 123.456)
9227                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9228                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9229                         echo "We will use %Lf."
9230                         ;;
9231                 esac
9232         fi
9233 fi
9234
9235 if $test X"$sPRIfldbl" = X; then
9236         $cat >try.c <<'EOCP'
9237 #include <sys/types.h>
9238 #include <stdio.h>
9239 int main() {
9240   long double d = 123.456;
9241   printf("%.3llf\n", d);
9242 }
9243 EOCP
9244         set try
9245         if eval $compile; then
9246                 yyy=`$run ./try`
9247                 case "$yyy" in
9248                 123.456)
9249                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9250                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9251                         echo "We will use %llf."
9252                         ;;
9253                 esac
9254         fi
9255 fi
9256
9257 if $test X"$sPRIfldbl" = X; then
9258         $cat >try.c <<'EOCP'
9259 #include <sys/types.h>
9260 #include <stdio.h>
9261 int main() {
9262   long double d = 123.456;
9263   printf("%.3lf\n", d);
9264 }
9265 EOCP
9266         set try
9267         if eval $compile; then
9268                 yyy=`$run ./try`
9269                 case "$yyy" in
9270                 123.456)
9271                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9272                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9273                         echo "We will use %lf."
9274                         ;;
9275                 esac
9276         fi
9277 fi
9278
9279 if $test X"$sPRIfldbl" = X; then
9280         echo "Cannot figure out how to print long doubles." >&4
9281 else
9282         sSCNfldbl=$sPRIfldbl    # expect consistency
9283 fi
9284
9285 $rm -f try try.*
9286
9287 fi # d_longdbl
9288
9289 case "$sPRIfldbl" in
9290 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9291         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9292         d_SCNfldbl="$undef";
9293         ;;
9294 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9295         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9296         d_SCNfldbl="$define";
9297         ;;
9298 esac
9299
9300 : Check how to convert floats to strings.
9301
9302 if test "X$d_Gconvert" = X; then
9303
9304 echo " "
9305 echo "Checking for an efficient way to convert floats to strings."
9306 echo " " > try.c
9307 case "$uselongdouble" in
9308 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9309 esac
9310 case "$d_longdbl" in
9311 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9312 esac
9313 case "$d_PRIgldbl" in
9314 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9315 esac
9316 $cat >>try.c <<EOP
9317 #ifdef TRY_gconvert
9318 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9319 char *myname = "gconvert";
9320 #endif
9321 #ifdef TRY_gcvt
9322 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9323 char *myname = "gcvt";
9324 #endif
9325 #ifdef TRY_qgcvt
9326 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9327 char *myname = "qgcvt";
9328 #define DOUBLETYPE long double
9329 #endif
9330 #ifdef TRY_sprintf
9331 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9332 #ifdef HAS_PRIgldbl
9333 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9334 #else
9335 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9336 #endif
9337 #else
9338 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9339 #endif
9340 char *myname = "sprintf";
9341 #endif
9342
9343 #ifndef DOUBLETYPE
9344 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9345 #define DOUBLETYPE long double
9346 #else
9347 #define DOUBLETYPE double
9348 #endif
9349 #endif
9350
9351 #include <stdio.h>
9352
9353 #define I_STDLIB $i_stdlib
9354 #ifdef I_STDLIB
9355 #include <stdlib.h>
9356 #endif
9357
9358 int
9359 checkit(expect, got)
9360 char *expect;
9361 char *got;
9362 {
9363     if (strcmp(expect, got)) {
9364                 printf("%s oddity:  Expected %s, got %s\n",
9365                         myname, expect, got);
9366                 exit(1);
9367         }
9368 }
9369
9370 int main()
9371
9372         char buf[64]; 
9373         buf[63] = '\0';
9374
9375         /* This must be 1st test on (which?) platform */
9376         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9377         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9378         checkit("0.1", buf);
9379
9380         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9381         checkit("0.01", buf);
9382
9383         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9384         checkit("0.001", buf);
9385
9386         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9387         checkit("0.0001", buf);
9388
9389         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9390         if (strlen(buf) > 5)
9391             checkit("9e-005", buf); /* for Microsoft ?? */
9392         else
9393             checkit("9e-05", buf);
9394
9395         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9396         checkit("1", buf);
9397
9398         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9399         checkit("1.1", buf);
9400
9401         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9402         checkit("1.01", buf);
9403
9404         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9405         checkit("1.001", buf);
9406
9407         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9408         checkit("1.0001", buf);
9409
9410         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9411         checkit("1.00001", buf);
9412
9413         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9414         checkit("1.000001", buf);
9415
9416         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9417         checkit("0", buf);
9418
9419         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9420         checkit("-1", buf);
9421
9422         /* Some Linux gcvt's give 1.e+5 here. */
9423         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9424         checkit("100000", buf);
9425         
9426         /* Some Linux gcvt's give -1.e+5 here. */
9427         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9428         checkit("-100000", buf);
9429
9430         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9431         checkit("123.456", buf);
9432
9433         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9434         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9435         /* 34 should be enough to scare even long double
9436          * places into using the e notation. */
9437         if (strlen(buf) > 5)
9438             checkit("1e+034", buf); /* for Microsoft */
9439         else
9440             checkit("1e+34", buf);
9441
9442         /* For Perl, if you add additional tests here, also add them to
9443          * t/base/num.t for benefit of platforms not using Configure or
9444          * overriding d_Gconvert */
9445
9446         exit(0);
9447 }
9448 EOP
9449 : first add preferred functions to our list
9450 xxx_list=""
9451 for xxx_convert in $gconvert_preference; do
9452     case $xxx_convert in
9453     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9454     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9455     esac 
9456 done
9457 : then add any others
9458 for xxx_convert in gconvert gcvt sprintf; do
9459     case "$xxx_list" in
9460     *$xxx_convert*) ;;
9461     *) xxx_list="$xxx_list $xxx_convert" ;;
9462     esac 
9463 done
9464
9465 case "$d_longdbl$uselongdouble" in
9466 "$define$define")
9467     : again, add prefered functions to our list first
9468     xxx_ld_list=""
9469     for xxx_convert in $gconvert_ld_preference; do
9470         case $xxx_convert in
9471         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9472         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9473         esac
9474     done
9475     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9476     for xxx_convert in qgcvt sprintf $xxx_list; do
9477         case "$xxx_ld_list" in
9478         $xxx_convert*|*" $xxx_convert"*) ;;
9479         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9480         esac
9481     done
9482     : if sprintf cannot do long doubles, move it to the end
9483     if test "$d_PRIgldbl" != "$define"; then
9484         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9485     fi
9486     : if no qgcvt, remove it
9487     if test "$d_qgcvt" != "$define"; then
9488         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9489     fi
9490     : use the ld_list
9491     xxx_list="$xxx_ld_list"
9492     ;;
9493 esac
9494
9495 for xxx_convert in $xxx_list; do
9496         echo "Trying $xxx_convert..."
9497         $rm -f try try$_o
9498         set try -DTRY_$xxx_convert
9499         if eval $compile; then
9500                 echo "$xxx_convert() found." >&4
9501                 if $run ./try; then
9502                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9503                         break;
9504                 else
9505                         echo "...But $xxx_convert didn't work as I expected."
9506                         xxx_convert=''
9507                 fi
9508         else
9509                 echo "$xxx_convert NOT found." >&4
9510         fi
9511 done
9512
9513 if test X$xxx_convert = X; then
9514     echo "*** WHOA THERE!!! ***" >&4
9515     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9516     xxx_convert=sprintf
9517 fi
9518
9519 case "$xxx_convert" in
9520 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9521 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9522 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9523 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9524    "$define$define$define")
9525       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9526    "$define$define$undef")
9527       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9528    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9529    esac
9530    ;;  
9531 esac
9532
9533 fi
9534
9535 : see if _fwalk exists
9536 set fwalk d__fwalk
9537 eval $inlibc
9538
9539 : Initialize h_fcntl
9540 h_fcntl=false
9541
9542 : Initialize h_sysfile
9543 h_sysfile=false
9544
9545 : access call always available on UNIX
9546 set access d_access
9547 eval $inlibc
9548
9549 : locate the flags for 'access()'
9550 case "$d_access" in
9551 "$define")
9552         echo " "
9553         $cat >access.c <<EOCP
9554 #include <sys/types.h>
9555 #ifdef I_FCNTL
9556 #include <fcntl.h>
9557 #endif
9558 #ifdef I_SYS_FILE
9559 #include <sys/file.h>
9560 #endif
9561 #ifdef I_UNISTD
9562 #include <unistd.h>
9563 #endif
9564 #$i_stdlib I_STDLIB
9565 #ifdef I_STDLIB
9566 #include <stdlib.h>
9567 #endif
9568 int main() {
9569         exit(R_OK);
9570 }
9571 EOCP
9572         : check sys/file.h first, no particular reason here
9573         if $test `./findhdr sys/file.h` && \
9574                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9575                 h_sysfile=true;
9576                 echo "<sys/file.h> defines the *_OK access constants." >&4
9577         elif $test `./findhdr fcntl.h` && \
9578                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9579                 h_fcntl=true;
9580                 echo "<fcntl.h> defines the *_OK access constants." >&4
9581         elif $test `./findhdr unistd.h` && \
9582                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9583                 echo "<unistd.h> defines the *_OK access constants." >&4
9584         else
9585                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9586         fi
9587         ;;
9588 esac
9589 $rm -f access*
9590
9591 : see if accessx exists
9592 set accessx d_accessx
9593 eval $inlibc
9594
9595 : see if aintl exists
9596 set aintl d_aintl
9597 eval $inlibc
9598
9599 : see if alarm exists
9600 set alarm d_alarm
9601 eval $inlibc
9602
9603 : see if POSIX threads are available
9604 set pthread.h i_pthread
9605 eval $inhdr
9606
9607 : define a fucntion to check prototypes
9608 $cat > protochk <<EOSH
9609 $startsh
9610 cc="$cc"
9611 optimize="$optimize"
9612 ccflags="$ccflags"
9613 prototype="$prototype"
9614 define="$define"
9615 rm=$rm
9616 usethreads=$usethreads
9617 i_pthread=$i_pthread
9618 pthread_h_first=$pthread_h_first
9619 EOSH
9620
9621 $cat >> protochk <<'EOSH'
9622
9623 $rm -f try.c
9624 foo="$1"
9625 shift
9626 while test $# -ge 2; do
9627         case "$1" in
9628                 $define) echo "#include <$2>" >> try.c ;;
9629                 literal) echo "$2" >> try.c ;;
9630         esac
9631     # Extra magic for the benefit of systems that need pthread.h
9632     # to be included early to correctly detect threadsafe functions.
9633     # Such functions must guarantee themselves, though, that the usethreads
9634     # and i_pthread have been defined, before calling protochk.
9635     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9636         echo "#include <pthread.h>" >> try.c
9637         pthread_h_done=yes
9638     fi
9639     shift 2
9640 done
9641 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9642 cat >> try.c <<'EOCP'
9643 #ifdef CAN_PROTOTYPE
9644 #define _(args) args
9645 #else
9646 #define _(args) ()
9647 #endif
9648 EOCP
9649 echo "$foo" >> try.c
9650 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9651 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9652 status=$?
9653 $rm -f try.[co]
9654 exit $status
9655 EOSH
9656 chmod +x protochk
9657 $eunicefix protochk
9658
9659 hasproto='varname=$1; func=$2; shift; shift;
9660 while $test $# -ge 2; do
9661         case "$1" in
9662         $define) echo "#include <$2>";;
9663         esac ;
9664     shift 2;
9665 done > try.c;
9666 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9667 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9668         echo "$func() prototype found.";
9669         val="$define";
9670 else
9671         echo "$func() prototype NOT found.";
9672         val="$undef";
9673 fi;
9674 set $varname;
9675 eval $setvar;
9676 $rm -f try.c tryout.c'
9677
9678 : see if sys/types.h has to be included
9679 set sys/types.h i_systypes
9680 eval $inhdr
9681
9682 : see if sys/select.h has to be included
9683 set sys/select.h i_sysselct
9684 eval $inhdr
9685
9686 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9687 while $test $# -ge 2; do
9688         case "$1" in
9689         $define) echo "#include <$2>";;
9690         esac ;
9691     shift 2;
9692 done > try.c;
9693 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9694 set try;
9695 if eval $compile; then
9696         val="$define";
9697 else
9698         val="$undef";
9699 fi;
9700 set $varname;
9701 eval $setvar;
9702 $rm -f try.c try.o'
9703
9704 : see if we should include time.h, sys/time.h, or both
9705 echo " "
9706 if test "X$timeincl" = X; then
9707         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9708         $echo $n "I'm now running the test program...$c"
9709         $cat >try.c <<EOCP
9710 #include <sys/types.h>
9711 #ifdef I_TIME
9712 #include <time.h>
9713 #endif
9714 #ifdef I_SYSTIME
9715 #ifdef SYSTIMEKERNEL
9716 #define KERNEL
9717 #endif
9718 #include <sys/time.h>
9719 #endif
9720 #ifdef I_SYSSELECT
9721 #include <sys/select.h>
9722 #endif
9723 #$i_stdlib I_STDLIB
9724 #ifdef I_STDLIB
9725 #include <stdlib.h>
9726 #endif
9727 int main()
9728 {
9729         struct tm foo;
9730 #ifdef S_TIMEVAL
9731         struct timeval bar;
9732 #endif
9733 #ifdef S_TIMEZONE
9734         struct timezone tzp;
9735 #endif
9736         if (foo.tm_sec == foo.tm_sec)
9737                 exit(0);
9738 #ifdef S_TIMEVAL
9739         if (bar.tv_sec == bar.tv_sec)
9740                 exit(0);
9741 #endif
9742         exit(1);
9743 }
9744 EOCP
9745         flags=''
9746         for s_timezone in '-DS_TIMEZONE' ''; do
9747         sysselect=''
9748         for s_timeval in '-DS_TIMEVAL' ''; do
9749         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9750         for i_time in '' '-DI_TIME'; do
9751         for i_systime in '-DI_SYSTIME' ''; do
9752                 case "$flags" in
9753                 '') $echo $n ".$c"
9754                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9755                         if eval $compile; then
9756                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9757                                 shift
9758                                 flags="$*"
9759                                 echo " "
9760                                 $echo $n "Succeeded with $flags$c"
9761                         fi
9762                         ;;
9763                 esac
9764         done
9765         done
9766         done
9767         done
9768         done
9769         timeincl=''
9770         echo " "
9771         case "$flags" in
9772         *SYSTIMEKERNEL*) i_systimek="$define"
9773                 timeincl=`./findhdr sys/time.h`
9774                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9775         *) i_systimek="$undef";;
9776         esac
9777         case "$flags" in
9778         *I_TIME*) i_time="$define"
9779                 timeincl=`./findhdr time.h`" $timeincl"
9780                 echo "We'll include <time.h>." >&4;;
9781         *) i_time="$undef";;
9782         esac
9783         case "$flags" in
9784         *I_SYSTIME*) i_systime="$define"
9785                 timeincl=`./findhdr sys/time.h`" $timeincl"
9786                 echo "We'll include <sys/time.h>." >&4;;
9787         *) i_systime="$undef";;
9788         esac
9789         $rm -f try.c try
9790 fi
9791 : see if struct tm knows about tm_zone
9792 case "$i_systime$i_time" in
9793 *$define*) 
9794         echo " "
9795         echo "Checking to see if your struct tm has tm_zone field..." >&4
9796         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9797         eval $hasfield
9798         ;;
9799 *)      val="$undef"
9800         set d_tm_tm_zone
9801         eval $setvar
9802         ;;
9803 esac
9804 case "$d_tm_tm_zone" in
9805 "$define")      echo "Yes, it does."   ;;
9806 *)              echo "No, it doesn't." ;;
9807 esac
9808 : see if struct tm knows about tm_gmtoff
9809 case "$i_systime$i_time" in
9810 *$define*) 
9811         echo " "
9812         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9813         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9814         eval $hasfield
9815         ;;
9816 *)      val="$undef"
9817         set d_tm_tm_gmtoff
9818         eval $setvar
9819         ;;
9820 esac
9821 case "$d_tm_tm_gmtoff" in
9822 "$define")      echo "Yes, it does."   ;;
9823 *)              echo "No, it doesn't." ;;
9824 esac
9825
9826 : see if asctime_r exists
9827 set asctime_r d_asctime_r
9828 eval $inlibc
9829 case "$d_asctime_r" in
9830 "$define")
9831         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9832         case "$d_asctime_r_proto:$usethreads" in
9833         ":define")      d_asctime_r_proto=define
9834                 set d_asctime_r_proto asctime_r $hdrs
9835                 eval $hasproto ;;
9836         *)      ;;
9837         esac
9838         case "$d_asctime_r_proto" in
9839         define)
9840         case "$asctime_r_proto" in
9841         ''|0) try='char* asctime_r(const struct tm*, char*);'
9842         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9843         esac
9844         case "$asctime_r_proto" in
9845         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9846         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9847         esac
9848         case "$asctime_r_proto" in
9849         ''|0) try='int asctime_r(const struct tm*, char*);'
9850         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9851         esac
9852         case "$asctime_r_proto" in
9853         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9854         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9855         esac
9856         case "$asctime_r_proto" in
9857         ''|0)   d_asctime_r=undef
9858                 asctime_r_proto=0
9859                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9860         * )     case "$asctime_r_proto" in
9861                 REENTRANT_PROTO*) ;;
9862                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9863                 esac
9864                 echo "Prototype: $try" ;;
9865         esac
9866         ;;
9867         *)      case "$usethreads" in
9868                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9869                 esac
9870                 d_asctime_r=undef
9871                 asctime_r_proto=0
9872                 ;;
9873         esac
9874         ;;
9875 *)      asctime_r_proto=0
9876         ;;
9877 esac
9878
9879 : see if atolf exists
9880 set atolf d_atolf
9881 eval $inlibc
9882
9883 : see if atoll exists
9884 set atoll d_atoll
9885 eval $inlibc
9886
9887 : Look for GCC-style attribute format
9888 case "$d_attribute_format" in
9889 '')
9890 echo " "
9891 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9892 $cat >attrib.c <<'EOCP'
9893 #include <stdio.h>
9894 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9895 EOCP
9896 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9897         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9898                 echo "Your C compiler doesn't support __attribute__((format))."
9899                 val="$undef"
9900         else
9901                 echo "Your C compiler supports __attribute__((format))."
9902                 val="$define"
9903         fi
9904 else
9905         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9906         val="$undef"
9907 fi
9908 ;;
9909 *) val="$d_attribute_format" ;;
9910 esac
9911 set d_attribute_format
9912 eval $setvar
9913 $rm -f attrib*
9914
9915 : Look for GCC-style attribute malloc
9916 case "$d_attribute_malloc" in
9917 '')
9918 echo " "
9919 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9920 $cat >attrib.c <<'EOCP'
9921 #include <stdio.h>
9922 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9923 EOCP
9924 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9925         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9926                 echo "Your C compiler doesn't support __attribute__((malloc))."
9927                 val="$undef"
9928         else
9929                 echo "Your C compiler supports __attribute__((malloc))."
9930                 val="$define"
9931         fi
9932 else
9933         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9934         val="$undef"
9935 fi
9936 ;;
9937 *) val="$d_attribute_malloc" ;;
9938 esac
9939 set d_attribute_malloc
9940 eval $setvar
9941 $rm -f attrib*
9942
9943 : Look for GCC-style attribute nonnull
9944 case "$d_attribute_nonnull" in
9945 '')
9946 echo " "
9947 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9948 $cat >attrib.c <<'EOCP'
9949 #include <stdio.h>
9950 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9951 EOCP
9952 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9953         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9954                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9955                 val="$undef"
9956         else
9957                 echo "Your C compiler supports __attribute__((nonnull))."
9958                 val="$define"
9959         fi
9960 else
9961         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9962         val="$undef"
9963 fi
9964 ;;
9965 *) val="$d_attribute_nonnull" ;;
9966 esac
9967 set d_attribute_nonnull
9968 eval $setvar
9969 $rm -f attrib*
9970
9971 : Look for GCC-style attribute noreturn
9972 case "$d_attribute_noreturn" in
9973 '')
9974 echo " "
9975 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9976 $cat >attrib.c <<'EOCP'
9977 #include <stdio.h>
9978 void fall_over_dead( void ) __attribute__((noreturn));
9979 EOCP
9980 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9981         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9982                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9983                 val="$undef"
9984         else
9985                 echo "Your C compiler supports __attribute__((noreturn))."
9986                 val="$define"
9987         fi
9988 else
9989         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9990         val="$undef"
9991 fi
9992 ;;
9993 *) val="$d_attribute_noreturn" ;;
9994 esac
9995 set d_attribute_noreturn
9996 eval $setvar
9997 $rm -f attrib*
9998
9999 : Look for GCC-style attribute pure
10000 case "$d_attribute_pure" in
10001 '')
10002 echo " "
10003 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10004 $cat >attrib.c <<'EOCP'
10005 #include <stdio.h>
10006 int square( int n ) __attribute__((pure));
10007 EOCP
10008 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10009         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10010                 echo "Your C compiler doesn't support __attribute__((pure))."
10011                 val="$undef"
10012         else
10013                 echo "Your C compiler supports __attribute__((pure))."
10014                 val="$define"
10015         fi
10016 else
10017         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10018         val="$undef"
10019 fi
10020 ;;
10021 *) val="$d_attribute_pure" ;;
10022 esac
10023 set d_attribute_pure
10024 eval $setvar
10025 $rm -f attrib*
10026
10027 : Look for GCC-style attribute unused
10028 case "$d_attribute_unused" in
10029 '')
10030 echo " "
10031 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10032 $cat >attrib.c <<'EOCP'
10033 #include <stdio.h>
10034 int do_something( int dummy __attribute__((unused)), int n );
10035 EOCP
10036 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10037         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10038                 echo "Your C compiler doesn't support __attribute__((unused))."
10039                 val="$undef"
10040         else
10041                 echo "Your C compiler supports __attribute__((unused))."
10042                 val="$define"
10043         fi
10044 else
10045         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10046         val="$undef"
10047 fi
10048 ;;
10049 *) val="$d_attribute_unused" ;;
10050 esac
10051 set d_attribute_unused
10052 eval $setvar
10053 $rm -f attrib*
10054
10055 : Look for GCC-style attribute warn_unused_result
10056 case "$d_attribute_warn_unused_result" in
10057 '')
10058 echo " "
10059 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10060 $cat >attrib.c <<'EOCP'
10061 #include <stdio.h>
10062 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10063 EOCP
10064 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10065         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10066                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10067                 val="$undef"
10068         else
10069                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10070                 val="$define"
10071         fi
10072 else
10073         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10074         val="$undef"
10075 fi
10076 ;;
10077 *) val="$d_attribute_warn_unused_result" ;;
10078 esac
10079 set d_attribute_warn_unused_result
10080 eval $setvar
10081 $rm -f attrib*
10082
10083 : see if bcmp exists
10084 set bcmp d_bcmp
10085 eval $inlibc
10086
10087 : see if bcopy exists
10088 set bcopy d_bcopy
10089 eval $inlibc
10090
10091 : see if this is a unistd.h system
10092 set unistd.h i_unistd
10093 eval $inhdr
10094
10095 : see if getpgrp exists
10096 set getpgrp d_getpgrp
10097 eval $inlibc
10098
10099 case "$d_getpgrp" in
10100 "$define")
10101         echo " "
10102         echo "Checking to see which flavor of getpgrp is in use..."
10103         $cat >try.c <<EOP
10104 #$i_unistd I_UNISTD
10105 #include <sys/types.h>
10106 #ifdef I_UNISTD
10107 #  include <unistd.h>
10108 #endif
10109 #$i_stdlib I_STDLIB
10110 #ifdef I_STDLIB
10111 #include <stdlib.h>
10112 #endif
10113 int main()
10114 {
10115         if (getuid() == 0) {
10116                 printf("(I see you are running Configure as super-user...)\n");
10117                 setuid(1);
10118         }
10119 #ifdef TRY_BSD_PGRP
10120         if (getpgrp(1) == 0)
10121                 exit(0);
10122 #else
10123         if (getpgrp() > 0)
10124                 exit(0);
10125 #endif
10126         exit(1);
10127 }
10128 EOP
10129         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10130                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10131                 val="$define"
10132         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10133                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10134                 val="$undef"
10135         else
10136                 echo "I can't seem to compile and run the test program."
10137                 if ./usg; then
10138                         xxx="a USG one, i.e. you use getpgrp()."
10139                 else
10140                         # SVR4 systems can appear rather BSD-ish.
10141                         case "$i_unistd" in
10142                         $undef)
10143                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10144                                 val="$define"
10145                                 ;;
10146                         $define)
10147                                 xxx="probably a USG one, i.e. you use getpgrp()."
10148                                 val="$undef"
10149                                 ;;
10150                         esac
10151                 fi
10152                 echo "Assuming your getpgrp is $xxx" >&4
10153         fi
10154         ;;
10155 *) val="$undef";;
10156 esac
10157 set d_bsdgetpgrp
10158 eval $setvar
10159 $rm -f try try.*
10160
10161 : see if setpgrp exists
10162 set setpgrp d_setpgrp
10163 eval $inlibc
10164
10165 case "$d_setpgrp" in
10166 "$define")
10167         echo " "
10168         echo "Checking to see which flavor of setpgrp is in use..."
10169         $cat >try.c <<EOP
10170 #$i_unistd I_UNISTD
10171 #include <sys/types.h>
10172 #ifdef I_UNISTD
10173 #  include <unistd.h>
10174 #endif
10175 #$i_stdlib I_STDLIB
10176 #ifdef I_STDLIB
10177 #include <stdlib.h>
10178 #endif
10179 int main()
10180 {
10181         if (getuid() == 0) {
10182                 printf("(I see you are running Configure as super-user...)\n");
10183                 setuid(1);
10184         }
10185 #ifdef TRY_BSD_PGRP
10186         if (-1 == setpgrp(1, 1))
10187                 exit(0);
10188 #else
10189         if (setpgrp() != -1)
10190                 exit(0);
10191 #endif
10192         exit(1);
10193 }
10194 EOP
10195         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10196                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10197                 val="$define"
10198         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10199                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10200                 val="$undef"
10201         else
10202                 echo "(I can't seem to compile and run the test program.)"
10203                 if ./usg; then
10204                         xxx="a USG one, i.e. you use setpgrp()."
10205                 else
10206                         # SVR4 systems can appear rather BSD-ish.
10207                         case "$i_unistd" in
10208                         $undef)
10209                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10210                                 val="$define"
10211                                 ;;
10212                         $define)
10213                                 xxx="probably a USG one, i.e. you use setpgrp()."
10214                                 val="$undef"
10215                                 ;;
10216                         esac
10217                 fi
10218                 echo "Assuming your setpgrp is $xxx" >&4
10219         fi
10220         ;;
10221 *) val="$undef";;
10222 esac
10223 set d_bsdsetpgrp
10224 eval $setvar
10225 $rm -f try try.*
10226 : see if bzero exists
10227 set bzero d_bzero
10228 eval $inlibc
10229
10230 : see if signal is declared as pointer to function returning int or void
10231 echo " "
10232 xxx=`./findhdr signal.h`
10233 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10234 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10235         echo "You have int (*signal())() instead of void." >&4
10236         val="$undef"
10237 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10238         echo "You have void (*signal())()." >&4
10239         val="$define"
10240 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10241         echo "You have int (*signal())() instead of void." >&4
10242         val="$undef"
10243 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10244         echo "You have void (*signal())()." >&4
10245         val="$define"
10246 else
10247         case "$d_voidsig" in
10248         '')
10249         echo "I can't determine whether signal handler returns void or int..." >&4
10250                 dflt=void
10251                 rp="What type does your signal handler return?"
10252                 . ./myread
10253                 case "$ans" in
10254                 v*) val="$define";;
10255                 *) val="$undef";;
10256                 esac;;
10257         "$define")
10258                 echo "As you already told me, signal handler returns void." >&4
10259                 val="$define"
10260                 ;;
10261         *)      echo "As you already told me, signal handler returns int." >&4
10262                 val="$undef"
10263                 ;;
10264         esac
10265 fi
10266 set d_voidsig
10267 eval $setvar
10268 case "$d_voidsig" in
10269 "$define") signal_t="void";;
10270 *) signal_t="int";;
10271 esac
10272 $rm -f $$.tmp
10273
10274 : check for ability to cast large floats to 32-bit ints.
10275 echo " "
10276 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10277 if $test "$intsize" -ge 4; then
10278         xxx=int
10279 else
10280         xxx=long
10281 fi
10282 $cat >try.c <<EOCP
10283 #include <stdio.h>
10284 #$i_stdlib I_STDLIB
10285 #ifdef I_STDLIB
10286 #include <stdlib.h>
10287 #endif
10288 #include <sys/types.h>
10289 #include <signal.h>
10290 $signal_t blech(s) int s; { exit(3); }
10291 int main()
10292 {
10293         $xxx i32;
10294         double f, g;
10295         int result = 0;
10296         char str[16];
10297         signal(SIGFPE, blech);
10298
10299         /* Don't let compiler optimize the test away.  Store the number 
10300            in a writable string for gcc to pass to sscanf under HP/UX.
10301         */
10302         sprintf(str, "2147483647");
10303         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10304         g = 10 * f;
10305         i32  = ($xxx) g;
10306
10307         /* x86 processors will probably give 0x8000 0000, which is a
10308            sign change.  We don't want that.  We want to mimic SPARC
10309            behavior here, which is to preserve the sign and give
10310            back 0x7fff ffff.
10311         */
10312         if (i32 != ($xxx) f)
10313                 result |= 1;
10314         exit(result);
10315 }
10316 EOCP
10317 set try
10318 if eval $compile_ok; then
10319         $run ./try
10320         yyy=$?
10321 else
10322         echo "(I can't seem to compile the test program--assuming it can't)"
10323         yyy=1
10324 fi
10325 case "$yyy" in
10326 0)      val="$define"
10327         echo "Yup, it can."
10328         ;;
10329 *)      val="$undef"
10330         echo "Nope, it can't."
10331         ;;
10332 esac
10333 set d_casti32
10334 eval $setvar
10335 $rm -f try try.*
10336
10337 : check for ability to cast negative floats to unsigned
10338 echo " "
10339 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10340 $cat >try.c <<EOCP
10341 #include <stdio.h>
10342 #$i_stdlib I_STDLIB
10343 #ifdef I_STDLIB
10344 #include <stdlib.h>
10345 #endif
10346 #include <sys/types.h>
10347 #include <signal.h>
10348 $signal_t blech(s) int s; { exit(7); }
10349 $signal_t blech_in_list(s) int s; { exit(4); }
10350 unsigned long dummy_long(p) unsigned long p; { return p; }
10351 unsigned int dummy_int(p) unsigned int p; { return p; }
10352 unsigned short dummy_short(p) unsigned short p; { return p; }
10353 int main()
10354 {
10355         double f;
10356         unsigned long along;
10357         unsigned int aint;
10358         unsigned short ashort;
10359         int result = 0;
10360         char str[16];
10361         
10362         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10363            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10364            optimized the whole file away
10365         */
10366         /* Store the number in a writable string for gcc to pass to 
10367            sscanf under HP/UX.
10368         */
10369         sprintf(str, "-123");
10370         sscanf(str, "%lf", &f);  /* f = -123.; */
10371
10372         signal(SIGFPE, blech);
10373         along = (unsigned long)f;
10374         aint = (unsigned int)f;
10375         ashort = (unsigned short)f;
10376         if (along != (unsigned long)-123)
10377                 result |= 1;
10378         if (aint != (unsigned int)-123)
10379                 result |= 1;
10380         if (ashort != (unsigned short)-123)
10381                 result |= 1;
10382         sprintf(str, "1073741824.");
10383         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10384         f = f + f;
10385         along = 0;
10386         along = (unsigned long)f;
10387         if (along != 0x80000000)
10388                 result |= 2;
10389         f -= 1.;
10390         along = 0;
10391         along = (unsigned long)f;
10392         if (along != 0x7fffffff)
10393                 result |= 1;
10394         f += 2.;
10395         along = 0;
10396         along = (unsigned long)f;
10397         if (along != 0x80000001)
10398                 result |= 2;
10399         if (result)
10400                 exit(result);
10401         signal(SIGFPE, blech_in_list);
10402         sprintf(str, "123.");
10403         sscanf(str, "%lf", &f);  /* f = 123.; */
10404         along = dummy_long((unsigned long)f);
10405         aint = dummy_int((unsigned int)f);
10406         ashort = dummy_short((unsigned short)f);
10407         if (along != (unsigned long)123)
10408                 result |= 4;
10409         if (aint != (unsigned int)123)
10410                 result |= 4;
10411         if (ashort != (unsigned short)123)
10412                 result |= 4;
10413         exit(result);
10414
10415 }
10416 EOCP
10417 set try
10418 if eval $compile_ok; then
10419         $run ./try
10420         castflags=$?
10421 else
10422         echo "(I can't seem to compile the test program--assuming it can't)"
10423         castflags=7
10424 fi
10425 case "$castflags" in
10426 0)      val="$define"
10427         echo "Yup, it can."
10428         ;;
10429 *)      val="$undef"
10430         echo "Nope, it can't."
10431         ;;
10432 esac
10433 set d_castneg
10434 eval $setvar
10435 $rm -f try.*
10436
10437 : see if vprintf exists
10438 echo " "
10439 if set vprintf val -f d_vprintf; eval $csym; $val; then
10440         echo 'vprintf() found.' >&4
10441         val="$define"
10442         $cat >try.c <<EOF
10443 #include <varargs.h>
10444 #$i_stdlib I_STDLIB
10445 #ifdef I_STDLIB
10446 #include <stdlib.h>
10447 #endif
10448
10449 int main() { xxx("foo"); }
10450
10451 xxx(va_alist)
10452 va_dcl
10453 {
10454         va_list args;
10455         char buf[10];
10456
10457         va_start(args);
10458         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10459 }
10460 EOF
10461         set try
10462         if eval $compile && $run ./try; then
10463                 echo "Your vsprintf() returns (int)." >&4
10464                 val2="$undef"
10465         else
10466                 echo "Your vsprintf() returns (char*)." >&4
10467                 val2="$define"
10468         fi
10469 else
10470         echo 'vprintf() NOT found.' >&4
10471                 val="$undef"
10472                 val2="$undef"
10473 fi
10474 $rm -f try try.*
10475 set d_vprintf
10476 eval $setvar
10477 val=$val2
10478 set d_charvspr
10479 eval $setvar
10480
10481 : see if chown exists
10482 set chown d_chown
10483 eval $inlibc
10484
10485 : see if chroot exists
10486 set chroot d_chroot
10487 eval $inlibc
10488
10489 : see if chsize exists
10490 set chsize d_chsize
10491 eval $inlibc
10492
10493 : see if class exists
10494 set class d_class
10495 eval $inlibc
10496
10497 hasstruct='varname=$1; struct=$2; shift; shift;
10498 while $test $# -ge 2; do
10499         case "$1" in
10500         $define) echo "#include <$2>";;
10501         esac ;
10502     shift 2;
10503 done > try.c;
10504 echo "int main () { struct $struct foo; }" >> try.c;
10505 set try;
10506 if eval $compile; then
10507         val="$define";
10508 else
10509         val="$undef";
10510 fi;
10511 set $varname;
10512 eval $setvar;
10513 $rm -f try.c try.o'
10514
10515 socketlib=''
10516 sockethdr=''
10517 : see whether socket exists
10518 echo " "
10519 $echo $n "Hmm... $c" >&4
10520 if set socket val -f d_socket; eval $csym; $val; then
10521         echo "Looks like you have Berkeley networking support." >&4
10522         d_socket="$define"
10523         if set setsockopt val -f; eval $csym; $val; then
10524                 d_oldsock="$undef"
10525         else
10526                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10527                 d_oldsock="$define"
10528         fi
10529 else
10530         if $contains socklib libc.list >/dev/null 2>&1; then
10531                 echo "Looks like you have Berkeley networking support." >&4
10532                 d_socket="$define"
10533                 : we will have to assume that it supports the 4.2 BSD interface
10534                 d_oldsock="$undef"
10535         else
10536                 echo "You don't have Berkeley networking in libc$_a..." >&4
10537                 if test "X$d_socket" = "X$define"; then
10538                    echo "...but you seem to believe that you have sockets." >&4
10539                 else
10540                         for net in net socket
10541                         do
10542                                 if test -f /usr/lib/lib$net$_a; then
10543                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10544                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10545                                         if $contains socket libc.list >/dev/null 2>&1; then
10546                                                 d_socket="$define"
10547                                                 socketlib="-l$net"
10548                                                 case "$net" in
10549                                                 net)
10550                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10551                                                         sockethdr="-I/usr/netinclude"
10552                                                         ;;
10553                                                 esac
10554                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10555                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10556                                                         d_oldsock="$undef"
10557                                                 else
10558                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10559                                                         d_oldsock="$define"
10560                                                 fi
10561                                                 break
10562                                         fi
10563                                 fi
10564                         done
10565                         if test "X$d_socket" != "X$define"; then
10566                            echo "or anywhere else I see." >&4
10567                            d_socket="$undef"
10568                            d_oldsock="$undef"
10569                         fi
10570                 fi
10571         fi
10572 fi
10573
10574 : see if socketpair exists
10575 set socketpair d_sockpair
10576 eval $inlibc
10577
10578
10579 echo " "
10580 echo "Checking the availability of certain socket constants..." >&4
10581 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10582         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10583         $cat >try.c <<EOF
10584 #include <sys/types.h>
10585 #include <sys/socket.h>
10586 int main() {
10587     int i = $ENUM;
10588 }
10589 EOF
10590         val="$undef"
10591         set try; if eval $compile; then
10592                 val="$define"
10593         fi
10594         set d_${enum}; eval $setvar
10595         $rm -f try.c try
10596 done
10597
10598 : see if this is a sys/uio.h system
10599 set sys/uio.h i_sysuio
10600 eval $inhdr
10601
10602
10603 echo " "
10604 echo "Checking to see if your system supports struct cmsghdr..." >&4
10605 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10606 eval $hasstruct
10607 case "$d_cmsghdr_s" in
10608 "$define")      echo "Yes, it does."   ;;
10609 *)              echo "No, it doesn't." ;;
10610 esac
10611
10612
10613 : check for const keyword
10614 echo " "
10615 echo 'Checking to see if your C compiler knows about "const"...' >&4
10616 $cat >const.c <<'EOCP'
10617 typedef struct spug { int drokk; } spug;
10618 int main()
10619 {
10620         const char *foo;
10621         const spug y;
10622 }
10623 EOCP
10624 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10625         val="$define"
10626         echo "Yup, it does."
10627 else
10628         val="$undef"
10629         echo "Nope, it doesn't."
10630 fi
10631 set d_const
10632 eval $setvar
10633
10634 : see if copysignl exists
10635 set copysignl d_copysignl
10636 eval $inlibc
10637
10638 : see if crypt exists
10639 echo " "
10640 set crypt d_crypt
10641 eval $inlibc
10642 case "$d_crypt" in
10643 $define) cryptlib='' ;;
10644 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10645                 echo 'crypt() found.' >&4
10646                 val="$define"
10647                 cryptlib=''
10648         else
10649                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10650                 if $test -z "$cryptlib"; then
10651                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10652                 else
10653                         cryptlib=-lcrypt
10654                 fi
10655                 if $test -z "$cryptlib"; then
10656                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10657                 else
10658                         cryptlib=-lcrypt
10659                 fi
10660                 if $test -z "$cryptlib"; then
10661                         cryptlib=`./loc libcrypt$_a "" $libpth`
10662                 else
10663                         cryptlib=-lcrypt
10664                 fi
10665                 if $test -z "$cryptlib"; then
10666                         echo 'crypt() NOT found.' >&4
10667                         val="$undef"
10668                 else
10669                         val="$define"
10670                 fi
10671         fi
10672         set d_crypt
10673         eval $setvar
10674         ;;
10675 esac
10676
10677 : see if this is a crypt.h system
10678 set crypt.h i_crypt
10679 eval $inhdr
10680
10681 : see if crypt_r exists
10682 set crypt_r d_crypt_r
10683 eval $inlibc
10684 case "$d_crypt_r" in
10685 "$define")
10686         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10687         case "$d_crypt_r_proto:$usethreads" in
10688         ":define")      d_crypt_r_proto=define
10689                 set d_crypt_r_proto crypt_r $hdrs
10690                 eval $hasproto ;;
10691         *)      ;;
10692         esac
10693         case "$d_crypt_r_proto" in
10694         define)
10695         case "$crypt_r_proto" in
10696         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10697         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10698         esac
10699         case "$crypt_r_proto" in
10700         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10701         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10702         esac
10703         case "$crypt_r_proto" in
10704         ''|0)   d_crypt_r=undef
10705                 crypt_r_proto=0
10706                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10707         * )     case "$crypt_r_proto" in
10708                 REENTRANT_PROTO*) ;;
10709                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10710                 esac
10711                 echo "Prototype: $try" ;;
10712         esac
10713         ;;
10714         *)      case "$usethreads" in
10715                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10716                 esac
10717                 d_crypt_r=undef
10718                 crypt_r_proto=0
10719                 ;;
10720         esac
10721         ;;
10722 *)      crypt_r_proto=0
10723         ;;
10724 esac
10725
10726 : get csh whereabouts
10727 case "$csh" in
10728 'csh') val="$undef" ;;
10729 *) val="$define" ;;
10730 esac
10731 set d_csh
10732 eval $setvar
10733 : Respect a hint or command line value for full_csh.
10734 case "$full_csh" in
10735 '') full_csh=$csh ;;
10736 esac
10737
10738 : see if ctermid_r exists
10739 set ctermid_r d_ctermid_r
10740 eval $inlibc
10741 case "$d_ctermid_r" in
10742 "$define")
10743         hdrs="$i_systypes sys/types.h define stdio.h "
10744         case "$d_ctermid_r_proto:$usethreads" in
10745         ":define")      d_ctermid_r_proto=define
10746                 set d_ctermid_r_proto ctermid_r $hdrs
10747                 eval $hasproto ;;
10748         *)      ;;
10749         esac
10750         case "$d_ctermid_r_proto" in
10751         define)
10752         case "$ctermid_r_proto" in
10753         ''|0) try='char* ctermid_r(char*);'
10754         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10755         esac
10756         case "$ctermid_r_proto" in
10757         ''|0)   d_ctermid_r=undef
10758                 ctermid_r_proto=0
10759                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10760         * )     case "$ctermid_r_proto" in
10761                 REENTRANT_PROTO*) ;;
10762                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10763                 esac
10764                 echo "Prototype: $try" ;;
10765         esac
10766         ;;
10767         *)      case "$usethreads" in
10768                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10769                 esac
10770                 d_ctermid_r=undef
10771                 ctermid_r_proto=0
10772                 ;;
10773         esac
10774         ;;
10775 *)      ctermid_r_proto=0
10776         ;;
10777 esac
10778
10779 : see if ctime_r exists
10780 set ctime_r d_ctime_r
10781 eval $inlibc
10782 case "$d_ctime_r" in
10783 "$define")
10784         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10785         case "$d_ctime_r_proto:$usethreads" in
10786         ":define")      d_ctime_r_proto=define
10787                 set d_ctime_r_proto ctime_r $hdrs
10788                 eval $hasproto ;;
10789         *)      ;;
10790         esac
10791         case "$d_ctime_r_proto" in
10792         define)
10793         case "$ctime_r_proto" in
10794         ''|0) try='char* ctime_r(const time_t*, char*);'
10795         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10796         esac
10797         case "$ctime_r_proto" in
10798         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10799         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10800         esac
10801         case "$ctime_r_proto" in
10802         ''|0) try='int ctime_r(const time_t*, char*);'
10803         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10804         esac
10805         case "$ctime_r_proto" in
10806         ''|0) try='int ctime_r(const time_t*, char*, int);'
10807         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10808         esac
10809         case "$ctime_r_proto" in
10810         ''|0)   d_ctime_r=undef
10811                 ctime_r_proto=0
10812                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10813         * )     case "$ctime_r_proto" in
10814                 REENTRANT_PROTO*) ;;
10815                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10816                 esac
10817                 echo "Prototype: $try" ;;
10818         esac
10819         ;;
10820         *)      case "$usethreads" in
10821                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10822                 esac
10823                 d_ctime_r=undef
10824                 ctime_r_proto=0
10825                 ;;
10826         esac
10827         ;;
10828 *)      ctime_r_proto=0
10829         ;;
10830 esac
10831
10832 : see if cuserid exists
10833 set cuserid d_cuserid
10834 eval $inlibc
10835
10836 : see if this is a limits.h system
10837 set limits.h i_limits
10838 eval $inhdr
10839
10840 : see if this is a float.h system
10841 set float.h i_float
10842 eval $inhdr
10843
10844 : See if number of significant digits in a double precision number is known
10845 echo " "
10846 $cat >dbl_dig.c <<EOM
10847 #$i_limits I_LIMITS
10848 #$i_float I_FLOAT
10849 #ifdef I_LIMITS
10850 #include <limits.h>
10851 #endif
10852 #ifdef I_FLOAT
10853 #include <float.h>
10854 #endif
10855 #ifdef DBL_DIG
10856 printf("Contains DBL_DIG");
10857 #endif
10858 EOM
10859 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10860 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10861         echo "DBL_DIG found." >&4
10862         val="$define"
10863 else
10864         echo "DBL_DIG NOT found." >&4
10865         val="$undef"
10866 fi
10867 $rm -f dbl_dig.?
10868 set d_dbl_dig
10869 eval $setvar
10870
10871 : see if dbm.h is available
10872 : see if dbmclose exists
10873 set dbmclose d_dbmclose
10874 eval $inlibc
10875
10876 case "$d_dbmclose" in
10877 $define)
10878         set dbm.h i_dbm
10879         eval $inhdr
10880         case "$i_dbm" in
10881         $define)
10882                 val="$undef"
10883                 set i_rpcsvcdbm
10884                 eval $setvar
10885                 ;;
10886         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10887                 eval $inhdr
10888                 ;;
10889         esac
10890         ;;
10891 *)      echo "We won't be including <dbm.h>"
10892         val="$undef"
10893         set i_dbm
10894         eval $setvar
10895         val="$undef"
10896         set i_rpcsvcdbm
10897         eval $setvar
10898         ;;
10899 esac
10900
10901 : see if prototype for dbminit is available
10902 echo " "
10903 set d_dbminitproto dbminit $i_dbm dbm.h
10904 eval $hasproto
10905
10906 : see if difftime exists
10907 set difftime d_difftime
10908 eval $inlibc
10909
10910 : see if this is a dirent system
10911 echo " "
10912 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10913         val="$define"
10914         echo "<dirent.h> found." >&4
10915 else
10916         val="$undef"
10917         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10918                 echo "<sys/dir.h> found." >&4
10919                 echo " "
10920         else
10921                 xinc=`./findhdr sys/ndir.h`
10922         fi
10923         echo "<dirent.h> NOT found." >&4
10924 fi
10925 set i_dirent
10926 eval $setvar
10927
10928 : Look for type of directory structure.
10929 echo " "
10930 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10931
10932 case "$direntrytype" in
10933 ''|' ')
10934         case "$i_dirent" in
10935         $define) guess1='struct dirent' ;;
10936         *) guess1='struct direct'  ;;
10937         esac
10938         ;;
10939 *)      guess1="$direntrytype"
10940         ;;
10941 esac
10942
10943 case "$guess1" in
10944 'struct dirent') guess2='struct direct' ;;
10945 *) guess2='struct dirent' ;;
10946 esac
10947                 
10948 if $contains "$guess1" try.c >/dev/null 2>&1; then
10949         direntrytype="$guess1"
10950         echo "Your directory entries are $direntrytype." >&4
10951 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10952         direntrytype="$guess2"
10953         echo "Your directory entries seem to be $direntrytype." >&4
10954 else
10955         echo "I don't recognize your system's directory entries." >&4
10956         rp="What type is used for directory entries on this system?"
10957         dflt="$guess1"
10958         . ./myread
10959         direntrytype="$ans"
10960 fi
10961 $rm -f try.c
10962
10963
10964 : see if the directory entry stores field length
10965 echo " "
10966 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10967 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10968         echo "Good, your directory entry keeps length information in d_namlen." >&4
10969         val="$define"
10970 else
10971         echo "Your directory entry does not know about the d_namlen field." >&4
10972         val="$undef"
10973 fi
10974 set d_dirnamlen
10975 eval $setvar
10976 $rm -f try.c
10977
10978 : see if this is an sysdir system
10979 set sys/dir.h i_sysdir
10980 eval $inhdr
10981
10982 : see if this is an sysndir system
10983 set sys/ndir.h i_sysndir
10984 eval $inhdr
10985
10986 : Look for dirfd
10987 echo " "
10988 $cat >dirfd.c <<EOM
10989 #include <stdio.h>
10990 #$i_stdlib I_STDLIB
10991 #ifdef I_STDLIB
10992 #include <stdlib.h>
10993 #endif
10994 #$i_dirent I_DIRENT             /**/
10995 #$i_sysdir I_SYS_DIR            /**/
10996 #$i_sysndir I_SYS_NDIR          /**/
10997 #$i_systypes I_SYS_TYPES        /**/
10998 #if defined(I_SYS_TYPES)
10999 #include <sys/types.h>
11000 #endif
11001 #if defined(I_DIRENT)
11002 #include <dirent.h>
11003 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11004 #include <sys/dir.h>
11005 #endif
11006 #else
11007 #ifdef I_SYS_NDIR
11008 #include <sys/ndir.h>
11009 #else
11010 #ifdef I_SYS_DIR
11011 #ifdef hp9000s500
11012 #include <ndir.h>       /* may be wrong in the future */
11013 #else
11014 #include <sys/dir.h>
11015 #endif
11016 #endif
11017 #endif
11018 #endif 
11019 int main() {
11020         DIR *dirp = opendir(".");
11021         if (dirfd(dirp) >= 0)
11022                 exit(0);
11023         else
11024                 exit(1);
11025 }
11026 EOM
11027 set dirfd
11028 if eval $compile; then
11029         val="$define"
11030 fi
11031 case "$val" in
11032 $define)        echo "dirfd() found." >&4       ;;
11033 *)              echo "dirfd() NOT found." >&4   ;;
11034 esac
11035 set d_dirfd
11036 eval $setvar
11037 $rm -f dirfd*
11038
11039 : see if dlerror exists
11040 xxx_runnm="$runnm"
11041 runnm=false
11042 set dlerror d_dlerror
11043 eval $inlibc
11044 runnm="$xxx_runnm"
11045
11046 : see if dlfcn is available
11047 set dlfcn.h i_dlfcn
11048 eval $inhdr
11049
11050 case "$usedl" in
11051 $define|y|true)
11052         $cat << EOM
11053
11054 On a few systems, the dynamically loaded modules that perl generates and uses
11055 will need a different extension than shared libs. The default will probably
11056 be appropriate.
11057
11058 EOM
11059         case "$dlext" in
11060         '')     dflt="$so" ;;
11061         *)      dflt="$dlext" ;;
11062         esac
11063         rp='What is the extension of dynamically loaded modules'
11064         . ./myread
11065         dlext="$ans"
11066         ;;
11067 *)
11068         dlext="none"
11069         ;;
11070 esac
11071
11072 : Check if dlsym need a leading underscore
11073 echo " "
11074 val="$undef"
11075
11076 case "$dlsrc" in
11077 dl_dlopen.xs)
11078         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11079         $cat >dyna.c <<'EOM'
11080 fred () { }
11081 EOM
11082
11083 $cat >fred.c<<EOM
11084
11085 #include <stdio.h>
11086 #$i_stdlib I_STDLIB
11087 #ifdef I_STDLIB
11088 #include <stdlib.h>
11089 #endif
11090 #$i_dlfcn I_DLFCN
11091 #ifdef I_DLFCN
11092 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11093 #else
11094 #include <sys/types.h>
11095 #include <nlist.h>
11096 #include <link.h>
11097 #endif
11098
11099 extern int fred() ;
11100
11101 int main()
11102 {
11103     void * handle ;
11104     void * symbol ;
11105 #ifndef RTLD_LAZY
11106     int mode = 1 ;
11107 #else
11108     int mode = RTLD_LAZY ;
11109 #endif
11110     handle = dlopen("./dyna.$dlext", mode) ;
11111     if (handle == NULL) {
11112         printf ("1\n") ;
11113         fflush (stdout) ;
11114         exit(0);
11115     }
11116     symbol = dlsym(handle, "fred") ;
11117     if (symbol == NULL) {
11118         /* try putting a leading underscore */
11119         symbol = dlsym(handle, "_fred") ;
11120         if (symbol == NULL) {
11121             printf ("2\n") ;
11122             fflush (stdout) ;
11123             exit(0);
11124         }
11125         printf ("3\n") ;
11126     }
11127     else
11128         printf ("4\n") ;
11129     fflush (stdout) ;
11130     exit(0);
11131 }
11132 EOM
11133         : Call the object file tmp-dyna.o in case dlext=o.
11134         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11135                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11136                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11137                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11138                 xxx=`$run ./fred`
11139                 case $xxx in
11140                 1)      echo "Test program failed using dlopen." >&4
11141                         echo "Perhaps you should not use dynamic loading." >&4;;
11142                 2)      echo "Test program failed using dlsym." >&4
11143                         echo "Perhaps you should not use dynamic loading." >&4;;
11144                 3)      echo "dlsym needs a leading underscore" >&4
11145                         val="$define" ;;
11146                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11147                 esac
11148         else
11149                 echo "I can't compile and run the test program." >&4
11150                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11151         fi
11152         ;;
11153 esac
11154                 
11155 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11156
11157 set d_dlsymun
11158 eval $setvar
11159
11160 : see if drand48_r exists
11161 set drand48_r d_drand48_r
11162 eval $inlibc
11163 case "$d_drand48_r" in
11164 "$define")
11165         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11166         case "$d_drand48_r_proto:$usethreads" in
11167         ":define")      d_drand48_r_proto=define
11168                 set d_drand48_r_proto drand48_r $hdrs
11169                 eval $hasproto ;;
11170         *)      ;;
11171         esac
11172         case "$d_drand48_r_proto" in
11173         define)
11174         case "$drand48_r_proto" in
11175         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11176         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11177         esac
11178         case "$drand48_r_proto" in
11179         ''|0)   d_drand48_r=undef
11180                 drand48_r_proto=0
11181                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11182         * )     case "$drand48_r_proto" in
11183                 REENTRANT_PROTO*) ;;
11184                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11185                 esac
11186                 echo "Prototype: $try" ;;
11187         esac
11188         ;;
11189         *)      case "$usethreads" in
11190                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11191                 esac
11192                 d_drand48_r=undef
11193                 drand48_r_proto=0
11194                 ;;
11195         esac
11196         ;;
11197 *)      drand48_r_proto=0
11198         ;;
11199 esac
11200
11201 : see if prototype for drand48 is available
11202 echo " "
11203 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11204 eval $hasproto
11205
11206 : see if dup2 exists
11207 set dup2 d_dup2
11208 eval $inlibc
11209
11210 : see if eaccess exists
11211 set eaccess d_eaccess
11212 eval $inlibc
11213
11214 : see if endgrent exists
11215 set endgrent d_endgrent
11216 eval $inlibc
11217
11218 : see if this is an grp system
11219 set grp.h i_grp
11220 eval $inhdr
11221
11222 case "$i_grp" in
11223 $define)
11224         xxx=`./findhdr grp.h`
11225         $cppstdin $cppflags $cppminus < $xxx >$$.h
11226
11227         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11228                 val="$define"
11229         else
11230                 val="$undef"
11231         fi
11232         set d_grpasswd
11233         eval $setvar
11234
11235         $rm -f $$.h
11236         ;;
11237 *)
11238         val="$undef";
11239         set d_grpasswd; eval $setvar
11240         ;;
11241 esac
11242
11243 : see if endgrent_r exists
11244 set endgrent_r d_endgrent_r
11245 eval $inlibc
11246 case "$d_endgrent_r" in
11247 "$define")
11248         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11249         case "$d_endgrent_r_proto:$usethreads" in
11250         ":define")      d_endgrent_r_proto=define
11251                 set d_endgrent_r_proto endgrent_r $hdrs
11252                 eval $hasproto ;;
11253         *)      ;;
11254         esac
11255         case "$d_endgrent_r_proto" in
11256         define)
11257         case "$endgrent_r_proto" in
11258         ''|0) try='int endgrent_r(FILE**);'
11259         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11260         esac
11261         case "$endgrent_r_proto" in
11262         ''|0) try='void endgrent_r(FILE**);'
11263         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11264         esac
11265         case "$endgrent_r_proto" in
11266         ''|0)   d_endgrent_r=undef
11267                 endgrent_r_proto=0
11268                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11269         * )     case "$endgrent_r_proto" in
11270                 REENTRANT_PROTO*) ;;
11271                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11272                 esac
11273                 echo "Prototype: $try" ;;
11274         esac
11275         ;;
11276         *)      case "$usethreads" in
11277                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11278                 esac
11279                 d_endgrent_r=undef
11280                 endgrent_r_proto=0
11281                 ;;
11282         esac
11283         ;;
11284 *)      endgrent_r_proto=0
11285         ;;
11286 esac
11287
11288 : see if endhostent exists
11289 set endhostent d_endhent
11290 eval $inlibc
11291
11292 : see if this is a netdb.h system
11293 set netdb.h i_netdb
11294 eval $inhdr
11295
11296 : see if endhostent_r exists
11297 set endhostent_r d_endhostent_r
11298 eval $inlibc
11299 case "$d_endhostent_r" in
11300 "$define")
11301         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11302         case "$d_endhostent_r_proto:$usethreads" in
11303         ":define")      d_endhostent_r_proto=define
11304                 set d_endhostent_r_proto endhostent_r $hdrs
11305                 eval $hasproto ;;
11306         *)      ;;
11307         esac
11308         case "$d_endhostent_r_proto" in
11309         define)
11310         case "$endhostent_r_proto" in
11311         ''|0) try='int endhostent_r(struct hostent_data*);'
11312         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11313         esac
11314         case "$endhostent_r_proto" in
11315         ''|0) try='void endhostent_r(struct hostent_data*);'
11316         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11317         esac
11318         case "$endhostent_r_proto" in
11319         ''|0)   d_endhostent_r=undef
11320                 endhostent_r_proto=0
11321                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11322         * )     case "$endhostent_r_proto" in
11323                 REENTRANT_PROTO*) ;;
11324                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11325                 esac
11326                 echo "Prototype: $try" ;;
11327         esac
11328         ;;
11329         *)      case "$usethreads" in
11330                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11331                 esac
11332                 d_endhostent_r=undef
11333                 endhostent_r_proto=0
11334                 ;;
11335         esac
11336         ;;
11337 *)      endhostent_r_proto=0
11338         ;;
11339 esac
11340
11341 : see if endnetent exists
11342 set endnetent d_endnent
11343 eval $inlibc
11344
11345 : see if endnetent_r exists
11346 set endnetent_r d_endnetent_r
11347 eval $inlibc
11348 case "$d_endnetent_r" in
11349 "$define")
11350         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11351         case "$d_endnetent_r_proto:$usethreads" in
11352         ":define")      d_endnetent_r_proto=define
11353                 set d_endnetent_r_proto endnetent_r $hdrs
11354                 eval $hasproto ;;
11355         *)      ;;
11356         esac
11357         case "$d_endnetent_r_proto" in
11358         define)
11359         case "$endnetent_r_proto" in
11360         ''|0) try='int endnetent_r(struct netent_data*);'
11361         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11362         esac
11363         case "$endnetent_r_proto" in
11364         ''|0) try='void endnetent_r(struct netent_data*);'
11365         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11366         esac
11367         case "$endnetent_r_proto" in
11368         ''|0)   d_endnetent_r=undef
11369                 endnetent_r_proto=0
11370                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11371         * )     case "$endnetent_r_proto" in
11372                 REENTRANT_PROTO*) ;;
11373                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11374                 esac
11375                 echo "Prototype: $try" ;;
11376         esac
11377         ;;
11378         *)      case "$usethreads" in
11379                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11380                 esac
11381                 d_endnetent_r=undef
11382                 endnetent_r_proto=0
11383                 ;;
11384         esac
11385         ;;
11386 *)      endnetent_r_proto=0
11387         ;;
11388 esac
11389
11390 : see if endprotoent exists
11391 set endprotoent d_endpent
11392 eval $inlibc
11393
11394 : see if endprotoent_r exists
11395 set endprotoent_r d_endprotoent_r
11396 eval $inlibc
11397 case "$d_endprotoent_r" in
11398 "$define")
11399         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11400         case "$d_endprotoent_r_proto:$usethreads" in
11401         ":define")      d_endprotoent_r_proto=define
11402                 set d_endprotoent_r_proto endprotoent_r $hdrs
11403                 eval $hasproto ;;
11404         *)      ;;
11405         esac
11406         case "$d_endprotoent_r_proto" in
11407         define)
11408         case "$endprotoent_r_proto" in
11409         ''|0) try='int endprotoent_r(struct protoent_data*);'
11410         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11411         esac
11412         case "$endprotoent_r_proto" in
11413         ''|0) try='void endprotoent_r(struct protoent_data*);'
11414         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11415         esac
11416         case "$endprotoent_r_proto" in
11417         ''|0)   d_endprotoent_r=undef
11418                 endprotoent_r_proto=0
11419                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11420         * )     case "$endprotoent_r_proto" in
11421                 REENTRANT_PROTO*) ;;
11422                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11423                 esac
11424                 echo "Prototype: $try" ;;
11425         esac
11426         ;;
11427         *)      case "$usethreads" in
11428                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11429                 esac
11430                 d_endprotoent_r=undef
11431                 endprotoent_r_proto=0
11432                 ;;
11433         esac
11434         ;;
11435 *)      endprotoent_r_proto=0
11436         ;;
11437 esac
11438
11439 : see if endpwent exists
11440 set endpwent d_endpwent
11441 eval $inlibc
11442
11443 : see if this is a pwd.h system
11444 set pwd.h i_pwd
11445 eval $inhdr
11446
11447 case "$i_pwd" in
11448 $define)
11449         xxx=`./findhdr pwd.h`
11450         $cppstdin $cppflags $cppminus < $xxx >$$.h
11451
11452         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11453                 val="$define"
11454         else
11455                 val="$undef"
11456         fi
11457         set d_pwquota
11458         eval $setvar
11459
11460         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11461                 val="$define"
11462         else
11463                 val="$undef"
11464         fi
11465         set d_pwage
11466         eval $setvar
11467
11468         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11469                 val="$define"
11470         else
11471                 val="$undef"
11472         fi
11473         set d_pwchange
11474         eval $setvar
11475
11476         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11477                 val="$define"
11478         else
11479                 val="$undef"
11480         fi
11481         set d_pwclass
11482         eval $setvar
11483
11484         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11485                 val="$define"
11486         else
11487                 val="$undef"
11488         fi
11489         set d_pwexpire
11490         eval $setvar
11491
11492         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11493                 val="$define"
11494         else
11495                 val="$undef"
11496         fi
11497         set d_pwcomment
11498         eval $setvar
11499
11500         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11501                 val="$define"
11502         else
11503                 val="$undef"
11504         fi
11505         set d_pwgecos
11506         eval $setvar
11507
11508         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11509                 val="$define"
11510         else
11511                 val="$undef"
11512         fi
11513         set d_pwpasswd
11514         eval $setvar
11515
11516         $rm -f $$.h
11517         ;;
11518 *)
11519         val="$undef"; 
11520         set d_pwquota; eval $setvar
11521         set d_pwage; eval $setvar
11522         set d_pwchange; eval $setvar
11523         set d_pwclass; eval $setvar
11524         set d_pwexpire; eval $setvar
11525         set d_pwcomment; eval $setvar
11526         set d_pwgecos; eval $setvar
11527         set d_pwpasswd; eval $setvar
11528         ;;
11529 esac
11530
11531 : see if endpwent_r exists
11532 set endpwent_r d_endpwent_r
11533 eval $inlibc
11534 case "$d_endpwent_r" in
11535 "$define")
11536         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11537         case "$d_endpwent_r_proto:$usethreads" in
11538         ":define")      d_endpwent_r_proto=define
11539                 set d_endpwent_r_proto endpwent_r $hdrs
11540                 eval $hasproto ;;
11541         *)      ;;
11542         esac
11543         case "$d_endpwent_r_proto" in
11544         define)
11545         case "$endpwent_r_proto" in
11546         ''|0) try='int endpwent_r(FILE**);'
11547         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11548         esac
11549         case "$endpwent_r_proto" in
11550         ''|0) try='void endpwent_r(FILE**);'
11551         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11552         esac
11553         case "$endpwent_r_proto" in
11554         ''|0)   d_endpwent_r=undef
11555                 endpwent_r_proto=0
11556                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11557         * )     case "$endpwent_r_proto" in
11558                 REENTRANT_PROTO*) ;;
11559                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11560                 esac
11561                 echo "Prototype: $try" ;;
11562         esac
11563         ;;
11564         *)      case "$usethreads" in
11565                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11566                 esac
11567                 d_endpwent_r=undef
11568                 endpwent_r_proto=0
11569                 ;;
11570         esac
11571         ;;
11572 *)      endpwent_r_proto=0
11573         ;;
11574 esac
11575
11576 : see if endservent exists
11577 set endservent d_endsent
11578 eval $inlibc
11579
11580 : see if endservent_r exists
11581 set endservent_r d_endservent_r
11582 eval $inlibc
11583 case "$d_endservent_r" in
11584 "$define")
11585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11586         case "$d_endservent_r_proto:$usethreads" in
11587         ":define")      d_endservent_r_proto=define
11588                 set d_endservent_r_proto endservent_r $hdrs
11589                 eval $hasproto ;;
11590         *)      ;;
11591         esac
11592         case "$d_endservent_r_proto" in
11593         define)
11594         case "$endservent_r_proto" in
11595         ''|0) try='int endservent_r(struct servent_data*);'
11596         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11597         esac
11598         case "$endservent_r_proto" in
11599         ''|0) try='void endservent_r(struct servent_data*);'
11600         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11601         esac
11602         case "$endservent_r_proto" in
11603         ''|0)   d_endservent_r=undef
11604                 endservent_r_proto=0
11605                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11606         * )     case "$endservent_r_proto" in
11607                 REENTRANT_PROTO*) ;;
11608                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11609                 esac
11610                 echo "Prototype: $try" ;;
11611         esac
11612         ;;
11613         *)      case "$usethreads" in
11614                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11615                 esac
11616                 d_endservent_r=undef
11617                 endservent_r_proto=0
11618                 ;;
11619         esac
11620         ;;
11621 *)      endservent_r_proto=0
11622         ;;
11623 esac
11624
11625 : Locate the flags for 'open()'
11626 echo " "
11627 $cat >try.c <<EOCP
11628 #include <sys/types.h>
11629 #ifdef I_FCNTL
11630 #include <fcntl.h>
11631 #endif
11632 #ifdef I_SYS_FILE
11633 #include <sys/file.h>
11634 #endif
11635 #$i_stdlib I_STDLIB
11636 #ifdef I_STDLIB
11637 #include <stdlib.h>
11638 #endif
11639 int main() {
11640         if(O_RDONLY);
11641 #ifdef O_TRUNC
11642         exit(0);
11643 #else
11644         exit(1);
11645 #endif
11646 }
11647 EOCP
11648 : check sys/file.h first to get FREAD on Sun
11649 if $test `./findhdr sys/file.h` && \
11650                 set try -DI_SYS_FILE && eval $compile; then
11651         h_sysfile=true;
11652         echo "<sys/file.h> defines the O_* constants..." >&4
11653         if $run ./try; then
11654                 echo "and you have the 3 argument form of open()." >&4
11655                 val="$define"
11656         else
11657                 echo "but not the 3 argument form of open().  Oh, well." >&4
11658                 val="$undef"
11659         fi
11660 elif $test `./findhdr fcntl.h` && \
11661                 set try -DI_FCNTL && eval $compile; then
11662         h_fcntl=true;
11663         echo "<fcntl.h> defines the O_* constants..." >&4
11664         if $run ./try; then
11665                 echo "and you have the 3 argument form of open()." >&4
11666                 val="$define"
11667         else
11668                 echo "but not the 3 argument form of open().  Oh, well." >&4
11669                 val="$undef"
11670         fi
11671 else
11672         val="$undef"
11673         echo "I can't find the O_* constant definitions!  You got problems." >&4
11674 fi
11675 set d_open3
11676 eval $setvar
11677 $rm -f try try.*
11678
11679 : see which of string.h or strings.h is needed
11680 echo " "
11681 strings=`./findhdr string.h`
11682 if $test "$strings" && $test -r "$strings"; then
11683         echo "Using <string.h> instead of <strings.h>." >&4
11684         val="$define"
11685 else
11686         val="$undef"
11687         strings=`./findhdr strings.h`
11688         if $test "$strings" && $test -r "$strings"; then
11689                 echo "Using <strings.h> instead of <string.h>." >&4
11690         else
11691                 echo "No string header found -- You'll surely have problems." >&4
11692         fi
11693 fi
11694 set i_string
11695 eval $setvar
11696 case "$i_string" in
11697 "$undef") strings=`./findhdr strings.h`;;
11698 *)        strings=`./findhdr string.h`;;
11699 esac
11700
11701 : see if this is a sys/file.h system
11702 val=''
11703 set sys/file.h val
11704 eval $inhdr
11705
11706 : do we need to include sys/file.h ?
11707 case "$val" in
11708 "$define")
11709         echo " "
11710         if $h_sysfile; then
11711                 val="$define"
11712                 echo "We'll be including <sys/file.h>." >&4
11713         else
11714                 val="$undef"
11715                 echo "We won't be including <sys/file.h>." >&4
11716         fi
11717         ;;
11718 *)
11719         h_sysfile=false
11720         ;;
11721 esac
11722 set i_sysfile
11723 eval $setvar
11724
11725 : see if fcntl.h is there
11726 val=''
11727 set fcntl.h val
11728 eval $inhdr
11729
11730 : see if we can include fcntl.h
11731 case "$val" in
11732 "$define")
11733         echo " "
11734         if $h_fcntl; then
11735                 val="$define"
11736                 echo "We'll be including <fcntl.h>." >&4
11737         else
11738                 val="$undef"
11739                 if $h_sysfile; then
11740         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11741                 else
11742                         echo "We won't be including <fcntl.h>." >&4
11743                 fi
11744         fi
11745         ;;
11746 *)
11747         h_fcntl=false
11748         val="$undef"
11749         ;;
11750 esac
11751 set i_fcntl
11752 eval $setvar
11753
11754 : check for non-blocking I/O stuff
11755 case "$h_sysfile" in
11756 true) echo "#include <sys/file.h>" > head.c;;
11757 *)
11758        case "$h_fcntl" in
11759        true) echo "#include <fcntl.h>" > head.c;;
11760        *) echo "#include <sys/fcntl.h>" > head.c;;
11761        esac
11762        ;;
11763 esac
11764 echo " "
11765 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11766 case "$o_nonblock" in
11767 '')
11768         $cat head.c > try.c
11769         $cat >>try.c <<EOCP
11770 #include <stdio.h>
11771 #$i_stdlib I_STDLIB
11772 #ifdef I_STDLIB
11773 #include <stdlib.h>
11774 #endif
11775 #$i_fcntl I_FCNTL
11776 #ifdef I_FCNTL
11777 #include <fcntl.h>
11778 #endif
11779 int main() {
11780 #ifdef O_NONBLOCK
11781         printf("O_NONBLOCK\n");
11782         exit(0);
11783 #endif
11784 #ifdef O_NDELAY
11785         printf("O_NDELAY\n");
11786         exit(0);
11787 #endif
11788 #ifdef FNDELAY
11789         printf("FNDELAY\n");
11790         exit(0);
11791 #endif
11792         exit(0);
11793 }
11794 EOCP
11795         set try
11796         if eval $compile_ok; then
11797                 o_nonblock=`$run ./try`
11798                 case "$o_nonblock" in
11799                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11800                 *) echo "Seems like we can use $o_nonblock.";;
11801                 esac
11802         else
11803                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11804         fi
11805         ;;
11806 *) echo "Using $hint value $o_nonblock.";;
11807 esac
11808 $rm -f try try.* .out core
11809
11810 echo " "
11811 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11812 case "$eagain" in
11813 '')
11814         $cat head.c > try.c
11815         $cat >>try.c <<EOCP
11816 #include <errno.h>
11817 #include <sys/types.h>
11818 #include <signal.h>
11819 #include <stdio.h> 
11820 #$i_stdlib I_STDLIB
11821 #ifdef I_STDLIB
11822 #include <stdlib.h>
11823 #endif
11824 #$i_fcntl I_FCNTL
11825 #ifdef I_FCNTL
11826 #include <fcntl.h>
11827 #endif
11828 #define MY_O_NONBLOCK $o_nonblock
11829 #ifndef errno  /* XXX need better Configure test */
11830 extern int errno;
11831 #endif
11832 #$i_unistd I_UNISTD
11833 #ifdef I_UNISTD
11834 #include <unistd.h>
11835 #endif
11836 #$i_string I_STRING
11837 #ifdef I_STRING
11838 #include <string.h>
11839 #else
11840 #include <strings.h>
11841 #endif
11842 $signal_t blech(x) int x; { exit(3); }
11843 EOCP
11844         $cat >> try.c <<'EOCP'
11845 int main()
11846 {
11847         int pd[2];
11848         int pu[2];
11849         char buf[1];
11850         char string[100];
11851
11852         pipe(pd);       /* Down: child -> parent */
11853         pipe(pu);       /* Up: parent -> child */
11854         if (0 != fork()) {
11855                 int ret;
11856                 close(pd[1]);   /* Parent reads from pd[0] */
11857                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11858 #ifdef F_SETFL
11859                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11860                         exit(1);
11861 #else
11862                 exit(4);
11863 #endif
11864                 signal(SIGALRM, blech);
11865                 alarm(5);
11866                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11867                         exit(2);
11868                 sprintf(string, "%d\n", ret);
11869                 write(2, string, strlen(string));
11870                 alarm(0);
11871 #ifdef EAGAIN
11872                 if (errno == EAGAIN) {
11873                         printf("EAGAIN\n");
11874                         goto ok;
11875                 }
11876 #endif
11877 #ifdef EWOULDBLOCK
11878                 if (errno == EWOULDBLOCK)
11879                         printf("EWOULDBLOCK\n");
11880 #endif
11881         ok:
11882                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11883                 sleep(2);                               /* Give it time to close our pipe */
11884                 alarm(5);
11885                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11886                 alarm(0);
11887                 sprintf(string, "%d\n", ret);
11888                 write(4, string, strlen(string));
11889                 exit(0);
11890         }
11891
11892         close(pd[0]);                   /* We write to pd[1] */
11893         close(pu[1]);                   /* We read from pu[0] */
11894         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11895         close(pd[1]);                   /* Pipe pd is now fully closed! */
11896         exit(0);                                /* Bye bye, thank you for playing! */
11897 }
11898 EOCP
11899         set try
11900         if eval $compile_ok; then
11901                 echo "$startsh" >mtry
11902                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11903                 chmod +x mtry
11904                 ./mtry >/dev/null 2>&1
11905                 case $? in
11906                 0) eagain=`$cat try.out`;;
11907                 1) echo "Could not perform non-blocking setting!";;
11908                 2) echo "I did a successful read() for something that was not there!";;
11909                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11910                 4) echo "Could not find F_SETFL!";;
11911                 *) echo "Something terribly wrong happened during testing.";;
11912                 esac
11913                 rd_nodata=`$cat try.ret`
11914                 echo "A read() system call with no data present returns $rd_nodata."
11915                 case "$rd_nodata" in
11916                 0|-1) ;;
11917                 *)
11918                         echo "(That's peculiar, fixing that to be -1.)"
11919                         rd_nodata=-1
11920                         ;;
11921                 esac
11922                 case "$eagain" in
11923                 '')
11924                         echo "Forcing errno EAGAIN on read() with no data available."
11925                         eagain=EAGAIN
11926                         ;;
11927                 *)
11928                         echo "Your read() sets errno to $eagain when no data is available."
11929                         ;;
11930                 esac
11931                 status=`$cat try.err`
11932                 case "$status" in
11933                 0) echo "And it correctly returns 0 to signal EOF.";;
11934                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11935                 *) echo "However, your read() returns '$status' on EOF??";;
11936                 esac
11937                 val="$define"
11938                 if test "$status" = "$rd_nodata"; then
11939                         echo "WARNING: you can't distinguish between EOF and no data!"
11940                         val="$undef"
11941                 fi
11942         else
11943                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11944                 eagain=EAGAIN
11945         fi
11946         set d_eofnblk
11947         eval $setvar
11948         ;;
11949 *)
11950         echo "Using $hint value $eagain."
11951         echo "Your read() returns $rd_nodata when no data is present."
11952         case "$d_eofnblk" in
11953         "$define") echo "And you can see EOF because read() returns 0.";;
11954         "$undef") echo "But you can't see EOF status from read() returned value.";;
11955         *)
11956                 echo "(Assuming you can't see EOF status from read anyway.)"
11957                 d_eofnblk=$undef
11958                 ;;
11959         esac
11960         ;;
11961 esac
11962 $rm -f try try.* .out core head.c mtry
11963
11964 : see if _ptr and _cnt from stdio act std
11965 echo " "
11966
11967 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11968         echo "(Looks like you have stdio.h from BSD.)"
11969         case "$stdio_ptr" in
11970         '') stdio_ptr='((fp)->_p)'
11971                 ptr_lval=$define
11972                 ;;
11973         *)      ptr_lval=$d_stdio_ptr_lval;;
11974         esac
11975         case "$stdio_cnt" in
11976         '') stdio_cnt='((fp)->_r)'
11977                 cnt_lval=$define
11978                 ;;
11979         *)      cnt_lval=$d_stdio_cnt_lval;;
11980         esac
11981         case "$stdio_base" in
11982         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11983         esac
11984         case "$stdio_bufsiz" in
11985         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11986         esac
11987 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11988         echo "(Looks like you have stdio.h from Linux.)"
11989         case "$stdio_ptr" in
11990         '') stdio_ptr='((fp)->_IO_read_ptr)'
11991                 ptr_lval=$define
11992                 ;;
11993         *)      ptr_lval=$d_stdio_ptr_lval;;
11994         esac
11995         case "$stdio_cnt" in
11996         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11997                 cnt_lval=$undef
11998                 ;;
11999         *)      cnt_lval=$d_stdio_cnt_lval;;
12000         esac
12001         case "$stdio_base" in
12002         '') stdio_base='((fp)->_IO_read_base)';;
12003         esac
12004         case "$stdio_bufsiz" in
12005         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12006         esac
12007 else
12008         case "$stdio_ptr" in
12009         '') stdio_ptr='((fp)->_ptr)'
12010                 ptr_lval=$define
12011                 ;;
12012         *)      ptr_lval=$d_stdio_ptr_lval;;
12013         esac
12014         case "$stdio_cnt" in
12015         '') stdio_cnt='((fp)->_cnt)'
12016                 cnt_lval=$define
12017                 ;;
12018         *)      cnt_lval=$d_stdio_cnt_lval;;
12019         esac
12020         case "$stdio_base" in
12021         '') stdio_base='((fp)->_base)';;
12022         esac
12023         case "$stdio_bufsiz" in
12024         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12025         esac
12026 fi
12027
12028 : test whether _ptr and _cnt really work
12029 echo "Checking how std your stdio is..." >&4
12030 $cat >try.c <<EOP
12031 #include <stdio.h>
12032 #$i_stdlib I_STDLIB
12033 #ifdef I_STDLIB
12034 #include <stdlib.h>
12035 #endif
12036 #define FILE_ptr(fp)    $stdio_ptr
12037 #define FILE_cnt(fp)    $stdio_cnt
12038 int main() {
12039         FILE *fp = fopen("try.c", "r");
12040         char c = getc(fp);
12041         if (
12042                 18 <= FILE_cnt(fp) &&
12043                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12044         )
12045                 exit(0);
12046         exit(1);
12047 }
12048 EOP
12049 val="$undef"
12050 set try
12051 if eval $compile && $to try.c; then
12052         if $run ./try; then
12053                 echo "Your stdio acts pretty std."
12054                 val="$define"
12055         else
12056                 echo "Your stdio isn't very std."
12057         fi
12058 else
12059         echo "Your stdio doesn't appear very std."
12060 fi
12061 $rm -f try.c try
12062
12063 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12064 # direct buffer manipulation no longer works.  The Configure tests
12065 # should be changed to correctly detect this, but until then,
12066 # the following check should at least let perl compile and run.
12067 # (This quick fix should be updated before 5.8.1.)
12068 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12069 # A. Dougherty, June 3, 2002.
12070 case "$d_gnulibc" in
12071 $define)
12072         case "$gnulibc_version" in
12073         2.[01]*)  ;;
12074         2.2) ;;
12075         2.2.[0-9]) ;;
12076         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12077                 val="$undef"
12078                 ;;
12079         esac
12080         ;;
12081 esac
12082 set d_stdstdio
12083 eval $setvar
12084
12085 : Can _ptr be used as an lvalue?
12086 case "$d_stdstdio$ptr_lval" in
12087 $define$define) val=$define ;;
12088 *) val=$undef ;;
12089 esac
12090 set d_stdio_ptr_lval
12091 eval $setvar
12092
12093 : Can _cnt be used as an lvalue?
12094 case "$d_stdstdio$cnt_lval" in
12095 $define$define) val=$define ;;
12096 *) val=$undef ;;
12097 esac
12098 set d_stdio_cnt_lval
12099 eval $setvar
12100
12101
12102 : test whether setting _ptr sets _cnt as a side effect
12103 d_stdio_ptr_lval_sets_cnt="$undef"
12104 d_stdio_ptr_lval_nochange_cnt="$undef"
12105 case "$d_stdio_ptr_lval$d_stdstdio" in
12106 $define$define)
12107         echo "Checking to see what happens if we set the stdio ptr..." >&4
12108 $cat >try.c <<EOP
12109 #include <stdio.h>
12110 /* Can we scream? */
12111 /* Eat dust sed :-) */
12112 /* In the buffer space, no one can hear you scream. */
12113 #$i_stdlib I_STDLIB
12114 #ifdef I_STDLIB
12115 #include <stdlib.h>
12116 #endif
12117 #define FILE_ptr(fp)    $stdio_ptr
12118 #define FILE_cnt(fp)    $stdio_cnt
12119 #include <sys/types.h>
12120 int main() {
12121         FILE *fp = fopen("try.c", "r");
12122         int c;
12123         char *ptr;
12124         size_t cnt;
12125         if (!fp) {
12126             puts("Fail even to read");
12127             exit(1);
12128         }
12129         c = getc(fp); /* Read away the first # */
12130         if (c == EOF) {
12131             puts("Fail even to read");
12132             exit(1);
12133         }
12134         if (!(
12135                 18 <= FILE_cnt(fp) &&
12136                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12137         )) {
12138                 puts("Fail even to read");
12139                 exit (1);
12140         }
12141         ptr = (char*) FILE_ptr(fp);
12142         cnt = (size_t)FILE_cnt(fp);
12143
12144         FILE_ptr(fp) += 42;
12145
12146         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12147                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12148                 exit (1);
12149         }
12150         if (FILE_cnt(fp) <= 20) {
12151                 printf ("Fail (<20 chars to test)");
12152                 exit (1);
12153         }
12154         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12155                 puts("Fail compare");
12156                 exit (1);
12157         }
12158         if (cnt == FILE_cnt(fp)) {
12159                 puts("Pass_unchanged");
12160                 exit (0);
12161         }       
12162         if (FILE_cnt(fp) == (cnt - 42)) {
12163                 puts("Pass_changed");
12164                 exit (0);
12165         }
12166         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12167         return 1;
12168
12169 }
12170 EOP
12171         set try
12172         if eval $compile && $to try.c; then
12173                 case `$run ./try` in
12174                 Pass_changed)
12175                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12176                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12177                 Pass_unchanged)
12178                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12179                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12180                 Fail*)
12181                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12182                 *)
12183                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12184         esac
12185         else
12186                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12187         fi
12188         $rm -f try.c try
12189         ;;
12190 esac
12191
12192 : see if _base is also standard
12193 val="$undef"
12194 case "$d_stdstdio" in
12195 $define)
12196         $cat >try.c <<EOP
12197 #include <stdio.h>
12198 #$i_stdlib I_STDLIB
12199 #ifdef I_STDLIB
12200 #include <stdlib.h>
12201 #endif
12202 #define FILE_base(fp)   $stdio_base
12203 #define FILE_bufsiz(fp) $stdio_bufsiz
12204 int main() {
12205         FILE *fp = fopen("try.c", "r");
12206         char c = getc(fp);
12207         if (
12208                 19 <= FILE_bufsiz(fp) &&
12209                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12210         )
12211                 exit(0);
12212         exit(1);
12213 }
12214 EOP
12215         set try
12216         if eval $compile && $to try.c; then
12217                 if $run ./try; then
12218                         echo "And its _base field acts std."
12219                         val="$define"
12220                 else
12221                         echo "But its _base field isn't std."
12222                 fi
12223         else
12224                 echo "However, it seems to be lacking the _base field."
12225         fi
12226         $rm -f try.c try
12227         ;;
12228 esac
12229 set d_stdiobase
12230 eval $setvar
12231
12232 : see if fast_stdio exists
12233 val="$undef"
12234 case "$d_stdstdio:$d_stdio_ptr_lval" in
12235 "$define:$define")
12236         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12237         *$define*)
12238                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12239                 val="$define"
12240                 ;;
12241         esac
12242         ;;
12243 esac
12244 set d_faststdio
12245 eval $setvar
12246
12247
12248
12249 : see if fchdir exists
12250 set fchdir d_fchdir
12251 eval $inlibc
12252
12253 : see if fchmod exists
12254 set fchmod d_fchmod
12255 eval $inlibc
12256
12257 : see if fchown exists
12258 set fchown d_fchown
12259 eval $inlibc
12260
12261 : see if this is an fcntl system
12262 set fcntl d_fcntl
12263 eval $inlibc
12264
12265 echo " "
12266 : See if fcntl-based locking works.
12267 $cat >try.c <<EOCP
12268 #$i_stdlib I_STDLIB
12269 #ifdef I_STDLIB
12270 #include <stdlib.h>
12271 #endif
12272 #include <unistd.h>
12273 #include <fcntl.h>
12274 #include <signal.h>
12275 $signal_t blech(x) int x; { exit(3); }
12276 int main() {
12277 #if defined(F_SETLK) && defined(F_SETLKW)
12278      struct flock flock;
12279      int retval, fd;
12280      fd = open("try.c", O_RDONLY);
12281      flock.l_type = F_RDLCK;
12282      flock.l_whence = SEEK_SET;
12283      flock.l_start = flock.l_len = 0;
12284      signal(SIGALRM, blech);
12285      alarm(10);
12286      retval = fcntl(fd, F_SETLK, &flock);
12287      close(fd);
12288      (retval < 0 ? exit(2) : exit(0));
12289 #else
12290      exit(2);
12291 #endif
12292 }
12293 EOCP
12294 echo "Checking if fcntl-based file locking works... "
12295 case "$d_fcntl" in
12296 "$define")
12297         set try
12298         if eval $compile_ok; then
12299                 if $run ./try; then
12300                         echo "Yes, it seems to work."
12301                         val="$define"
12302                 else
12303                         echo "Nope, it didn't work."
12304                         val="$undef"
12305                         case "$?" in
12306                         3) $cat >&4 <<EOM
12307 ***
12308 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12309 *** This is (almost) impossible.
12310 *** If your NFS lock daemons are not feeling well, something like
12311 *** this may happen, please investigate.  Cannot continue, aborting.
12312 ***
12313 EOM
12314                                 exit 1
12315                                 ;;
12316                         esac
12317                 fi
12318         else
12319                 echo "I'm unable to compile the test program, so I'll assume not."
12320                 val="$undef"
12321         fi
12322         ;;
12323 *) val="$undef";
12324         echo "Nope, since you don't even have fcntl()."
12325         ;;
12326 esac
12327 set d_fcntl_can_lock
12328 eval $setvar
12329 $rm -f try*
12330
12331
12332 : check for fd_set items
12333 $cat <<EOM
12334
12335 Checking to see how well your C compiler handles fd_set and friends ...
12336 EOM
12337 $cat >try.c <<EOCP
12338 #$i_stdlib I_STDLIB
12339 #ifdef I_STDLIB
12340 #include <stdlib.h>
12341 #endif
12342 #$i_systime I_SYS_TIME
12343 #$i_sysselct I_SYS_SELECT
12344 #$d_socket HAS_SOCKET
12345 #include <sys/types.h>
12346 #ifdef HAS_SOCKET
12347 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12348 #endif
12349 #ifdef I_SYS_TIME
12350 #include <sys/time.h>
12351 #endif
12352 #ifdef I_SYS_SELECT
12353 #include <sys/select.h>
12354 #endif
12355 int main() {
12356         fd_set fds;
12357
12358 #ifdef TRYBITS
12359         if(fds.fds_bits);
12360 #endif
12361
12362 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12363         exit(0);
12364 #else
12365         exit(1);
12366 #endif
12367 }
12368 EOCP
12369 set try -DTRYBITS
12370 if eval $compile; then
12371         d_fds_bits="$define"
12372         d_fd_set="$define"
12373         echo "Well, your system knows about the normal fd_set typedef..." >&4
12374         if $run ./try; then
12375                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12376                 d_fd_macros="$define"
12377         else
12378                 $cat >&4 <<'EOM'
12379 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12380 EOM
12381                 d_fd_macros="$undef"
12382         fi
12383 else
12384         $cat <<'EOM'
12385 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12386 EOM
12387         set try
12388         if eval $compile; then
12389                 d_fds_bits="$undef"
12390                 d_fd_set="$define"
12391                 echo "Well, your system has some sort of fd_set available..." >&4
12392                 if $run ./try; then
12393                         echo "and you have the normal fd_set macros." >&4
12394                         d_fd_macros="$define"
12395                 else
12396                         $cat <<'EOM'
12397 but not the normal fd_set macros!  Gross!  More work for me...
12398 EOM
12399                         d_fd_macros="$undef"
12400                 fi
12401         else
12402         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12403                 d_fd_set="$undef"
12404                 d_fds_bits="$undef"
12405                 d_fd_macros="$undef"
12406         fi
12407 fi
12408 $rm -f try try.*
12409
12410 : see if fgetpos exists
12411 set fgetpos d_fgetpos
12412 eval $inlibc
12413
12414 : see if finite exists
12415 set finite d_finite
12416 eval $inlibc
12417
12418 : see if finitel exists
12419 set finitel d_finitel
12420 eval $inlibc
12421
12422 : see if flock exists
12423 set flock d_flock
12424 eval $inlibc
12425
12426 : see if prototype for flock is available
12427 echo " "
12428 set d_flockproto flock $i_sysfile sys/file.h
12429 eval $hasproto
12430
12431 : see if fork exists
12432 set fork d_fork
12433 eval $inlibc
12434
12435 : see if fp_class exists
12436 set fp_class d_fp_class
12437 eval $inlibc
12438
12439 : see if pathconf exists
12440 set pathconf d_pathconf
12441 eval $inlibc
12442
12443 : see if fpathconf exists
12444 set fpathconf d_fpathconf
12445 eval $inlibc
12446
12447 : see if fpclass exists
12448 set fpclass d_fpclass
12449 eval $inlibc
12450
12451 : see if fpclassify exists
12452 set fpclassify d_fpclassify
12453 eval $inlibc
12454
12455 : see if fpclassl exists
12456 set fpclassl d_fpclassl
12457 eval $inlibc
12458
12459
12460 : check for fpos64_t
12461 echo " "
12462 echo "Checking to see if you have fpos64_t..." >&4
12463 $cat >try.c <<EOCP
12464 #include <stdio.h>
12465 int main() { fpos64_t x = 7; }
12466 EOCP
12467 set try
12468 if eval $compile; then
12469         val="$define"
12470         echo "You have fpos64_t."
12471 else
12472         val="$undef"
12473         echo "You do not have fpos64_t."
12474         case "$fpossize" in
12475         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12476         esac
12477 fi
12478 $rm -f try.* try
12479 set d_fpos64_t
12480 eval $setvar
12481
12482 : see if frexpl exists
12483 set frexpl d_frexpl
12484 eval $inlibc
12485
12486 : see if this is a sys/param system
12487 set sys/param.h i_sysparam
12488 eval $inhdr
12489
12490 : see if this is a sys/mount.h system
12491 set sys/mount.h i_sysmount
12492 eval $inhdr
12493
12494
12495 echo " "
12496 echo "Checking to see if your system supports struct fs_data..." >&4
12497 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12498 eval $hasstruct
12499 case "$d_fs_data_s" in
12500 "$define")      echo "Yes, it does."   ;;
12501 *)              echo "No, it doesn't." ;;
12502 esac
12503
12504 : see if fseeko exists
12505 set fseeko d_fseeko
12506 eval $inlibc
12507 case "$longsize" in
12508 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12509 esac
12510
12511 : see if fsetpos exists
12512 set fsetpos d_fsetpos
12513 eval $inlibc
12514
12515
12516 : see if fstatfs exists
12517 set fstatfs d_fstatfs
12518 eval $inlibc
12519
12520
12521 : see if statvfs exists
12522 set statvfs d_statvfs
12523 eval $inlibc
12524
12525 : see if fstatvfs exists
12526 set fstatvfs d_fstatvfs
12527 eval $inlibc
12528
12529
12530 : see if fsync exists
12531 set fsync d_fsync
12532 eval $inlibc
12533
12534 : see if ftello exists
12535 set ftello d_ftello
12536 eval $inlibc
12537 case "$longsize" in
12538 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12539 esac
12540
12541 : see if getcwd exists
12542 set getcwd d_getcwd
12543 eval $inlibc
12544
12545 : see if getespwnam exists
12546 set getespwnam d_getespwnam
12547 eval $inlibc
12548
12549
12550 : see if getfsstat exists
12551 set getfsstat d_getfsstat
12552 eval $inlibc
12553
12554 : see if getgrent exists
12555 set getgrent d_getgrent
12556 eval $inlibc
12557
12558 : see if getgrent_r exists
12559 set getgrent_r d_getgrent_r
12560 eval $inlibc
12561 case "$d_getgrent_r" in
12562 "$define")
12563         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12564         case "$d_getgrent_r_proto:$usethreads" in
12565         ":define")      d_getgrent_r_proto=define
12566                 set d_getgrent_r_proto getgrent_r $hdrs
12567                 eval $hasproto ;;
12568         *)      ;;
12569         esac
12570         case "$d_getgrent_r_proto" in
12571         define)
12572         case "$getgrent_r_proto" in
12573         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12574         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12575         esac
12576         case "$getgrent_r_proto" in
12577         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12578         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12579         esac
12580         case "$getgrent_r_proto" in
12581         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12582         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12583         esac
12584         case "$getgrent_r_proto" in
12585         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12586         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12587         esac
12588         case "$getgrent_r_proto" in
12589         ''|0) try='int getgrent_r(struct group*, char*, int);'
12590         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12591         esac
12592         case "$getgrent_r_proto" in
12593         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12594         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12595         esac
12596         case "$getgrent_r_proto" in
12597         ''|0)   d_getgrent_r=undef
12598                 getgrent_r_proto=0
12599                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12600         * )     case "$getgrent_r_proto" in
12601                 REENTRANT_PROTO*) ;;
12602                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12603                 esac
12604                 echo "Prototype: $try" ;;
12605         esac
12606         ;;
12607         *)      case "$usethreads" in
12608                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12609                 esac
12610                 d_getgrent_r=undef
12611                 getgrent_r_proto=0
12612                 ;;
12613         esac
12614         ;;
12615 *)      getgrent_r_proto=0
12616         ;;
12617 esac
12618
12619 : see if getgrgid_r exists
12620 set getgrgid_r d_getgrgid_r
12621 eval $inlibc
12622 case "$d_getgrgid_r" in
12623 "$define")
12624         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12625         case "$d_getgrgid_r_proto:$usethreads" in
12626         ":define")      d_getgrgid_r_proto=define
12627                 set d_getgrgid_r_proto getgrgid_r $hdrs
12628                 eval $hasproto ;;
12629         *)      ;;
12630         esac
12631         case "$d_getgrgid_r_proto" in
12632         define)
12633         case "$getgrgid_r_proto" in
12634         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12635         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12636         esac
12637         case "$getgrgid_r_proto" in
12638         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12639         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12640         esac
12641         case "$getgrgid_r_proto" in
12642         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12643         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12644         esac
12645         case "$getgrgid_r_proto" in
12646         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12647         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12648         esac
12649         case "$getgrgid_r_proto" in
12650         ''|0)   d_getgrgid_r=undef
12651                 getgrgid_r_proto=0
12652                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12653         * )     case "$getgrgid_r_proto" in
12654                 REENTRANT_PROTO*) ;;
12655                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12656                 esac
12657                 echo "Prototype: $try" ;;
12658         esac
12659         ;;
12660         *)      case "$usethreads" in
12661                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12662                 esac
12663                 d_getgrgid_r=undef
12664                 getgrgid_r_proto=0
12665                 ;;
12666         esac
12667         ;;
12668 *)      getgrgid_r_proto=0
12669         ;;
12670 esac
12671
12672 : see if getgrnam_r exists
12673 set getgrnam_r d_getgrnam_r
12674 eval $inlibc
12675 case "$d_getgrnam_r" in
12676 "$define")
12677         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12678         case "$d_getgrnam_r_proto:$usethreads" in
12679         ":define")      d_getgrnam_r_proto=define
12680                 set d_getgrnam_r_proto getgrnam_r $hdrs
12681                 eval $hasproto ;;
12682         *)      ;;
12683         esac
12684         case "$d_getgrnam_r_proto" in
12685         define)
12686         case "$getgrnam_r_proto" in
12687         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12688         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12689         esac
12690         case "$getgrnam_r_proto" in
12691         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12692         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12693         esac
12694         case "$getgrnam_r_proto" in
12695         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12696         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12697         esac
12698         case "$getgrnam_r_proto" in
12699         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12700         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12701         esac
12702         case "$getgrnam_r_proto" in
12703         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12704         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12705         esac
12706         case "$getgrnam_r_proto" in
12707         ''|0)   d_getgrnam_r=undef
12708                 getgrnam_r_proto=0
12709                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12710         * )     case "$getgrnam_r_proto" in
12711                 REENTRANT_PROTO*) ;;
12712                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12713                 esac
12714                 echo "Prototype: $try" ;;
12715         esac
12716         ;;
12717         *)      case "$usethreads" in
12718                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12719                 esac
12720                 d_getgrnam_r=undef
12721                 getgrnam_r_proto=0
12722                 ;;
12723         esac
12724         ;;
12725 *)      getgrnam_r_proto=0
12726         ;;
12727 esac
12728
12729 : see if gethostbyaddr exists
12730 set gethostbyaddr d_gethbyaddr
12731 eval $inlibc
12732
12733 : see if gethostbyname exists
12734 set gethostbyname d_gethbyname
12735 eval $inlibc
12736
12737 : see if gethostent exists
12738 set gethostent d_gethent
12739 eval $inlibc
12740
12741 : see how we will look up host name
12742 echo " "
12743 call=''
12744 if set gethostname val -f d_gethname; eval $csym; $val; then
12745         echo 'gethostname() found.' >&4
12746         d_gethname="$define"
12747         call=gethostname
12748 fi
12749 if set uname val -f d_uname; eval $csym; $val; then
12750         if ./xenix; then
12751                 $cat <<'EOM'
12752 uname() was found, but you're running xenix, and older versions of xenix
12753 have a broken uname(). If you don't really know whether your xenix is old
12754 enough to have a broken system call, use the default answer.
12755
12756 EOM
12757                 dflt=y
12758                 case "$d_uname" in
12759                 "$define") dflt=n;;
12760                 esac
12761                 rp='Is your uname() broken?'
12762                 . ./myread
12763                 case "$ans" in
12764                 n*) d_uname="$define"; call=uname;;
12765                 esac
12766         else
12767                 echo 'uname() found.' >&4
12768                 d_uname="$define"
12769                 case "$call" in
12770                 '') call=uname ;;
12771                 esac
12772         fi
12773 fi
12774 case "$d_gethname" in
12775 '') d_gethname="$undef";;
12776 esac
12777 case "$d_uname" in
12778 '') d_uname="$undef";;
12779 esac
12780 case "$d_uname$d_gethname" in
12781 *define*)
12782         dflt=n
12783         cat <<EOM
12784  
12785 Every now and then someone has a $call() that lies about the hostname
12786 but can't be fixed for political or economic reasons.  If you wish, I can
12787 pretend $call() isn't there and maybe compute hostname at run-time
12788 thanks to the '$phostname' command.
12789
12790 EOM
12791         rp="Shall I ignore $call() from now on?"
12792         . ./myread
12793         case "$ans" in
12794         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12795         esac;;
12796 esac
12797 case "$phostname" in
12798 '') aphostname='';;
12799 *) case "$aphostname" in
12800         /*) ;;
12801         *) set X $phostname
12802                 shift
12803                 file=$1
12804                 shift
12805                 file=`./loc $file $file $pth`
12806                 aphostname=`echo $file $*`
12807                 ;;
12808         esac
12809         ;;
12810 esac
12811 case "$d_uname$d_gethname" in
12812 *define*) ;;
12813 *)
12814         case "$phostname" in
12815         '')
12816                 echo "There will be no way for $package to get your hostname." >&4;;
12817         *)
12818         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12819                 ;;
12820         esac;;
12821 esac
12822 case "$d_phostname" in
12823 '') d_phostname="$undef";;
12824 esac
12825
12826 : see if gethostbyaddr_r exists
12827 set gethostbyaddr_r d_gethostbyaddr_r
12828 eval $inlibc
12829 case "$d_gethostbyaddr_r" in
12830 "$define")
12831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12832         case "$d_gethostbyaddr_r_proto:$usethreads" in
12833         ":define")      d_gethostbyaddr_r_proto=define
12834                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12835                 eval $hasproto ;;
12836         *)      ;;
12837         esac
12838         case "$d_gethostbyaddr_r_proto" in
12839         define)
12840         case "$gethostbyaddr_r_proto" in
12841         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12842         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12843         esac
12844         case "$gethostbyaddr_r_proto" in
12845         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12846         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12847         esac
12848         case "$gethostbyaddr_r_proto" in
12849         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12850         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12851         esac
12852         case "$gethostbyaddr_r_proto" in
12853         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12854         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12855         esac
12856         case "$gethostbyaddr_r_proto" in
12857         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12858         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12859         esac
12860         case "$gethostbyaddr_r_proto" in
12861         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12862         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12863         esac
12864         case "$gethostbyaddr_r_proto" in
12865         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12866         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12867         esac
12868         case "$gethostbyaddr_r_proto" in
12869         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12870         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12871         esac
12872         case "$gethostbyaddr_r_proto" in
12873         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12874         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12875         esac
12876         case "$gethostbyaddr_r_proto" in
12877         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12878         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12879         esac
12880         case "$gethostbyaddr_r_proto" in
12881         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12882         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12883         esac
12884         case "$gethostbyaddr_r_proto" in
12885         ''|0)   d_gethostbyaddr_r=undef
12886                 gethostbyaddr_r_proto=0
12887                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12888         * )     case "$gethostbyaddr_r_proto" in
12889                 REENTRANT_PROTO*) ;;
12890                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12891                 esac
12892                 echo "Prototype: $try" ;;
12893         esac
12894         ;;
12895         *)      case "$usethreads" in
12896                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12897                 esac
12898                 d_gethostbyaddr_r=undef
12899                 gethostbyaddr_r_proto=0
12900                 ;;
12901         esac
12902         ;;
12903 *)      gethostbyaddr_r_proto=0
12904         ;;
12905 esac
12906
12907 : see if gethostbyname_r exists
12908 set gethostbyname_r d_gethostbyname_r
12909 eval $inlibc
12910 case "$d_gethostbyname_r" in
12911 "$define")
12912         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12913         case "$d_gethostbyname_r_proto:$usethreads" in
12914         ":define")      d_gethostbyname_r_proto=define
12915                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12916                 eval $hasproto ;;
12917         *)      ;;
12918         esac
12919         case "$d_gethostbyname_r_proto" in
12920         define)
12921         case "$gethostbyname_r_proto" in
12922         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12923         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12924         esac
12925         case "$gethostbyname_r_proto" in
12926         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12927         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12928         esac
12929         case "$gethostbyname_r_proto" in
12930         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12931         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12932         esac
12933         case "$gethostbyname_r_proto" in
12934         ''|0)   d_gethostbyname_r=undef
12935                 gethostbyname_r_proto=0
12936                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12937         * )     case "$gethostbyname_r_proto" in
12938                 REENTRANT_PROTO*) ;;
12939                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12940                 esac
12941                 echo "Prototype: $try" ;;
12942         esac
12943         ;;
12944         *)      case "$usethreads" in
12945                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12946                 esac
12947                 d_gethostbyname_r=undef
12948                 gethostbyname_r_proto=0
12949                 ;;
12950         esac
12951         ;;
12952 *)      gethostbyname_r_proto=0
12953         ;;
12954 esac
12955
12956 : see if gethostent_r exists
12957 set gethostent_r d_gethostent_r
12958 eval $inlibc
12959 case "$d_gethostent_r" in
12960 "$define")
12961         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12962         case "$d_gethostent_r_proto:$usethreads" in
12963         ":define")      d_gethostent_r_proto=define
12964                 set d_gethostent_r_proto gethostent_r $hdrs
12965                 eval $hasproto ;;
12966         *)      ;;
12967         esac
12968         case "$d_gethostent_r_proto" in
12969         define)
12970         case "$gethostent_r_proto" in
12971         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12972         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12973         esac
12974         case "$gethostent_r_proto" in
12975         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12976         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12977         esac
12978         case "$gethostent_r_proto" in
12979         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12980         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12981         esac
12982         case "$gethostent_r_proto" in
12983         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12984         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12985         esac
12986         case "$gethostent_r_proto" in
12987         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12988         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12989         esac
12990         case "$gethostent_r_proto" in
12991         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12992         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12993         esac
12994         case "$gethostent_r_proto" in
12995         ''|0)   d_gethostent_r=undef
12996                 gethostent_r_proto=0
12997                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12998         * )     case "$gethostent_r_proto" in
12999                 REENTRANT_PROTO*) ;;
13000                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13001                 esac
13002                 echo "Prototype: $try" ;;
13003         esac
13004         ;;
13005         *)      case "$usethreads" in
13006                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13007                 esac
13008                 d_gethostent_r=undef
13009                 gethostent_r_proto=0
13010                 ;;
13011         esac
13012         ;;
13013 *)      gethostent_r_proto=0
13014         ;;
13015 esac
13016
13017 : see if prototypes for various gethostxxx netdb.h functions are available
13018 echo " "
13019 set d_gethostprotos gethostent $i_netdb netdb.h
13020 eval $hasproto
13021
13022 : see if getitimer exists
13023 set getitimer d_getitimer
13024 eval $inlibc
13025
13026 : see if getlogin exists
13027 set getlogin d_getlogin
13028 eval $inlibc
13029
13030 : see if getlogin_r exists
13031 set getlogin_r d_getlogin_r
13032 eval $inlibc
13033 case "$d_getlogin_r" in
13034 "$define")
13035         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13036         case "$d_getlogin_r_proto:$usethreads" in
13037         ":define")      d_getlogin_r_proto=define
13038                 set d_getlogin_r_proto getlogin_r $hdrs
13039                 eval $hasproto ;;
13040         *)      ;;
13041         esac
13042         case "$d_getlogin_r_proto" in
13043         define)
13044         case "$getlogin_r_proto" in
13045         ''|0) try='int getlogin_r(char*, size_t);'
13046         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13047         esac
13048         case "$getlogin_r_proto" in
13049         ''|0) try='int getlogin_r(char*, int);'
13050         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13051         esac
13052         case "$getlogin_r_proto" in
13053         ''|0) try='char* getlogin_r(char*, size_t);'
13054         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13055         esac
13056         case "$getlogin_r_proto" in
13057         ''|0) try='char* getlogin_r(char*, int);'
13058         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13059         esac
13060         case "$getlogin_r_proto" in
13061         ''|0)   d_getlogin_r=undef
13062                 getlogin_r_proto=0
13063                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13064         * )     case "$getlogin_r_proto" in
13065                 REENTRANT_PROTO*) ;;
13066                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13067                 esac
13068                 echo "Prototype: $try" ;;
13069         esac
13070         ;;
13071         *)      case "$usethreads" in
13072                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13073                 esac
13074                 d_getlogin_r=undef
13075                 getlogin_r_proto=0
13076                 ;;
13077         esac
13078         ;;
13079 *)      getlogin_r_proto=0
13080         ;;
13081 esac
13082
13083 : see if getmnt exists
13084 set getmnt d_getmnt
13085 eval $inlibc
13086
13087 : see if getmntent exists
13088 set getmntent d_getmntent
13089 eval $inlibc
13090
13091 : see if getnetbyaddr exists
13092 set getnetbyaddr d_getnbyaddr
13093 eval $inlibc
13094
13095 : see if getnetbyname exists
13096 set getnetbyname d_getnbyname
13097 eval $inlibc
13098
13099 : see if getnetent exists
13100 set getnetent d_getnent
13101 eval $inlibc
13102
13103 : see if getnetbyaddr_r exists
13104 set getnetbyaddr_r d_getnetbyaddr_r
13105 eval $inlibc
13106 case "$d_getnetbyaddr_r" in
13107 "$define")
13108         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13109         case "$d_getnetbyaddr_r_proto:$usethreads" in
13110         ":define")      d_getnetbyaddr_r_proto=define
13111                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13112                 eval $hasproto ;;
13113         *)      ;;
13114         esac
13115         case "$d_getnetbyaddr_r_proto" in
13116         define)
13117         case "$getnetbyaddr_r_proto" in
13118         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13119         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13120         esac
13121         case "$getnetbyaddr_r_proto" in
13122         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13123         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13124         esac
13125         case "$getnetbyaddr_r_proto" in
13126         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13127         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13128         esac
13129         case "$getnetbyaddr_r_proto" in
13130         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13131         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13132         esac
13133         case "$getnetbyaddr_r_proto" in
13134         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13135         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13136         esac
13137         case "$getnetbyaddr_r_proto" in
13138         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13139         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13140         esac
13141         case "$getnetbyaddr_r_proto" in
13142         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13143         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13144         esac
13145         case "$getnetbyaddr_r_proto" in
13146         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13147         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13148         esac
13149         case "$getnetbyaddr_r_proto" in
13150         ''|0)   d_getnetbyaddr_r=undef
13151                 getnetbyaddr_r_proto=0
13152                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13153         * )     case "$getnetbyaddr_r_proto" in
13154                 REENTRANT_PROTO*) ;;
13155                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13156                 esac
13157                 echo "Prototype: $try" ;;
13158         esac
13159         ;;
13160         *)      case "$usethreads" in
13161                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13162                 esac
13163                 d_getnetbyaddr_r=undef
13164                 getnetbyaddr_r_proto=0
13165                 ;;
13166         esac
13167         ;;
13168 *)      getnetbyaddr_r_proto=0
13169         ;;
13170 esac
13171
13172 : see if getnetbyname_r exists
13173 set getnetbyname_r d_getnetbyname_r
13174 eval $inlibc
13175 case "$d_getnetbyname_r" in
13176 "$define")
13177         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13178         case "$d_getnetbyname_r_proto:$usethreads" in
13179         ":define")      d_getnetbyname_r_proto=define
13180                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13181                 eval $hasproto ;;
13182         *)      ;;
13183         esac
13184         case "$d_getnetbyname_r_proto" in
13185         define)
13186         case "$getnetbyname_r_proto" in
13187         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13188         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13189         esac
13190         case "$getnetbyname_r_proto" in
13191         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13192         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13193         esac
13194         case "$getnetbyname_r_proto" in
13195         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13196         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13197         esac
13198         case "$getnetbyname_r_proto" in
13199         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13200         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13201         esac
13202         case "$getnetbyname_r_proto" in
13203         ''|0)   d_getnetbyname_r=undef
13204                 getnetbyname_r_proto=0
13205                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13206         * )     case "$getnetbyname_r_proto" in
13207                 REENTRANT_PROTO*) ;;
13208                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13209                 esac
13210                 echo "Prototype: $try" ;;
13211         esac
13212         ;;
13213         *)      case "$usethreads" in
13214                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13215                 esac
13216                 d_getnetbyname_r=undef
13217                 getnetbyname_r_proto=0
13218                 ;;
13219         esac
13220         ;;
13221 *)      getnetbyname_r_proto=0
13222         ;;
13223 esac
13224
13225 : see if getnetent_r exists
13226 set getnetent_r d_getnetent_r
13227 eval $inlibc
13228 case "$d_getnetent_r" in
13229 "$define")
13230         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13231         case "$d_getnetent_r_proto:$usethreads" in
13232         ":define")      d_getnetent_r_proto=define
13233                 set d_getnetent_r_proto getnetent_r $hdrs
13234                 eval $hasproto ;;
13235         *)      ;;
13236         esac
13237         case "$d_getnetent_r_proto" in
13238         define)
13239         case "$getnetent_r_proto" in
13240         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13241         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13242         esac
13243         case "$getnetent_r_proto" in
13244         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13245         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13246         esac
13247         case "$getnetent_r_proto" in
13248         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13249         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13250         esac
13251         case "$getnetent_r_proto" in
13252         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13253         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13254         esac
13255         case "$getnetent_r_proto" in
13256         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13257         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13258         esac
13259         case "$getnetent_r_proto" in
13260         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13261         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13262         esac
13263         case "$getnetent_r_proto" in
13264         ''|0)   d_getnetent_r=undef
13265                 getnetent_r_proto=0
13266                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13267         * )     case "$getnetent_r_proto" in
13268                 REENTRANT_PROTO*) ;;
13269                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13270                 esac
13271                 echo "Prototype: $try" ;;
13272         esac
13273         ;;
13274         *)      case "$usethreads" in
13275                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13276                 esac
13277                 d_getnetent_r=undef
13278                 getnetent_r_proto=0
13279                 ;;
13280         esac
13281         ;;
13282 *)      getnetent_r_proto=0
13283         ;;
13284 esac
13285
13286 : see if prototypes for various getnetxxx netdb.h functions are available
13287 echo " "
13288 set d_getnetprotos getnetent $i_netdb netdb.h
13289 eval $hasproto
13290
13291 : see if getpagesize exists
13292 set getpagesize d_getpagsz
13293 eval $inlibc
13294
13295
13296 : see if getprotobyname exists
13297 set getprotobyname d_getpbyname
13298 eval $inlibc
13299
13300 : see if getprotobynumber exists
13301 set getprotobynumber d_getpbynumber
13302 eval $inlibc
13303
13304 : see if getprotoent exists
13305 set getprotoent d_getpent
13306 eval $inlibc
13307
13308 : see if getpgid exists
13309 set getpgid d_getpgid
13310 eval $inlibc
13311
13312 : see if getpgrp2 exists
13313 set getpgrp2 d_getpgrp2
13314 eval $inlibc
13315
13316 : see if getppid exists
13317 set getppid d_getppid
13318 eval $inlibc
13319
13320 : see if getpriority exists
13321 set getpriority d_getprior
13322 eval $inlibc
13323
13324 : see if getprotobyname_r exists
13325 set getprotobyname_r d_getprotobyname_r
13326 eval $inlibc
13327 case "$d_getprotobyname_r" in
13328 "$define")
13329         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13330         case "$d_getprotobyname_r_proto:$usethreads" in
13331         ":define")      d_getprotobyname_r_proto=define
13332                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13333                 eval $hasproto ;;
13334         *)      ;;
13335         esac
13336         case "$d_getprotobyname_r_proto" in
13337         define)
13338         case "$getprotobyname_r_proto" in
13339         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13340         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13341         esac
13342         case "$getprotobyname_r_proto" in
13343         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13344         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13345         esac
13346         case "$getprotobyname_r_proto" in
13347         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13348         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13349         esac
13350         case "$getprotobyname_r_proto" in
13351         ''|0)   d_getprotobyname_r=undef
13352                 getprotobyname_r_proto=0
13353                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13354         * )     case "$getprotobyname_r_proto" in
13355                 REENTRANT_PROTO*) ;;
13356                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13357                 esac
13358                 echo "Prototype: $try" ;;
13359         esac
13360         ;;
13361         *)      case "$usethreads" in
13362                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13363                 esac
13364                 d_getprotobyname_r=undef
13365                 getprotobyname_r_proto=0
13366                 ;;
13367         esac
13368         ;;
13369 *)      getprotobyname_r_proto=0
13370         ;;
13371 esac
13372
13373 : see if getprotobynumber_r exists
13374 set getprotobynumber_r d_getprotobynumber_r
13375 eval $inlibc
13376 case "$d_getprotobynumber_r" in
13377 "$define")
13378         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13379         case "$d_getprotobynumber_r_proto:$usethreads" in
13380         ":define")      d_getprotobynumber_r_proto=define
13381                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13382                 eval $hasproto ;;
13383         *)      ;;
13384         esac
13385         case "$d_getprotobynumber_r_proto" in
13386         define)
13387         case "$getprotobynumber_r_proto" in
13388         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13389         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13390         esac
13391         case "$getprotobynumber_r_proto" in
13392         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13393         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13394         esac
13395         case "$getprotobynumber_r_proto" in
13396         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13397         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13398         esac
13399         case "$getprotobynumber_r_proto" in
13400         ''|0)   d_getprotobynumber_r=undef
13401                 getprotobynumber_r_proto=0
13402                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13403         * )     case "$getprotobynumber_r_proto" in
13404                 REENTRANT_PROTO*) ;;
13405                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13406                 esac
13407                 echo "Prototype: $try" ;;
13408         esac
13409         ;;
13410         *)      case "$usethreads" in
13411                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13412                 esac
13413                 d_getprotobynumber_r=undef
13414                 getprotobynumber_r_proto=0
13415                 ;;
13416         esac
13417         ;;
13418 *)      getprotobynumber_r_proto=0
13419         ;;
13420 esac
13421
13422 : see if getprotoent_r exists
13423 set getprotoent_r d_getprotoent_r
13424 eval $inlibc
13425 case "$d_getprotoent_r" in
13426 "$define")
13427         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13428         case "$d_getprotoent_r_proto:$usethreads" in
13429         ":define")      d_getprotoent_r_proto=define
13430                 set d_getprotoent_r_proto getprotoent_r $hdrs
13431                 eval $hasproto ;;
13432         *)      ;;
13433         esac
13434         case "$d_getprotoent_r_proto" in
13435         define)
13436         case "$getprotoent_r_proto" in
13437         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13438         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13439         esac
13440         case "$getprotoent_r_proto" in
13441         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13442         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13443         esac
13444         case "$getprotoent_r_proto" in
13445         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13446         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13447         esac
13448         case "$getprotoent_r_proto" in
13449         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13450         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13451         esac
13452         case "$getprotoent_r_proto" in
13453         ''|0)   d_getprotoent_r=undef
13454                 getprotoent_r_proto=0
13455                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13456         * )     case "$getprotoent_r_proto" in
13457                 REENTRANT_PROTO*) ;;
13458                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13459                 esac
13460                 echo "Prototype: $try" ;;
13461         esac
13462         ;;
13463         *)      case "$usethreads" in
13464                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13465                 esac
13466                 d_getprotoent_r=undef
13467                 getprotoent_r_proto=0
13468                 ;;
13469         esac
13470         ;;
13471 *)      getprotoent_r_proto=0
13472         ;;
13473 esac
13474
13475 : see if prototypes for various getprotoxxx netdb.h functions are available
13476 echo " "
13477 set d_getprotoprotos getprotoent $i_netdb netdb.h
13478 eval $hasproto
13479
13480 : see if getprpwnam exists
13481 set getprpwnam d_getprpwnam
13482 eval $inlibc
13483
13484 : see if getpwent exists
13485 set getpwent d_getpwent
13486 eval $inlibc
13487
13488 : see if getpwent_r exists
13489 set getpwent_r d_getpwent_r
13490 eval $inlibc
13491 case "$d_getpwent_r" in
13492 "$define")
13493         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13494         case "$d_getpwent_r_proto:$usethreads" in
13495         ":define")      d_getpwent_r_proto=define
13496                 set d_getpwent_r_proto getpwent_r $hdrs
13497                 eval $hasproto ;;
13498         *)      ;;
13499         esac
13500         case "$d_getpwent_r_proto" in
13501         define)
13502         case "$getpwent_r_proto" in
13503         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13504         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13505         esac
13506         case "$getpwent_r_proto" in
13507         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13508         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13509         esac
13510         case "$getpwent_r_proto" in
13511         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13512         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13513         esac
13514         case "$getpwent_r_proto" in
13515         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13516         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13517         esac
13518         case "$getpwent_r_proto" in
13519         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13520         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13521         esac
13522         case "$getpwent_r_proto" in
13523         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13524         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13525         esac
13526         case "$getpwent_r_proto" in
13527         ''|0)   d_getpwent_r=undef
13528                 getpwent_r_proto=0
13529                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13530         * )     case "$getpwent_r_proto" in
13531                 REENTRANT_PROTO*) ;;
13532                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13533                 esac
13534                 echo "Prototype: $try" ;;
13535         esac
13536         ;;
13537         *)      case "$usethreads" in
13538                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13539                 esac
13540                 d_getpwent_r=undef
13541                 getpwent_r_proto=0
13542                 ;;
13543         esac
13544         ;;
13545 *)      getpwent_r_proto=0
13546         ;;
13547 esac
13548
13549 : see if getpwnam_r exists
13550 set getpwnam_r d_getpwnam_r
13551 eval $inlibc
13552 case "$d_getpwnam_r" in
13553 "$define")
13554         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13555         case "$d_getpwnam_r_proto:$usethreads" in
13556         ":define")      d_getpwnam_r_proto=define
13557                 set d_getpwnam_r_proto getpwnam_r $hdrs
13558                 eval $hasproto ;;
13559         *)      ;;
13560         esac
13561         case "$d_getpwnam_r_proto" in
13562         define)
13563         case "$getpwnam_r_proto" in
13564         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13565         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13566         esac
13567         case "$getpwnam_r_proto" in
13568         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13569         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13570         esac
13571         case "$getpwnam_r_proto" in
13572         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13573         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13574         esac
13575         case "$getpwnam_r_proto" in
13576         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13577         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13578         esac
13579         case "$getpwnam_r_proto" in
13580         ''|0)   d_getpwnam_r=undef
13581                 getpwnam_r_proto=0
13582                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13583         * )     case "$getpwnam_r_proto" in
13584                 REENTRANT_PROTO*) ;;
13585                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13586                 esac
13587                 echo "Prototype: $try" ;;
13588         esac
13589         ;;
13590         *)      case "$usethreads" in
13591                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13592                 esac
13593                 d_getpwnam_r=undef
13594                 getpwnam_r_proto=0
13595                 ;;
13596         esac
13597         ;;
13598 *)      getpwnam_r_proto=0
13599         ;;
13600 esac
13601
13602 : see if getpwuid_r exists
13603 set getpwuid_r d_getpwuid_r
13604 eval $inlibc
13605 case "$d_getpwuid_r" in
13606 "$define")
13607         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13608         case "$d_getpwuid_r_proto:$usethreads" in
13609         ":define")      d_getpwuid_r_proto=define
13610                 set d_getpwuid_r_proto getpwuid_r $hdrs
13611                 eval $hasproto ;;
13612         *)      ;;
13613         esac
13614         case "$d_getpwuid_r_proto" in
13615         define)
13616         case "$getpwuid_r_proto" in
13617         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13618         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13619         esac
13620         case "$getpwuid_r_proto" in
13621         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13622         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13623         esac
13624         case "$getpwuid_r_proto" in
13625         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13626         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13627         esac
13628         case "$getpwuid_r_proto" in
13629         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13630         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13631         esac
13632         case "$getpwuid_r_proto" in
13633         ''|0)   d_getpwuid_r=undef
13634                 getpwuid_r_proto=0
13635                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13636         * )     case "$getpwuid_r_proto" in
13637                 REENTRANT_PROTO*) ;;
13638                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13639                 esac
13640                 echo "Prototype: $try" ;;
13641         esac
13642         ;;
13643         *)      case "$usethreads" in
13644                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13645                 esac
13646                 d_getpwuid_r=undef
13647                 getpwuid_r_proto=0
13648                 ;;
13649         esac
13650         ;;
13651 *)      getpwuid_r_proto=0
13652         ;;
13653 esac
13654
13655
13656 : see if getservbyname exists
13657 set getservbyname d_getsbyname
13658 eval $inlibc
13659
13660 : see if getservbyport exists
13661 set getservbyport d_getsbyport
13662 eval $inlibc
13663
13664 : see if getservent exists
13665 set getservent d_getsent
13666 eval $inlibc
13667
13668 : see if getservbyname_r exists
13669 set getservbyname_r d_getservbyname_r
13670 eval $inlibc
13671 case "$d_getservbyname_r" in
13672 "$define")
13673         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13674         case "$d_getservbyname_r_proto:$usethreads" in
13675         ":define")      d_getservbyname_r_proto=define
13676                 set d_getservbyname_r_proto getservbyname_r $hdrs
13677                 eval $hasproto ;;
13678         *)      ;;
13679         esac
13680         case "$d_getservbyname_r_proto" in
13681         define)
13682         case "$getservbyname_r_proto" in
13683         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13684         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13685         esac
13686         case "$getservbyname_r_proto" in
13687         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13688         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13689         esac
13690         case "$getservbyname_r_proto" in
13691         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13692         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13693         esac
13694         case "$getservbyname_r_proto" in
13695         ''|0)   d_getservbyname_r=undef
13696                 getservbyname_r_proto=0
13697                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13698         * )     case "$getservbyname_r_proto" in
13699                 REENTRANT_PROTO*) ;;
13700                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13701                 esac
13702                 echo "Prototype: $try" ;;
13703         esac
13704         ;;
13705         *)      case "$usethreads" in
13706                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13707                 esac
13708                 d_getservbyname_r=undef
13709                 getservbyname_r_proto=0
13710                 ;;
13711         esac
13712         ;;
13713 *)      getservbyname_r_proto=0
13714         ;;
13715 esac
13716
13717 : see if getservbyport_r exists
13718 set getservbyport_r d_getservbyport_r
13719 eval $inlibc
13720 case "$d_getservbyport_r" in
13721 "$define")
13722         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13723         case "$d_getservbyport_r_proto:$usethreads" in
13724         ":define")      d_getservbyport_r_proto=define
13725                 set d_getservbyport_r_proto getservbyport_r $hdrs
13726                 eval $hasproto ;;
13727         *)      ;;
13728         esac
13729         case "$d_getservbyport_r_proto" in
13730         define)
13731         case "$getservbyport_r_proto" in
13732         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13733         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13734         esac
13735         case "$getservbyport_r_proto" in
13736         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13737         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13738         esac
13739         case "$getservbyport_r_proto" in
13740         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13741         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13742         esac
13743         case "$getservbyport_r_proto" in
13744         ''|0)   d_getservbyport_r=undef
13745                 getservbyport_r_proto=0
13746                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13747         * )     case "$getservbyport_r_proto" in
13748                 REENTRANT_PROTO*) ;;
13749                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13750                 esac
13751                 echo "Prototype: $try" ;;
13752         esac
13753         ;;
13754         *)      case "$usethreads" in
13755                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13756                 esac
13757                 d_getservbyport_r=undef
13758                 getservbyport_r_proto=0
13759                 ;;
13760         esac
13761         ;;
13762 *)      getservbyport_r_proto=0
13763         ;;
13764 esac
13765
13766 : see if getservent_r exists
13767 set getservent_r d_getservent_r
13768 eval $inlibc
13769 case "$d_getservent_r" in
13770 "$define")
13771         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13772         case "$d_getservent_r_proto:$usethreads" in
13773         ":define")      d_getservent_r_proto=define
13774                 set d_getservent_r_proto getservent_r $hdrs
13775                 eval $hasproto ;;
13776         *)      ;;
13777         esac
13778         case "$d_getservent_r_proto" in
13779         define)
13780         case "$getservent_r_proto" in
13781         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13782         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13783         esac
13784         case "$getservent_r_proto" in
13785         ''|0) try='int getservent_r(struct servent*, char*, int);'
13786         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13787         esac
13788         case "$getservent_r_proto" in
13789         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13790         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13791         esac
13792         case "$getservent_r_proto" in
13793         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13794         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13795         esac
13796         case "$getservent_r_proto" in
13797         ''|0)   d_getservent_r=undef
13798                 getservent_r_proto=0
13799                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13800         * )     case "$getservent_r_proto" in
13801                 REENTRANT_PROTO*) ;;
13802                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13803                 esac
13804                 echo "Prototype: $try" ;;
13805         esac
13806         ;;
13807         *)      case "$usethreads" in
13808                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13809                 esac
13810                 d_getservent_r=undef
13811                 getservent_r_proto=0
13812                 ;;
13813         esac
13814         ;;
13815 *)      getservent_r_proto=0
13816         ;;
13817 esac
13818
13819 : see if prototypes for various getservxxx netdb.h functions are available
13820 echo " "
13821 set d_getservprotos getservent $i_netdb netdb.h
13822 eval $hasproto
13823
13824 : see if getspnam exists
13825 set getspnam d_getspnam
13826 eval $inlibc
13827
13828 : see if this is a shadow.h system
13829 set shadow.h i_shadow
13830 eval $inhdr
13831
13832 : see if getspnam_r exists
13833 set getspnam_r d_getspnam_r
13834 eval $inlibc
13835 case "$d_getspnam_r" in
13836 "$define")
13837         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13838         case "$d_getspnam_r_proto:$usethreads" in
13839         ":define")      d_getspnam_r_proto=define
13840                 set d_getspnam_r_proto getspnam_r $hdrs
13841                 eval $hasproto ;;
13842         *)      ;;
13843         esac
13844         case "$d_getspnam_r_proto" in
13845         define)
13846         case "$getspnam_r_proto" in
13847         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13848         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13849         esac
13850         case "$getspnam_r_proto" in
13851         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13852         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13853         esac
13854         case "$getspnam_r_proto" in
13855         ''|0)   d_getspnam_r=undef
13856                 getspnam_r_proto=0
13857                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13858         * )     case "$getspnam_r_proto" in
13859                 REENTRANT_PROTO*) ;;
13860                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13861                 esac
13862                 echo "Prototype: $try" ;;
13863         esac
13864         ;;
13865         *)      case "$usethreads" in
13866                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13867                 esac
13868                 d_getspnam_r=undef
13869                 getspnam_r_proto=0
13870                 ;;
13871         esac
13872         ;;
13873 *)      getspnam_r_proto=0
13874         ;;
13875 esac
13876
13877 : see if gettimeofday or ftime exists
13878 set gettimeofday d_gettimeod
13879 eval $inlibc
13880 case "$d_gettimeod" in
13881 "$undef")
13882         set ftime d_ftime 
13883         eval $inlibc
13884         ;;
13885 *)
13886         val="$undef"; set d_ftime; eval $setvar
13887         ;;
13888 esac
13889 case "$d_gettimeod$d_ftime" in
13890 "$undef$undef")
13891         echo " "
13892         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13893         ;;
13894 esac
13895
13896 : see if gmtime_r exists
13897 set gmtime_r d_gmtime_r
13898 eval $inlibc
13899 case "$d_gmtime_r" in
13900 "$define")
13901         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13902         case "$d_gmtime_r_proto:$usethreads" in
13903         ":define")      d_gmtime_r_proto=define
13904                 set d_gmtime_r_proto gmtime_r $hdrs
13905                 eval $hasproto ;;
13906         *)      ;;
13907         esac
13908         case "$d_gmtime_r_proto" in
13909         define)
13910         case "$gmtime_r_proto" in
13911         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13912         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13913         esac
13914         case "$gmtime_r_proto" in
13915         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13916         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13917         esac
13918         case "$gmtime_r_proto" in
13919         ''|0)   d_gmtime_r=undef
13920                 gmtime_r_proto=0
13921                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13922         * )     case "$gmtime_r_proto" in
13923                 REENTRANT_PROTO*) ;;
13924                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13925                 esac
13926                 echo "Prototype: $try" ;;
13927         esac
13928         ;;
13929         *)      case "$usethreads" in
13930                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13931                 esac
13932                 d_gmtime_r=undef
13933                 gmtime_r_proto=0
13934                 ;;
13935         esac
13936         ;;
13937 *)      gmtime_r_proto=0
13938         ;;
13939 esac
13940
13941 : see if hasmntopt exists
13942 set hasmntopt d_hasmntopt
13943 eval $inlibc
13944
13945 : see if this is a netinet/in.h or sys/in.h system
13946 set netinet/in.h i_niin sys/in.h i_sysin
13947 eval $inhdr
13948
13949 : see if arpa/inet.h has to be included
13950 set arpa/inet.h i_arpainet
13951 eval $inhdr
13952
13953 : see if htonl --and friends-- exists
13954 val=''
13955 set htonl val
13956 eval $inlibc
13957
13958 : Maybe they are macros.
13959 case "$val" in
13960 $undef)
13961         $cat >htonl.c <<EOM
13962 #include <stdio.h>
13963 #include <sys/types.h>
13964 #$i_niin I_NETINET_IN
13965 #$i_sysin I_SYS_IN
13966 #$i_arpainet I_ARPA_INET
13967 #ifdef I_NETINET_IN
13968 #include <netinet/in.h>
13969 #endif
13970 #ifdef I_SYS_IN
13971 #include <sys/in.h>
13972 #endif
13973 #ifdef I_ARPA_INET
13974 #include <arpa/inet.h>
13975 #endif
13976 #ifdef htonl
13977 printf("Defined as a macro.");
13978 #endif
13979 EOM
13980         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13981         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13982                 val="$define"
13983                 echo "But it seems to be defined as a macro." >&4
13984         fi
13985         $rm -f htonl.?
13986         ;;
13987 esac
13988 set d_htonl
13989 eval $setvar
13990
13991 : see if ilogbl exists
13992 set ilogbl d_ilogbl
13993 eval $inlibc
13994
13995 : index or strchr
13996 echo " "
13997 if set index val -f; eval $csym; $val; then
13998         if set strchr val -f d_strchr; eval $csym; $val; then
13999                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14000                         val="$define"
14001                         vali="$undef"
14002                         echo "strchr() found." >&4
14003                 else
14004                         val="$undef"
14005                         vali="$define"
14006                         echo "index() found." >&4
14007                 fi
14008         else
14009                 val="$undef"
14010                 vali="$define"
14011                 echo "index() found." >&4
14012         fi
14013 else
14014         if set strchr val -f d_strchr; eval $csym; $val; then
14015                 val="$define"
14016                 vali="$undef"
14017                 echo "strchr() found." >&4
14018         else
14019                 echo "No index() or strchr() found!" >&4
14020                 val="$undef"
14021                 vali="$undef"
14022         fi
14023 fi
14024 set d_strchr; eval $setvar
14025 val="$vali"
14026 set d_index; eval $setvar
14027
14028 : check whether inet_aton exists
14029 set inet_aton d_inetaton
14030 eval $inlibc
14031
14032 : Look for isascii
14033 echo " "
14034 $cat >isascii.c <<EOCP
14035 #include <stdio.h>
14036 #include <ctype.h>
14037 #$i_stdlib I_STDLIB
14038 #ifdef I_STDLIB
14039 #include <stdlib.h>
14040 #endif
14041 int main() {
14042         int c = 'A';
14043         if (isascii(c))
14044                 exit(0);
14045         else
14046                 exit(1);
14047 }
14048 EOCP
14049 set isascii
14050 if eval $compile; then
14051         echo "isascii() found." >&4
14052         val="$define"
14053 else
14054         echo "isascii() NOT found." >&4
14055         val="$undef"
14056 fi
14057 set d_isascii
14058 eval $setvar
14059 $rm -f isascii*
14060
14061 : see if isfinite exists
14062 set isfinite d_isfinite
14063 eval $inlibc
14064
14065 : see if isinf exists
14066 set isinf d_isinf
14067 eval $inlibc
14068
14069 : see if isnan exists
14070 set isnan d_isnan
14071 eval $inlibc
14072
14073 : see if isnanl exists
14074 set isnanl d_isnanl
14075 eval $inlibc
14076
14077 : see if killpg exists
14078 set killpg d_killpg
14079 eval $inlibc
14080
14081 : see if lchown exists
14082 echo " "
14083 $cat > try.c <<'EOCP'
14084 /* System header to define __stub macros and hopefully few prototypes,
14085     which can conflict with char lchown(); below.  */
14086 #include <assert.h>
14087 /* Override any gcc2 internal prototype to avoid an error.  */
14088 /* We use char because int might match the return type of a gcc2
14089    builtin and then its argument prototype would still apply.  */
14090 char lchown();
14091 int main() {
14092     /*  The GNU C library defines this for functions which it implements
14093         to always fail with ENOSYS.  Some functions are actually named
14094         something starting with __ and the normal name is an alias.  */
14095 #if defined (__stub_lchown) || defined (__stub___lchown)
14096 choke me
14097 #else
14098 lchown();
14099 #endif
14100 ; return 0; }
14101 EOCP
14102 set try
14103 if eval $compile; then
14104     $echo "lchown() found." >&4
14105     val="$define"
14106 else
14107     $echo "lchown() NOT found." >&4
14108     val="$undef"
14109 fi
14110 set d_lchown
14111 eval $setvar
14112
14113 : See if number of significant digits in a double precision number is known
14114 echo " "
14115 $cat >ldbl_dig.c <<EOM
14116 #$i_limits I_LIMITS
14117 #$i_float I_FLOAT
14118 #ifdef I_LIMITS
14119 #include <limits.h>
14120 #endif
14121 #ifdef I_FLOAT
14122 #include <float.h>
14123 #endif
14124 #ifdef LDBL_DIG
14125 printf("Contains LDBL_DIG");
14126 #endif
14127 EOM
14128 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14129 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14130         echo "LDBL_DIG found." >&4
14131         val="$define"
14132 else
14133         echo "LDBL_DIG NOT found." >&4
14134         val="$undef"
14135 fi
14136 $rm -f ldbl_dig.?
14137 set d_ldbl_dig
14138 eval $setvar
14139
14140 : see if this is a math.h system
14141 set math.h i_math
14142 eval $inhdr
14143
14144 d_libm_lib_version="$undef"
14145 case $i_math in
14146     $define)
14147         : check to see if math.h defines _LIB_VERSION
14148         echo " "
14149         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14150         $cat >try.c <<EOCP
14151 #include <unistd.h>
14152 #include <math.h>
14153 int main (int argc, char *argv[])
14154 {
14155     printf ("%d\n", _LIB_VERSION);
14156     return (0);
14157     } /* main */
14158 EOCP
14159         set try
14160         if eval $compile; then
14161             foo=`$run ./try`
14162             echo "Yes, it does ($foo)" >&4
14163             d_libm_lib_version="$define"
14164         else
14165             echo "No, it does not (probably harmless)\n" >&4
14166             fi
14167         $rm -f try.* try core core.try.*
14168         ;;
14169
14170     esac
14171
14172 : see if link exists
14173 set link d_link
14174 eval $inlibc
14175
14176 : see if localtime_r exists
14177 set localtime_r d_localtime_r
14178 eval $inlibc
14179 case "$d_localtime_r" in
14180 "$define")
14181         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14182         case "$d_localtime_r_proto:$usethreads" in
14183         ":define")      d_localtime_r_proto=define
14184                 set d_localtime_r_proto localtime_r $hdrs
14185                 eval $hasproto ;;
14186         *)      ;;
14187         esac
14188         case "$d_localtime_r_proto" in
14189         define)
14190         case "$localtime_r_proto" in
14191         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14192         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14193         esac
14194         case "$localtime_r_proto" in
14195         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14196         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14197         esac
14198         case "$localtime_r_proto" in
14199         ''|0)   d_localtime_r=undef
14200                 localtime_r_proto=0
14201                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14202         * )     case "$localtime_r_proto" in
14203                 REENTRANT_PROTO*) ;;
14204                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14205                 esac
14206                 echo "Prototype: $try" ;;
14207         esac
14208         ;;
14209         *)      case "$usethreads" in
14210                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14211                 esac
14212                 d_localtime_r=undef
14213                 localtime_r_proto=0
14214                 ;;
14215         esac
14216         ;;
14217 *)      localtime_r_proto=0
14218         ;;
14219 esac
14220
14221 : see if localeconv exists
14222 set localeconv d_locconv
14223 eval $inlibc
14224
14225 : see if lockf exists
14226 set lockf d_lockf
14227 eval $inlibc
14228
14229 : see if prototype for lseek is available
14230 echo " "
14231 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14232 eval $hasproto
14233
14234 : see if lstat exists
14235 set lstat d_lstat
14236 eval $inlibc
14237
14238 : see if madvise exists
14239 set madvise d_madvise
14240 eval $inlibc
14241
14242 : see if mblen exists
14243 set mblen d_mblen
14244 eval $inlibc
14245
14246 : see if mbstowcs exists
14247 set mbstowcs d_mbstowcs
14248 eval $inlibc
14249
14250 : see if mbtowc exists
14251 set mbtowc d_mbtowc
14252 eval $inlibc
14253
14254 : see if memchr exists
14255 set memchr d_memchr
14256 eval $inlibc
14257
14258 : see if memcmp exists
14259 set memcmp d_memcmp
14260 eval $inlibc
14261
14262 : see if memcpy exists
14263 set memcpy d_memcpy
14264 eval $inlibc
14265
14266 : see if memmove exists
14267 set memmove d_memmove
14268 eval $inlibc
14269
14270 : see if memset exists
14271 set memset d_memset
14272 eval $inlibc
14273
14274 : see if mkdir exists
14275 set mkdir d_mkdir
14276 eval $inlibc
14277
14278 : see if mkdtemp exists
14279 set mkdtemp d_mkdtemp
14280 eval $inlibc
14281
14282 : see if mkfifo exists
14283 set mkfifo d_mkfifo
14284 eval $inlibc
14285
14286 : see if mkstemp exists
14287 set mkstemp d_mkstemp
14288 eval $inlibc
14289
14290 : see if mkstemps exists
14291 set mkstemps d_mkstemps
14292 eval $inlibc
14293
14294 : see if mktime exists
14295 set mktime d_mktime
14296 eval $inlibc
14297
14298 : see if this is a sys/mman.h system
14299 set sys/mman.h i_sysmman
14300 eval $inhdr
14301
14302 : see if mmap exists
14303 set mmap d_mmap
14304 eval $inlibc
14305 : see what shmat returns
14306 : default to something harmless
14307 mmaptype='void *'
14308 case "$i_sysmman$d_mmap" in
14309 "$define$define")
14310         $cat >mmap.c <<'END'
14311 #include <sys/mman.h>
14312 void *mmap();
14313 END
14314         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14315                 mmaptype='void *'
14316         else
14317                 mmaptype='caddr_t'
14318         fi
14319         echo "and it returns ($mmaptype)." >&4
14320         ;;
14321 esac
14322
14323
14324
14325 : see if sqrtl exists
14326 set sqrtl d_sqrtl
14327 eval $inlibc
14328
14329 : see if scalbnl exists
14330 set scalbnl d_scalbnl
14331 eval $inlibc
14332
14333 : see if modfl exists
14334 set modfl d_modfl
14335 eval $inlibc
14336
14337 : see if prototype for modfl is available
14338 echo " "
14339 set d_modflproto modfl $i_math math.h
14340 eval $hasproto
14341
14342 d_modfl_pow32_bug="$undef"
14343
14344 case "$d_longdbl$d_modfl" in
14345 $define$define)
14346         $cat <<EOM
14347 Checking to see whether your modfl() is okay for large values...
14348 EOM
14349 $cat >try.c <<EOCP
14350 #include <math.h> 
14351 #include <stdio.h>
14352 EOCP
14353 if $test "X$d_modflproto" != "X$define"; then
14354         $cat >>try.c <<EOCP
14355 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14356 long double modfl (long double, long double *);
14357 EOCP
14358 fi
14359 $cat >>try.c <<EOCP
14360 int main() {
14361     long double nv = 4294967303.15;
14362     long double v, w;
14363     v = modfl(nv, &w);         
14364 #ifdef __GLIBC__
14365     printf("glibc");
14366 #endif
14367     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14368     return 0;
14369 }
14370 EOCP
14371         case "$osname:$gccversion" in
14372         aix:)   saveccflags="$ccflags"
14373                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14374         esac
14375         set try
14376         if eval $compile; then
14377                 foo=`$run ./try`
14378                 case "$foo" in
14379                 *" 4294967303.150000 1.150000 4294967302.000000")
14380                         echo >&4 "Your modfl() is broken for large values."
14381                         d_modfl_pow32_bug="$define"
14382                         case "$foo" in
14383                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14384                         ;;
14385                         esac
14386                         ;;
14387                 *" 4294967303.150000 0.150000 4294967303.000000")
14388                         echo >&4 "Your modfl() seems okay for large values."
14389                         ;;
14390                 *)      echo >&4 "I don't understand your modfl() at all."
14391                         d_modfl="$undef"
14392                         ;;
14393                 esac
14394                 $rm -f try.* try core core.try.*
14395         else
14396                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14397                 d_modfl="$undef"
14398         fi
14399         case "$osname:$gccversion" in
14400         aix:)   ccflags="$saveccflags" ;; # restore
14401         esac
14402         ;;
14403 esac
14404
14405 if $test "$uselongdouble" = "$define"; then
14406     message=""
14407     if $test "$d_sqrtl" != "$define"; then
14408         message="$message sqrtl"
14409     fi
14410     if $test "$d_modfl" != "$define"; then
14411         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14412             echo "You have both aintl and copysignl, so I can emulate modfl."
14413         else
14414             message="$message modfl"
14415         fi
14416     fi
14417     if $test "$d_frexpl" != "$define"; then
14418         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14419             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14420         else
14421             message="$message frexpl"
14422         fi
14423     fi
14424
14425     if $test "$message" != ""; then
14426         $cat <<EOM >&4
14427
14428 *** You requested the use of long doubles but you do not seem to have
14429 *** the following mathematical functions needed for long double support:
14430 ***    $message
14431 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14432 *** Cannot continue, aborting.
14433
14434 EOM
14435
14436         exit 1
14437     fi
14438 fi
14439
14440 : see if mprotect exists
14441 set mprotect d_mprotect
14442 eval $inlibc
14443
14444 : see if msgctl exists
14445 set msgctl d_msgctl
14446 eval $inlibc
14447
14448 : see if msgget exists
14449 set msgget d_msgget
14450 eval $inlibc
14451
14452 : see if msgsnd exists
14453 set msgsnd d_msgsnd
14454 eval $inlibc
14455
14456 : see if msgrcv exists
14457 set msgrcv d_msgrcv
14458 eval $inlibc
14459
14460 : see how much of the 'msg*(2)' library is present.
14461 h_msg=true
14462 echo " "
14463 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14464 *"$undef"*) h_msg=false;;
14465 esac
14466 case "$osname" in
14467 freebsd)
14468     case "`ipcs 2>&1`" in
14469     "SVID messages"*"not configured"*)
14470         echo "Your $osname does not have the msg*(2) configured." >&4
14471         h_msg=false
14472         val="$undef"
14473         set msgctl d_msgctl
14474         eval $setvar
14475         set msgget d_msgget
14476         eval $setvar
14477         set msgsnd d_msgsnd
14478         eval $setvar
14479         set msgrcv d_msgrcv
14480         eval $setvar
14481         ;;
14482     esac
14483     ;;
14484 esac
14485 : we could also check for sys/ipc.h ...
14486 if $h_msg && $test `./findhdr sys/msg.h`; then
14487         echo "You have the full msg*(2) library." >&4
14488         val="$define"
14489 else
14490         echo "You don't have the full msg*(2) library." >&4
14491         val="$undef"
14492 fi
14493 set d_msg
14494 eval $setvar
14495
14496
14497 echo " "
14498 echo "Checking to see if your system supports struct msghdr..." >&4
14499 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14500 eval $hasstruct
14501 case "$d_msghdr_s" in
14502 "$define")      echo "Yes, it does."   ;;
14503 *)              echo "No, it doesn't." ;;
14504 esac
14505
14506
14507 : see if msync exists
14508 set msync d_msync
14509 eval $inlibc
14510
14511 : see if munmap exists
14512 set munmap d_munmap
14513 eval $inlibc
14514
14515 : see if nice exists
14516 set nice d_nice
14517 eval $inlibc
14518
14519 : see if this is a langinfo.h system
14520 set langinfo.h i_langinfo
14521 eval $inhdr
14522
14523 : see if nl_langinfo exists
14524 set nl_langinfo d_nl_langinfo
14525 eval $inlibc
14526
14527 : check for length of character
14528 echo " "
14529 case "$charsize" in
14530 '')
14531         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14532         $cat >try.c <<EOCP
14533 #include <stdio.h>
14534 #$i_stdlib I_STDLIB
14535 #ifdef I_STDLIB
14536 #include <stdlib.h>
14537 #endif
14538 int main()
14539 {
14540     printf("%d\n", (int)sizeof(char));
14541     exit(0);
14542 }
14543 EOCP
14544         set try
14545         if eval $compile_ok; then
14546                 dflt=`$run ./try`
14547         else
14548                 dflt='1'
14549                 echo "(I can't seem to compile the test program.  Guessing...)"
14550         fi
14551         ;;
14552 *)
14553         dflt="$charsize"
14554         ;;
14555 esac
14556 rp="What is the size of a character (in bytes)?"
14557 . ./myread
14558 charsize="$ans"
14559 $rm -f try.c try
14560
14561 : check for volatile keyword
14562 echo " "
14563 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14564 $cat >try.c <<'EOCP'
14565 int main()
14566 {
14567         typedef struct _goo_struct goo_struct;
14568         goo_struct * volatile goo = ((goo_struct *)0);
14569         struct _goo_struct {
14570                 long long_int;
14571                 int reg_int;
14572                 char char_var;
14573         };
14574         typedef unsigned short foo_t;
14575         char *volatile foo;
14576         volatile int bar;
14577         volatile foo_t blech;
14578         foo = foo;
14579 }
14580 EOCP
14581 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14582         val="$define"
14583         echo "Yup, it does."
14584 else
14585         val="$undef"
14586         echo "Nope, it doesn't."
14587 fi
14588 set d_volatile
14589 eval $setvar
14590 $rm -f try.*
14591
14592
14593 echo " "
14594 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14595
14596 case "$use64bitint:$d_quad:$quadtype" in
14597 define:define:?*)
14598         ivtype="$quadtype"
14599         uvtype="$uquadtype"
14600         ivsize=8
14601         uvsize=8
14602         ;;
14603 *)      ivtype="long"
14604         uvtype="unsigned long"
14605         ivsize=$longsize
14606         uvsize=$longsize
14607         ;;
14608 esac
14609
14610 case "$uselongdouble:$d_longdbl" in
14611 define:define)
14612         nvtype="long double"
14613         nvsize=$longdblsize
14614         ;;
14615 *)      nvtype=double
14616         nvsize=$doublesize
14617         ;;
14618 esac
14619
14620 $echo "(IV will be "$ivtype", $ivsize bytes)"
14621 $echo "(UV will be "$uvtype", $uvsize bytes)"
14622 $echo "(NV will be "$nvtype", $nvsize bytes)"
14623
14624 $cat >try.c <<EOCP
14625 #$i_inttypes I_INTTYPES
14626 #ifdef I_INTTYPES
14627 #include <inttypes.h>
14628 #endif
14629 #include <stdio.h>
14630 int main() {
14631 #ifdef INT8
14632    int8_t i =  INT8_MAX;
14633   uint8_t u = UINT8_MAX;
14634   printf("int8_t\n");
14635 #endif
14636 #ifdef INT16
14637    int16_t i =  INT16_MAX;
14638   uint16_t i = UINT16_MAX;
14639   printf("int16_t\n");
14640 #endif
14641 #ifdef INT32
14642    int32_t i =  INT32_MAX;
14643   uint32_t u = UINT32_MAX;
14644   printf("int32_t\n");
14645 #endif
14646 }
14647 EOCP
14648
14649 case "$i8type" in
14650 '')     case "$charsize" in
14651         1)      i8type=char
14652                 u8type="unsigned char"
14653                 i8size=$charsize
14654                 u8size=$charsize
14655                 ;;
14656         esac
14657         ;;
14658 esac
14659 case "$i8type" in
14660 '')     set try -DINT8
14661         if eval $compile; then
14662                 case "`$run ./try`" in
14663                 int8_t) i8type=int8_t
14664                         u8type=uint8_t
14665                         i8size=1
14666                         u8size=1
14667                         ;;
14668                 esac
14669         fi
14670         ;;
14671 esac
14672 case "$i8type" in
14673 '')     if $test $charsize -ge 1; then
14674                 i8type=char
14675                 u8type="unsigned char"
14676                 i8size=$charsize
14677                 u8size=$charsize
14678         fi
14679         ;;
14680 esac
14681
14682 case "$i16type" in
14683 '')     case "$shortsize" in
14684         2)      i16type=short
14685                 u16type="unsigned short"
14686                 i16size=$shortsize
14687                 u16size=$shortsize
14688                 ;;
14689         esac
14690         ;;
14691 esac
14692 case "$i16type" in
14693 '')     set try -DINT16
14694         if eval $compile; then
14695                 case "`$run ./try`" in
14696                 int16_t)
14697                         i16type=int16_t
14698                         u16type=uint16_t
14699                         i16size=2
14700                         u16size=2
14701                         ;;
14702                 esac
14703         fi
14704         ;;
14705 esac
14706 case "$i16type" in
14707 '')     if $test $shortsize -ge 2; then
14708                 i16type=short
14709                 u16type="unsigned short"
14710                 i16size=$shortsize
14711                 u16size=$shortsize
14712         fi
14713         ;;
14714 esac
14715
14716 case "$i32type" in
14717 '')     case "$longsize" in
14718         4)      i32type=long
14719                 u32type="unsigned long"
14720                 i32size=$longsize
14721                 u32size=$longsize
14722                 ;;
14723         *)      case "$intsize" in
14724                 4)      i32type=int
14725                         u32type="unsigned int"
14726                         i32size=$intsize
14727                         u32size=$intsize
14728                         ;;
14729                 esac
14730                 ;;
14731         esac
14732         ;;
14733 esac
14734 case "$i32type" in
14735 '')     set try -DINT32
14736         if eval $compile; then
14737                 case "`$run ./try`" in
14738                 int32_t)
14739                         i32type=int32_t
14740                         u32type=uint32_t
14741                         i32size=4
14742                         u32size=4
14743                         ;;
14744                 esac
14745         fi
14746         ;;
14747 esac
14748 case "$i32type" in
14749 '')     if $test $intsize -ge 4; then
14750                 i32type=int
14751                 u32type="unsigned int"
14752                 i32size=$intsize
14753                 u32size=$intsize
14754         fi
14755         ;;
14756 esac
14757
14758 case "$i64type" in
14759 '')     case "$d_quad:$quadtype" in
14760         define:?*)
14761                 i64type="$quadtype"
14762                 u64type="$uquadtype"
14763                 i64size=8
14764                 u64size=8
14765                 ;;
14766         esac
14767         ;;
14768 esac
14769
14770 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14771 : volatile so that the compiler has to store it out to memory.
14772 if test X"$d_volatile" = X"$define"; then
14773         volatile=volatile
14774 fi
14775 $cat <<EOP >try.c
14776 #include <stdio.h>
14777 #$i_stdlib I_STDLIB
14778 #ifdef I_STDLIB
14779 #include <stdlib.h>
14780 #endif
14781 #include <sys/types.h>
14782 #include <signal.h>
14783 #ifdef SIGFPE
14784 $volatile int bletched = 0;
14785 $signal_t blech(s) int s; { bletched = 1; }
14786 #endif
14787 int main() {
14788     $uvtype u = 0;
14789     $nvtype d;
14790     int     n = 8 * $uvsize;
14791     int     i;
14792 #ifdef SIGFPE
14793     signal(SIGFPE, blech);
14794 #endif
14795
14796     for (i = 0; i < n; i++) {
14797       u = u << 1 | ($uvtype)1;
14798       d = ($nvtype)u;
14799       if (($uvtype)d != u)
14800         break;
14801       if (d <= 0)
14802         break;
14803       d = ($nvtype)(u - 1);
14804       if (($uvtype)d != (u - 1))
14805         break;
14806 #ifdef SIGFPE
14807       if (bletched) {
14808         break;
14809 #endif
14810       } 
14811     }
14812     printf("%d\n", ((i == n) ? -n : i));
14813     exit(0);
14814 }
14815 EOP
14816 set try
14817
14818 d_nv_preserves_uv="$undef"
14819 if eval $compile; then
14820         nv_preserves_uv_bits="`$run ./try`"
14821 fi
14822 case "$nv_preserves_uv_bits" in
14823 \-[1-9]*)       
14824         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14825         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14826         d_nv_preserves_uv="$define"
14827         ;;
14828 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14829         d_nv_preserves_uv="$undef" ;;
14830 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14831         nv_preserves_uv_bits="$undef" ;;
14832 esac
14833
14834 $rm -f try.* try
14835
14836
14837 : check for off64_t
14838 echo " "
14839 echo "Checking to see if you have off64_t..." >&4
14840 $cat >try.c <<EOCP
14841 #include <sys/types.h>
14842 #include <unistd.h>
14843 int main() { off64_t x = 7; }
14844 EOCP
14845 set try
14846 if eval $compile; then
14847         val="$define"
14848         echo "You have off64_t."
14849 else
14850         val="$undef"
14851         echo "You do not have off64_t."
14852         case "$lseeksize" in
14853         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14854         esac
14855 fi
14856 $rm -f try.* try
14857 set d_off64_t
14858 eval $setvar
14859
14860 : how to create joinable pthreads
14861 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14862         echo " "
14863         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14864         $cat >try.c <<'EOCP'
14865 #include <pthread.h>
14866 int main() {
14867     int detachstate = JOINABLE;
14868 }
14869 EOCP
14870         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14871         if eval $compile; then
14872                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14873                 val="$undef" # Yes, undef.
14874                 set d_old_pthread_create_joinable
14875                 eval $setvar
14876                 val=""
14877                 set old_pthread_create_joinable
14878                 eval $setvar
14879         else
14880                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14881                 if eval $compile; then
14882                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14883                         val="$define"
14884                         set d_old_pthread_create_joinable
14885                         eval $setvar
14886                         val=PTHREAD_CREATE_UNDETACHED
14887                         set old_pthread_create_joinable
14888                         eval $setvar
14889                 else            
14890                         set try -DJOINABLE=__UNDETACHED
14891                         if eval $compile; then
14892                                 echo "You seem to use __UNDETACHED." >&4
14893                                 val="$define"
14894                                 set d_old_pthread_create_joinable
14895                                 eval $setvar
14896                                 val=__UNDETACHED
14897                                 set old_pthread_create_joinable
14898                                 eval $setvar
14899                         else
14900                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14901                                 val="$define"
14902                                 set d_old_pthread_create_joinable
14903                                 eval $setvar
14904                                 val=0
14905                                 set old_pthread_create_joinable
14906                                 eval $setvar
14907                         fi
14908                 fi
14909         fi
14910         $rm -f try try.*
14911 else
14912     d_old_pthread_create_joinable="$undef"
14913     old_pthread_create_joinable=""
14914 fi
14915
14916 : see if pause exists
14917 set pause d_pause
14918 eval $inlibc
14919
14920 : see if pipe exists
14921 set pipe d_pipe
14922 eval $inlibc
14923
14924 : see if poll exists
14925 set poll d_poll
14926 eval $inlibc
14927
14928 : see if readlink exists
14929 set readlink d_readlink
14930 eval $inlibc
14931
14932 echo " "
14933 procselfexe=''
14934 val="$undef"
14935 case "$d_readlink" in
14936 "$define")
14937         if $issymlink /proc/self/exe ; then
14938                 $ls -l /proc/self/exe > reflect
14939                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14940                         echo "You have Linux-like /proc/self/exe."
14941                         procselfexe='"/proc/self/exe"'
14942                         val="$define"
14943                 fi
14944         fi
14945         if $issymlink /proc/curproc/file ; then
14946                 $ls -l /proc/curproc/file > reflect
14947                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14948                         echo "You have BSD-like /proc/curproc/file."
14949                         procselfexe='"/proc/curproc/file"'
14950                         val="$define"
14951                 fi
14952         fi
14953         ;;
14954 esac
14955 $rm -f reflect
14956 set d_procselfexe
14957 eval $setvar
14958
14959 : see whether the pthread_atfork exists
14960 $cat >try.c <<EOP
14961 #include <pthread.h>
14962 #include <stdio.h>
14963 int main() {
14964 #ifdef  PTHREAD_ATFORK
14965         pthread_atfork(NULL,NULL,NULL);
14966 #endif
14967 }
14968 EOP
14969
14970 : see if pthread_atfork exists
14971 set try -DPTHREAD_ATFORK
14972 if eval $compile; then
14973     val="$define"
14974 else
14975     val="$undef"
14976 fi
14977 case "$usethreads" in
14978 $define)
14979         case "$val" in
14980         $define) echo 'pthread_atfork found.' >&4        ;;
14981         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14982         esac
14983 esac
14984 set d_pthread_atfork
14985 eval $setvar
14986
14987 : see if pthread_attr_setscope exists
14988 set pthread_attr_setscope d_pthread_attr_setscope
14989 eval $inlibc
14990
14991
14992 : see whether the various POSIXish _yields exist
14993 $cat >try.c <<EOP
14994 #include <pthread.h>
14995 #include <stdio.h>
14996 int main() {
14997 #ifdef SCHED_YIELD
14998         sched_yield();
14999 #else
15000 #ifdef PTHREAD_YIELD
15001         pthread_yield();
15002 #else
15003 #ifdef PTHREAD_YIELD_NULL
15004         pthread_yield(NULL);
15005 #endif
15006 #endif
15007 #endif
15008 }
15009 EOP
15010 : see if sched_yield exists
15011 set try -DSCHED_YIELD
15012 if eval $compile; then
15013     val="$define"
15014     sched_yield='sched_yield()'
15015 else
15016     val="$undef"
15017 fi
15018 case "$usethreads" in
15019 $define)
15020         case "$val" in
15021         $define) echo 'sched_yield() found.' >&4        ;;
15022         *)       echo 'sched_yield() NOT found.' >&4    ;;
15023         esac
15024 esac
15025 set d_sched_yield
15026 eval $setvar
15027
15028 : see if pthread_yield exists
15029 set try -DPTHREAD_YIELD
15030 if eval $compile; then
15031     val="$define"
15032     case "$sched_yield" in
15033     '') sched_yield='pthread_yield()' ;;
15034     esac
15035 else
15036     set try -DPTHREAD_YIELD_NULL
15037     if eval $compile; then
15038         val="$define"
15039         case "$sched_yield" in
15040         '') sched_yield='pthread_yield(NULL)' ;;
15041         esac
15042     else
15043         val="$undef"
15044     fi
15045 fi
15046 case "$usethreads" in
15047 $define)
15048         case "$val" in
15049         $define) echo 'pthread_yield() found.' >&4      ;;
15050         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15051         esac
15052         ;;
15053 esac
15054 set d_pthread_yield
15055 eval $setvar
15056
15057 case "$sched_yield" in
15058 '') sched_yield=undef ;;
15059 esac
15060
15061 $rm -f try try.*
15062
15063 : see if random_r exists
15064 set random_r d_random_r
15065 eval $inlibc
15066 case "$d_random_r" in
15067 "$define")
15068         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15069         case "$d_random_r_proto:$usethreads" in
15070         ":define")      d_random_r_proto=define
15071                 set d_random_r_proto random_r $hdrs
15072                 eval $hasproto ;;
15073         *)      ;;
15074         esac
15075         case "$d_random_r_proto" in
15076         define)
15077         case "$random_r_proto" in
15078         ''|0) try='int random_r(int*, struct random_data*);'
15079         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15080         esac
15081         case "$random_r_proto" in
15082         ''|0) try='int random_r(long*, struct random_data*);'
15083         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15084         esac
15085         case "$random_r_proto" in
15086         ''|0) try='int random_r(struct random_data*, int32_t*);'
15087         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15088         esac
15089         case "$random_r_proto" in
15090         ''|0)   d_random_r=undef
15091                 random_r_proto=0
15092                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15093         * )     case "$random_r_proto" in
15094                 REENTRANT_PROTO*) ;;
15095                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15096                 esac
15097                 echo "Prototype: $try" ;;
15098         esac
15099         ;;
15100         *)      case "$usethreads" in
15101                 define) echo "random_r has no prototype, not using it." >&4 ;;
15102                 esac
15103                 d_random_r=undef
15104                 random_r_proto=0
15105                 ;;
15106         esac
15107         ;;
15108 *)      random_r_proto=0
15109         ;;
15110 esac
15111
15112 : see if readdir and friends exist
15113 set readdir d_readdir
15114 eval $inlibc
15115 set seekdir d_seekdir
15116 eval $inlibc
15117 set telldir d_telldir
15118 eval $inlibc
15119 set rewinddir d_rewinddir
15120 eval $inlibc
15121
15122 : see if readdir64_r exists
15123 set readdir64_r d_readdir64_r
15124 eval $inlibc
15125 case "$d_readdir64_r" in
15126 "$define")
15127         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15128         case "$d_readdir64_r_proto:$usethreads" in
15129         ":define")      d_readdir64_r_proto=define
15130                 set d_readdir64_r_proto readdir64_r $hdrs
15131                 eval $hasproto ;;
15132         *)      ;;
15133         esac
15134         case "$d_readdir64_r_proto" in
15135         define)
15136         case "$readdir64_r_proto" in
15137         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15138         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15139         esac
15140         case "$readdir64_r_proto" in
15141         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15142         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15143         esac
15144         case "$readdir64_r_proto" in
15145         ''|0)   d_readdir64_r=undef
15146                 readdir64_r_proto=0
15147                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15148         * )     case "$readdir64_r_proto" in
15149                 REENTRANT_PROTO*) ;;
15150                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15151                 esac
15152                 echo "Prototype: $try" ;;
15153         esac
15154         ;;
15155         *)      case "$usethreads" in
15156                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15157                 esac
15158                 d_readdir64_r=undef
15159                 readdir64_r_proto=0
15160                 ;;
15161         esac
15162         ;;
15163 *)      readdir64_r_proto=0
15164         ;;
15165 esac
15166
15167 : see if readdir_r exists
15168 set readdir_r d_readdir_r
15169 eval $inlibc
15170 case "$d_readdir_r" in
15171 "$define")
15172         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15173         case "$d_readdir_r_proto:$usethreads" in
15174         ":define")      d_readdir_r_proto=define
15175                 set d_readdir_r_proto readdir_r $hdrs
15176                 eval $hasproto ;;
15177         *)      ;;
15178         esac
15179         case "$d_readdir_r_proto" in
15180         define)
15181         case "$readdir_r_proto" in
15182         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15183         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15184         esac
15185         case "$readdir_r_proto" in
15186         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15187         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15188         esac
15189         case "$readdir_r_proto" in
15190         ''|0)   d_readdir_r=undef
15191                 readdir_r_proto=0
15192                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15193         * )     case "$readdir_r_proto" in
15194                 REENTRANT_PROTO*) ;;
15195                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15196                 esac
15197                 echo "Prototype: $try" ;;
15198         esac
15199         ;;
15200         *)      case "$usethreads" in
15201                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15202                 esac
15203                 d_readdir_r=undef
15204                 readdir_r_proto=0
15205                 ;;
15206         esac
15207         ;;
15208 *)      readdir_r_proto=0
15209         ;;
15210 esac
15211
15212 : see if readv exists
15213 set readv d_readv
15214 eval $inlibc
15215
15216 : see if recvmsg exists
15217 set recvmsg d_recvmsg
15218 eval $inlibc
15219
15220 : see if rename exists
15221 set rename d_rename
15222 eval $inlibc
15223
15224 : see if rmdir exists
15225 set rmdir d_rmdir
15226 eval $inlibc
15227
15228 : see if memory.h is available.
15229 val=''
15230 set memory.h val
15231 eval $inhdr
15232
15233 : See if it conflicts with string.h
15234 case "$val" in
15235 $define)
15236         case "$strings" in
15237         '') ;;
15238         *)
15239                 $cppstdin $cppflags $cppminus < $strings > mem.h
15240                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15241                         echo " "
15242                         echo "We won't be including <memory.h>."
15243                         val="$undef"
15244                 fi
15245                 $rm -f mem.h
15246                 ;;
15247         esac
15248 esac
15249 set i_memory
15250 eval $setvar
15251
15252 : can bcopy handle overlapping blocks?
15253 echo " "
15254 val="$undef"
15255 case "$d_memmove" in
15256 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15257 *)      case "$d_bcopy" in
15258         "$define")
15259                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15260                 $cat >try.c <<EOCP
15261 #$i_memory I_MEMORY
15262 #$i_stdlib I_STDLIB
15263 #$i_string I_STRING
15264 #$i_unistd I_UNISTD
15265 EOCP
15266         $cat >>try.c <<'EOCP'
15267 #include <stdio.h>
15268 #ifdef I_MEMORY
15269 #  include <memory.h>
15270 #endif
15271 #ifdef I_STDLIB
15272 #  include <stdlib.h>
15273 #endif
15274 #ifdef I_STRING
15275 #  include <string.h>
15276 #else
15277 #  include <strings.h>
15278 #endif
15279 #ifdef I_UNISTD
15280 #  include <unistd.h>  /* Needed for NetBSD */
15281 #endif
15282 int main()
15283 {
15284 char buf[128], abc[128];
15285 char *b;
15286 int len;
15287 int off;
15288 int align;
15289
15290 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15291    try to store the string in read-only memory. */
15292 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15293
15294 for (align = 7; align >= 0; align--) {
15295         for (len = 36; len; len--) {
15296                 b = buf+align;
15297                 bcopy(abc, b, len);
15298                 for (off = 1; off <= len; off++) {
15299                         bcopy(b, b+off, len);
15300                         bcopy(b+off, b, len);
15301                         if (bcmp(b, abc, len))
15302                                 exit(1);
15303                 }
15304         }
15305 }
15306 exit(0);
15307 }
15308 EOCP
15309                 set try
15310                 if eval $compile_ok; then
15311                         if ./try 2>/dev/null; then
15312                                 echo "Yes, it can."
15313                                 val="$define"
15314                         else
15315                                 echo "It can't, sorry."
15316                         fi
15317                 else
15318                         echo "(I can't compile the test program, so we'll assume not...)"
15319                 fi
15320                 ;;
15321         esac
15322         $rm -f try.* try core
15323         ;;
15324 esac
15325 set d_safebcpy
15326 eval $setvar
15327
15328 : can memcpy handle overlapping blocks?
15329 echo " "
15330 val="$undef"
15331 case "$d_memmove" in
15332 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15333 *)      case "$d_memcpy" in
15334         "$define")
15335                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15336                 $cat >try.c <<EOCP
15337 #$i_memory I_MEMORY
15338 #$i_stdlib I_STDLIB
15339 #$i_string I_STRING
15340 #$i_unistd I_UNISTD
15341 EOCP
15342         $cat >>try.c <<'EOCP'
15343 #include <stdio.h>
15344 #ifdef I_MEMORY
15345 #  include <memory.h>
15346 #endif
15347 #ifdef I_STDLIB
15348 #  include <stdlib.h>
15349 #endif
15350 #ifdef I_STRING
15351 #  include <string.h>
15352 #else
15353 #  include <strings.h>
15354 #endif
15355 #ifdef I_UNISTD
15356 #  include <unistd.h>  /* Needed for NetBSD */
15357 #endif
15358 int main()
15359 {
15360 char buf[128], abc[128];
15361 char *b;
15362 int len;
15363 int off;
15364 int align;
15365
15366 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15367    try to store the string in read-only memory. */
15368 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15369
15370 for (align = 7; align >= 0; align--) {
15371         for (len = 36; len; len--) {
15372                 b = buf+align;
15373                 memcpy(b, abc, len);
15374                 for (off = 1; off <= len; off++) {
15375                         memcpy(b+off, b, len);
15376                         memcpy(b, b+off, len);
15377                         if (memcmp(b, abc, len))
15378                                 exit(1);
15379                 }
15380         }
15381 }
15382 exit(0);
15383 }
15384 EOCP
15385                 set try
15386                 if eval $compile_ok; then
15387                         if ./try 2>/dev/null; then
15388                                 echo "Yes, it can."
15389                                 val="$define"
15390                         else
15391                                 echo "It can't, sorry."
15392                         fi
15393                 else
15394                         echo "(I can't compile the test program, so we'll assume not...)"
15395                 fi
15396                 ;;
15397         esac
15398         $rm -f try.* try core
15399         ;;
15400 esac
15401 set d_safemcpy
15402 eval $setvar
15403
15404 : can memcmp be trusted to compare relative magnitude?
15405 val="$undef"
15406 case "$d_memcmp" in
15407 "$define")
15408         echo " "
15409         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15410         $cat >try.c <<EOCP
15411 #$i_memory I_MEMORY
15412 #$i_stdlib I_STDLIB
15413 #$i_string I_STRING
15414 #$i_unistd I_UNISTD
15415 EOCP
15416         $cat >>try.c <<'EOCP'
15417 #include <stdio.h>
15418 #ifdef I_MEMORY
15419 #  include <memory.h>
15420 #endif
15421 #ifdef I_STDLIB
15422 #  include <stdlib.h>
15423 #endif
15424 #ifdef I_STRING
15425 #  include <string.h>
15426 #else
15427 #  include <strings.h>
15428 #endif
15429 #ifdef I_UNISTD
15430 #  include <unistd.h>  /* Needed for NetBSD */
15431 #endif
15432 int main()
15433 {
15434 char a = -1;
15435 char b = 0;
15436 if ((a < b) && memcmp(&a, &b, 1) < 0)
15437         exit(1);
15438 exit(0);
15439 }
15440 EOCP
15441         set try
15442         if eval $compile_ok; then
15443                 if $run ./try 2>/dev/null; then
15444                         echo "Yes, it can."
15445                         val="$define"
15446                 else
15447                         echo "No, it can't (it uses signed chars)."
15448                 fi
15449         else
15450                 echo "(I can't compile the test program, so we'll assume not...)"
15451         fi
15452         ;;
15453 esac
15454 $rm -f try.* try core
15455 set d_sanemcmp
15456 eval $setvar
15457
15458 : see if prototype for sbrk is available
15459 echo " "
15460 set d_sbrkproto sbrk $i_unistd unistd.h
15461 eval $hasproto
15462
15463 : see if select exists
15464 set select d_select
15465 eval $inlibc
15466
15467 : see if semctl exists
15468 set semctl d_semctl
15469 eval $inlibc
15470
15471 : see if semget exists
15472 set semget d_semget
15473 eval $inlibc
15474
15475 : see if semop exists
15476 set semop d_semop
15477 eval $inlibc
15478
15479 : see how much of the 'sem*(2)' library is present.
15480 h_sem=true
15481 echo " "
15482 case "$d_semctl$d_semget$d_semop" in
15483 *"$undef"*) h_sem=false;;
15484 esac
15485 case "$osname" in
15486 freebsd)
15487     case "`ipcs 2>&1`" in
15488     "SVID messages"*"not configured"*)
15489         echo "Your $osname does not have the sem*(2) configured." >&4
15490         h_sem=false
15491         val="$undef"
15492         set semctl d_semctl
15493         eval $setvar
15494         set semget d_semget
15495         eval $setvar
15496         set semop d_semop
15497         eval $setvar
15498         ;;
15499     esac
15500     ;;
15501 esac
15502 : we could also check for sys/ipc.h ...
15503 if $h_sem && $test `./findhdr sys/sem.h`; then
15504         echo "You have the full sem*(2) library." >&4
15505         val="$define"
15506 else
15507         echo "You don't have the full sem*(2) library." >&4
15508         val="$undef"
15509 fi
15510 set d_sem
15511 eval $setvar
15512
15513 : see whether sys/sem.h defines union semun
15514 echo " "
15515 $cat > try.c <<'END'
15516 #include <sys/types.h>
15517 #include <sys/ipc.h>
15518 #include <sys/sem.h>
15519 int main () { union semun semun; semun.buf = 0; }
15520 END
15521 set try
15522 if eval $compile; then
15523     echo "You have union semun in <sys/sem.h>." >&4
15524     val="$define"
15525 else
15526     echo "You do not have union semun in <sys/sem.h>." >&4
15527     val="$undef"
15528 fi
15529 $rm -f try try.c
15530 set d_union_semun
15531 eval $setvar
15532
15533 : see how to do semctl IPC_STAT
15534 case "$d_sem" in
15535 $define)
15536     echo " "
15537     $cat > try.h <<END
15538 #ifndef S_IRUSR
15539 #   ifdef S_IREAD
15540 #       define S_IRUSR S_IREAD
15541 #       define S_IWUSR S_IWRITE
15542 #       define S_IXUSR S_IEXEC
15543 #   else
15544 #       define S_IRUSR 0400
15545 #       define S_IWUSR 0200
15546 #       define S_IXUSR 0100
15547 #   endif
15548 #   define S_IRGRP (S_IRUSR>>3)
15549 #   define S_IWGRP (S_IWUSR>>3)
15550 #   define S_IXGRP (S_IXUSR>>3)
15551 #   define S_IROTH (S_IRUSR>>6)
15552 #   define S_IWOTH (S_IWUSR>>6)
15553 #   define S_IXOTH (S_IXUSR>>6)
15554 #endif
15555 #ifndef S_IRWXU
15556 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15557 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15558 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15559 #endif
15560 END
15561     : see whether semctl IPC_STAT can use union semun
15562     val="$undef"
15563     case "$d_semctl_semun" in
15564     '')
15565       $cat > try.c <<END
15566 #include <sys/types.h>
15567 #include <sys/ipc.h>
15568 #include <sys/sem.h>
15569 #include <sys/stat.h>
15570 #include <stdio.h>
15571 #include <errno.h>
15572 #include "try.h"
15573 #ifndef errno
15574 extern int errno;
15575 #endif
15576 #$d_union_semun HAS_UNION_SEMUN
15577 int main() {
15578     union semun
15579 #ifndef HAS_UNION_SEMUN
15580     {
15581         int val;
15582         struct semid_ds *buf;
15583         unsigned short *array;
15584     }
15585 #endif
15586     arg;
15587     int sem, st;
15588
15589 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15590     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15591     if (sem > -1) {
15592         struct semid_ds argbuf;
15593         arg.buf = &argbuf;
15594 #       ifdef IPC_STAT
15595         st = semctl(sem, 0, IPC_STAT, arg);
15596         if (st == 0)
15597             printf("semun\n");
15598         else
15599 #       endif /* IPC_STAT */
15600             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15601 #       ifdef IPC_RMID
15602         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15603 #       endif /* IPC_RMID */
15604             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15605     } else
15606 #endif /* IPC_PRIVATE && ... */
15607         printf("semget failed: errno = %d\n", errno);
15608   return 0;
15609 }
15610 END
15611       set try
15612       if eval $compile; then
15613           xxx=`$run ./try`
15614           case "$xxx" in
15615           semun) val="$define" ;;
15616           esac
15617       fi
15618       $rm -f try try.c
15619       ;;
15620     esac
15621     set d_semctl_semun
15622     eval $setvar
15623     case "$d_semctl_semun" in
15624     $define)
15625         echo "You can use union semun for semctl IPC_STAT." >&4
15626         also='also'
15627         ;;
15628     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15629         also=''
15630         ;;
15631     esac
15632
15633     : see whether semctl IPC_STAT can use struct semid_ds pointer
15634     val="$undef"
15635     case "$d_semctl_semid_ds" in
15636     '')
15637       $cat > try.c <<'END'
15638 #include <sys/types.h>
15639 #include <sys/ipc.h>
15640 #include <sys/sem.h>
15641 #include <sys/stat.h>
15642 #include "try.h"
15643 #include <stdio.h>
15644 #include <errno.h>
15645 #ifndef errno
15646 extern int errno;
15647 #endif
15648 int main() {
15649     struct semid_ds arg;
15650     int sem, st;
15651
15652 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15653     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15654     if (sem > -1) {
15655 #       ifdef IPC_STAT
15656         st = semctl(sem, 0, IPC_STAT, &arg);
15657         if (st == 0)
15658             printf("semid_ds\n");
15659         else
15660 #       endif /* IPC_STAT */
15661             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15662 #       ifdef IPC_RMID
15663         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15664 #       endif /* IPC_RMID */
15665             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15666     } else
15667 #endif /* IPC_PRIVATE && ... */
15668         printf("semget failed: errno = %d\n", errno);
15669
15670     return 0;
15671 }
15672 END
15673       set try
15674       if eval $compile; then
15675           xxx=`$run ./try`
15676           case "$xxx" in
15677           semid_ds) val="$define" ;;
15678           esac
15679       fi
15680       $rm -f try try.c
15681       ;;
15682     esac
15683     set d_semctl_semid_ds
15684     eval $setvar
15685     case "$d_semctl_semid_ds" in
15686     $define)
15687         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15688         ;;
15689     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15690         ;;
15691     esac
15692     $rm -f try.h
15693     ;;
15694 *)  val="$undef"
15695
15696     # We do not have the full sem*(2) library, so assume we can not
15697     # use either.
15698
15699     set d_semctl_semun
15700     eval $setvar
15701
15702     set d_semctl_semid_ds
15703     eval $setvar
15704     ;;
15705 esac
15706
15707 : see if sendmsg exists
15708 set sendmsg d_sendmsg
15709 eval $inlibc
15710
15711 : see if setegid exists
15712 set setegid d_setegid
15713 eval $inlibc
15714
15715 : see if seteuid exists
15716 set seteuid d_seteuid
15717 eval $inlibc
15718
15719 : see if setgrent exists
15720 set setgrent d_setgrent
15721 eval $inlibc
15722
15723 : see if setgrent_r exists
15724 set setgrent_r d_setgrent_r
15725 eval $inlibc
15726 case "$d_setgrent_r" in
15727 "$define")
15728         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15729         case "$d_setgrent_r_proto:$usethreads" in
15730         ":define")      d_setgrent_r_proto=define
15731                 set d_setgrent_r_proto setgrent_r $hdrs
15732                 eval $hasproto ;;
15733         *)      ;;
15734         esac
15735         case "$d_setgrent_r_proto" in
15736         define)
15737         case "$setgrent_r_proto" in
15738         ''|0) try='int setgrent_r(FILE**);'
15739         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15740         esac
15741         case "$setgrent_r_proto" in
15742         ''|0) try='void setgrent_r(FILE**);'
15743         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15744         esac
15745         case "$setgrent_r_proto" in
15746         ''|0)   d_setgrent_r=undef
15747                 setgrent_r_proto=0
15748                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15749         * )     case "$setgrent_r_proto" in
15750                 REENTRANT_PROTO*) ;;
15751                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15752                 esac
15753                 echo "Prototype: $try" ;;
15754         esac
15755         ;;
15756         *)      case "$usethreads" in
15757                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15758                 esac
15759                 d_setgrent_r=undef
15760                 setgrent_r_proto=0
15761                 ;;
15762         esac
15763         ;;
15764 *)      setgrent_r_proto=0
15765         ;;
15766 esac
15767
15768 : see if sethostent exists
15769 set sethostent d_sethent
15770 eval $inlibc
15771
15772 : see if sethostent_r exists
15773 set sethostent_r d_sethostent_r
15774 eval $inlibc
15775 case "$d_sethostent_r" in
15776 "$define")
15777         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15778         case "$d_sethostent_r_proto:$usethreads" in
15779         ":define")      d_sethostent_r_proto=define
15780                 set d_sethostent_r_proto sethostent_r $hdrs
15781                 eval $hasproto ;;
15782         *)      ;;
15783         esac
15784         case "$d_sethostent_r_proto" in
15785         define)
15786         case "$sethostent_r_proto" in
15787         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15788         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15789         esac
15790         case "$sethostent_r_proto" in
15791         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15792         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15793         esac
15794         case "$sethostent_r_proto" in
15795         ''|0)   d_sethostent_r=undef
15796                 sethostent_r_proto=0
15797                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15798         * )     case "$sethostent_r_proto" in
15799                 REENTRANT_PROTO*) ;;
15800                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15801                 esac
15802                 echo "Prototype: $try" ;;
15803         esac
15804         ;;
15805         *)      case "$usethreads" in
15806                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15807                 esac
15808                 d_sethostent_r=undef
15809                 sethostent_r_proto=0
15810                 ;;
15811         esac
15812         ;;
15813 *)      sethostent_r_proto=0
15814         ;;
15815 esac
15816
15817 : see if setitimer exists
15818 set setitimer d_setitimer
15819 eval $inlibc
15820
15821 : see if setlinebuf exists
15822 set setlinebuf d_setlinebuf
15823 eval $inlibc
15824
15825 : see if setlocale exists
15826 set setlocale d_setlocale
15827 eval $inlibc
15828
15829 : see if locale.h is available
15830 set locale.h i_locale
15831 eval $inhdr
15832
15833 : see if setlocale_r exists
15834 set setlocale_r d_setlocale_r
15835 eval $inlibc
15836 case "$d_setlocale_r" in
15837 "$define")
15838         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15839         case "$d_setlocale_r_proto:$usethreads" in
15840         ":define")      d_setlocale_r_proto=define
15841                 set d_setlocale_r_proto setlocale_r $hdrs
15842                 eval $hasproto ;;
15843         *)      ;;
15844         esac
15845         case "$d_setlocale_r_proto" in
15846         define)
15847         case "$setlocale_r_proto" in
15848         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15849         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15850         esac
15851         case "$setlocale_r_proto" in
15852         ''|0)   d_setlocale_r=undef
15853                 setlocale_r_proto=0
15854                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15855         * )     case "$setlocale_r_proto" in
15856                 REENTRANT_PROTO*) ;;
15857                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15858                 esac
15859                 echo "Prototype: $try" ;;
15860         esac
15861         ;;
15862         *)      case "$usethreads" in
15863                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15864                 esac
15865                 d_setlocale_r=undef
15866                 setlocale_r_proto=0
15867                 ;;
15868         esac
15869         ;;
15870 *)      setlocale_r_proto=0
15871         ;;
15872 esac
15873
15874 : see if setnetent exists
15875 set setnetent d_setnent
15876 eval $inlibc
15877
15878 : see if setnetent_r exists
15879 set setnetent_r d_setnetent_r
15880 eval $inlibc
15881 case "$d_setnetent_r" in
15882 "$define")
15883         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15884         case "$d_setnetent_r_proto:$usethreads" in
15885         ":define")      d_setnetent_r_proto=define
15886                 set d_setnetent_r_proto setnetent_r $hdrs
15887                 eval $hasproto ;;
15888         *)      ;;
15889         esac
15890         case "$d_setnetent_r_proto" in
15891         define)
15892         case "$setnetent_r_proto" in
15893         ''|0) try='int setnetent_r(int, struct netent_data*);'
15894         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15895         esac
15896         case "$setnetent_r_proto" in
15897         ''|0) try='void setnetent_r(int, struct netent_data*);'
15898         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15899         esac
15900         case "$setnetent_r_proto" in
15901         ''|0)   d_setnetent_r=undef
15902                 setnetent_r_proto=0
15903                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15904         * )     case "$setnetent_r_proto" in
15905                 REENTRANT_PROTO*) ;;
15906                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15907                 esac
15908                 echo "Prototype: $try" ;;
15909         esac
15910         ;;
15911         *)      case "$usethreads" in
15912                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15913                 esac
15914                 d_setnetent_r=undef
15915                 setnetent_r_proto=0
15916                 ;;
15917         esac
15918         ;;
15919 *)      setnetent_r_proto=0
15920         ;;
15921 esac
15922
15923 : see if setprotoent exists
15924 set setprotoent d_setpent
15925 eval $inlibc
15926
15927 : see if setpgid exists
15928 set setpgid d_setpgid
15929 eval $inlibc
15930
15931 : see if setpgrp2 exists
15932 set setpgrp2 d_setpgrp2
15933 eval $inlibc
15934
15935 : see if setpriority exists
15936 set setpriority d_setprior
15937 eval $inlibc
15938
15939 : see if setproctitle exists
15940 set setproctitle d_setproctitle
15941 eval $inlibc
15942
15943 : see if setprotoent_r exists
15944 set setprotoent_r d_setprotoent_r
15945 eval $inlibc
15946 case "$d_setprotoent_r" in
15947 "$define")
15948         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15949         case "$d_setprotoent_r_proto:$usethreads" in
15950         ":define")      d_setprotoent_r_proto=define
15951                 set d_setprotoent_r_proto setprotoent_r $hdrs
15952                 eval $hasproto ;;
15953         *)      ;;
15954         esac
15955         case "$d_setprotoent_r_proto" in
15956         define)
15957         case "$setprotoent_r_proto" in
15958         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15959         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15960         esac
15961         case "$setprotoent_r_proto" in
15962         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15963         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15964         esac
15965         case "$setprotoent_r_proto" in
15966         ''|0)   d_setprotoent_r=undef
15967                 setprotoent_r_proto=0
15968                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15969         * )     case "$setprotoent_r_proto" in
15970                 REENTRANT_PROTO*) ;;
15971                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15972                 esac
15973                 echo "Prototype: $try" ;;
15974         esac
15975         ;;
15976         *)      case "$usethreads" in
15977                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15978                 esac
15979                 d_setprotoent_r=undef
15980                 setprotoent_r_proto=0
15981                 ;;
15982         esac
15983         ;;
15984 *)      setprotoent_r_proto=0
15985         ;;
15986 esac
15987
15988 : see if setpwent exists
15989 set setpwent d_setpwent
15990 eval $inlibc
15991
15992 : see if setpwent_r exists
15993 set setpwent_r d_setpwent_r
15994 eval $inlibc
15995 case "$d_setpwent_r" in
15996 "$define")
15997         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15998         case "$d_setpwent_r_proto:$usethreads" in
15999         ":define")      d_setpwent_r_proto=define
16000                 set d_setpwent_r_proto setpwent_r $hdrs
16001                 eval $hasproto ;;
16002         *)      ;;
16003         esac
16004         case "$d_setpwent_r_proto" in
16005         define)
16006         case "$setpwent_r_proto" in
16007         ''|0) try='int setpwent_r(FILE**);'
16008         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16009         esac
16010         case "$setpwent_r_proto" in
16011         ''|0) try='void setpwent_r(FILE**);'
16012         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16013         esac
16014         case "$setpwent_r_proto" in
16015         ''|0)   d_setpwent_r=undef
16016                 setpwent_r_proto=0
16017                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16018         * )     case "$setpwent_r_proto" in
16019                 REENTRANT_PROTO*) ;;
16020                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16021                 esac
16022                 echo "Prototype: $try" ;;
16023         esac
16024         ;;
16025         *)      case "$usethreads" in
16026                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16027                 esac
16028                 d_setpwent_r=undef
16029                 setpwent_r_proto=0
16030                 ;;
16031         esac
16032         ;;
16033 *)      setpwent_r_proto=0
16034         ;;
16035 esac
16036
16037 : see if setregid exists
16038 set setregid d_setregid
16039 eval $inlibc
16040 set setresgid d_setresgid
16041 eval $inlibc
16042
16043 : see if setreuid exists
16044 set setreuid d_setreuid
16045 eval $inlibc
16046 set setresuid d_setresuid
16047 eval $inlibc
16048
16049 : see if setrgid exists
16050 set setrgid d_setrgid
16051 eval $inlibc
16052
16053 : see if setruid exists
16054 set setruid d_setruid
16055 eval $inlibc
16056
16057 : see if setservent exists
16058 set setservent d_setsent
16059 eval $inlibc
16060
16061 : see if setservent_r exists
16062 set setservent_r d_setservent_r
16063 eval $inlibc
16064 case "$d_setservent_r" in
16065 "$define")
16066         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16067         case "$d_setservent_r_proto:$usethreads" in
16068         ":define")      d_setservent_r_proto=define
16069                 set d_setservent_r_proto setservent_r $hdrs
16070                 eval $hasproto ;;
16071         *)      ;;
16072         esac
16073         case "$d_setservent_r_proto" in
16074         define)
16075         case "$setservent_r_proto" in
16076         ''|0) try='int setservent_r(int, struct servent_data*);'
16077         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16078         esac
16079         case "$setservent_r_proto" in
16080         ''|0) try='void setservent_r(int, struct servent_data*);'
16081         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16082         esac
16083         case "$setservent_r_proto" in
16084         ''|0)   d_setservent_r=undef
16085                 setservent_r_proto=0
16086                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16087         * )     case "$setservent_r_proto" in
16088                 REENTRANT_PROTO*) ;;
16089                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16090                 esac
16091                 echo "Prototype: $try" ;;
16092         esac
16093         ;;
16094         *)      case "$usethreads" in
16095                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16096                 esac
16097                 d_setservent_r=undef
16098                 setservent_r_proto=0
16099                 ;;
16100         esac
16101         ;;
16102 *)      setservent_r_proto=0
16103         ;;
16104 esac
16105
16106 : see if setsid exists
16107 set setsid d_setsid
16108 eval $inlibc
16109
16110 : see if setvbuf exists
16111 set setvbuf d_setvbuf
16112 eval $inlibc
16113
16114 : see if sfio.h is available
16115 set sfio.h i_sfio
16116 eval $inhdr
16117
16118
16119 : see if sfio library is available
16120 case "$i_sfio" in
16121 $define)
16122         val=''
16123         set sfreserve val
16124         eval $inlibc
16125         ;;
16126 *)
16127         val="$undef"
16128         ;;
16129 esac
16130 : Ok, but do we want to use it.
16131 case "$val" in
16132 $define)
16133         case "$usesfio" in
16134         true|$define|[yY]*) dflt='y';;
16135         *) dflt='n';;
16136         esac
16137         echo "$package can use the sfio library, but it is experimental."
16138         case "$useperlio" in
16139         "$undef")
16140             echo "For sfio also the PerlIO abstraction layer is needed."
16141             echo "Earlier you said you wouldn't want that."
16142             ;;
16143         esac
16144         rp="You seem to have sfio available, do you want to try using it?"
16145         . ./myread
16146         case "$ans" in
16147         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16148                 useperlio="$define"
16149                 val="$define"
16150                 ;;
16151         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16152                 val="$undef"
16153                 ;;
16154         esac
16155         ;;
16156 *)      case "$usesfio" in
16157         true|$define|[yY]*)
16158                 echo "Sorry, cannot find sfio on this machine." >&4
16159                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16160                 val="$undef"
16161                 ;;
16162         esac
16163         ;;
16164 esac
16165 set d_sfio
16166 eval $setvar
16167 case "$d_sfio" in
16168 $define) usesfio='true';;
16169 *) usesfio='false';;
16170 esac
16171 case "$d_sfio" in
16172 $define) ;;
16173 *)      : Remove sfio from list of libraries to use
16174         case "$libs" in
16175         *-lsfio*)
16176                 echo "Removing unneeded -lsfio from library list" >&4
16177                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16178                 shift
16179                 libs="$*"
16180                 echo "libs = $libs" >&4
16181                 ;;
16182         esac
16183 ;;
16184 esac
16185
16186
16187 : see if shmctl exists
16188 set shmctl d_shmctl
16189 eval $inlibc
16190
16191 : see if shmget exists
16192 set shmget d_shmget
16193 eval $inlibc
16194
16195 : see if shmat exists
16196 set shmat d_shmat
16197 eval $inlibc
16198 : see what shmat returns
16199 case "$d_shmat" in
16200 "$define")
16201         $cat >shmat.c <<'END'
16202 #include <sys/shm.h>
16203 void *shmat();
16204 END
16205         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16206                 shmattype='void *'
16207         else
16208                 shmattype='char *'
16209         fi
16210         echo "and it returns ($shmattype)." >&4
16211         : see if a prototype for shmat is available
16212         xxx=`./findhdr sys/shm.h`
16213         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16214         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16215                 val="$define"
16216         else
16217                 val="$undef"
16218         fi
16219         $rm -f shmat.[co]
16220         ;;
16221 *)
16222         val="$undef"
16223         ;;
16224 esac
16225 set d_shmatprototype
16226 eval $setvar
16227
16228 : see if shmdt exists
16229 set shmdt d_shmdt
16230 eval $inlibc
16231
16232 : see how much of the 'shm*(2)' library is present.
16233 h_shm=true
16234 echo " "
16235 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16236 *"$undef"*) h_shm=false;;
16237 esac
16238 case "$osname" in
16239 freebsd)
16240     case "`ipcs 2>&1`" in
16241     "SVID shared memory"*"not configured"*)
16242         echo "Your $osname does not have the shm*(2) configured." >&4
16243         h_shm=false
16244         val="$undef"
16245         set shmctl d_shmctl
16246         evat $setvar
16247         set shmget d_shmget
16248         evat $setvar
16249         set shmat d_shmat
16250         evat $setvar
16251         set shmdt d_shmdt
16252         evat $setvar
16253         ;;
16254     esac
16255     ;;
16256 esac
16257 : we could also check for sys/ipc.h ...
16258 if $h_shm && $test `./findhdr sys/shm.h`; then
16259         echo "You have the full shm*(2) library." >&4
16260         val="$define"
16261 else
16262         echo "You don't have the full shm*(2) library." >&4
16263         val="$undef"
16264 fi
16265 set d_shm
16266 eval $setvar
16267
16268 echo " "
16269 : see if we have sigaction
16270 if set sigaction val -f d_sigaction; eval $csym; $val; then
16271         echo 'sigaction() found.' >&4
16272         $cat > try.c <<EOP
16273 #include <stdio.h>
16274 #include <sys/types.h>
16275 #include <signal.h>
16276 #$i_stdlib I_STDLIB
16277 #ifdef I_STDLIB
16278 #include <stdlib.h>
16279 #endif
16280 int main()
16281 {
16282     struct sigaction act, oact;
16283     act.sa_flags = 0;
16284     oact.sa_handler = 0;
16285     /* so that act and oact are used */
16286     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16287 }
16288 EOP
16289         set try
16290         if eval $compile_ok; then
16291                 val="$define"
16292         else
16293                 echo "But you don't seem to have a useable struct sigaction." >&4
16294                 val="$undef"
16295         fi
16296 else
16297         echo 'sigaction NOT found.' >&4
16298         val="$undef"
16299 fi
16300 set d_sigaction; eval $setvar
16301 $rm -f try try$_o try.c
16302
16303 : see if sigprocmask exists
16304 set sigprocmask d_sigprocmask
16305 eval $inlibc
16306
16307 : see if sigsetjmp exists
16308 echo " "
16309 case "$d_sigsetjmp" in
16310 '')
16311         $cat >try.c <<EOP
16312 #include <setjmp.h>
16313 #$i_stdlib I_STDLIB
16314 #ifdef I_STDLIB
16315 #include <stdlib.h>
16316 #endif
16317 sigjmp_buf env;
16318 int set = 1;
16319 int main()
16320 {
16321         if (sigsetjmp(env,1))
16322                 exit(set);
16323         set = 0;
16324         siglongjmp(env, 1);
16325         exit(1);
16326 }
16327 EOP
16328         set try
16329         if eval $compile; then
16330                 if $run ./try >/dev/null 2>&1; then
16331                         echo "POSIX sigsetjmp found." >&4
16332                         val="$define"
16333                 else
16334                         $cat >&4 <<EOM
16335 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16336 I'll ignore them.
16337 EOM
16338                         val="$undef"
16339                 fi
16340         else
16341                 echo "sigsetjmp not found." >&4
16342                 val="$undef"
16343         fi
16344         ;;
16345 *) val="$d_sigsetjmp"
16346         case "$d_sigsetjmp" in
16347         $define) echo "POSIX sigsetjmp found." >&4;;
16348         $undef) echo "sigsetjmp not found." >&4;;
16349         esac
16350         ;;
16351 esac
16352 set d_sigsetjmp
16353 eval $setvar
16354 $rm -f try.c try
16355
16356 : see if sockatmark exists
16357 set sockatmark d_sockatmark
16358 eval $inlibc
16359
16360 : see if prototype for sockatmark is available
16361 echo " "
16362 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16363 eval $hasproto
16364
16365 : see if socks5_init exists
16366 set socks5_init d_socks5_init
16367 eval $inlibc
16368
16369 : see if srand48_r exists
16370 set srand48_r d_srand48_r
16371 eval $inlibc
16372 case "$d_srand48_r" in
16373 "$define")
16374         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16375         case "$d_srand48_r_proto:$usethreads" in
16376         ":define")      d_srand48_r_proto=define
16377                 set d_srand48_r_proto srand48_r $hdrs
16378                 eval $hasproto ;;
16379         *)      ;;
16380         esac
16381         case "$d_srand48_r_proto" in
16382         define)
16383         case "$srand48_r_proto" in
16384         ''|0) try='int srand48_r(long, struct drand48_data*);'
16385         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16386         esac
16387         case "$srand48_r_proto" in
16388         ''|0)   d_srand48_r=undef
16389                 srand48_r_proto=0
16390                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16391         * )     case "$srand48_r_proto" in
16392                 REENTRANT_PROTO*) ;;
16393                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16394                 esac
16395                 echo "Prototype: $try" ;;
16396         esac
16397         ;;
16398         *)      case "$usethreads" in
16399                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16400                 esac
16401                 d_srand48_r=undef
16402                 srand48_r_proto=0
16403                 ;;
16404         esac
16405         ;;
16406 *)      srand48_r_proto=0
16407         ;;
16408 esac
16409
16410 : see if srandom_r exists
16411 set srandom_r d_srandom_r
16412 eval $inlibc
16413 case "$d_srandom_r" in
16414 "$define")
16415         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16416         case "$d_srandom_r_proto:$usethreads" in
16417         ":define")      d_srandom_r_proto=define
16418                 set d_srandom_r_proto srandom_r $hdrs
16419                 eval $hasproto ;;
16420         *)      ;;
16421         esac
16422         case "$d_srandom_r_proto" in
16423         define)
16424         case "$srandom_r_proto" in
16425         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16426         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16427         esac
16428         case "$srandom_r_proto" in
16429         ''|0)   d_srandom_r=undef
16430                 srandom_r_proto=0
16431                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16432         * )     case "$srandom_r_proto" in
16433                 REENTRANT_PROTO*) ;;
16434                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16435                 esac
16436                 echo "Prototype: $try" ;;
16437         esac
16438         ;;
16439         *)      case "$usethreads" in
16440                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16441                 esac
16442                 d_srandom_r=undef
16443                 srandom_r_proto=0
16444                 ;;
16445         esac
16446         ;;
16447 *)      srandom_r_proto=0
16448         ;;
16449 esac
16450
16451 : see if prototype for setresgid is available
16452 echo " "
16453 set d_sresgproto setresgid $i_unistd unistd.h
16454 eval $hasproto
16455
16456 : see if prototype for setresuid is available
16457 echo " "
16458 set d_sresuproto setresuid $i_unistd unistd.h
16459 eval $hasproto
16460
16461 : see if sys/stat.h is available
16462 set sys/stat.h i_sysstat
16463 eval $inhdr
16464
16465
16466 : see if stat knows about block sizes
16467 echo " "
16468 echo "Checking to see if your struct stat has st_blocks field..." >&4
16469 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16470 eval $hasfield
16471
16472
16473 : see if this is a sys/vfs.h system
16474 set sys/vfs.h i_sysvfs
16475 eval $inhdr
16476
16477
16478 : see if this is a sys/statfs.h system
16479 set sys/statfs.h i_sysstatfs
16480 eval $inhdr
16481
16482
16483 echo " "
16484 echo "Checking to see if your system supports struct statfs..." >&4
16485 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
16486 eval $hasstruct
16487 case "$d_statfs_s" in
16488 "$define")      echo "Yes, it does."   ;;
16489 *)              echo "No, it doesn't." ;;
16490 esac
16491
16492
16493
16494 : see if struct statfs knows about f_flags
16495 case "$d_statfs_s" in
16496 define) 
16497         echo " "
16498         echo "Checking to see if your struct statfs has f_flags field..." >&4
16499         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
16500         eval $hasfield
16501         ;;
16502 *)      val="$undef"
16503         set d_statfs_f_flags
16504         eval $setvar
16505         ;;
16506 esac
16507 case "$d_statfs_f_flags" in
16508 "$define")      echo "Yes, it does."   ;;
16509 *)              echo "No, it doesn't." ;;
16510 esac
16511
16512 $cat >&4 <<EOM
16513 Checking how to access stdio streams by file descriptor number...
16514 EOM
16515 case "$stdio_stream_array" in
16516 '')     $cat >try.c <<EOCP
16517 #include <stdio.h>
16518 int main() {
16519   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16520     printf("yes\n");
16521 }
16522 EOCP
16523         for s in _iob __iob __sF
16524         do
16525                 set try -DSTDIO_STREAM_ARRAY=$s
16526                 if eval $compile; then
16527                         case "`$run ./try`" in
16528                         yes)    stdio_stream_array=$s; break ;;
16529                         esac
16530                 fi
16531         done
16532         $rm -f try.* try$exe_ext
16533 esac
16534 case "$stdio_stream_array" in
16535 '')     $cat >&4 <<EOM
16536 I can't figure out how to access stdio streams by file descriptor number.
16537 EOM
16538         d_stdio_stream_array="$undef"
16539         ;;
16540 *)      $cat >&4 <<EOM
16541 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16542 EOM
16543         d_stdio_stream_array="$define"
16544         ;;
16545 esac
16546
16547 : see if strcoll exists
16548 set strcoll d_strcoll
16549 eval $inlibc
16550
16551 : check for structure copying
16552 echo " "
16553 echo "Checking to see if your C compiler can copy structs..." >&4
16554 $cat >try.c <<'EOCP'
16555 int main()
16556 {
16557         struct blurfl {
16558                 int dyick;
16559         } foo, bar;
16560
16561         foo = bar;
16562 }
16563 EOCP
16564 if $cc -c try.c >/dev/null 2>&1 ; then
16565         val="$define"
16566         echo "Yup, it can."
16567 else
16568         val="$undef"
16569         echo "Nope, it can't."
16570 fi
16571 set d_strctcpy
16572 eval $setvar
16573 $rm -f try.*
16574
16575 : see if strerror and/or sys_errlist[] exist
16576 echo " "
16577 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16578     if set strerror val -f d_strerror; eval $csym; $val; then
16579                 echo 'strerror() found.' >&4
16580                 d_strerror="$define"
16581                 d_strerrm='strerror(e)'
16582                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16583                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16584                         d_syserrlst="$define"
16585                 else
16586                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16587                         d_syserrlst="$undef"
16588                 fi
16589     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16590                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16591                 echo 'strerror() found in string header.' >&4
16592                 d_strerror="$define"
16593                 d_strerrm='strerror(e)'
16594                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16595                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16596                                 d_syserrlst="$define"
16597                 else
16598                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16599                         d_syserrlst="$undef"
16600                 fi
16601     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16602                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16603                 d_strerror="$undef"
16604                 d_syserrlst="$define"
16605                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16606     else
16607                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16608                 d_strerror="$undef"
16609                 d_syserrlst="$undef"
16610                 d_strerrm='"unknown"'
16611     fi
16612 fi
16613
16614 : see if strerror_r exists
16615 set strerror_r d_strerror_r
16616 eval $inlibc
16617 case "$d_strerror_r" in
16618 "$define")
16619         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16620         case "$d_strerror_r_proto:$usethreads" in
16621         ":define")      d_strerror_r_proto=define
16622                 set d_strerror_r_proto strerror_r $hdrs
16623                 eval $hasproto ;;
16624         *)      ;;
16625         esac
16626         case "$d_strerror_r_proto" in
16627         define)
16628         case "$strerror_r_proto" in
16629         ''|0) try='int strerror_r(int, char*, size_t);'
16630         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16631         esac
16632         case "$strerror_r_proto" in
16633         ''|0) try='int strerror_r(int, char*, int);'
16634         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16635         esac
16636         case "$strerror_r_proto" in
16637         ''|0) try='char* strerror_r(int, char*, size_t);'
16638         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16639         esac
16640         case "$strerror_r_proto" in
16641         ''|0)   d_strerror_r=undef
16642                 strerror_r_proto=0
16643                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16644         * )     case "$strerror_r_proto" in
16645                 REENTRANT_PROTO*) ;;
16646                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16647                 esac
16648                 echo "Prototype: $try" ;;
16649         esac
16650         ;;
16651         *)      case "$usethreads" in
16652                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16653                 esac
16654                 d_strerror_r=undef
16655                 strerror_r_proto=0
16656                 ;;
16657         esac
16658         ;;
16659 *)      strerror_r_proto=0
16660         ;;
16661 esac
16662
16663 : see if strftime exists
16664 set strftime d_strftime
16665 eval $inlibc
16666
16667 : see if strlcat exists
16668 set strlcat d_strlcat
16669 eval $inlibc
16670
16671 : see if strlcpy exists
16672 set strlcpy d_strlcpy
16673 eval $inlibc
16674
16675 : see if strtod exists
16676 set strtod d_strtod
16677 eval $inlibc
16678
16679 : see if strtol exists
16680 set strtol d_strtol
16681 eval $inlibc
16682
16683 : see if strtold exists
16684 set strtold d_strtold
16685 eval $inlibc
16686
16687 : see if strtoll exists
16688 set strtoll d_strtoll
16689 eval $inlibc
16690
16691 case "$d_longlong-$d_strtoll" in
16692 "$define-$define")
16693         $cat <<EOM
16694 Checking whether your strtoll() works okay...
16695 EOM
16696         $cat >try.c <<'EOCP'
16697 #include <errno.h>
16698 #ifdef __hpux
16699 #define strtoll __strtoll
16700 #endif
16701 #ifdef __EMX__
16702 #define strtoll _strtoll
16703 #endif
16704 #include <stdio.h>
16705 extern long long int strtoll(char *s, char **, int); 
16706 static int bad = 0;
16707 int check(char *s, long long ell, int een) {
16708         long long gll;
16709         errno = 0;
16710         gll = strtoll(s, 0, 10);
16711         if (!((gll == ell) && (errno == een)))
16712                 bad++;
16713 }
16714 int main() {
16715         check(" 1",                                      1LL, 0);
16716         check(" 0",                                      0LL, 0);
16717         check("-1",                                     -1LL, 0);
16718         check("-9223372036854775808", -9223372036854775808LL, 0);
16719         check("-9223372036854775808", -9223372036854775808LL, 0);
16720         check(" 9223372036854775807",  9223372036854775807LL, 0);
16721         check("-9223372036854775808", -9223372036854775808LL, 0);
16722         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16723         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16724         if (!bad)
16725                 printf("ok\n");
16726 }
16727 EOCP
16728         set try
16729         if eval $compile; then
16730                 yyy=`$run ./try`
16731                 case "$yyy" in
16732                 ok) echo "Your strtoll() seems to be working okay." ;;
16733                 *) cat <<EOM >&4
16734 Your strtoll() doesn't seem to be working okay.
16735 EOM
16736                    d_strtoll="$undef"
16737                    ;;
16738                 esac
16739         else
16740                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16741                 d_strtoll="$undef"
16742         fi
16743         ;;
16744 esac
16745
16746 : see if strtoq exists
16747 set strtoq d_strtoq
16748 eval $inlibc
16749
16750 : see if strtoul exists
16751 set strtoul d_strtoul
16752 eval $inlibc
16753
16754 case "$d_strtoul" in
16755 "$define")
16756         $cat <<EOM
16757 Checking whether your strtoul() works okay...
16758 EOM
16759         $cat >try.c <<'EOCP'
16760 #include <errno.h>
16761 #include <stdio.h>
16762 extern unsigned long int strtoul(char *s, char **, int); 
16763 static int bad = 0;
16764 void check(char *s, unsigned long eul, int een) {
16765         unsigned long gul;
16766         errno = 0;
16767         gul = strtoul(s, 0, 10);
16768         if (!((gul == eul) && (errno == een)))
16769                 bad++;
16770 }
16771 int main() {
16772         check(" 1", 1L, 0);
16773         check(" 0", 0L, 0);
16774 EOCP
16775         case "$longsize" in
16776         8)
16777             $cat >>try.c <<'EOCP'
16778         check("18446744073709551615", 18446744073709551615UL, 0);
16779         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16780 #if 0 /* strtoul() for /^-/ strings is undefined. */
16781         check("-1", 18446744073709551615UL, 0);
16782         check("-18446744073709551614", 2, 0);
16783         check("-18446744073709551615", 1, 0);
16784         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16785         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16786 #endif
16787 EOCP
16788                 ;;
16789         4)
16790                     $cat >>try.c <<'EOCP'
16791         check("4294967295", 4294967295UL, 0);
16792         check("4294967296", 4294967295UL, ERANGE);
16793 #if 0 /* strtoul() for /^-/ strings is undefined. */
16794         check("-1", 4294967295UL, 0);
16795         check("-4294967294", 2, 0);
16796         check("-4294967295", 1, 0);
16797         check("-4294967296", 4294967295UL, ERANGE);
16798         check("-4294967297", 4294967295UL, ERANGE);
16799 #endif
16800 EOCP
16801                 ;;
16802         *)
16803 : Should we write these tests to be more portable by sprintf-ing
16804 : ~0 and then manipulating that char string as input for strtol?
16805                 ;;
16806         esac
16807         $cat >>try.c <<'EOCP'
16808         if (!bad)
16809                 printf("ok\n");
16810         return 0;
16811 }
16812 EOCP
16813         set try
16814         if eval $compile; then
16815                 case "`$run ./try`" in
16816                 ok) echo "Your strtoul() seems to be working okay." ;;
16817                 *) cat <<EOM >&4
16818 Your strtoul() doesn't seem to be working okay.
16819 EOM
16820                    d_strtoul="$undef"
16821                    ;;
16822                 esac
16823         fi
16824         ;;
16825 esac
16826
16827 : see if strtoull exists
16828 set strtoull d_strtoull
16829 eval $inlibc
16830
16831 case "$d_longlong-$d_strtoull" in
16832 "$define-$define")
16833         $cat <<EOM
16834 Checking whether your strtoull() works okay...
16835 EOM
16836         $cat >try.c <<'EOCP'
16837 #include <errno.h>
16838 #ifdef __hpux
16839 #define strtoull __strtoull
16840 #endif
16841 #include <stdio.h>
16842 extern unsigned long long int strtoull(char *s, char **, int); 
16843 static int bad = 0;
16844 int check(char *s, long long eull, int een) {
16845         long long gull;
16846         errno = 0;
16847         gull = strtoull(s, 0, 10);
16848         if (!((gull == eull) && (errno == een)))
16849                 bad++;
16850 }
16851 int main() {
16852         check(" 1",                                        1LL, 0);
16853         check(" 0",                                        0LL, 0);
16854         check("18446744073709551615",  18446744073709551615ULL, 0);
16855         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16856 #if 0 /* strtoull() for /^-/ strings is undefined. */
16857         check("-1",                    18446744073709551615ULL, 0);
16858         check("-18446744073709551614",                     2LL, 0);
16859         check("-18446744073709551615",                     1LL, 0);
16860         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16861         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16862 #endif
16863         if (!bad)
16864                 printf("ok\n");
16865 }
16866 EOCP
16867         set try
16868         if eval $compile; then
16869                 case "`$run ./try`" in
16870                 ok) echo "Your strtoull() seems to be working okay." ;;
16871                 *) cat <<EOM >&4
16872 Your strtoull() doesn't seem to be working okay.
16873 EOM
16874                    d_strtoull="$undef"
16875                    ;;
16876                 esac
16877         fi
16878         ;;
16879 esac
16880
16881 : see if strtouq exists
16882 set strtouq d_strtouq
16883 eval $inlibc
16884
16885 case "$d_strtouq" in
16886 "$define")
16887         $cat <<EOM
16888 Checking whether your strtouq() works okay...
16889 EOM
16890         $cat >try.c <<'EOCP'
16891 #include <errno.h>
16892 #include <stdio.h>
16893 extern unsigned long long int strtouq(char *s, char **, int); 
16894 static int bad = 0;
16895 void check(char *s, unsigned long long eull, int een) {
16896         unsigned long long gull;
16897         errno = 0;
16898         gull = strtouq(s, 0, 10);
16899         if (!((gull == eull) && (errno == een)))
16900                 bad++;
16901 }
16902 int main() {
16903         check(" 1",                                        1LL, 0);
16904         check(" 0",                                        0LL, 0);
16905         check("18446744073709551615",  18446744073709551615ULL, 0);
16906         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16907 #if 0 /* strtouq() for /^-/ strings is undefined. */
16908         check("-1",                    18446744073709551615ULL, 0);
16909         check("-18446744073709551614",                     2LL, 0);
16910         check("-18446744073709551615",                     1LL, 0);
16911         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16912         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16913 #endif
16914         if (!bad)
16915                 printf("ok\n");
16916         return 0;
16917 }
16918 EOCP
16919         set try
16920         if eval $compile; then
16921                 case "`$run ./try`" in
16922                 ok) echo "Your strtouq() seems to be working okay." ;;
16923                 *) cat <<EOM >&4
16924 Your strtouq() doesn't seem to be working okay.
16925 EOM
16926                    d_strtouq="$undef"
16927                    ;;
16928                 esac
16929         fi
16930         ;;
16931 esac
16932
16933 : see if strxfrm exists
16934 set strxfrm d_strxfrm
16935 eval $inlibc
16936
16937 : see if symlink exists
16938 set symlink d_symlink
16939 eval $inlibc
16940
16941 : see if syscall exists
16942 set syscall d_syscall
16943 eval $inlibc
16944
16945 : see if prototype for syscall is available
16946 echo " "
16947 set d_syscallproto syscall $i_unistd unistd.h
16948 eval $hasproto
16949
16950 : see if sysconf exists
16951 set sysconf d_sysconf
16952 eval $inlibc
16953
16954 : see if system exists
16955 set system d_system
16956 eval $inlibc
16957
16958 : see if tcgetpgrp exists
16959 set tcgetpgrp d_tcgetpgrp
16960 eval $inlibc
16961
16962 : see if tcsetpgrp exists
16963 set tcsetpgrp d_tcsetpgrp
16964 eval $inlibc
16965
16966 : see if prototype for telldir is available
16967 echo " "
16968 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16969 eval $hasproto
16970
16971 : see if time exists
16972 echo " "
16973 if test "X$d_time" = X -o X"$timetype" = X; then
16974     if set time val -f d_time; eval $csym; $val; then
16975                 echo 'time() found.' >&4
16976                 val="$define"
16977                 rp="What is the type returned by time() on this system?"
16978                 set time_t timetype long stdio.h sys/types.h
16979                 eval $typedef_ask
16980     else
16981                 echo 'time() not found, hope that will do.' >&4
16982                 val="$undef"
16983                 timetype='int';
16984     fi
16985     set d_time
16986     eval $setvar
16987 fi
16988
16989 : see if this is a sys/times.h system
16990 set sys/times.h i_systimes
16991 eval $inhdr
16992
16993 : see if times exists
16994 echo " "
16995 if set times val -f d_times; eval $csym; $val; then
16996         echo 'times() found.' >&4
16997         d_times="$define"
16998         inc=''
16999         case "$i_systimes" in
17000         "$define") inc='sys/times.h';;
17001         esac
17002         rp="What is the type returned by times() on this system?"
17003         set clock_t clocktype long stdio.h sys/types.h $inc
17004         eval $typedef_ask
17005 else
17006         echo 'times() NOT found, hope that will do.' >&4
17007         d_times="$undef"
17008         clocktype='int'
17009 fi
17010
17011 : see if tmpnam_r exists
17012 set tmpnam_r d_tmpnam_r
17013 eval $inlibc
17014 case "$d_tmpnam_r" in
17015 "$define")
17016         hdrs="$i_systypes sys/types.h define stdio.h "
17017         case "$d_tmpnam_r_proto:$usethreads" in
17018         ":define")      d_tmpnam_r_proto=define
17019                 set d_tmpnam_r_proto tmpnam_r $hdrs
17020                 eval $hasproto ;;
17021         *)      ;;
17022         esac
17023         case "$d_tmpnam_r_proto" in
17024         define)
17025         case "$tmpnam_r_proto" in
17026         ''|0) try='char* tmpnam_r(char*);'
17027         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17028         esac
17029         case "$tmpnam_r_proto" in
17030         ''|0)   d_tmpnam_r=undef
17031                 tmpnam_r_proto=0
17032                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17033         * )     case "$tmpnam_r_proto" in
17034                 REENTRANT_PROTO*) ;;
17035                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17036                 esac
17037                 echo "Prototype: $try" ;;
17038         esac
17039         ;;
17040         *)      case "$usethreads" in
17041                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17042                 esac
17043                 d_tmpnam_r=undef
17044                 tmpnam_r_proto=0
17045                 ;;
17046         esac
17047         ;;
17048 *)      tmpnam_r_proto=0
17049         ;;
17050 esac
17051
17052 : see if truncate exists
17053 set truncate d_truncate
17054 eval $inlibc
17055
17056 : see if ttyname_r exists
17057 set ttyname_r d_ttyname_r
17058 eval $inlibc
17059 case "$d_ttyname_r" in
17060 "$define")
17061         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17062         case "$d_ttyname_r_proto:$usethreads" in
17063         ":define")      d_ttyname_r_proto=define
17064                 set d_ttyname_r_proto ttyname_r $hdrs
17065                 eval $hasproto ;;
17066         *)      ;;
17067         esac
17068         case "$d_ttyname_r_proto" in
17069         define)
17070         case "$ttyname_r_proto" in
17071         ''|0) try='int ttyname_r(int, char*, size_t);'
17072         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17073         esac
17074         case "$ttyname_r_proto" in
17075         ''|0) try='int ttyname_r(int, char*, int);'
17076         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17077         esac
17078         case "$ttyname_r_proto" in
17079         ''|0) try='char* ttyname_r(int, char*, int);'
17080         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17081         esac
17082         case "$ttyname_r_proto" in
17083         ''|0)   d_ttyname_r=undef
17084                 ttyname_r_proto=0
17085                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17086         * )     case "$ttyname_r_proto" in
17087                 REENTRANT_PROTO*) ;;
17088                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17089                 esac
17090                 echo "Prototype: $try" ;;
17091         esac
17092         ;;
17093         *)      case "$usethreads" in
17094                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17095                 esac
17096                 d_ttyname_r=undef
17097                 ttyname_r_proto=0
17098                 ;;
17099         esac
17100         ;;
17101 *)      ttyname_r_proto=0
17102         ;;
17103 esac
17104
17105 : see if tzname[] exists
17106 echo " "
17107 if set tzname val -a d_tzname; eval $csym; $val; then
17108         val="$define"
17109         echo 'tzname[] found.' >&4
17110 else
17111         val="$undef"
17112         echo 'tzname[] NOT found.' >&4
17113 fi
17114 set d_tzname
17115 eval $setvar
17116
17117 case "$osname" in
17118 next|rhapsody|darwin) multiarch="$define" ;;
17119 esac
17120 case "$multiarch" in
17121 ''|[nN]*) multiarch="$undef" ;;
17122 esac
17123
17124 : check for ordering of bytes in a UV
17125 echo " "
17126 case "$usecrosscompile$multiarch" in
17127 *$define*)
17128         $cat <<EOM
17129 You seem to be either cross-compiling or doing a multiarchitecture build,
17130 skipping the byteorder check.
17131
17132 EOM
17133         byteorder='ffff'
17134         ;;
17135 *)
17136         case "$byteorder" in
17137         '')
17138                 $cat <<'EOM'
17139 In the following, larger digits indicate more significance.  A big-endian
17140 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17141 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17142 machines may have weird orders like 3412.  A Cray will report 87654321,
17143 an Alpha will report 12345678. If the test program works the default is
17144 probably right.
17145 I'm now running the test program...
17146 EOM
17147                 $cat >try.c <<EOCP
17148 #include <stdio.h>
17149 #$i_stdlib I_STDLIB
17150 #ifdef I_STDLIB
17151 #include <stdlib.h>
17152 #endif
17153 #include <sys/types.h>
17154 typedef $uvtype UV;
17155 int main()
17156 {
17157         int i;
17158         union {
17159                 UV l;
17160                 char c[$uvsize];
17161         } u;
17162
17163         if ($uvsize > 4)
17164                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17165         else
17166                 u.l = (UV)0x04030201;
17167         for (i = 0; i < $uvsize; i++)
17168                 printf("%c", u.c[i]+'0');
17169         printf("\n");
17170         exit(0);
17171 }
17172 EOCP
17173                 xxx_prompt=y
17174                 set try
17175                 if eval $compile && ./try > /dev/null; then
17176                         dflt=`$run ./try`
17177                         case "$dflt" in
17178                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17179                                 echo "(The test program ran ok.)"
17180                                 echo "byteorder=$dflt"
17181                                 xxx_prompt=n
17182                         ;;
17183                         ????|????????) echo "(The test program ran ok.)" ;;
17184                         *) echo "(The test program didn't run right for some reason.)" ;;
17185                         esac
17186                 else
17187                         dflt='4321'
17188                         cat <<'EOM'
17189 (I can't seem to compile the test program.  Guessing big-endian...)
17190 EOM
17191                 fi
17192                 case "$xxx_prompt" in
17193                 y)
17194                         rp="What is the order of bytes in $uvtype?"
17195                         . ./myread
17196                         byteorder="$ans"
17197                         ;;
17198                 *)      byteorder=$dflt
17199                         ;;
17200                 esac
17201                 ;;
17202         esac
17203         $rm -f try.c try
17204         ;;
17205 esac
17206
17207
17208 $cat <<EOM
17209
17210 Checking to see whether you can access character data unalignedly...
17211 EOM
17212 case "$d_u32align" in
17213 '')   $cat >try.c <<EOCP
17214 #include <stdio.h>
17215 #$i_stdlib I_STDLIB
17216 #ifdef I_STDLIB
17217 #include <stdlib.h>
17218 #endif
17219 #define U32 $u32type
17220 #define BYTEORDER 0x$byteorder
17221 #define U8 $u8type
17222 #include <signal.h>
17223 #ifdef SIGBUS
17224 $signal_t bletch(s) int s; { exit(4); }
17225 #endif
17226 int main() {
17227 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17228     U8 buf[8];
17229     U32 *up;
17230     int i;
17231
17232     if (sizeof(U32) != 4) {
17233         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17234         exit(1);
17235     }
17236
17237     fflush(stdout);
17238
17239 #ifdef SIGBUS
17240     signal(SIGBUS, bletch);
17241 #endif
17242
17243     buf[0] = 0;
17244     buf[1] = 0;
17245     buf[2] = 0;
17246     buf[3] = 1;
17247     buf[4] = 0;
17248     buf[5] = 0;
17249     buf[6] = 0;
17250     buf[7] = 1;
17251
17252     for (i = 0; i < 4; i++) {
17253         up = (U32*)(buf + i);
17254         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17255                (*up == 1 << (8*(3-i)))  /* little-endian */
17256               )
17257            )
17258         {
17259             printf("read failed (%x)\n", *up);
17260             exit(2);
17261         }
17262     }
17263
17264     /* write test */
17265     for (i = 0; i < 4; i++) {
17266         up = (U32*)(buf + i);
17267         *up = 0xBeef;
17268         if (*up != 0xBeef) {
17269             printf("write failed (%x)\n", *up);
17270             exit(3);
17271         }
17272     }
17273
17274     exit(0);
17275 #else
17276     printf("1\n");
17277     exit(1);
17278 #endif
17279     return 0;
17280 }
17281 EOCP
17282 set try
17283 if eval $compile_ok; then
17284         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17285         $run ./try 2>&1 >/dev/null
17286         case "$?" in
17287         0)      cat >&4 <<EOM
17288 You can access character data pretty unalignedly.
17289 EOM
17290                 d_u32align="$undef"
17291                 ;;
17292         *)      cat >&4 <<EOM
17293 It seems that you must access character data in an aligned manner.
17294 EOM
17295                 d_u32align="$define"
17296                 ;;
17297         esac
17298 else
17299         rp='Can you access character data at unaligned addresses?'
17300         dflt='n'
17301         . ./myread
17302         case "$ans" in
17303         [yY]*)  d_u32align="$undef"  ;;
17304         *)      d_u32align="$define" ;;
17305         esac
17306 fi
17307 $rm -f core core.try.* try.core
17308 ;;
17309 esac
17310
17311 : see if ualarm exists
17312 set ualarm d_ualarm
17313 eval $inlibc
17314
17315 : see if umask exists
17316 set umask d_umask
17317 eval $inlibc
17318
17319 : see if unordered exists
17320 set unordered d_unordered
17321 eval $inlibc
17322
17323 : see if usleep exists
17324 set usleep d_usleep
17325 eval $inlibc
17326
17327 : see if prototype for usleep is available
17328 echo " "
17329 set d_usleepproto usleep $i_unistd unistd.h
17330 eval $hasproto
17331
17332 : see if ustat exists
17333 set ustat d_ustat
17334 eval $inlibc
17335
17336 : backward compatibility for d_hvfork
17337 if test X$d_hvfork != X; then
17338         d_vfork="$d_hvfork"
17339         d_hvfork=''
17340 fi
17341 : see if there is a vfork
17342 val=''
17343 set vfork val
17344 eval $inlibc
17345
17346 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17347 : perl on Solaris 2.x, and probably elsewhere.
17348 case "$val" in
17349 $define)
17350         echo " "
17351         case "$usevfork" in
17352         false) dflt='n';;
17353         *) dflt='y';;
17354         esac
17355         cat <<'EOM'
17356  
17357 Perl can only use a vfork() that doesn't suffer from strict
17358 restrictions on calling functions or modifying global data in
17359 the child.  For example, glibc-2.1 contains such a vfork()
17360 that is unsuitable.  If your system provides a proper fork()
17361 call, chances are that you do NOT want perl to use vfork().
17362
17363 EOM
17364         rp="Do you still want to use vfork()?"
17365         . ./myread
17366         case "$ans" in
17367         y|Y) ;;
17368         *)
17369                 echo "Ok, we won't use vfork()."
17370                 val="$undef"
17371                 ;;
17372         esac
17373         ;;
17374 esac
17375 set d_vfork
17376 eval $setvar
17377 case "$d_vfork" in
17378 $define) usevfork='true';;
17379 *) usevfork='false';;
17380 esac
17381
17382 : see if closedir exists
17383 set closedir d_closedir
17384 eval $inlibc
17385
17386 case "$d_closedir" in
17387 "$define")
17388         echo " "
17389         echo "Checking whether closedir() returns a status..." >&4
17390         cat > try.c <<EOM
17391 #$i_dirent I_DIRENT             /**/
17392 #$i_sysdir I_SYS_DIR            /**/
17393 #$i_sysndir I_SYS_NDIR          /**/
17394 #$i_systypes I_SYS_TYPES        /**/
17395
17396 #if defined(I_SYS_TYPES)
17397 #include <sys/types.h>
17398 #endif
17399 #if defined(I_DIRENT)
17400 #include <dirent.h>
17401 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17402 #include <sys/dir.h>
17403 #endif
17404 #else
17405 #ifdef I_SYS_NDIR
17406 #include <sys/ndir.h>
17407 #else
17408 #ifdef I_SYS_DIR
17409 #ifdef hp9000s500
17410 #include <ndir.h>       /* may be wrong in the future */
17411 #else
17412 #include <sys/dir.h>
17413 #endif
17414 #endif
17415 #endif
17416 #endif 
17417 int main() { return closedir(opendir(".")); }
17418 EOM
17419         set try
17420         if eval $compile_ok; then
17421                 if $run ./try > /dev/null 2>&1 ; then
17422                         echo "Yes, it does."
17423                         val="$undef"
17424                 else
17425                         echo "No, it doesn't."
17426                         val="$define"
17427                 fi
17428         else
17429                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17430                 val="$define"
17431         fi
17432         ;;
17433 *)
17434         val="$undef";
17435         ;;
17436 esac
17437 set d_void_closedir
17438 eval $setvar
17439 $rm -f try try.*
17440 : see if there is a wait4
17441 set wait4 d_wait4
17442 eval $inlibc
17443
17444 : see if waitpid exists
17445 set waitpid d_waitpid
17446 eval $inlibc
17447
17448 : see if wcstombs exists
17449 set wcstombs d_wcstombs
17450 eval $inlibc
17451
17452 : see if wctomb exists
17453 set wctomb d_wctomb
17454 eval $inlibc
17455
17456 : see if writev exists
17457 set writev d_writev
17458 eval $inlibc
17459
17460 : preserve RCS keywords in files with variable substitution, grrr
17461 Date='$Date'
17462 Id='$Id'
17463 Log='$Log'
17464 RCSfile='$RCSfile'
17465 Revision='$Revision'
17466
17467 : check for alignment requirements
17468 echo " "
17469 case "$usecrosscompile$multiarch" in
17470 *$define*)
17471         $cat <<EOM
17472 You seem to be either cross-compiling or doing a multiarchitecture build,
17473 skipping the memory alignment check.
17474
17475 EOM
17476         case "$alignbytes" in
17477         '') alignbytes=8 ;;
17478         esac
17479         ;;
17480 *)
17481         case "$alignbytes" in
17482         '') echo "Checking alignment constraints..." >&4
17483                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17484                         $cat >try.c <<'EOCP'
17485 typedef long double NV;
17486 EOCP
17487                 else
17488                         $cat >try.c <<'EOCP'
17489 typedef double NV;
17490 EOCP
17491                 fi
17492                 $cat >>try.c <<'EOCP'
17493 #include <stdio.h>
17494 struct foobar {
17495         char foo;
17496         NV bar;
17497 } try_algn;
17498 int main()
17499 {
17500     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17501     return(0);
17502 }
17503 EOCP
17504                 set try
17505                 if eval $compile_ok; then
17506                         dflt=`$run ./try`
17507                 else
17508                         dflt='8'
17509                         echo "(I can't seem to compile the test program...)"
17510                 fi
17511                 ;;
17512         *) dflt="$alignbytes"
17513                 ;;
17514         esac
17515         rp="Doubles must be aligned on a how-many-byte boundary?"
17516         . ./myread
17517         alignbytes="$ans"
17518         $rm -f try.c try
17519         ;;
17520 esac
17521
17522
17523 : set the base revision
17524 baserev=5.0
17525
17526 : how do we concatenate cpp tokens here?
17527 echo " "
17528 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17529 $cat >cpp_stuff.c <<'EOCP'
17530 #define RCAT(a,b)a/**/b
17531 #define ACAT(a,b)a ## b
17532 RCAT(Rei,ser)
17533 ACAT(Cir,cus)
17534 EOCP
17535 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17536 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17537         echo "Oh!  Smells like ANSI's been here." >&4
17538         echo "We can catify or stringify, separately or together!"
17539         cpp_stuff=42
17540 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17541         echo "Ah, yes!  The good old days!" >&4
17542         echo "However, in the good old days we don't know how to stringify and"
17543         echo "catify at the same time."
17544         cpp_stuff=1
17545 else
17546         $cat >&4 <<EOM
17547 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17548 You're going to have to edit the values of CAT[2-5] in config.h...
17549 EOM
17550         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17551 fi
17552 $rm -f cpp_stuff.*
17553
17554 : see if this is a db.h system
17555 set db.h i_db
17556 eval $inhdr
17557
17558 case "$i_db" in
17559 $define)
17560         : Check db version.
17561         echo " "
17562         echo "Checking Berkeley DB version ..." >&4
17563         $cat >try.c <<EOCP
17564 #$d_const HASCONST
17565 #ifndef HASCONST
17566 #define const
17567 #endif
17568 #include <sys/types.h>
17569 #include <stdio.h>
17570 #$i_stdlib I_STDLIB
17571 #ifdef I_STDLIB
17572 #include <stdlib.h>
17573 #endif
17574 #include <db.h>
17575 int main(int argc, char *argv[])
17576 {
17577 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17578     int Major, Minor, Patch ;
17579     unsigned long Version ;
17580     (void)db_version(&Major, &Minor, &Patch) ;
17581     if (argc == 2) {
17582         printf("%d %d %d %d %d %d\n",
17583                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17584                Major, Minor, Patch);
17585         exit(0);
17586     }
17587     printf("You have Berkeley DB Version 2 or greater.\n");
17588
17589     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17590                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17591     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17592                 Major, Minor, Patch) ;
17593
17594     /* check that db.h & libdb are compatible */
17595     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17596         printf("db.h and libdb are incompatible.\n") ;
17597         exit(3);        
17598     }
17599
17600     printf("db.h and libdb are compatible.\n") ;
17601
17602     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17603                 + DB_VERSION_PATCH ;
17604
17605     /* needs to be >= 2.3.4 */
17606     if (Version < 2003004) {
17607     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17608         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17609         exit(2);        
17610     }
17611
17612     exit(0);
17613 #else
17614 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17615     if (argc == 2) {
17616         printf("1 0 0\n");
17617         exit(0);
17618     }
17619     printf("You have Berkeley DB Version 1.\n");
17620     exit(0);    /* DB version < 2: the coast is clear. */
17621 #else
17622     exit(1);    /* <db.h> not Berkeley DB? */
17623 #endif
17624 #endif
17625 }
17626 EOCP
17627         set try
17628         if eval $compile_ok && $run ./try; then
17629                 echo 'Looks OK.' >&4
17630                 set `$run ./try 1`
17631                 db_version_major=$1
17632                 db_version_minor=$2
17633                 db_version_patch=$3
17634         else
17635                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17636                 i_db=$undef
17637                 case " $libs " in
17638                 *"-ldb "*)
17639                         : Remove db from list of libraries to use
17640                         echo "Removing unusable -ldb from library list" >&4
17641                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17642                         shift
17643                         libs="$*"
17644                         echo "libs = $libs" >&4
17645                         ;;
17646                 esac
17647         fi
17648         $rm -f try.*
17649         ;;
17650 esac
17651
17652 case "$i_db" in
17653 define)
17654         : Check the return type needed for hash 
17655         echo " "
17656         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17657         $cat >try.c <<EOCP
17658 #$d_const HASCONST
17659 #ifndef HASCONST
17660 #define const
17661 #endif
17662 #include <sys/types.h>
17663 #include <db.h>
17664
17665 #ifndef DB_VERSION_MAJOR
17666 u_int32_t hash_cb (ptr, size)
17667 const void *ptr;
17668 size_t size;
17669 {
17670 }
17671 HASHINFO info;
17672 int main()
17673 {
17674         info.hash = hash_cb;
17675 }
17676 #endif
17677 EOCP
17678         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17679                 if $contains warning try.out >>/dev/null 2>&1 ; then
17680                         db_hashtype='int'
17681                 else
17682                         db_hashtype='u_int32_t'
17683                 fi
17684         else
17685                 : XXX Maybe we should just give up here.
17686                 db_hashtype=u_int32_t
17687                 $cat try.out >&4
17688                 echo "Help:  I can't seem to compile the db test program." >&4
17689                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17690         fi
17691         $rm -f try.*
17692         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17693         ;;
17694 *)      db_hashtype=u_int32_t
17695         ;;
17696 esac
17697 case "$i_db" in
17698 define)
17699         : Check the return type needed for prefix 
17700         echo " "
17701         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17702         cat >try.c <<EOCP
17703 #$d_const HASCONST
17704 #ifndef HASCONST
17705 #define const
17706 #endif
17707 #include <sys/types.h>
17708 #include <db.h>
17709
17710 #ifndef DB_VERSION_MAJOR
17711 size_t prefix_cb (key1, key2)
17712 const DBT *key1;
17713 const DBT *key2;
17714 {
17715 }
17716 BTREEINFO info;
17717 int main()
17718 {
17719         info.prefix = prefix_cb;
17720 }
17721 #endif
17722 EOCP
17723         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17724                 if $contains warning try.out >>/dev/null 2>&1 ; then
17725                         db_prefixtype='int'
17726                 else
17727                         db_prefixtype='size_t'
17728                 fi
17729         else
17730                 db_prefixtype='size_t'
17731                 : XXX Maybe we should just give up here.
17732                 $cat try.out >&4
17733                 echo "Help:  I can't seem to compile the db test program." >&4
17734                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17735         fi
17736         $rm -f try.*
17737         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17738         ;;
17739 *)      db_prefixtype='size_t'
17740         ;;
17741 esac
17742
17743
17744 : How can we generate normalized random numbers ?
17745 echo " "
17746 echo "Looking for a random number function..." >&4
17747 case "$randfunc" in
17748 '')
17749         if set drand48 val -f; eval $csym; $val; then
17750                 dflt="drand48"
17751                 echo "Good, found drand48()." >&4
17752         elif set random val -f; eval $csym; $val; then
17753                 dflt="random"
17754                 echo "OK, found random()." >&4
17755         else
17756                 dflt="rand"
17757                 echo "Yick, looks like I have to use rand()." >&4
17758         fi
17759         echo " "
17760         ;;
17761 *)
17762         dflt="$randfunc"
17763         ;;
17764 esac
17765 cont=true
17766
17767 case "$ccflags" in
17768 *-Dmy_rand=*|*-Dmy_srand=*)
17769         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17770         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17771         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17772         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17773         ;;
17774 esac
17775
17776 while $test "$cont"; do
17777         rp="Use which function to generate random numbers?"
17778         . ./myread
17779         if $test "$ans" = "$dflt"; then
17780                 : null
17781         else
17782                 randbits=''
17783         fi
17784         randfunc="$ans"
17785         if set $ans val -f; eval $csym; $val; then
17786                 cont=''
17787         else
17788                 dflt=y
17789                 rp="I cannot find function $ans. Use that name anyway?"
17790                 . ./myread
17791                 dflt=rand
17792                 case "$ans" in
17793                         [yY]*) cont='';;
17794                 esac
17795         fi
17796         case "$cont" in
17797         '')
17798                 case "$randfunc" in
17799                 drand48)
17800                         drand01="drand48()"
17801                         seedfunc="srand48"
17802                         randbits=48
17803                         randseedtype=long
17804                         ;;
17805                 rand|random)
17806                         case "$randbits" in
17807                         '')
17808 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17809                                 $cat >try.c <<EOCP
17810 #$i_unistd I_UNISTD
17811 #$i_stdlib I_STDLIB
17812 #include <stdio.h>
17813 #ifdef I_UNISTD
17814 #  include <unistd.h>
17815 #endif
17816 #ifdef I_STDLIB
17817 #  include <stdlib.h>
17818 #endif
17819 int main()
17820 {
17821         register int i;
17822         register unsigned long tmp;
17823         register unsigned long max = 0L;
17824
17825         for (i = 1000; i; i--) {
17826                 tmp = (unsigned long) $randfunc();
17827                 if (tmp > max) max = tmp;
17828         }
17829         for (i = 0; max; i++)
17830                 max /= 2;
17831         printf("%d\n",i);
17832 }
17833 EOCP
17834                                 set try
17835                                 if eval $compile_ok; then
17836                                         dflt=`try`
17837                                 else
17838                                         dflt='?'
17839                                         echo "(I can't seem to compile the test program...)"
17840                                 fi
17841                                 ;;
17842                         *)
17843                                 dflt="$randbits"
17844                                 ;;
17845                         esac
17846                         rp="How many bits does your $randfunc() function produce?"
17847                         . ./myread
17848                         randbits="$ans"
17849                         $rm -f try.c try
17850                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17851                         seedfunc="s$randfunc"
17852                         randseedtype=unsigned
17853                         ;;
17854                 *)
17855                         dflt="31"
17856                         rp="How many bits does your $randfunc() function produce?"
17857                         . ./myread
17858                         randbits="$ans"
17859                         seedfunc="s$randfunc"
17860                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17861                         if set $seedfunc val -f; eval $csym; $val; then
17862                                 echo "(Using $seedfunc() to seed random generator)"
17863                         else
17864                                 echo "(Warning: no $seedfunc() to seed random generator)"
17865                                 seedfunc=rand
17866                         fi
17867                         randseedtype=unsigned
17868                         ;;
17869                 esac
17870                 ;;
17871         esac
17872 done
17873
17874 echo " "
17875 echo "Determining whether or not we are on an EBCDIC system..." >&4
17876 $cat >try.c <<'EOM'
17877 int main()
17878 {
17879   if ('M'==0xd4) return 0;
17880   return 1;
17881 }
17882 EOM
17883
17884 val=$undef
17885 set try
17886 if eval $compile_ok; then
17887         if $run ./try; then
17888                 echo "You seem to speak EBCDIC." >&4
17889                 val="$define"
17890         else
17891                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17892         fi
17893 else
17894         echo "I'm unable to compile the test program." >&4
17895         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17896 fi
17897 $rm -f try try.*
17898 set ebcdic
17899 eval $setvar
17900
17901 echo " "
17902 $cat >&4 <<EOM
17903 Checking how to flush all pending stdio output...
17904 EOM
17905 # I only know how to find the first 32 possibly open files on SunOS.
17906 # See also hints/sunos_4_1.sh and util.c  --AD
17907 case "$osname" in
17908 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17909 esac
17910 $cat >>try.c <<EOCP
17911 #include <stdio.h>
17912 #$i_stdlib I_STDLIB
17913 #ifdef I_STDLIB
17914 #include <stdlib.h>
17915 #endif
17916 #$i_unistd I_UNISTD
17917 #ifdef I_UNISTD
17918 # include <unistd.h>
17919 #endif
17920 #$d_sysconf HAS_SYSCONF
17921 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17922 #ifdef HAS_STDIO_STREAM_ARRAY
17923 # define STDIO_STREAM_ARRAY $stdio_stream_array
17924 #endif
17925 int main() {
17926   FILE* p;
17927   unlink("try.out");
17928   p = fopen("try.out", "w");
17929 #ifdef TRY_FPUTC
17930   fputc('x', p);
17931 #else
17932 # ifdef TRY_FPRINTF
17933   fprintf(p, "x");
17934 # endif
17935 #endif
17936 #ifdef TRY_FFLUSH_NULL
17937   fflush(NULL);
17938 #endif
17939 #ifdef TRY_FFLUSH_ALL
17940   {
17941     long open_max = -1;
17942 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17943     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17944 # else
17945 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17946     open_max = sysconf(_SC_OPEN_MAX);
17947 #  else
17948 #   ifdef FOPEN_MAX
17949     open_max = FOPEN_MAX;
17950 #   else
17951 #    ifdef OPEN_MAX
17952     open_max = OPEN_MAX;
17953 #    else
17954 #     ifdef _NFILE
17955     open_max = _NFILE;
17956 #     endif
17957 #    endif
17958 #   endif
17959 #  endif
17960 # endif 
17961 # ifdef HAS_STDIO_STREAM_ARRAY
17962     if (open_max > 0) {
17963       long i;
17964       for (i = 0; i < open_max; i++)
17965             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17966                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17967                 STDIO_STREAM_ARRAY[i]._flag)
17968                 fflush(&STDIO_STREAM_ARRAY[i]);
17969     }   
17970   }
17971 # endif
17972 #endif
17973   _exit(42);
17974 }
17975 EOCP
17976 : first we have to find out how _not_ to flush
17977 $to try.c
17978 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17979     output=''
17980     set try -DTRY_FPUTC
17981     if eval $compile; then
17982             $run ./try 2>/dev/null
17983             code="$?"
17984             $from try.out
17985             if $test ! -s try.out -a "X$code" = X42; then
17986                 output=-DTRY_FPUTC
17987             fi
17988     fi
17989     case "$output" in
17990     '')
17991             set try -DTRY_FPRINTF
17992             if eval $compile; then
17993                     $run ./try 2>/dev/null
17994                     code="$?"
17995                     $from try.out
17996                     if $test ! -s try.out -a "X$code" = X42; then
17997                         output=-DTRY_FPRINTF
17998                     fi
17999             fi
18000         ;;
18001     esac
18002 fi
18003 : check for fflush NULL behaviour
18004 case "$fflushNULL" in
18005 '')     set try -DTRY_FFLUSH_NULL $output
18006         if eval $compile; then
18007                 $run ./try 2>/dev/null
18008                 code="$?"
18009                 $from try.out
18010                 if $test -s try.out -a "X$code" = X42; then
18011                         fflushNULL="`$cat try.out`"
18012                 else
18013                         if $test "X$code" != X42; then
18014                                 $cat >&4 <<EOM
18015 (If this test failed, don't worry, we'll try another method shortly.)
18016 EOM
18017                         fi
18018                 fi
18019         fi
18020         $rm -f core try.core core.try.*
18021         case "$fflushNULL" in
18022         x)      $cat >&4 <<EOM
18023 Your fflush(NULL) works okay for output streams.
18024 Let's see if it clobbers input pipes...
18025 EOM
18026 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18027 # bug that improperly flushes the input end of pipes.  So we avoid the
18028 # autoflush on fork/system/exec support for now. :-(
18029 $cat >tryp.c <<EOCP
18030 #include <stdio.h>
18031 int
18032 main(int argc, char **argv)
18033 {
18034     char buf[1024];
18035     int i;
18036     char *bp = buf;
18037     while (1) {
18038         while ((i = getc(stdin)) != -1
18039                && (*bp++ = i) != '\n'
18040                && bp < &buf[1024])
18041         /* DO NOTHING */ ;
18042         *bp = '\0';
18043         fprintf(stdout, "%s", buf);
18044         fflush(NULL);
18045         if (i == -1)
18046             return 0;
18047         bp = buf;
18048     }
18049 }
18050 EOCP
18051                 fflushNULL="$define"
18052                 set tryp
18053                 if eval $compile; then
18054                     $rm -f tryp.out
18055                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18056                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18057                        $cat >&4 <<EOM
18058 fflush(NULL) seems to behave okay with input streams.
18059 EOM
18060                         fflushNULL="$define"
18061                     else
18062                         $cat >&4 <<EOM
18063 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18064 EOM
18065                         fflushNULL="$undef"
18066                     fi
18067                 fi
18068                 $rm -f core tryp.c tryp.core core.tryp.*
18069                 ;;
18070         '')     $cat >&4 <<EOM
18071 Your fflush(NULL) isn't working (contrary to ANSI C).
18072 EOM
18073                 fflushNULL="$undef"
18074                 ;;
18075         *)      $cat >&4 <<EOM
18076 Cannot figure out whether your fflush(NULL) works or not.
18077 I'm assuming it doesn't (contrary to ANSI C).
18078 EOM
18079                 fflushNULL="$undef"
18080                 ;;
18081         esac
18082         ;;
18083 $define|true|[yY]*)
18084         fflushNULL="$define"
18085         ;;
18086 *)
18087         fflushNULL="$undef"
18088         ;;
18089 esac
18090 : check explicit looping only if NULL did not work, and if the pipe
18091 : bug does not show up on an explicit flush too
18092 case "$fflushNULL" in
18093 "$undef")
18094         $cat >tryp.c <<EOCP
18095 #include <stdio.h>
18096 int
18097 main(int argc, char **argv)
18098 {
18099     char buf[1024];
18100     int i;
18101     char *bp = buf;
18102     while (1) {
18103         while ((i = getc(stdin)) != -1
18104                && (*bp++ = i) != '\n'
18105                && bp < &buf[1024])
18106         /* DO NOTHING */ ;
18107         *bp = '\0';
18108         fprintf(stdout, "%s", buf);
18109         fflush(stdin);
18110         if (i == -1)
18111             return 0;
18112         bp = buf;
18113     }
18114 }
18115 EOCP
18116         set tryp
18117         if eval $compile; then
18118             $rm -f tryp.out
18119             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18120             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18121                $cat >&4 <<EOM
18122 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18123 EOM
18124                 : now check for fflushall behaviour
18125                 case "$fflushall" in
18126                 '')     set try -DTRY_FFLUSH_ALL $output
18127                         if eval $compile; then
18128                                 $cat >&4 <<EOM
18129 (Now testing the other method--but note that this also may fail.)
18130 EOM
18131                                 $run ./try 2>/dev/null
18132                                 code=$?
18133                                 $from try.out
18134                                 if $test -s try.out -a "X$code" = X42; then
18135                                         fflushall="`$cat try.out`"
18136                                 fi
18137                         fi
18138                         $rm -f core try.core core.try.*
18139                         case "$fflushall" in
18140                         x)      $cat >&4 <<EOM
18141 Whew. Flushing explicitly all the stdio streams works.
18142 EOM
18143                                 fflushall="$define"
18144                                 ;;
18145                         '')     $cat >&4 <<EOM
18146 Sigh. Flushing explicitly all the stdio streams doesn't work.
18147 EOM
18148                                 fflushall="$undef"
18149                                 ;;
18150                         *)      $cat >&4 <<EOM
18151 Cannot figure out whether flushing stdio streams explicitly works or not.
18152 I'm assuming it doesn't.
18153 EOM
18154                                 fflushall="$undef"
18155                                 ;;
18156                         esac
18157                         ;;
18158                 "$define"|true|[yY]*)
18159                         fflushall="$define"
18160                         ;;
18161                 *)
18162                         fflushall="$undef"
18163                         ;;
18164                 esac
18165             else
18166                 $cat >&4 <<EOM
18167 All is futile.  Even fflush(stdin) clobbers input pipes!
18168 EOM
18169                 fflushall="$undef"
18170             fi
18171         else
18172             fflushall="$undef"
18173         fi
18174         $rm -f core tryp.c tryp.core core.tryp.*
18175         ;;
18176 *)      fflushall="$undef"
18177         ;;
18178 esac
18179
18180 case "$fflushNULL$fflushall" in
18181 undefundef)
18182         $cat <<EOM
18183 OK, I give up.  I cannot figure out how to flush pending stdio output.
18184 We won't be flushing handles at all before fork/exec/popen.
18185 EOM
18186         ;;
18187 esac
18188 $rm -f try.* try$exe_ext
18189
18190 : Store the full pathname to the ar program for use in the C program
18191 : Respect a hint or command line value for full_ar.
18192 case "$full_ar" in
18193 '') full_ar=$ar ;;
18194 esac
18195
18196 : Store the full pathname to the sed program for use in the C program
18197 full_sed=$sed
18198
18199 : see what type gids are declared as in the kernel
18200 echo " "
18201 echo "Looking for the type for group ids returned by getgid()."
18202 set gid_t gidtype xxx stdio.h sys/types.h
18203 eval $typedef
18204 case "$gidtype" in
18205 xxx)
18206         xxx=`./findhdr sys/user.h`
18207         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18208         case $1 in
18209         unsigned) dflt="$1 $2" ;;
18210         *) dflt="$1" ;;
18211         esac
18212         ;;
18213 *) dflt="$gidtype";;
18214 esac
18215 case "$gidtype" in
18216 gid_t) echo "gid_t found." ;;
18217 *)      rp="What is the type for group ids returned by getgid()?"
18218         . ./myread
18219         gidtype="$ans"
18220         ;;
18221 esac
18222
18223 echo " "
18224 case "$gidtype" in
18225 *_t) zzz="$gidtype"     ;;
18226 *)   zzz="gid"          ;;
18227 esac
18228 echo "Checking the size of $zzz..." >&4 
18229 cat > try.c <<EOCP
18230 #include <sys/types.h>
18231 #include <stdio.h>
18232 #$i_stdlib I_STDLIB
18233 #ifdef I_STDLIB
18234 #include <stdlib.h>
18235 #endif
18236 int main() {
18237     printf("%d\n", (int)sizeof($gidtype));
18238     exit(0);
18239 }
18240 EOCP
18241 set try
18242 if eval $compile_ok; then
18243         yyy=`$run ./try`
18244         case "$yyy" in
18245         '')     gidsize=4
18246                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18247                 ;;
18248         *)      gidsize=$yyy
18249                 echo "Your $zzz is $gidsize bytes long."
18250                 ;;
18251         esac
18252 else
18253         gidsize=4
18254         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18255 fi
18256
18257
18258 echo " "
18259 case "$gidtype" in
18260 *_t) zzz="$gidtype"     ;;
18261 *)   zzz="gid"          ;;
18262 esac
18263 echo "Checking the sign of $zzz..." >&4 
18264 cat > try.c <<EOCP
18265 #include <sys/types.h>
18266 #include <stdio.h>
18267 int main() {
18268         $gidtype foo = -1;
18269         if (foo < 0)
18270                 printf("-1\n");
18271         else
18272                 printf("1\n");
18273 }
18274 EOCP
18275 set try
18276 if eval $compile; then
18277         yyy=`$run ./try`
18278         case "$yyy" in
18279         '')     gidsign=1
18280                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18281                 ;;
18282         *)      gidsign=$yyy
18283                 case "$gidsign" in
18284                  1) echo "Your $zzz is unsigned." ;;
18285                 -1) echo "Your $zzz is signed."   ;;
18286                 esac
18287                 ;;
18288         esac
18289 else
18290         gidsign=1
18291         echo "(I can't compile the test program--guessing unsigned.)" >&4
18292 fi
18293
18294
18295 echo " "
18296
18297 if $test X"$quadtype" != X; then
18298
18299 echo "Checking how to print 64-bit integers..." >&4
18300
18301 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18302         $cat >try.c <<'EOCP'
18303 #include <sys/types.h>
18304 #include <stdio.h>
18305 int main() {
18306   int q = 12345678901;
18307   printf("%ld\n", q);
18308 }
18309 EOCP
18310         set try
18311         if eval $compile; then
18312                 yyy=`$run ./try`
18313                 case "$yyy" in
18314                 12345678901)
18315                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18316                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18317                         echo "We will use %d."
18318                         ;;
18319                 esac
18320         fi
18321 fi
18322
18323 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18324         $cat >try.c <<'EOCP'
18325 #include <sys/types.h>
18326 #include <stdio.h>
18327 int main() {
18328   long q = 12345678901;
18329   printf("%ld\n", q);
18330 }
18331 EOCP
18332         set try
18333         if eval $compile; then
18334                 yyy=`$run ./try`
18335                 case "$yyy" in
18336                 12345678901)
18337                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18338                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18339                         echo "We will use %ld."
18340                         ;;
18341                 esac
18342         fi
18343 fi
18344
18345 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18346         $cat >try.c <<'EOCP'
18347 #include <sys/types.h>
18348 #include <inttypes.h>
18349 #include <stdio.h>
18350 int main() {
18351   int64_t q = 12345678901;
18352   printf("%" PRId64 "\n", q);
18353 }
18354 EOCP
18355         set try
18356         if eval $compile; then
18357                 yyy=`$run ./try`
18358                 case "$yyy" in
18359                 12345678901)
18360                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18361                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18362                         echo "We will use the C9X style."
18363                         ;;
18364                 esac
18365         fi
18366 fi
18367
18368 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18369         $cat >try.c <<EOCP
18370 #include <sys/types.h>
18371 #include <stdio.h>
18372 int main() {
18373   $quadtype q = 12345678901;
18374   printf("%Ld\n", q);
18375 }
18376 EOCP
18377         set try
18378         if eval $compile; then
18379                 yyy=`$run ./try`
18380                 case "$yyy" in
18381                 12345678901)
18382                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18383                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18384                         echo "We will use %Ld."
18385                         ;;
18386                 esac
18387         fi
18388 fi
18389
18390 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18391         $cat >try.c <<'EOCP'
18392 #include <sys/types.h>
18393 #include <stdio.h>
18394 int main() {
18395   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18396   printf("%lld\n", q);
18397 }
18398 EOCP
18399         set try
18400         if eval $compile; then
18401                 yyy=`$run ./try`
18402                 case "$yyy" in
18403                 12345678901)
18404                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18405                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18406                         echo "We will use the %lld style."
18407                         ;;
18408                 esac
18409         fi
18410 fi
18411
18412 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18413         $cat >try.c <<EOCP
18414 #include <sys/types.h>
18415 #include <stdio.h>
18416 int main() {
18417   $quadtype q = 12345678901;
18418   printf("%qd\n", q);
18419 }
18420 EOCP
18421         set try
18422         if eval $compile; then
18423                 yyy=`$run ./try`
18424                 case "$yyy" in
18425                 12345678901)
18426                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18427                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18428                         echo "We will use %qd."
18429                         ;;
18430                 esac
18431         fi
18432 fi
18433
18434 if $test X"$sPRId64" = X; then
18435         echo "Cannot figure out how to print 64-bit integers." >&4
18436 fi
18437
18438 $rm -f try try.*
18439
18440 fi
18441
18442 case "$sPRId64" in
18443 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18444         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18445         ;;
18446 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18447         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18448         ;;
18449 esac
18450
18451
18452 echo " "
18453 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18454
18455 if $test X"$ivsize" = X8; then
18456         ivdformat="$sPRId64"
18457         uvuformat="$sPRIu64"
18458         uvoformat="$sPRIo64"
18459         uvxformat="$sPRIx64"
18460         uvXUformat="$sPRIXU64"
18461 else
18462         if $test X"$ivsize" = X"$longsize"; then
18463                 ivdformat='"ld"'
18464                 uvuformat='"lu"'
18465                 uvoformat='"lo"'
18466                 uvxformat='"lx"'
18467                 uvXUformat='"lX"'
18468         else
18469                 if $test X"$ivsize" = X"$intsize"; then
18470                         ivdformat='"d"'
18471                         uvuformat='"u"'
18472                         uvoformat='"o"'
18473                         uvxformat='"x"'
18474                         uvXUformat='"X"'
18475                 else
18476                         : far out
18477                         if $test X"$ivsize" = X"$shortsize"; then
18478                                 ivdformat='"hd"'
18479                                 uvuformat='"hu"'
18480                                 uvoformat='"ho"'
18481                                 uvxformat='"hx"'
18482                                 uvXUformat='"hX"'
18483                         fi
18484                 fi
18485         fi
18486 fi
18487
18488 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18489         nveformat="$sPRIeldbl"
18490         nvfformat="$sPRIfldbl"
18491         nvgformat="$sPRIgldbl"
18492         nvEUformat="$sPRIEUldbl"
18493         nvFUformat="$sPRIFUldbl"
18494         nvGUformat="$sPRIGUldbl"
18495 else
18496         nveformat='"e"'
18497         nvfformat='"f"'
18498         nvgformat='"g"'
18499         nvEUformat='"E"'
18500         nvFUformat='"F"'
18501         nvGUformat='"G"'
18502 fi
18503
18504 case "$ivdformat" in
18505 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18506     exit 1
18507     ;;
18508 esac
18509
18510
18511 echo " "
18512 $echo "Checking the format string to be used for gids..." >&4
18513
18514 case "$gidsign" in
18515 -1)     if $test X"$gidsize" = X"$ivsize"; then
18516                 gidformat="$ivdformat"
18517         else
18518                 if $test X"$gidsize" = X"$longsize"; then
18519                         gidformat='"ld"'
18520                 else
18521                         if $test X"$gidsize" = X"$intsize"; then
18522                                 gidformat='"d"'
18523                         else
18524                                 if $test X"$gidsize" = X"$shortsize"; then
18525                                         gidformat='"hd"'
18526                                 fi
18527                         fi
18528                 fi
18529         fi
18530         ;;
18531 *)      if $test X"$gidsize" = X"$uvsize"; then
18532                 gidformat="$uvuformat"
18533         else
18534                 if $test X"$gidsize" = X"$longsize"; then
18535                         gidformat='"lu"'
18536                 else
18537                         if $test X"$gidsize" = X"$intsize"; then
18538                                 gidformat='"u"'
18539                         else
18540                                 if $test X"$gidsize" = X"$shortsize"; then
18541                                         gidformat='"hu"'
18542                                 fi
18543                         fi
18544                 fi
18545         fi
18546         ;;
18547 esac
18548
18549 : see if getgroups exists
18550 set getgroups d_getgrps
18551 eval $inlibc
18552
18553 : see if setgroups exists
18554 set setgroups d_setgrps
18555 eval $inlibc
18556
18557
18558 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18559 echo " "
18560 case "$d_getgrps$d_setgrps" in
18561 *define*)
18562         case "$groupstype" in
18563         '') dflt="$gidtype" ;;
18564         *)  dflt="$groupstype" ;;
18565         esac
18566         $cat <<EOM
18567 What type of pointer is the second argument to getgroups() and setgroups()?
18568 Usually this is the same as group ids, $gidtype, but not always.
18569
18570 EOM
18571         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18572         . ./myread
18573         groupstype="$ans"
18574         ;;
18575 *)  groupstype="$gidtype";;
18576 esac
18577
18578 echo " "
18579 echo "Checking if your $make program sets \$(MAKE)..." >&4
18580 case "$make_set_make" in
18581 '')
18582         $sed 's/^X //' > testmake.mak << 'EOF'
18583 Xall:
18584 X       @echo 'maketemp="$(MAKE)"'
18585 EOF
18586         case "`$make -f testmake.mak 2>/dev/null`" in
18587         *maketemp=*) make_set_make='#' ;;
18588         *)      make_set_make="MAKE=$make" ;;
18589         esac
18590         $rm -f testmake.mak
18591         ;;
18592 esac
18593 case "$make_set_make" in
18594 '#') echo "Yup, it does.";;
18595 *) echo "Nope, it doesn't.";;
18596 esac
18597
18598 : see what type is used for mode_t
18599 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18600 set mode_t modetype int stdio.h sys/types.h
18601 eval $typedef_ask
18602
18603 : see if stdarg is available
18604 echo " "
18605 if $test `./findhdr stdarg.h`; then
18606         echo "<stdarg.h> found." >&4
18607         valstd="$define"
18608 else
18609         echo "<stdarg.h> NOT found." >&4
18610         valstd="$undef"
18611 fi
18612
18613 : see if varags is available
18614 echo " "
18615 if $test `./findhdr varargs.h`; then
18616         echo "<varargs.h> found." >&4
18617 else
18618         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18619 fi
18620
18621 : set up the varargs testing programs
18622 $cat > varargs.c <<EOP
18623 #ifdef I_STDARG
18624 #include <stdarg.h>
18625 #endif
18626 #ifdef I_VARARGS
18627 #include <varargs.h>
18628 #endif
18629
18630 #ifdef I_STDARG
18631 int f(char *p, ...)
18632 #else
18633 int f(va_alist)
18634 va_dcl
18635 #endif
18636 {
18637         va_list ap;
18638 #ifndef I_STDARG
18639         char *p;
18640 #endif
18641 #ifdef I_STDARG
18642         va_start(ap,p);
18643 #else
18644         va_start(ap);
18645         p = va_arg(ap, char *);
18646 #endif
18647         va_end(ap);
18648 }
18649 EOP
18650 $cat > varargs <<EOP
18651 $startsh
18652 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18653         echo "true"
18654 else
18655         echo "false"
18656 fi
18657 $rm -f varargs$_o
18658 EOP
18659 chmod +x varargs
18660
18661 : now check which varargs header should be included
18662 echo " "
18663 i_varhdr=''
18664 case "$valstd" in
18665 "$define")
18666         if `./varargs I_STDARG`; then
18667                 val='stdarg.h'
18668         elif `./varargs I_VARARGS`; then
18669                 val='varargs.h'
18670         fi
18671         ;;
18672 *)
18673         if `./varargs I_VARARGS`; then
18674                 val='varargs.h'
18675         fi
18676         ;;
18677 esac
18678 case "$val" in
18679 '')
18680 echo "I could not find the definition for va_dcl... You have problems..." >&4
18681         val="$undef"; set i_stdarg; eval $setvar
18682         val="$undef"; set i_varargs; eval $setvar
18683         ;;
18684 *) 
18685         set i_varhdr
18686         eval $setvar
18687         case "$i_varhdr" in
18688         stdarg.h)
18689                 val="$define"; set i_stdarg; eval $setvar
18690                 val="$undef"; set i_varargs; eval $setvar
18691                 ;;
18692         varargs.h)
18693                 val="$undef"; set i_stdarg; eval $setvar
18694                 val="$define"; set i_varargs; eval $setvar
18695                 ;;
18696         esac
18697         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18698 esac
18699 $rm -f varargs*
18700
18701 : see if we need va_copy
18702 echo " "
18703 case "$i_stdarg" in
18704 "$define")
18705         $cat >try.c <<EOCP
18706 #include <stdarg.h>
18707 #include <stdio.h>
18708 #$i_stdlib I_STDLIB
18709 #ifdef I_STDLIB
18710 #include <stdlib.h>
18711 #endif
18712 #include <signal.h>
18713
18714 int
18715 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18716 {
18717   return vfprintf(f, fmt, *valp);
18718 }
18719  
18720 int    
18721 myvfprintf(FILE *f, const  char *fmt, va_list val)
18722 {
18723   return ivfprintf(f, fmt, &val);
18724 }
18725       
18726 int
18727 myprintf(char *fmt, ...) 
18728 {
18729   va_list val;
18730   va_start(val, fmt);
18731   return myvfprintf(stdout, fmt, val); 
18732 }         
18733
18734 int
18735 main(int ac, char **av)
18736 {
18737   signal(SIGSEGV, exit);
18738
18739   myprintf("%s%cs all right, then\n", "that", '\'');                            
18740   exit(0);      
18741 }
18742 EOCP
18743         set try
18744         if eval $compile && $run ./try 2>&1 >/dev/null; then
18745                 case "`$run ./try`" in
18746                 "that's all right, then")
18747                         okay=yes
18748                         ;;
18749                 esac
18750         fi
18751         case "$okay" in
18752         yes)    echo "It seems that you don't need va_copy()." >&4
18753                 need_va_copy="$undef"
18754                 ;;
18755         *)      echo "It seems that va_copy() or similar will be needed." >&4
18756                 need_va_copy="$define"
18757                 ;;
18758         esac
18759         $rm -f try.* core core.* *.core *.core.*
18760         ;;
18761 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18762         ;;
18763 esac
18764
18765 : see what type is used for size_t
18766 rp="What is the type used for the length parameter for string functions?"
18767 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18768 eval $typedef_ask
18769
18770 : check for type of arguments to gethostbyaddr. 
18771 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18772         case "$d_gethbyaddr" in
18773         $define)
18774                 $cat <<EOM
18775
18776 Checking to see what type of arguments are accepted by gethostbyaddr().
18777 EOM
18778                 hdrs="$define sys/types.h
18779                         $d_socket sys/socket.h 
18780                         $i_niin netinet/in.h 
18781                         $i_netdb netdb.h
18782                         $i_unistd unistd.h"
18783                 : The first arg can 'char *' or 'void *'
18784                 : The second arg is some of integral type
18785                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18786                         for yyy in size_t long int; do
18787                                 case "$netdb_host_type" in
18788                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18789                                         if ./protochk "$try" $hdrs; then
18790                                                 echo "Your system accepts $xxx for the first arg."
18791                                                 echo "...and $yyy for the second arg."
18792                                                 netdb_host_type="$xxx"
18793                                                 netdb_hlen_type="$yyy"
18794                                         fi
18795                                         ;;
18796                                 esac
18797                         done
18798                 done
18799                 : In case none of those worked, prompt the user.
18800                 case "$netdb_host_type" in
18801                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18802                         dflt='char *'
18803                         . ./myread
18804                         netdb_host_type=$ans
18805                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18806                         dflt="$sizetype"
18807                         . ./myread
18808                         netdb_hlen_type=$ans
18809                         ;;
18810                 esac
18811                 ;;
18812         *)      : no gethostbyaddr, so pick harmless defaults
18813                 netdb_host_type='char *'
18814                 netdb_hlen_type="$sizetype"
18815                 ;;
18816         esac
18817         # Remove the "const" if needed. -- but then we'll have a 
18818         # prototype clash!
18819         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18820 fi
18821
18822 : check for type of argument to gethostbyname. 
18823 if test "X$netdb_name_type" = X ; then
18824         case "$d_gethbyname" in
18825         $define)
18826                 $cat <<EOM
18827
18828 Checking to see what type of argument is accepted by gethostbyname().
18829 EOM
18830                 hdrs="$define sys/types.h
18831                         $d_socket sys/socket.h 
18832                         $i_niin netinet/in.h 
18833                         $i_netdb netdb.h
18834                         $i_unistd unistd.h"
18835                 for xxx in "const char *" "char *"; do
18836                         case "$netdb_name_type" in
18837                         '')     try="extern struct hostent *gethostbyname($xxx);"
18838                                 if ./protochk "$try" $hdrs; then
18839                                         echo "Your system accepts $xxx."
18840                                         netdb_name_type="$xxx"
18841                                 fi
18842                                 ;;
18843                         esac
18844                 done
18845                 : In case none of those worked, prompt the user.
18846                 case "$netdb_name_type" in
18847                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18848                         dflt='char *'
18849                         . ./myread
18850                         netdb_name_type=$ans
18851                         ;;
18852                 esac
18853                 ;;
18854         *)      : no gethostbyname, so pick harmless default
18855                 netdb_name_type='char *'
18856                 ;;
18857         esac
18858 fi
18859
18860 : check for type of 1st argument to getnetbyaddr. 
18861 if test "X$netdb_net_type" = X ; then
18862         case "$d_getnbyaddr" in
18863         $define)
18864                 $cat <<EOM
18865
18866 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18867 EOM
18868                 hdrs="$define sys/types.h
18869                         $d_socket sys/socket.h 
18870                         $i_niin netinet/in.h 
18871                         $i_netdb netdb.h
18872                         $i_unistd unistd.h"
18873                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18874                         case "$netdb_net_type" in
18875                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18876                                 if ./protochk "$try" $hdrs; then
18877                                         echo "Your system accepts $xxx."
18878                                         netdb_net_type="$xxx"
18879                                 fi
18880                                 ;;
18881                         esac
18882                 done
18883                 : In case none of those worked, prompt the user.
18884                 case "$netdb_net_type" in
18885                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18886                         dflt='long'
18887                         . ./myread
18888                         netdb_net_type=$ans
18889                         ;;
18890                 esac
18891                 ;;
18892         *)      : no getnetbyaddr, so pick harmless default
18893                 netdb_net_type='long'
18894                 ;;
18895         esac
18896 fi
18897 : locate the preferred pager for this system
18898 fn=f/
18899 case "$pager" in
18900 '')
18901         dflt=''
18902         case "$pg" in
18903         /*) dflt=$pg;;
18904         [a-zA-Z]:/*) dflt=$pg;;
18905         esac
18906         case "$more" in
18907         /*) dflt=$more;;
18908         [a-zA-Z]:/*) dflt=$more;;
18909         esac
18910         case "$less" in
18911         /*) dflt=$less;;
18912         [a-zA-Z]:/*) dflt=$less;;
18913         esac
18914         case "$dflt" in
18915         '') dflt=/usr/ucb/more;;
18916         esac
18917         ;;
18918 *)      dflt="$pager"
18919         : Instruct ./getfile to trust the hinted or previous pager value,
18920         : even if it does not begin with a slash.  For example, on os2,
18921         : pager might be cmd /c more.  See comments in UU/getfile.
18922         fn="f/($pager)"
18923         ;;
18924 esac
18925 echo " "
18926 rp='What pager is used on your system?'
18927 . ./getfile
18928 pager="$ans"
18929
18930 : see what type pids are declared as in the kernel
18931 rp="What is the type of process ids on this system?"
18932 set pid_t pidtype int stdio.h sys/types.h
18933 eval $typedef_ask
18934
18935 : see if ar generates random libraries by itself
18936 echo " "
18937 echo "Checking how to generate random libraries on your machine..." >&4
18938 echo 'int bar1() { return bar2(); }' > bar1.c
18939 echo 'int bar2() { return 2; }' > bar2.c
18940 $cat > foo.c <<EOP
18941 #$i_stdlib I_STDLIB
18942 #ifdef I_STDLIB
18943 #include <stdlib.h>
18944 #endif
18945 int main() { printf("%d\n", bar1()); exit(0); }
18946 EOP
18947 $cc $ccflags -c bar1.c >/dev/null 2>&1
18948 $cc $ccflags -c bar2.c >/dev/null 2>&1
18949 $cc $ccflags -c foo.c >/dev/null 2>&1
18950 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18951 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18952         $run ./foobar >/dev/null 2>&1; then
18953         echo "$ar appears to generate random libraries itself."
18954         orderlib=false
18955         ranlib=":"
18956 elif $ar ts bar$_a >/dev/null 2>&1 &&
18957         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18958         $run ./foobar >/dev/null 2>&1; then
18959                 echo "a table of contents needs to be added with '$ar ts'."
18960                 orderlib=false
18961                 ranlib="$ar ts"
18962 else
18963         case "$ranlib" in
18964         :) ranlib='';;
18965         '')
18966                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18967                 $test -f $ranlib || ranlib=''
18968                 ;;
18969         esac
18970         if $test -n "$ranlib"; then
18971                 echo "your system has '$ranlib'; we'll use that."
18972                 orderlib=false
18973         else
18974                 echo "your system doesn't seem to support random libraries"
18975                 echo "so we'll use lorder and tsort to order the libraries."
18976                 orderlib=true
18977                 ranlib=":"
18978         fi
18979 fi
18980 $rm -f foo* bar* 
18981
18982 : check for type of arguments to select. 
18983 case "$selecttype" in
18984 '') case "$d_select" in
18985         $define)
18986                 echo " "
18987                 $cat <<EOM
18988 Checking to see what type of arguments are accepted by select().
18989 EOM
18990                 hdrs="$define sys/types.h
18991                         $i_systime sys/time.h 
18992                         $i_sysselct sys/select.h
18993                         $d_socket sys/socket.h"
18994                 : The first arg can be int, unsigned, or size_t
18995                 : The last arg may or may not be 'const'
18996                 val=''
18997                 : void pointer has been seen but using that
18998                 : breaks the selectminbits test
18999                 for xxx in 'fd_set *' 'int *'; do
19000                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19001                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19002                                         case "$val" in
19003                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19004                                                 if ./protochk "$try" $hdrs; then
19005                                                         echo "Your system accepts $xxx."
19006                                                         val="$xxx"
19007                                                 fi
19008                                                 ;;
19009                                         esac
19010                                 done
19011                         done
19012                 done
19013                 case "$val" in
19014                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19015                         case "$d_fd_set" in
19016                                 $define) dflt="fd_set *" ;;
19017                                 *)              dflt="int *" ;;
19018                         esac
19019                         . ./myread
19020                         val=$ans
19021                         ;;
19022                 esac
19023                 selecttype="$val"
19024                 ;;
19025         *)      : no select, so pick a harmless default
19026                 selecttype='int *'
19027                 ;;
19028         esac
19029         ;;
19030 esac
19031
19032 : check for the select 'width'
19033 case "$selectminbits" in
19034 '') safebits=`expr $ptrsize \* 8`
19035     case "$d_select" in
19036         $define)
19037                 $cat <<EOM
19038
19039 Checking to see on how many bits at a time your select() operates...
19040 EOM
19041                 $cat >try.c <<EOCP
19042 #include <sys/types.h>
19043 #$i_time I_TIME
19044 #$i_systime I_SYS_TIME
19045 #$i_systimek I_SYS_TIME_KERNEL
19046 #ifdef I_TIME
19047 #   include <time.h>
19048 #endif
19049 #ifdef I_SYS_TIME
19050 #   ifdef I_SYS_TIME_KERNEL
19051 #       define KERNEL
19052 #   endif
19053 #   include <sys/time.h>
19054 #   ifdef I_SYS_TIME_KERNEL
19055 #       undef KERNEL
19056 #   endif
19057 #endif
19058 #$i_sysselct I_SYS_SELECT
19059 #ifdef I_SYS_SELECT
19060 #include <sys/select.h>
19061 #endif
19062 #$d_socket HAS_SOCKET
19063 #ifdef HAS_SOCKET
19064 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19065 #endif
19066 #include <stdio.h>
19067 #$i_stdlib I_STDLIB
19068 #ifdef I_STDLIB
19069 #include <stdlib.h>
19070 #endif
19071 $selecttype b;
19072 #define S sizeof(*(b))
19073 #define MINBITS 64
19074 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19075 #define NBITS  (NBYTES * 8)
19076 int main() {
19077     char *s = malloc(NBYTES);
19078     struct timeval t;
19079     int i;
19080     FILE* fp;
19081     int fd;
19082
19083     if (!s)
19084         exit(1);
19085     fclose(stdin);
19086     fp = fopen("try.c", "r");
19087     if (fp == 0)
19088       exit(2);
19089     fd = fileno(fp);
19090     if (fd < 0)
19091       exit(3);
19092     b = ($selecttype)s;
19093     for (i = 0; i < NBITS; i++)
19094         FD_SET(i, b);
19095     t.tv_sec  = 0;
19096     t.tv_usec = 0;
19097     select(fd + 1, b, 0, 0, &t);
19098     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19099     free(s);
19100     printf("%d\n", i + 1);
19101     return 0;
19102 }
19103 EOCP
19104                 set try
19105                 if eval $compile_ok; then
19106                         selectminbits=`$run ./try`
19107                         case "$selectminbits" in
19108                         '')     cat >&4 <<EOM
19109 Cannot figure out on how many bits at a time your select() operates.
19110 I'll play safe and guess it is $safebits bits.
19111 EOM
19112                                 selectminbits=$safebits
19113                                 bits="$safebits bits"
19114                                 ;;
19115                         1)      bits="1 bit" ;;
19116                         *)      bits="$selectminbits bits" ;;
19117                         esac
19118                         echo "Your select() operates on $bits at a time." >&4
19119                 else
19120                         rp='What is the minimum number of bits your select() operates on?'
19121                         case "$byteorder" in
19122                         12345678)       dflt=64 ;;
19123                         1234)           dflt=32 ;;
19124                         *)              dflt=1  ;;
19125                         esac
19126                         . ./myread
19127                         val=$ans
19128                         selectminbits="$val"
19129                 fi
19130                 $rm -f try.* try
19131                 ;;
19132         *)      : no select, so pick a harmless default
19133                 selectminbits=$safebits
19134                 ;;
19135         esac
19136         ;;
19137 esac
19138
19139 : Trace out the files included by signal.h, then look for SIGxxx names.
19140 : Remove SIGARRAYSIZE used by HPUX.
19141 : Remove SIGSTKSIZE used by Linux.
19142 : Remove SIGSTKSZ used by Posix.
19143 : Remove SIGTYP void lines used by OS2.
19144 : Some cpps, like os390, dont give the file name anywhere
19145 if [ "X$fieldn" = X ]; then
19146         : Just make some guesses.  We check them later.
19147         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19148 else
19149         xxx=`echo '#include <signal.h>' |
19150         $cppstdin $cppminus $cppflags 2>/dev/null |
19151         $grep '^[       ]*#.*include' | 
19152         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19153 fi
19154 : Check this list of files to be sure we have parsed the cpp output ok.
19155 : This will also avoid potentially non-existent files, such 
19156 : as ../foo/bar.h
19157 xxxfiles=''
19158 for xx in $xxx /dev/null ; do
19159         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19160 done
19161 : If we have found no files, at least try signal.h
19162 case "$xxxfiles" in
19163 '')     xxxfiles=`./findhdr signal.h` ;;
19164 esac
19165 xxx=`awk '
19166 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19167         print substr($2, 4, 20)
19168 }
19169 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19170         print substr($3, 4, 20)
19171 }' $xxxfiles`
19172 : Append some common names just in case the awk scan failed.
19173 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19174 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19175 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19176 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19177 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19178
19179 : generate a few handy files for later
19180 $cat > signal.c <<EOCP
19181 #include <sys/types.h>
19182 #include <signal.h>
19183 #$i_stdlib I_STDLIB
19184 #ifdef I_STDLIB
19185 #include <stdlib.h>
19186 #endif
19187 #include <stdio.h>
19188 int main() {
19189
19190 /* Strange style to avoid deeply-nested #if/#else/#endif */
19191 #ifndef NSIG
19192 #  ifdef _NSIG
19193 #    define NSIG (_NSIG)
19194 #  endif
19195 #endif
19196
19197 #ifndef NSIG
19198 #  ifdef SIGMAX
19199 #    define NSIG (SIGMAX+1)
19200 #  endif
19201 #endif
19202
19203 #ifndef NSIG
19204 #  ifdef SIG_MAX
19205 #    define NSIG (SIG_MAX+1)
19206 #  endif
19207 #endif
19208
19209 #ifndef NSIG
19210 #  ifdef MAXSIG
19211 #    define NSIG (MAXSIG+1)
19212 #  endif
19213 #endif
19214
19215 #ifndef NSIG
19216 #  ifdef MAX_SIG
19217 #    define NSIG (MAX_SIG+1)
19218 #  endif
19219 #endif
19220
19221 #ifndef NSIG
19222 #  ifdef SIGARRAYSIZE
19223 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
19224 #  endif
19225 #endif
19226
19227 #ifndef NSIG
19228 #  ifdef _sys_nsig
19229 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19230 #  endif
19231 #endif
19232
19233 /* Default to some arbitrary number that's big enough to get most
19234    of the common signals.
19235 */
19236 #ifndef NSIG
19237 #    define NSIG 50
19238 #endif
19239
19240 printf("NSIG %d\n", NSIG);
19241
19242 #ifndef JUST_NSIG
19243
19244 EOCP
19245
19246 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19247 {
19248         printf "#ifdef SIG"; printf $1; printf "\n"
19249         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19250         printf $1; printf ");\n"
19251         printf "#endif\n"
19252 }
19253 END {
19254         printf "#endif /* JUST_NSIG */\n";
19255         printf "exit(0);\n}\n";
19256 }
19257 ' >>signal.c
19258 $cat >signal.awk <<'EOP'
19259 BEGIN { ndups = 0 }
19260 $1 ~ /^NSIG$/ { nsig = $2 }
19261 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19262     if ($2 > maxsig) { maxsig = $2 }
19263     if (sig_name[$2]) {
19264         dup_name[ndups] = $1
19265         dup_num[ndups] = $2
19266         ndups++ 
19267     }
19268     else {
19269         sig_name[$2] = $1
19270         sig_num[$2] = $2
19271     }
19272 }
19273 END { 
19274     if (nsig == 0) {
19275         nsig = maxsig + 1
19276     }
19277     printf("NSIG %d\n", nsig);
19278     for (n = 1; n < nsig; n++) {
19279         if (sig_name[n]) {
19280             printf("%s %d\n", sig_name[n], sig_num[n])
19281         }
19282         else {
19283             printf("NUM%d %d\n", n, n) 
19284         }
19285     }
19286     for (n = 0; n < ndups; n++) {
19287         printf("%s %d\n", dup_name[n], dup_num[n])
19288     }
19289 }
19290 EOP
19291 $cat >signal_cmd <<EOS
19292 $startsh
19293 if $test -s signal.lst; then
19294     echo "Using your existing signal.lst file"
19295         exit 0
19296 fi
19297 xxx="$xxx"
19298 EOS
19299 $cat >>signal_cmd <<'EOS'
19300
19301 set signal
19302 if eval $compile_ok; then
19303         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19304 else
19305         echo "(I can't seem be able to compile the whole test program)" >&4
19306         echo "(I'll try it in little pieces.)" >&4
19307         set signal -DJUST_NSIG
19308         if eval $compile_ok; then
19309                 $run ./signal$_exe > signal.nsg
19310                 $cat signal.nsg
19311         else
19312                 echo "I can't seem to figure out how many signals you have." >&4
19313                 echo "Guessing 50." >&4
19314                 echo 'NSIG 50' > signal.nsg
19315         fi
19316         : Now look at all the signal names, one at a time.
19317         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19318                 $cat > signal.c <<EOCP
19319 #include <sys/types.h>
19320 #include <signal.h>
19321 #include <stdio.h>
19322 int main() {
19323 printf("$xx %d\n", SIG${xx});
19324 return 0;
19325 }
19326 EOCP
19327                 set signal
19328                 if eval $compile; then
19329                         echo "SIG${xx} found."
19330                         $run ./signal$_exe  >> signal.ls1
19331                 else
19332                         echo "SIG${xx} NOT found."
19333                 fi
19334         done
19335         if $test -s signal.ls1; then
19336                 $cat signal.nsg signal.ls1 |
19337                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19338         fi
19339
19340 fi
19341 if $test -s signal.lst; then
19342         :
19343 else
19344         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19345         echo 'kill -l' >signal
19346         set X `csh -f <signal`
19347         $rm -f signal
19348         shift
19349         case $# in
19350         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19351         esac
19352         echo $@ | $tr ' ' $trnl | \
19353             $awk '{ printf "%s %d\n", $1, ++s; }
19354                   END { printf "NSIG %d\n", ++s }' >signal.lst
19355 fi
19356 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19357 EOS
19358 chmod a+x signal_cmd
19359 $eunicefix signal_cmd
19360
19361 : generate list of signal names
19362 echo " "
19363 case "$sig_name_init" in
19364 '') doinit=yes ;;
19365 *)  case "$sig_num_init" in
19366     ''|*,*) doinit=yes ;;
19367     esac ;;
19368 esac
19369 case "$doinit" in
19370 yes)
19371         echo "Generating a list of signal names and numbers..." >&4
19372         . ./signal_cmd
19373         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19374         sig_name=`$awk 'BEGIN { printf "ZERO " }
19375                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19376         sig_num=`$awk  'BEGIN { printf "0 " }
19377                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19378         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19379                              !/^NSIG/   { printf "\"%s\", ", $1 }
19380                              END        { printf "0\n" }' signal.lst`
19381         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19382                              !/^NSIG/   { printf "%d, ", $2}
19383                              END        { printf "0\n"}' signal.lst`
19384         ;;
19385 esac
19386 echo "The following $sig_count signals are available:"
19387 echo " "
19388 echo $sig_name | $awk \
19389 'BEGIN { linelen = 0 }
19390 {
19391         for (i = 1; i <= NF; i++) {
19392                 name = "SIG" $i " "
19393                 linelen = linelen + length(name)
19394                 if (linelen > 70) {
19395                         printf "\n"
19396                         linelen = length(name)
19397                 }
19398                 printf "%s", name
19399         }
19400         printf "\n"
19401 }'
19402 sig_size=`echo $sig_name | awk '{print NF}'`
19403 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19404
19405 echo " "
19406 case "$sizetype" in
19407 *_t) zzz="$sizetype"    ;;
19408 *)   zzz="filesize"     ;;
19409 esac
19410 echo "Checking the size of $zzz..." >&4 
19411 cat > try.c <<EOCP
19412 #include <sys/types.h>
19413 #include <stdio.h>
19414 #$i_stdlib I_STDLIB
19415 #ifdef I_STDLIB
19416 #include <stdlib.h>
19417 #endif
19418 int main() {
19419     printf("%d\n", (int)sizeof($sizetype));
19420     exit(0);
19421 }
19422 EOCP
19423 set try
19424 if eval $compile_ok; then
19425         yyy=`$run ./try`
19426         case "$yyy" in
19427         '')     sizesize=4
19428                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19429                 ;;
19430         *)      sizesize=$yyy
19431                 echo "Your $zzz size is $sizesize bytes."
19432                 ;;
19433         esac
19434 else
19435         sizesize=4
19436         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19437 fi
19438
19439
19440 : check for socklen_t
19441 echo " "
19442 echo "Checking to see if you have socklen_t..." >&4
19443 $cat >try.c <<EOCP
19444 #include <sys/types.h>
19445 #$d_socket HAS_SOCKET
19446 #ifdef HAS_SOCKET
19447 #include <sys/socket.h>
19448 #endif
19449 int main() { socklen_t x = 16; }
19450 EOCP
19451 set try
19452 if eval $compile; then
19453         val="$define"
19454         echo "You have socklen_t."
19455 else
19456         val="$undef"
19457         echo "You do not have socklen_t."
19458         case "$sizetype" in
19459         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19460         esac
19461 fi
19462 $rm -f try try.*
19463 set d_socklen_t
19464 eval $setvar
19465
19466 : see if this is a socks.h system
19467 set socks.h i_socks
19468 eval $inhdr
19469
19470 : check for type of the size argument to socket calls
19471 case "$d_socket" in
19472 "$define")
19473         $cat <<EOM
19474
19475 Checking to see what type is the last argument of accept().
19476 EOM
19477         yyy=''
19478         case "$d_socklen_t" in
19479         "$define") yyy="$yyy socklen_t"
19480         esac
19481         yyy="$yyy $sizetype int long unsigned"
19482         for xxx in $yyy; do
19483                 case "$socksizetype" in
19484                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19485                         case "$usesocks" in
19486                         "$define")
19487                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19488                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19489                                         socksizetype="$xxx"
19490                                 fi
19491                                 ;;
19492                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19493                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19494                                         socksizetype="$xxx"
19495                                 fi
19496                                 ;;
19497                         esac
19498                         ;;
19499                 esac
19500         done
19501 : In case none of those worked, prompt the user.
19502         case "$socksizetype" in
19503         '')     rp='What is the type for socket address structure sizes?'
19504                 dflt='int'
19505                 . ./myread
19506                 socksizetype=$ans
19507                 ;;
19508         esac
19509         ;;
19510 *)      : no sockets, so pick relatively harmless default
19511         socksizetype='int'
19512         ;;
19513 esac
19514
19515 : see what type is used for signed size_t
19516 set ssize_t ssizetype int stdio.h sys/types.h
19517 eval $typedef
19518 dflt="$ssizetype"
19519 $cat > try.c <<EOM
19520 #include <stdio.h>
19521 #$i_stdlib I_STDLIB
19522 #ifdef I_STDLIB
19523 #include <stdlib.h>
19524 #endif
19525 #include <sys/types.h>
19526 #define Size_t $sizetype
19527 #define SSize_t $dflt
19528 int main()
19529 {
19530         if (sizeof(Size_t) == sizeof(SSize_t))
19531                 printf("$dflt\n");
19532         else if (sizeof(Size_t) == sizeof(int))
19533                 printf("int\n");
19534         else 
19535                 printf("long\n");
19536         exit(0);
19537 }
19538 EOM
19539 echo " "
19540 set try
19541 if eval $compile_ok && $run ./try > /dev/null; then
19542         ssizetype=`$run ./try`
19543         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19544 else
19545         $cat >&4 <<EOM
19546 Help! I can't compile and run the ssize_t test program: please enlighten me!
19547 (This is probably a misconfiguration in your system or libraries, and
19548 you really ought to fix it.  Still, I'll try anyway.)
19549
19550 I need a type that is the same size as $sizetype, but is guaranteed to
19551 be signed.  Common values are ssize_t, int and long.
19552
19553 EOM
19554         rp="What signed type is the same size as $sizetype?"
19555         . ./myread
19556         ssizetype="$ans"
19557 fi
19558 $rm -f try try.*
19559
19560 : see what type of char stdio uses.
19561 echo " "
19562 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19563 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19564         echo "Your stdio uses unsigned chars." >&4
19565         stdchar="unsigned char"
19566 else
19567         echo "Your stdio uses signed chars." >&4
19568         stdchar="char"
19569 fi
19570 $rm -f stdioh
19571
19572
19573
19574 : see what type uids are declared as in the kernel
19575 echo " "
19576 echo "Looking for the type for user ids returned by getuid()."
19577 set uid_t uidtype xxx stdio.h sys/types.h
19578 eval $typedef
19579 case "$uidtype" in
19580 xxx)
19581         xxx=`./findhdr sys/user.h`
19582         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19583         case $1 in
19584         unsigned) dflt="$1 $2" ;;
19585         *) dflt="$1" ;;
19586         esac
19587         ;;
19588 *) dflt="$uidtype";;
19589 esac
19590 case "$uidtype" in
19591 uid_t)  echo "uid_t found." ;;
19592 *)      rp="What is the type for user ids returned by getuid()?"
19593         . ./myread
19594         uidtype="$ans"
19595         ;;
19596 esac
19597
19598 echo " "
19599 case "$uidtype" in
19600 *_t) zzz="$uidtype"     ;;
19601 *)   zzz="uid"          ;;
19602 esac
19603 echo "Checking the size of $zzz..." >&4 
19604 cat > try.c <<EOCP
19605 #include <sys/types.h>
19606 #include <stdio.h>
19607 #$i_stdlib I_STDLIB
19608 #ifdef I_STDLIB
19609 #include <stdlib.h>
19610 #endif
19611 int main() {
19612     printf("%d\n", (int)sizeof($uidtype));
19613     exit(0);
19614 }
19615 EOCP
19616 set try
19617 if eval $compile_ok; then
19618         yyy=`$run ./try`
19619         case "$yyy" in
19620         '')     uidsize=4
19621                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19622                 ;;
19623         *)      uidsize=$yyy
19624                 echo "Your $zzz is $uidsize bytes long."
19625                 ;;
19626         esac
19627 else
19628         uidsize=4
19629         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19630 fi
19631
19632 echo " "
19633 case "$uidtype" in
19634 *_t) zzz="$uidtype"     ;;
19635 *)   zzz="uid"          ;;
19636 esac
19637 echo "Checking the sign of $zzz..." >&4
19638 cat > try.c <<EOCP
19639 #include <sys/types.h>
19640 #include <stdio.h>
19641 int main() {
19642         $uidtype foo = -1;
19643         if (foo < 0)
19644                 printf("-1\n");
19645         else
19646                 printf("1\n");
19647 }
19648 EOCP
19649 set try
19650 if eval $compile; then
19651         yyy=`$run ./try`
19652         case "$yyy" in
19653         '')     uidsign=1
19654                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19655                 ;;
19656         *)      uidsign=$yyy
19657                 case "$uidsign" in
19658                  1) echo "Your $zzz is unsigned." ;;
19659                 -1) echo "Your $zzz is signed."   ;;
19660                 esac
19661                 ;;
19662         esac
19663 else
19664         uidsign=1
19665         echo "(I can't compile the test program--guessing unsigned.)" >&4
19666 fi
19667
19668
19669
19670 echo " "
19671 $echo "Checking the format string to be used for uids..." >&4
19672
19673 case "$uidsign" in
19674 -1)     if $test X"$uidsize" = X"$ivsize"; then
19675                 uidformat="$ivdformat"
19676         else
19677                 if $test X"$uidsize" = X"$longsize"; then
19678                         uidformat='"ld"'
19679                 else
19680                         if $test X"$uidsize" = X"$intsize"; then
19681                                 uidformat='"d"'
19682                         else
19683                                 if $test X"$uidsize" = X"$shortsize"; then
19684                                         uidformat='"hd"'
19685                                 fi
19686                         fi
19687                 fi
19688         fi
19689         ;;
19690 *)      if $test X"$uidsize" = X"$uvsize"; then
19691                 uidformat="$uvuformat"
19692         else
19693                 if $test X"$uidsize" = X"$longsize"; then
19694                         uidformat='"lu"'
19695                 else
19696                         if $test X"$uidsize" = X"$intsize"; then
19697                                 uidformat='"u"'
19698                         else
19699                                 if $test X"$uidsize" = X"$shortsize"; then
19700                                         uidformat='"hu"'
19701                                 fi
19702                         fi
19703                 fi
19704         fi
19705         ;;
19706 esac
19707
19708
19709 case "$usesitecustomize" in
19710     $define|true|[Yy]*)
19711         usesitecustomize="$define"
19712         ;;
19713     *)
19714         usesitecustomize="$undef"
19715         ;;
19716     esac
19717
19718 : determine compiler compiler
19719 case "$yacc" in
19720 '')
19721         dflt=yacc;;
19722 *)
19723         dflt="$yacc";;
19724 esac
19725 echo " "
19726 comp='yacc'
19727 if $test -f "$byacc$_exe"; then
19728         dflt="$byacc"
19729         comp="byacc or $comp"
19730 fi
19731 if $test -f "$bison$_exe"; then
19732         comp="$comp or bison -y"
19733 fi
19734 rp="Which compiler compiler ($comp) shall I use?"
19735 . ./myread
19736 yacc="$ans"
19737 case "$yacc" in
19738 *bis*)
19739         case "$yacc" in
19740         *-y*) ;;
19741         *)
19742                 yacc="$yacc -y"
19743                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19744                 ;;
19745         esac
19746         ;;
19747 esac
19748
19749 : see if this is a fp.h system
19750 set fp.h i_fp
19751 eval $inhdr
19752
19753 : see if this is a fp_class.h system
19754 set fp_class.h i_fp_class
19755 eval $inhdr
19756
19757 : see if this is a ieeefp.h system
19758 case "$i_ieeefp" in
19759 '' ) set ieeefp.h i_ieeefp
19760      eval $inhdr
19761      ;;
19762 esac
19763
19764 : see if this is a libutil.h system
19765 set libutil.h i_libutil
19766 eval $inhdr
19767
19768 : see if mach cthreads are available
19769 if test "X$usethreads" = "X$define"; then
19770         set mach/cthreads.h i_machcthr
19771         eval $inhdr
19772 else
19773         i_machcthr="$undef"
19774 fi
19775
19776
19777
19778 : see if this is a mntent.h system
19779 set mntent.h i_mntent
19780 eval $inhdr
19781
19782 : see if ndbm.h is available
19783 set ndbm.h t_ndbm
19784 eval $inhdr
19785
19786 case "$t_ndbm" in
19787 $undef)
19788     # Some Linux distributions such as RedHat 7.1 put the
19789     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19790     if $test -f /usr/include/gdbm/ndbm.h; then
19791         echo '<gdbm/ndbm.h> found.'
19792         ccflags="$ccflags -I/usr/include/gdbm"
19793         cppflags="$cppflags -I/usr/include/gdbm"
19794         t_ndbm=$define
19795     fi
19796     ;;
19797 esac
19798
19799 case "$t_ndbm" in
19800 $define)
19801         : see if dbm_open exists
19802         set dbm_open d_dbm_open
19803         eval $inlibc
19804         case "$d_dbm_open" in
19805         $undef)
19806                 t_ndbm="$undef"
19807                 echo "We won't be including <ndbm.h>"
19808                 ;;
19809         esac
19810         ;;
19811 esac
19812 val="$t_ndbm"
19813 set i_ndbm
19814 eval $setvar
19815
19816 : see if net/errno.h is available
19817 val=''
19818 set net/errno.h val
19819 eval $inhdr
19820
19821 : Unfortunately, it causes problems on some systems.  Arrgh.
19822 case "$val" in
19823 $define)
19824         cat > try.c <<'EOM'
19825 #include <stdio.h>
19826 #include <errno.h>
19827 #include <net/errno.h>
19828 int func()
19829 {
19830         return ENOTSOCK;
19831 }
19832 EOM
19833         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19834                 echo "We'll be including <net/errno.h>." >&4
19835         else
19836                 echo "We won't be including <net/errno.h>." >&4
19837                 val="$undef"
19838         fi
19839         $rm -f try.* try
19840         ;;
19841 esac
19842 set i_neterrno
19843 eval $setvar
19844
19845 : see if netinet/tcp.h is available
19846 set netinet/tcp.h i_netinettcp
19847 eval $inhdr
19848
19849 : see if this is a poll.h system
19850 set poll.h i_poll
19851 eval $inhdr
19852
19853 : see if this is a prot.h system
19854 set prot.h i_prot
19855 eval $inhdr
19856
19857 echo " "
19858 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19859 $cat <<'EOSH' > Cppsym.know
19860 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19861 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19862 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19863 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19864 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19865 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19866 bull c cadmus clipper CMU COFF COMPILER_VERSION
19867 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19868 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19869 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19870 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19871 GLIBC GLIBC_MINOR
19872 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19873 H3050R H3050RX hbullx20 hcx host_mips
19874 hp200 hp300 hp700 HP700 hp800 hp9000
19875 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19876 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19877 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19878 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19879 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19880 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19881 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19882 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19883 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19884 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19885 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19886 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19887 MATH_HAS_NO_SIDE_EFFECTS
19888 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19889 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19890 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19891 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19892 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19893 NetBSD news1500 news1700 news1800 news1900 news3700
19894 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19895 ns32016 ns32332 ns32k nsc32000
19896 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19897 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19898 pc532 pdp11 PGC PIC plexus PORTAR posix
19899 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19900 POSIX_C_SOURCE POSIX_SOURCE POWER
19901 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19902 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19903 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19904 sony sony_news sonyrisc sparc sparclite spectrum
19905 stardent stdc STDC_EXT stratos sun sun3 sun386
19906 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19907 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19908 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19909 sysV68 sysV88 Tek4132 Tek4300 titan
19910 TM3200 TM5400 TM5600
19911 tower tower32 tower32_200 tower32_600 tower32_700
19912 tower32_800 tower32_850 tss
19913 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19914 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19915 unix UNIX95 UNIX99 unixpc unos
19916 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19917 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19918 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19919 USGr4 USGr4_2
19920 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19921 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19922 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19923 z8000
19924 EOSH
19925 # Maybe put other stuff here too.
19926 cat <<EOSH >>Cppsym.know
19927 $osname
19928 EOSH
19929 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19930 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19931 $cat Cppsym.know > Cppsym.c
19932 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19933 $rm -f Cppsym.a Cppsym.b Cppsym.c
19934 cat <<EOSH > Cppsym
19935 $startsh
19936 if $test \$# -gt 0; then
19937     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19938     if $test -s Cppsym.got; then
19939         $rm -f Cppsym.got
19940         exit 0
19941     fi
19942     $rm -f Cppsym.got
19943     exit 1
19944 else
19945     $tr " " "$trnl" | ./Cppsym.try
19946     exit 0
19947 fi
19948 EOSH
19949 chmod +x Cppsym
19950 $eunicefix Cppsym
19951 cat <<EOSH > Cppsym.try
19952 $startsh
19953 cat <<'EOCP' > try.c
19954 #include <stdio.h>
19955 int main() {
19956 EOCP
19957 $awk \\
19958 EOSH
19959 cat <<'EOSH' >> Cppsym.try
19960 'length($1) > 0 {
19961     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
19962     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
19963     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
19964     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
19965 }'       >> try.c
19966 echo 'return 0;}' >> try.c
19967 EOSH
19968 cat <<EOSH >> Cppsym.try
19969 ccflags="$ccflags"
19970 case "$osname-$gccversion" in
19971 irix-) ccflags="\$ccflags -woff 1178" ;;
19972 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19973 esac
19974 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19975 EOSH
19976 chmod +x Cppsym.try
19977 $eunicefix Cppsym.try
19978 ./Cppsym < Cppsym.know > Cppsym.true
19979 : now check the C compiler for additional symbols
19980 postprocess_cc_v=''
19981 case "$osname" in
19982 aix) postprocess_cc_v="|$tr , ' '" ;;
19983 esac
19984 $cat >ccsym <<EOS
19985 $startsh
19986 $cat >tmp.c <<EOF
19987 extern int foo;
19988 EOF
19989 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19990 do
19991         case "\$i" in
19992         -D*) echo "\$i" | $sed 's/^-D//';;
19993         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19994         esac
19995 done
19996 $rm -f try.c
19997 EOS
19998 postprocess_cc_v=''
19999 chmod +x ccsym
20000 $eunicefix ccsym
20001 ./ccsym > ccsym1.raw
20002 if $test -s ccsym1.raw; then
20003        $sort ccsym1.raw | $uniq >ccsym.raw
20004 else
20005        mv ccsym1.raw ccsym.raw
20006 fi
20007
20008 $awk '/\=/ { print $0; next }
20009         { print $0"=1" }' ccsym.raw >ccsym.list
20010 $awk '/\=/ { print $0; next }
20011         { print $0"=1" }' Cppsym.true >ccsym.true
20012 $comm -13 ccsym.true ccsym.list >ccsym.own
20013 $comm -12 ccsym.true ccsym.list >ccsym.com
20014 $comm -23 ccsym.true ccsym.list >ccsym.cpp
20015 also=''
20016 if $test -z ccsym.raw; then
20017         echo "Your C compiler doesn't seem to define any symbols!" >&4
20018         echo " "
20019         echo "However, your C preprocessor defines the following symbols:"
20020         $cat Cppsym.true
20021         ccsymbols=''
20022         cppsymbols=`$cat Cppsym.true`
20023         cppsymbols=`echo $cppsymbols`
20024         cppccsymbols="$cppsymbols"
20025 else
20026         if $test -s ccsym.com; then
20027                 echo "Your C compiler and pre-processor define these symbols:"
20028                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20029                 also='also '
20030                 symbols='ones'
20031                 cppccsymbols=`$cat ccsym.com`
20032                 cppccsymbols=`echo $cppccsymbols`
20033                 $test "$silent" || sleep 1
20034         fi
20035         if $test -s ccsym.cpp; then
20036                 $test "$also" && echo " "
20037                 echo "Your C pre-processor ${also}defines the following symbols:"
20038                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20039                 also='further '
20040                 cppsymbols=`$cat ccsym.cpp`
20041                 cppsymbols=`echo $cppsymbols`
20042                 $test "$silent" || sleep 1
20043         fi
20044         if $test -s ccsym.own; then
20045                 $test "$also" && echo " "
20046                 echo "Your C compiler ${also}defines the following cpp symbols:"
20047                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20048                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20049                 ccsymbols=`$cat ccsym.own`
20050                 ccsymbols=`echo $ccsymbols`
20051                 $test "$silent" || sleep 1
20052         fi
20053 fi
20054
20055 : see if this is a termio system
20056 val="$undef"
20057 val2="$undef"
20058 val3="$undef"
20059 if $test `./findhdr termios.h`; then
20060         set tcsetattr i_termios
20061         eval $inlibc
20062         val3="$i_termios"
20063 fi
20064 echo " "
20065 case "$val3" in
20066 "$define") echo "You have POSIX termios.h... good!" >&4;;
20067 *) if ./Cppsym pyr; then
20068                 case "`/bin/universe`" in
20069                 ucb) if $test `./findhdr sgtty.h`; then
20070                                 val2="$define"
20071                                 echo "<sgtty.h> found." >&4
20072                         else
20073                                 echo "System is pyramid with BSD universe."
20074                                 echo "<sgtty.h> not found--you could have problems." >&4
20075                         fi;;
20076                 *) if $test `./findhdr termio.h`; then
20077                                 val="$define"
20078                                 echo "<termio.h> found." >&4
20079                         else
20080                                 echo "System is pyramid with USG universe."
20081                                 echo "<termio.h> not found--you could have problems." >&4
20082                         fi;;
20083                 esac
20084         elif ./usg; then
20085                 if $test `./findhdr termio.h`; then
20086                         echo "<termio.h> found." >&4
20087                         val="$define"
20088                 elif $test `./findhdr sgtty.h`; then
20089                         echo "<sgtty.h> found." >&4
20090                         val2="$define"
20091                 else
20092 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20093                 fi
20094         else
20095                 if $test `./findhdr sgtty.h`; then
20096                         echo "<sgtty.h> found." >&4
20097                         val2="$define"
20098                 elif $test `./findhdr termio.h`; then
20099                         echo "<termio.h> found." >&4
20100                         val="$define"
20101                 else
20102 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20103                 fi
20104         fi;;
20105 esac
20106 set i_termio; eval $setvar
20107 val=$val2; set i_sgtty; eval $setvar
20108 val=$val3; set i_termios; eval $setvar
20109
20110 : see if stddef is available
20111 set stddef.h i_stddef
20112 eval $inhdr
20113
20114 : see if this is a sunmath.h system
20115 set sunmath.h i_sunmath
20116 eval $inhdr
20117
20118 : see if sys/access.h is available
20119 set sys/access.h i_sysaccess
20120 eval $inhdr
20121
20122 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20123 set sys/filio.h i_sysfilio
20124 eval $inhdr
20125 echo " "
20126 if $test `./findhdr sys/ioctl.h`; then
20127         val="$define"
20128         echo '<sys/ioctl.h> found.' >&4
20129 else
20130         val="$undef"
20131         if $test $i_sysfilio = "$define"; then
20132             echo '<sys/ioctl.h> NOT found.' >&4
20133         else
20134                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20135                 $test $i_termio = "$define" && xxx="termio.h"
20136                 $test $i_termios = "$define" && xxx="termios.h"
20137 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20138         fi
20139 fi
20140 set i_sysioctl
20141 eval $setvar
20142
20143 : see if socket ioctl defs are in sys/sockio.h
20144 echo " "
20145 xxx=`./findhdr sys/sockio.h`
20146 if $test "$xxx"; then
20147         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20148                 val="$define"
20149                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20150         else
20151                 val="$undef"
20152                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20153         fi
20154 else
20155         val="$undef"
20156         $cat <<EOM
20157 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20158 EOM
20159 fi
20160 set i_syssockio
20161 eval $setvar
20162
20163
20164 : see if this is a syslog.h system
20165 set syslog.h i_syslog
20166 eval $inhdr
20167
20168
20169 : see if this is a sys/mode.h system
20170 set sys/mode.h i_sysmode
20171 eval $inhdr
20172
20173 : see if sys/resource.h has to be included
20174 set sys/resource.h i_sysresrc
20175 eval $inhdr
20176
20177 : see if sys/security.h is available
20178 set sys/security.h i_syssecrt
20179 eval $inhdr
20180
20181 : see if this is a sys/statvfs.h system
20182 set sys/statvfs.h i_sysstatvfs
20183 eval $inhdr
20184
20185 : see if this is a sys/un.h system
20186 set sys/un.h i_sysun
20187 eval $inhdr
20188
20189
20190 : see if this is a sys/utsname.h system
20191 set sys/utsname.h i_sysutsname
20192 eval $inhdr
20193
20194 : see if this is a syswait system
20195 set sys/wait.h i_syswait
20196 eval $inhdr
20197
20198 : see if this is a ustat.h system
20199 set ustat.h i_ustat
20200 eval $inhdr
20201
20202 : see if this is an utime system
20203 set utime.h i_utime
20204 eval $inhdr
20205
20206 : see if this is a values.h system
20207 set values.h i_values
20208 eval $inhdr
20209
20210 : see if this is a vfork system
20211 case "$d_vfork" in
20212 "$define")
20213         set vfork.h i_vfork
20214         eval $inhdr
20215         ;;
20216 *)
20217         i_vfork="$undef"
20218         ;;
20219 esac
20220
20221 : see if gdbm.h is available
20222 set gdbm.h t_gdbm
20223 eval $inhdr
20224 case "$t_gdbm" in
20225 $define)
20226         : see if gdbm_open exists
20227         set gdbm_open d_gdbm_open
20228         eval $inlibc
20229         case "$d_gdbm_open" in
20230         $undef)
20231                 t_gdbm="$undef"
20232                 echo "We won't be including <gdbm.h>"
20233                 ;;
20234         esac
20235         ;;
20236 esac
20237 val="$t_gdbm"
20238 set i_gdbm
20239 eval $setvar
20240
20241 echo " "
20242 echo "Looking for extensions..." >&4
20243 : If we are using the old config.sh, known_extensions may contain
20244 : old or inaccurate or duplicate values.
20245 known_extensions=''
20246 nonxs_extensions=''
20247 : We do not use find because it might not be available.
20248 : We do not just use MANIFEST because the user may have dropped
20249 : some additional extensions into the source tree and expect them
20250 : to be built.
20251
20252 : Function to recursively find available extensions, ignoring DynaLoader
20253 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20254 find_extensions='
20255     for xxx in *; do
20256        case "$xxx" in
20257            DynaLoader|dynaload) ;;
20258            *)
20259            if $test -f $xxx/$xxx.xs; then
20260                known_extensions="$known_extensions $1$xxx";
20261            elif $test -f $xxx/Makefile.PL; then
20262                nonxs_extensions="$nonxs_extensions $1$xxx";
20263            else
20264                if $test -d $xxx -a $# -lt 10; then
20265                    set $1$xxx/ $*;
20266                    cd "$xxx";
20267                    eval $find_extensions;
20268                    cd ..;
20269                    shift;
20270                fi;
20271            fi
20272            ;;
20273        esac;
20274     done'
20275 tdir=`pwd`
20276 cd "$rsrc/ext"
20277 set X
20278 shift
20279 eval $find_extensions
20280 # Special case:  Add in threads/shared since it is not picked up by the
20281 # recursive find above (and adding in general recursive finding breaks
20282 # SDBM_File/sdbm).  A.D.  10/25/2001.
20283 known_extensions="$known_extensions threads/shared"
20284 set X $nonxs_extensions
20285 shift
20286 nonxs_extensions="$*"
20287 set X $known_extensions
20288 shift
20289 known_extensions="$*"
20290 cd "$tdir"
20291
20292 : Now see which are supported on this system.
20293 avail_ext=''
20294 for xxx in $known_extensions ; do
20295         case "$xxx" in
20296         DB_File|db_file)
20297                 case "$i_db" in
20298                 $define) avail_ext="$avail_ext $xxx" ;;
20299                 esac
20300                 ;;
20301         GDBM_File|gdbm_fil)
20302                 case "$i_gdbm" in 
20303                 $define) avail_ext="$avail_ext $xxx" ;;
20304                 esac
20305                 ;;
20306         I18N/Langinfo|i18n_lan)
20307                 case "$i_langinfo$d_nl_langinfo" in 
20308                 $define$define) avail_ext="$avail_ext $xxx" ;;
20309                 esac
20310                 ;;
20311         NDBM_File|ndbm_fil)
20312                 case "$i_ndbm" in
20313                 $define)
20314                     case "$osname-$use64bitint" in
20315                     hpux-define)
20316                         case "$libs" in
20317                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20318                         esac
20319                         ;;
20320                     *) avail_ext="$avail_ext $xxx" ;;
20321                     esac
20322                     ;;
20323                 esac
20324                 ;;
20325         ODBM_File|odbm_fil) 
20326                 case "${i_dbm}${i_rpcsvcdbm}" in
20327                 *"${define}"*)
20328                     case "$osname-$use64bitint" in
20329                     hpux-define)
20330                         case "$libs" in
20331                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20332                         esac
20333                         ;;
20334                     *) avail_ext="$avail_ext $xxx" ;;
20335                     esac
20336                     ;;
20337                 esac
20338                 ;;
20339         POSIX|posix)
20340                 case "$useposix" in
20341                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20342                 esac
20343                 ;;
20344         Opcode|opcode)
20345                 case "$useopcode" in
20346                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20347                 esac
20348                 ;;
20349         Socket|socket)
20350                 case "$d_socket" in 
20351                 true|$define|y)
20352                     case "$osname" in
20353                     beos) ;; # not unless BONE
20354                     *) avail_ext="$avail_ext $xxx" ;;
20355                     esac
20356                     ;;
20357                 esac
20358                 ;;
20359         Sys/Syslog|sys/syslog)
20360                 : XXX syslog requires socket
20361                 case "$d_socket" in 
20362                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20363                 esac
20364                 ;;
20365         Thread|thread)
20366                 case "$usethreads" in
20367                 true|$define|y)
20368                         case "$useithreads" in
20369                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20370                         esac
20371                 esac
20372                 ;;
20373         XS/APItest|xs/apitest)
20374                 # This is just for testing.  Skip it unless we have dynamic loading.
20375
20376                 case "$usedl" in
20377                 $define) avail_ext="$avail_ext $xxx" ;;
20378                 esac
20379                 ;;
20380         XS/Typemap|xs/typemap)
20381                 # This is just for testing.  Skip it unless we have dynamic loading.
20382                 case "$usedl" in
20383                 $define) avail_ext="$avail_ext $xxx" ;;
20384                 esac
20385                 ;;
20386         threads|threads/shared)
20387                 # threads and threads::shared are special cases.
20388                 # To stop people from asking "Perl 5.8.0 was supposed
20389                 # to have this new fancy threads implementation but my
20390                 # perl doesn't have it" and from people trying to
20391                 # (re)install the threads module using CPAN.pm and
20392                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20393                 # the threads.pm and threads/shared.pm will always be
20394                 # there, croaking informatively ("you need to rebuild
20395                 # all of Perl with threads, sorry") when threads haven't
20396                 # been compiled in.
20397                 # --jhi
20398                 avail_ext="$avail_ext $xxx"
20399                 ;;
20400         IPC/SysV|ipc/sysv)
20401                 : XXX Do we need a useipcsysv variable here
20402                 case "${d_msg}${d_sem}${d_shm}" in 
20403                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20404                 esac
20405                 ;;
20406         *)      avail_ext="$avail_ext $xxx"
20407                 ;;
20408         esac
20409 done
20410
20411 set X $avail_ext
20412 shift
20413 avail_ext="$*"
20414
20415 case "$onlyextensions" in
20416 '') ;;
20417 *)  keepextensions=''
20418     echo "You have requested that only certains extensions be included..." >&4
20419     for i in $onlyextensions; do
20420         case " $avail_ext " in
20421         *" $i "*)
20422             echo "Keeping extension $i."
20423             keepextensions="$keepextensions $i"
20424             ;;
20425         *) echo "Ignoring extension $i." ;;
20426         esac
20427     done
20428     avail_ext="$keepextensions"
20429     ;;
20430 esac
20431
20432 case "$noextensions" in
20433 '') ;;
20434 *)  keepextensions=''
20435     echo "You have requested that certain extensions be ignored..." >&4
20436     for i in $avail_ext; do
20437         case " $noextensions " in
20438         *" $i "*) echo "Ignoring extension $i." ;;
20439         *) echo "Keeping extension $i.";
20440            keepextensions="$keepextensions $i"
20441            ;;
20442         esac
20443     done
20444     avail_ext="$keepextensions"
20445     ;;
20446 esac
20447
20448 : Now see which nonxs extensions are supported on this system.
20449 : For now assume all are.
20450 nonxs_ext=''
20451 for xxx in $nonxs_extensions ; do
20452         case "$xxx" in
20453         *)      nonxs_ext="$nonxs_ext $xxx"
20454                 ;;
20455         esac
20456 done
20457
20458 set X $nonxs_ext
20459 shift
20460 nonxs_ext="$*"
20461
20462 case $usedl in
20463 $define)
20464         $cat <<EOM
20465 A number of extensions are supplied with $package.  You may choose to
20466 compile these extensions for dynamic loading (the default), compile
20467 them into the $package executable (static loading), or not include
20468 them at all.  Answer "none" to include no extensions.
20469 Note that DynaLoader is always built and need not be mentioned here.
20470
20471 EOM
20472         case "$dynamic_ext" in
20473         '')
20474                 : Exclude those listed in static_ext
20475                 dflt=''
20476                 for xxx in $avail_ext; do
20477                         case " $static_ext " in
20478                         *" $xxx "*) ;;
20479                         *) dflt="$dflt $xxx" ;;
20480                         esac
20481                 done
20482                 set X $dflt
20483                 shift
20484                 dflt="$*"
20485                 ;;
20486         *)      dflt="$dynamic_ext"
20487                 # Perhaps we are reusing an old out-of-date config.sh.
20488                 case "$hint" in
20489                 previous)
20490                         if test X"$dynamic_ext" != X"$avail_ext"; then
20491                                 $cat <<EOM
20492 NOTICE:  Your previous config.sh list may be incorrect. 
20493 The extensions now available to you are 
20494         ${avail_ext}
20495 but the default list from your previous config.sh is
20496         ${dynamic_ext} 
20497
20498 EOM
20499                         fi
20500                         ;;
20501                 esac
20502                 ;;
20503         esac
20504         case "$dflt" in
20505         '')     dflt=none;;
20506         esac
20507         rp="What extensions do you wish to load dynamically?"
20508         . ./myread
20509         case "$ans" in
20510         none) dynamic_ext=' ' ;;
20511         *) dynamic_ext="$ans" ;;
20512         esac
20513
20514         case "$static_ext" in
20515         '')
20516                 : Exclude those already listed in dynamic linking
20517                 dflt=''
20518                 for xxx in $avail_ext; do
20519                         case " $dynamic_ext " in
20520                         *" $xxx "*) ;;
20521                         *) dflt="$dflt $xxx" ;;
20522                         esac
20523                 done
20524                 set X $dflt
20525                 shift
20526                 dflt="$*"
20527                 ;;
20528         *)  dflt="$static_ext" 
20529                 ;;
20530         esac
20531
20532         case "$dflt" in
20533         '')     dflt=none;;
20534         esac
20535         rp="What extensions do you wish to load statically?"
20536         . ./myread
20537         case "$ans" in
20538         none) static_ext=' ' ;;
20539         *) static_ext="$ans" ;;
20540         esac
20541         ;;
20542 *)
20543         $cat <<EOM
20544 A number of extensions are supplied with $package.  Answer "none" 
20545 to include no extensions. 
20546 Note that DynaLoader is always built and need not be mentioned here.
20547
20548 EOM
20549         case "$static_ext" in
20550         '') dflt="$avail_ext" ;;
20551         *)      dflt="$static_ext"
20552                 # Perhaps we are reusing an old out-of-date config.sh.
20553                 case "$hint" in
20554                 previous)
20555                         if test X"$static_ext" != X"$avail_ext"; then
20556                                 $cat <<EOM
20557 NOTICE:  Your previous config.sh list may be incorrect. 
20558 The extensions now available to you are 
20559         ${avail_ext}
20560 but the default list from your previous config.sh is
20561         ${static_ext} 
20562
20563 EOM
20564                         fi
20565                         ;;
20566                 esac
20567                 ;;
20568         esac
20569         : Exclude those that are not xs extensions
20570         case "$dflt" in
20571         '')     dflt=none;;
20572         esac
20573         rp="What extensions do you wish to include?"
20574         . ./myread
20575         case "$ans" in
20576         none) static_ext=' ' ;;
20577         *) static_ext="$ans" ;;
20578         esac
20579         ;;
20580 esac
20581 #        
20582 # Encode is a special case.  If we are building Encode as a static
20583 # extension, we need to explicitly list its subextensions as well.
20584 # For other nested extensions, this is handled automatically by
20585 # the appropriate Makefile.PL.
20586 case " $static_ext " in
20587         *" Encode "*) # Add the subextensions of Encode
20588         cd "$rsrc/ext"
20589         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20590                 static_ext="$static_ext Encode/$xxx"
20591         done
20592         cd "$tdir"
20593         ;;
20594 esac
20595
20596 set X $dynamic_ext $static_ext $nonxs_ext
20597 shift
20598 extensions="$*"
20599
20600 # Sanity check:  We require an extension suitable for use with
20601 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20602 # should show up as failures in the test suite, but it's helpful to
20603 # catch them now.) The 'extensions' list is normally sorted
20604 # alphabetically, so we need to accept either
20605 #    DB_File ... Fcntl ... IO  ....
20606 # or something like
20607 #    Fcntl ... NDBM_File ... IO  ....
20608 case " $extensions"  in
20609 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20610 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20611 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20612 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20613    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20614    ;;
20615 esac
20616
20617 : Remove libraries needed only for extensions
20618 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20619 : The exception is SunOS 4.x, which needs them.
20620 case "${osname}X${osvers}" in
20621 sunos*X4*)
20622     perllibs="$libs"
20623     ;;
20624 *) case "$usedl" in
20625     $define|true|[yY]*)
20626             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20627             shift
20628             perllibs="$*"
20629             ;;
20630     *)  perllibs="$libs"
20631             ;;
20632     esac
20633     ;;
20634 esac
20635
20636 : Remove build directory name from cppstdin so it can be used from
20637 : either the present location or the final installed location.
20638 echo " "
20639 : Get out of the UU directory to get correct path name.
20640 cd ..
20641 case "$cppstdin" in
20642 `pwd`/cppstdin)
20643         echo "Stripping down cppstdin path name"
20644         cppstdin=cppstdin
20645         ;;
20646 esac
20647 cd UU
20648
20649 : end of configuration questions
20650 echo " "
20651 echo "End of configuration questions."
20652 echo " "
20653
20654 : back to where it started
20655 if test -d ../UU; then
20656         cd ..
20657 fi
20658
20659 : configuration may be patched via a 'config.arch' file
20660 if $test -f config.arch; then
20661         echo "I see a config.arch file, loading it."
20662         . ./config.arch
20663 fi
20664
20665 : configuration may be patched via a 'config.over' file
20666 if $test -f config.over; then
20667         echo " "
20668         dflt=y
20669         rp='I see a config.over file.  Do you wish to load it?'
20670         . UU/myread
20671         case "$ans" in
20672         n*) echo "OK, I'll ignore it.";;
20673         *)      . ./config.over
20674                 echo "Configuration override changes have been loaded."
20675                 ;;
20676         esac
20677 fi
20678
20679 : in case they want portability, strip down executable paths
20680 case "$d_portable" in
20681 "$define")
20682         echo " "
20683         echo "Stripping down executable paths..." >&4
20684         for file in $loclist $trylist; do
20685                 eval temp=\$$file
20686                 eval $file=`basename $temp`
20687         done
20688         ;;
20689 esac
20690
20691 : create config.sh file
20692 echo " "
20693 echo "Creating config.sh..." >&4
20694 $spitshell <<EOT >config.sh
20695 $startsh
20696 #
20697 # This file was produced by running the Configure script. It holds all the
20698 # definitions figured out by Configure. Should you modify one of these values,
20699 # do not forget to propagate your changes by running "Configure -der". You may
20700 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20701 #
20702
20703 # Package name      : $package
20704 # Source directory  : $src
20705 # Configuration time: $cf_time
20706 # Configured by     : $cf_by
20707 # Target system     : $myuname
20708
20709 Author='$Author'
20710 Date='$Date'
20711 Header='$Header'
20712 Id='$Id'
20713 Locker='$Locker'
20714 Log='$Log'
20715 Mcc='$Mcc'
20716 RCSfile='$RCSfile'
20717 Revision='$Revision'
20718 Source='$Source'
20719 State='$State'
20720 _a='$_a'
20721 _exe='$_exe'
20722 _o='$_o'
20723 afs='$afs'
20724 afsroot='$afsroot'
20725 alignbytes='$alignbytes'
20726 ansi2knr='$ansi2knr'
20727 aphostname='$aphostname'
20728 api_revision='$api_revision'
20729 api_subversion='$api_subversion'
20730 api_version='$api_version'
20731 api_versionstring='$api_versionstring'
20732 ar='$ar'
20733 archlib='$archlib'
20734 archlibexp='$archlibexp'
20735 archname64='$archname64'
20736 archname='$archname'
20737 archobjs='$archobjs'
20738 asctime_r_proto='$asctime_r_proto'
20739 awk='$awk'
20740 baserev='$baserev'
20741 bash='$bash'
20742 bin='$bin'
20743 binexp='$binexp'
20744 bison='$bison'
20745 byacc='$byacc'
20746 byteorder='$byteorder'
20747 c='$c'
20748 castflags='$castflags'
20749 cat='$cat'
20750 cc='$cc'
20751 cccdlflags='$cccdlflags'
20752 ccdlflags='$ccdlflags'
20753 ccflags='$ccflags'
20754 ccflags_uselargefiles='$ccflags_uselargefiles'
20755 ccname='$ccname'
20756 ccsymbols='$ccsymbols'
20757 ccversion='$ccversion'
20758 cf_by='$cf_by'
20759 cf_email='$cf_email'
20760 cf_time='$cf_time'
20761 charsize='$charsize'
20762 chgrp='$chgrp'
20763 chmod='$chmod'
20764 chown='$chown'
20765 clocktype='$clocktype'
20766 comm='$comm'
20767 compress='$compress'
20768 contains='$contains'
20769 cp='$cp'
20770 cpio='$cpio'
20771 cpp='$cpp'
20772 cpp_stuff='$cpp_stuff'
20773 cppccsymbols='$cppccsymbols'
20774 cppflags='$cppflags'
20775 cpplast='$cpplast'
20776 cppminus='$cppminus'
20777 cpprun='$cpprun'
20778 cppstdin='$cppstdin'
20779 cppsymbols='$cppsymbols'
20780 crypt_r_proto='$crypt_r_proto'
20781 cryptlib='$cryptlib'
20782 csh='$csh'
20783 ctermid_r_proto='$ctermid_r_proto'
20784 ctime_r_proto='$ctime_r_proto'
20785 d_Gconvert='$d_Gconvert'
20786 d_PRIEUldbl='$d_PRIEUldbl'
20787 d_PRIFUldbl='$d_PRIFUldbl'
20788 d_PRIGUldbl='$d_PRIGUldbl'
20789 d_PRIXU64='$d_PRIXU64'
20790 d_PRId64='$d_PRId64'
20791 d_PRIeldbl='$d_PRIeldbl'
20792 d_PRIfldbl='$d_PRIfldbl'
20793 d_PRIgldbl='$d_PRIgldbl'
20794 d_PRIi64='$d_PRIi64'
20795 d_PRIo64='$d_PRIo64'
20796 d_PRIu64='$d_PRIu64'
20797 d_PRIx64='$d_PRIx64'
20798 d_SCNfldbl='$d_SCNfldbl'
20799 d__fwalk='$d__fwalk'
20800 d_access='$d_access'
20801 d_accessx='$d_accessx'
20802 d_aintl='$d_aintl'
20803 d_alarm='$d_alarm'
20804 d_archlib='$d_archlib'
20805 d_asctime_r='$d_asctime_r'
20806 d_atolf='$d_atolf'
20807 d_atoll='$d_atoll'
20808 d_attribute_format='$d_attribute_format'
20809 d_attribute_malloc='$d_attribute_malloc'
20810 d_attribute_nonnull='$d_attribute_nonnull'
20811 d_attribute_noreturn='$d_attribute_noreturn'
20812 d_attribute_pure='$d_attribute_pure'
20813 d_attribute_unused='$d_attribute_unused'
20814 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
20815 d_bcmp='$d_bcmp'
20816 d_bcopy='$d_bcopy'
20817 d_bsd='$d_bsd'
20818 d_bsdgetpgrp='$d_bsdgetpgrp'
20819 d_bsdsetpgrp='$d_bsdsetpgrp'
20820 d_bzero='$d_bzero'
20821 d_casti32='$d_casti32'
20822 d_castneg='$d_castneg'
20823 d_charvspr='$d_charvspr'
20824 d_chown='$d_chown'
20825 d_chroot='$d_chroot'
20826 d_chsize='$d_chsize'
20827 d_class='$d_class'
20828 d_closedir='$d_closedir'
20829 d_cmsghdr_s='$d_cmsghdr_s'
20830 d_const='$d_const'
20831 d_copysignl='$d_copysignl'
20832 d_crypt='$d_crypt'
20833 d_crypt_r='$d_crypt_r'
20834 d_csh='$d_csh'
20835 d_ctermid_r='$d_ctermid_r'
20836 d_ctime_r='$d_ctime_r'
20837 d_cuserid='$d_cuserid'
20838 d_dbl_dig='$d_dbl_dig'
20839 d_dbminitproto='$d_dbminitproto'
20840 d_difftime='$d_difftime'
20841 d_dirfd='$d_dirfd'
20842 d_dirnamlen='$d_dirnamlen'
20843 d_dlerror='$d_dlerror'
20844 d_dlopen='$d_dlopen'
20845 d_dlsymun='$d_dlsymun'
20846 d_dosuid='$d_dosuid'
20847 d_drand48_r='$d_drand48_r'
20848 d_drand48proto='$d_drand48proto'
20849 d_dup2='$d_dup2'
20850 d_eaccess='$d_eaccess'
20851 d_endgrent='$d_endgrent'
20852 d_endgrent_r='$d_endgrent_r'
20853 d_endhent='$d_endhent'
20854 d_endhostent_r='$d_endhostent_r'
20855 d_endnent='$d_endnent'
20856 d_endnetent_r='$d_endnetent_r'
20857 d_endpent='$d_endpent'
20858 d_endprotoent_r='$d_endprotoent_r'
20859 d_endpwent='$d_endpwent'
20860 d_endpwent_r='$d_endpwent_r'
20861 d_endsent='$d_endsent'
20862 d_endservent_r='$d_endservent_r'
20863 d_eofnblk='$d_eofnblk'
20864 d_eunice='$d_eunice'
20865 d_faststdio='$d_faststdio'
20866 d_fchdir='$d_fchdir'
20867 d_fchmod='$d_fchmod'
20868 d_fchown='$d_fchown'
20869 d_fcntl='$d_fcntl'
20870 d_fcntl_can_lock='$d_fcntl_can_lock'
20871 d_fd_macros='$d_fd_macros'
20872 d_fd_set='$d_fd_set'
20873 d_fds_bits='$d_fds_bits'
20874 d_fgetpos='$d_fgetpos'
20875 d_finite='$d_finite'
20876 d_finitel='$d_finitel'
20877 d_flexfnam='$d_flexfnam'
20878 d_flock='$d_flock'
20879 d_flockproto='$d_flockproto'
20880 d_fork='$d_fork'
20881 d_fp_class='$d_fp_class'
20882 d_fpathconf='$d_fpathconf'
20883 d_fpclass='$d_fpclass'
20884 d_fpclassify='$d_fpclassify'
20885 d_fpclassl='$d_fpclassl'
20886 d_fpos64_t='$d_fpos64_t'
20887 d_frexpl='$d_frexpl'
20888 d_fs_data_s='$d_fs_data_s'
20889 d_fseeko='$d_fseeko'
20890 d_fsetpos='$d_fsetpos'
20891 d_fstatfs='$d_fstatfs'
20892 d_fstatvfs='$d_fstatvfs'
20893 d_fsync='$d_fsync'
20894 d_ftello='$d_ftello'
20895 d_ftime='$d_ftime'
20896 d_getcwd='$d_getcwd'
20897 d_getespwnam='$d_getespwnam'
20898 d_getfsstat='$d_getfsstat'
20899 d_getgrent='$d_getgrent'
20900 d_getgrent_r='$d_getgrent_r'
20901 d_getgrgid_r='$d_getgrgid_r'
20902 d_getgrnam_r='$d_getgrnam_r'
20903 d_getgrps='$d_getgrps'
20904 d_gethbyaddr='$d_gethbyaddr'
20905 d_gethbyname='$d_gethbyname'
20906 d_gethent='$d_gethent'
20907 d_gethname='$d_gethname'
20908 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20909 d_gethostbyname_r='$d_gethostbyname_r'
20910 d_gethostent_r='$d_gethostent_r'
20911 d_gethostprotos='$d_gethostprotos'
20912 d_getitimer='$d_getitimer'
20913 d_getlogin='$d_getlogin'
20914 d_getlogin_r='$d_getlogin_r'
20915 d_getmnt='$d_getmnt'
20916 d_getmntent='$d_getmntent'
20917 d_getnbyaddr='$d_getnbyaddr'
20918 d_getnbyname='$d_getnbyname'
20919 d_getnent='$d_getnent'
20920 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20921 d_getnetbyname_r='$d_getnetbyname_r'
20922 d_getnetent_r='$d_getnetent_r'
20923 d_getnetprotos='$d_getnetprotos'
20924 d_getpagsz='$d_getpagsz'
20925 d_getpbyname='$d_getpbyname'
20926 d_getpbynumber='$d_getpbynumber'
20927 d_getpent='$d_getpent'
20928 d_getpgid='$d_getpgid'
20929 d_getpgrp2='$d_getpgrp2'
20930 d_getpgrp='$d_getpgrp'
20931 d_getppid='$d_getppid'
20932 d_getprior='$d_getprior'
20933 d_getprotobyname_r='$d_getprotobyname_r'
20934 d_getprotobynumber_r='$d_getprotobynumber_r'
20935 d_getprotoent_r='$d_getprotoent_r'
20936 d_getprotoprotos='$d_getprotoprotos'
20937 d_getprpwnam='$d_getprpwnam'
20938 d_getpwent='$d_getpwent'
20939 d_getpwent_r='$d_getpwent_r'
20940 d_getpwnam_r='$d_getpwnam_r'
20941 d_getpwuid_r='$d_getpwuid_r'
20942 d_getsbyname='$d_getsbyname'
20943 d_getsbyport='$d_getsbyport'
20944 d_getsent='$d_getsent'
20945 d_getservbyname_r='$d_getservbyname_r'
20946 d_getservbyport_r='$d_getservbyport_r'
20947 d_getservent_r='$d_getservent_r'
20948 d_getservprotos='$d_getservprotos'
20949 d_getspnam='$d_getspnam'
20950 d_getspnam_r='$d_getspnam_r'
20951 d_gettimeod='$d_gettimeod'
20952 d_gmtime_r='$d_gmtime_r'
20953 d_gnulibc='$d_gnulibc'
20954 d_grpasswd='$d_grpasswd'
20955 d_hasmntopt='$d_hasmntopt'
20956 d_htonl='$d_htonl'
20957 d_ilogbl='$d_ilogbl'
20958 d_index='$d_index'
20959 d_inetaton='$d_inetaton'
20960 d_int64_t='$d_int64_t'
20961 d_isascii='$d_isascii'
20962 d_isfinite='$d_isfinite'
20963 d_isinf='$d_isinf'
20964 d_isnan='$d_isnan'
20965 d_isnanl='$d_isnanl'
20966 d_killpg='$d_killpg'
20967 d_lchown='$d_lchown'
20968 d_ldbl_dig='$d_ldbl_dig'
20969 d_libm_lib_version='$d_libm_lib_version'
20970 d_link='$d_link'
20971 d_localtime_r='$d_localtime_r'
20972 d_locconv='$d_locconv'
20973 d_lockf='$d_lockf'
20974 d_longdbl='$d_longdbl'
20975 d_longlong='$d_longlong'
20976 d_lseekproto='$d_lseekproto'
20977 d_lstat='$d_lstat'
20978 d_madvise='$d_madvise'
20979 d_mblen='$d_mblen'
20980 d_mbstowcs='$d_mbstowcs'
20981 d_mbtowc='$d_mbtowc'
20982 d_memchr='$d_memchr'
20983 d_memcmp='$d_memcmp'
20984 d_memcpy='$d_memcpy'
20985 d_memmove='$d_memmove'
20986 d_memset='$d_memset'
20987 d_mkdir='$d_mkdir'
20988 d_mkdtemp='$d_mkdtemp'
20989 d_mkfifo='$d_mkfifo'
20990 d_mkstemp='$d_mkstemp'
20991 d_mkstemps='$d_mkstemps'
20992 d_mktime='$d_mktime'
20993 d_mmap='$d_mmap'
20994 d_modfl='$d_modfl'
20995 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20996 d_modflproto='$d_modflproto'
20997 d_mprotect='$d_mprotect'
20998 d_msg='$d_msg'
20999 d_msg_ctrunc='$d_msg_ctrunc'
21000 d_msg_dontroute='$d_msg_dontroute'
21001 d_msg_oob='$d_msg_oob'
21002 d_msg_peek='$d_msg_peek'
21003 d_msg_proxy='$d_msg_proxy'
21004 d_msgctl='$d_msgctl'
21005 d_msgget='$d_msgget'
21006 d_msghdr_s='$d_msghdr_s'
21007 d_msgrcv='$d_msgrcv'
21008 d_msgsnd='$d_msgsnd'
21009 d_msync='$d_msync'
21010 d_munmap='$d_munmap'
21011 d_mymalloc='$d_mymalloc'
21012 d_nice='$d_nice'
21013 d_nl_langinfo='$d_nl_langinfo'
21014 d_nv_preserves_uv='$d_nv_preserves_uv'
21015 d_off64_t='$d_off64_t'
21016 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21017 d_oldpthreads='$d_oldpthreads'
21018 d_oldsock='$d_oldsock'
21019 d_open3='$d_open3'
21020 d_pathconf='$d_pathconf'
21021 d_pause='$d_pause'
21022 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21023 d_phostname='$d_phostname'
21024 d_pipe='$d_pipe'
21025 d_poll='$d_poll'
21026 d_portable='$d_portable'
21027 d_procselfexe='$d_procselfexe'
21028 d_pthread_atfork='$d_pthread_atfork'
21029 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21030 d_pthread_yield='$d_pthread_yield'
21031 d_pwage='$d_pwage'
21032 d_pwchange='$d_pwchange'
21033 d_pwclass='$d_pwclass'
21034 d_pwcomment='$d_pwcomment'
21035 d_pwexpire='$d_pwexpire'
21036 d_pwgecos='$d_pwgecos'
21037 d_pwpasswd='$d_pwpasswd'
21038 d_pwquota='$d_pwquota'
21039 d_qgcvt='$d_qgcvt'
21040 d_quad='$d_quad'
21041 d_random_r='$d_random_r'
21042 d_readdir64_r='$d_readdir64_r'
21043 d_readdir='$d_readdir'
21044 d_readdir_r='$d_readdir_r'
21045 d_readlink='$d_readlink'
21046 d_readv='$d_readv'
21047 d_recvmsg='$d_recvmsg'
21048 d_rename='$d_rename'
21049 d_rewinddir='$d_rewinddir'
21050 d_rmdir='$d_rmdir'
21051 d_safebcpy='$d_safebcpy'
21052 d_safemcpy='$d_safemcpy'
21053 d_sanemcmp='$d_sanemcmp'
21054 d_sbrkproto='$d_sbrkproto'
21055 d_scalbnl='$d_scalbnl'
21056 d_sched_yield='$d_sched_yield'
21057 d_scm_rights='$d_scm_rights'
21058 d_seekdir='$d_seekdir'
21059 d_select='$d_select'
21060 d_sem='$d_sem'
21061 d_semctl='$d_semctl'
21062 d_semctl_semid_ds='$d_semctl_semid_ds'
21063 d_semctl_semun='$d_semctl_semun'
21064 d_semget='$d_semget'
21065 d_semop='$d_semop'
21066 d_sendmsg='$d_sendmsg'
21067 d_setegid='$d_setegid'
21068 d_seteuid='$d_seteuid'
21069 d_setgrent='$d_setgrent'
21070 d_setgrent_r='$d_setgrent_r'
21071 d_setgrps='$d_setgrps'
21072 d_sethent='$d_sethent'
21073 d_sethostent_r='$d_sethostent_r'
21074 d_setitimer='$d_setitimer'
21075 d_setlinebuf='$d_setlinebuf'
21076 d_setlocale='$d_setlocale'
21077 d_setlocale_r='$d_setlocale_r'
21078 d_setnent='$d_setnent'
21079 d_setnetent_r='$d_setnetent_r'
21080 d_setpent='$d_setpent'
21081 d_setpgid='$d_setpgid'
21082 d_setpgrp2='$d_setpgrp2'
21083 d_setpgrp='$d_setpgrp'
21084 d_setprior='$d_setprior'
21085 d_setproctitle='$d_setproctitle'
21086 d_setprotoent_r='$d_setprotoent_r'
21087 d_setpwent='$d_setpwent'
21088 d_setpwent_r='$d_setpwent_r'
21089 d_setregid='$d_setregid'
21090 d_setresgid='$d_setresgid'
21091 d_setresuid='$d_setresuid'
21092 d_setreuid='$d_setreuid'
21093 d_setrgid='$d_setrgid'
21094 d_setruid='$d_setruid'
21095 d_setsent='$d_setsent'
21096 d_setservent_r='$d_setservent_r'
21097 d_setsid='$d_setsid'
21098 d_setvbuf='$d_setvbuf'
21099 d_sfio='$d_sfio'
21100 d_shm='$d_shm'
21101 d_shmat='$d_shmat'
21102 d_shmatprototype='$d_shmatprototype'
21103 d_shmctl='$d_shmctl'
21104 d_shmdt='$d_shmdt'
21105 d_shmget='$d_shmget'
21106 d_sigaction='$d_sigaction'
21107 d_sigprocmask='$d_sigprocmask'
21108 d_sigsetjmp='$d_sigsetjmp'
21109 d_sockatmark='$d_sockatmark'
21110 d_sockatmarkproto='$d_sockatmarkproto'
21111 d_socket='$d_socket'
21112 d_socklen_t='$d_socklen_t'
21113 d_sockpair='$d_sockpair'
21114 d_socks5_init='$d_socks5_init'
21115 d_sqrtl='$d_sqrtl'
21116 d_srand48_r='$d_srand48_r'
21117 d_srandom_r='$d_srandom_r'
21118 d_sresgproto='$d_sresgproto'
21119 d_sresuproto='$d_sresuproto'
21120 d_statblks='$d_statblks'
21121 d_statfs_f_flags='$d_statfs_f_flags'
21122 d_statfs_s='$d_statfs_s'
21123 d_statvfs='$d_statvfs'
21124 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21125 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21126 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21127 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21128 d_stdio_stream_array='$d_stdio_stream_array'
21129 d_stdiobase='$d_stdiobase'
21130 d_stdstdio='$d_stdstdio'
21131 d_strchr='$d_strchr'
21132 d_strcoll='$d_strcoll'
21133 d_strctcpy='$d_strctcpy'
21134 d_strerrm='$d_strerrm'
21135 d_strerror='$d_strerror'
21136 d_strerror_r='$d_strerror_r'
21137 d_strftime='$d_strftime'
21138 d_strlcat='$d_strlcat'
21139 d_strlcpy='$d_strlcpy'
21140 d_strtod='$d_strtod'
21141 d_strtol='$d_strtol'
21142 d_strtold='$d_strtold'
21143 d_strtoll='$d_strtoll'
21144 d_strtoq='$d_strtoq'
21145 d_strtoul='$d_strtoul'
21146 d_strtoull='$d_strtoull'
21147 d_strtouq='$d_strtouq'
21148 d_strxfrm='$d_strxfrm'
21149 d_suidsafe='$d_suidsafe'
21150 d_symlink='$d_symlink'
21151 d_syscall='$d_syscall'
21152 d_syscallproto='$d_syscallproto'
21153 d_sysconf='$d_sysconf'
21154 d_sysernlst='$d_sysernlst'
21155 d_syserrlst='$d_syserrlst'
21156 d_system='$d_system'
21157 d_tcgetpgrp='$d_tcgetpgrp'
21158 d_tcsetpgrp='$d_tcsetpgrp'
21159 d_telldir='$d_telldir'
21160 d_telldirproto='$d_telldirproto'
21161 d_time='$d_time'
21162 d_times='$d_times'
21163 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21164 d_tm_tm_zone='$d_tm_tm_zone'
21165 d_tmpnam_r='$d_tmpnam_r'
21166 d_truncate='$d_truncate'
21167 d_ttyname_r='$d_ttyname_r'
21168 d_tzname='$d_tzname'
21169 d_u32align='$d_u32align'
21170 d_ualarm='$d_ualarm'
21171 d_umask='$d_umask'
21172 d_uname='$d_uname'
21173 d_union_semun='$d_union_semun'
21174 d_unordered='$d_unordered'
21175 d_usleep='$d_usleep'
21176 d_usleepproto='$d_usleepproto'
21177 d_ustat='$d_ustat'
21178 d_vendorarch='$d_vendorarch'
21179 d_vendorbin='$d_vendorbin'
21180 d_vendorlib='$d_vendorlib'
21181 d_vendorscript='$d_vendorscript'
21182 d_vfork='$d_vfork'
21183 d_void_closedir='$d_void_closedir'
21184 d_voidsig='$d_voidsig'
21185 d_voidtty='$d_voidtty'
21186 d_volatile='$d_volatile'
21187 d_vprintf='$d_vprintf'
21188 d_wait4='$d_wait4'
21189 d_waitpid='$d_waitpid'
21190 d_wcstombs='$d_wcstombs'
21191 d_wctomb='$d_wctomb'
21192 d_writev='$d_writev'
21193 d_xenix='$d_xenix'
21194 date='$date'
21195 db_hashtype='$db_hashtype'
21196 db_prefixtype='$db_prefixtype'
21197 db_version_major='$db_version_major'
21198 db_version_minor='$db_version_minor'
21199 db_version_patch='$db_version_patch'
21200 defvoidused='$defvoidused'
21201 direntrytype='$direntrytype'
21202 dlext='$dlext'
21203 dlsrc='$dlsrc'
21204 doublesize='$doublesize'
21205 drand01='$drand01'
21206 drand48_r_proto='$drand48_r_proto'
21207 dynamic_ext='$dynamic_ext'
21208 eagain='$eagain'
21209 ebcdic='$ebcdic'
21210 echo='$echo'
21211 egrep='$egrep'
21212 emacs='$emacs'
21213 endgrent_r_proto='$endgrent_r_proto'
21214 endhostent_r_proto='$endhostent_r_proto'
21215 endnetent_r_proto='$endnetent_r_proto'
21216 endprotoent_r_proto='$endprotoent_r_proto'
21217 endpwent_r_proto='$endpwent_r_proto'
21218 endservent_r_proto='$endservent_r_proto'
21219 eunicefix='$eunicefix'
21220 exe_ext='$exe_ext'
21221 expr='$expr'
21222 extensions='$extensions'
21223 extras='$extras'
21224 fflushNULL='$fflushNULL'
21225 fflushall='$fflushall'
21226 find='$find'
21227 firstmakefile='$firstmakefile'
21228 flex='$flex'
21229 fpossize='$fpossize'
21230 fpostype='$fpostype'
21231 freetype='$freetype'
21232 from='$from'
21233 full_ar='$full_ar'
21234 full_csh='$full_csh'
21235 full_sed='$full_sed'
21236 gccansipedantic='$gccansipedantic'
21237 gccosandvers='$gccosandvers'
21238 gccversion='$gccversion'
21239 getgrent_r_proto='$getgrent_r_proto'
21240 getgrgid_r_proto='$getgrgid_r_proto'
21241 getgrnam_r_proto='$getgrnam_r_proto'
21242 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21243 gethostbyname_r_proto='$gethostbyname_r_proto'
21244 gethostent_r_proto='$gethostent_r_proto'
21245 getlogin_r_proto='$getlogin_r_proto'
21246 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21247 getnetbyname_r_proto='$getnetbyname_r_proto'
21248 getnetent_r_proto='$getnetent_r_proto'
21249 getprotobyname_r_proto='$getprotobyname_r_proto'
21250 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21251 getprotoent_r_proto='$getprotoent_r_proto'
21252 getpwent_r_proto='$getpwent_r_proto'
21253 getpwnam_r_proto='$getpwnam_r_proto'
21254 getpwuid_r_proto='$getpwuid_r_proto'
21255 getservbyname_r_proto='$getservbyname_r_proto'
21256 getservbyport_r_proto='$getservbyport_r_proto'
21257 getservent_r_proto='$getservent_r_proto'
21258 getspnam_r_proto='$getspnam_r_proto'
21259 gidformat='$gidformat'
21260 gidsign='$gidsign'
21261 gidsize='$gidsize'
21262 gidtype='$gidtype'
21263 glibpth='$glibpth'
21264 gmake='$gmake'
21265 gmtime_r_proto='$gmtime_r_proto'
21266 gnulibc_version='$gnulibc_version'
21267 grep='$grep'
21268 groupcat='$groupcat'
21269 groupstype='$groupstype'
21270 gzip='$gzip'
21271 h_fcntl='$h_fcntl'
21272 h_sysfile='$h_sysfile'
21273 hint='$hint'
21274 hostcat='$hostcat'
21275 html1dir='$html1dir'
21276 html1direxp='$html1direxp'
21277 html3dir='$html3dir'
21278 html3direxp='$html3direxp'
21279 i16size='$i16size'
21280 i16type='$i16type'
21281 i32size='$i32size'
21282 i32type='$i32type'
21283 i64size='$i64size'
21284 i64type='$i64type'
21285 i8size='$i8size'
21286 i8type='$i8type'
21287 i_arpainet='$i_arpainet'
21288 i_bsdioctl='$i_bsdioctl'
21289 i_crypt='$i_crypt'
21290 i_db='$i_db'
21291 i_dbm='$i_dbm'
21292 i_dirent='$i_dirent'
21293 i_dld='$i_dld'
21294 i_dlfcn='$i_dlfcn'
21295 i_fcntl='$i_fcntl'
21296 i_float='$i_float'
21297 i_fp='$i_fp'
21298 i_fp_class='$i_fp_class'
21299 i_gdbm='$i_gdbm'
21300 i_grp='$i_grp'
21301 i_ieeefp='$i_ieeefp'
21302 i_inttypes='$i_inttypes'
21303 i_langinfo='$i_langinfo'
21304 i_libutil='$i_libutil'
21305 i_limits='$i_limits'
21306 i_locale='$i_locale'
21307 i_machcthr='$i_machcthr'
21308 i_malloc='$i_malloc'
21309 i_math='$i_math'
21310 i_memory='$i_memory'
21311 i_mntent='$i_mntent'
21312 i_ndbm='$i_ndbm'
21313 i_netdb='$i_netdb'
21314 i_neterrno='$i_neterrno'
21315 i_netinettcp='$i_netinettcp'
21316 i_niin='$i_niin'
21317 i_poll='$i_poll'
21318 i_prot='$i_prot'
21319 i_pthread='$i_pthread'
21320 i_pwd='$i_pwd'
21321 i_rpcsvcdbm='$i_rpcsvcdbm'
21322 i_sfio='$i_sfio'
21323 i_sgtty='$i_sgtty'
21324 i_shadow='$i_shadow'
21325 i_socks='$i_socks'
21326 i_stdarg='$i_stdarg'
21327 i_stddef='$i_stddef'
21328 i_stdlib='$i_stdlib'
21329 i_string='$i_string'
21330 i_sunmath='$i_sunmath'
21331 i_sysaccess='$i_sysaccess'
21332 i_sysdir='$i_sysdir'
21333 i_sysfile='$i_sysfile'
21334 i_sysfilio='$i_sysfilio'
21335 i_sysin='$i_sysin'
21336 i_sysioctl='$i_sysioctl'
21337 i_syslog='$i_syslog'
21338 i_sysmman='$i_sysmman'
21339 i_sysmode='$i_sysmode'
21340 i_sysmount='$i_sysmount'
21341 i_sysndir='$i_sysndir'
21342 i_sysparam='$i_sysparam'
21343 i_sysresrc='$i_sysresrc'
21344 i_syssecrt='$i_syssecrt'
21345 i_sysselct='$i_sysselct'
21346 i_syssockio='$i_syssockio'
21347 i_sysstat='$i_sysstat'
21348 i_sysstatfs='$i_sysstatfs'
21349 i_sysstatvfs='$i_sysstatvfs'
21350 i_systime='$i_systime'
21351 i_systimek='$i_systimek'
21352 i_systimes='$i_systimes'
21353 i_systypes='$i_systypes'
21354 i_sysuio='$i_sysuio'
21355 i_sysun='$i_sysun'
21356 i_sysutsname='$i_sysutsname'
21357 i_sysvfs='$i_sysvfs'
21358 i_syswait='$i_syswait'
21359 i_termio='$i_termio'
21360 i_termios='$i_termios'
21361 i_time='$i_time'
21362 i_unistd='$i_unistd'
21363 i_ustat='$i_ustat'
21364 i_utime='$i_utime'
21365 i_values='$i_values'
21366 i_varargs='$i_varargs'
21367 i_varhdr='$i_varhdr'
21368 i_vfork='$i_vfork'
21369 ignore_versioned_solibs='$ignore_versioned_solibs'
21370 inc_version_list='$inc_version_list'
21371 inc_version_list_init='$inc_version_list_init'
21372 incpath='$incpath'
21373 inews='$inews'
21374 installarchlib='$installarchlib'
21375 installbin='$installbin'
21376 installhtml1dir='$installhtml1dir'
21377 installhtml3dir='$installhtml3dir'
21378 installman1dir='$installman1dir'
21379 installman3dir='$installman3dir'
21380 installprefix='$installprefix'
21381 installprefixexp='$installprefixexp'
21382 installprivlib='$installprivlib'
21383 installscript='$installscript'
21384 installsitearch='$installsitearch'
21385 installsitebin='$installsitebin'
21386 installsitehtml1dir='$installsitehtml1dir'
21387 installsitehtml3dir='$installsitehtml3dir'
21388 installsitelib='$installsitelib'
21389 installsiteman1dir='$installsiteman1dir'
21390 installsiteman3dir='$installsiteman3dir'
21391 installsitescript='$installsitescript'
21392 installstyle='$installstyle'
21393 installusrbinperl='$installusrbinperl'
21394 installvendorarch='$installvendorarch'
21395 installvendorbin='$installvendorbin'
21396 installvendorhtml1dir='$installvendorhtml1dir'
21397 installvendorhtml3dir='$installvendorhtml3dir'
21398 installvendorlib='$installvendorlib'
21399 installvendorman1dir='$installvendorman1dir'
21400 installvendorman3dir='$installvendorman3dir'
21401 installvendorscript='$installvendorscript'
21402 intsize='$intsize'
21403 issymlink='$issymlink'
21404 ivdformat='$ivdformat'
21405 ivsize='$ivsize'
21406 ivtype='$ivtype'
21407 known_extensions='$known_extensions'
21408 ksh='$ksh'
21409 ld='$ld'
21410 lddlflags='$lddlflags'
21411 ldflags='$ldflags'
21412 ldflags_uselargefiles='$ldflags_uselargefiles'
21413 ldlibpthname='$ldlibpthname'
21414 less='$less'
21415 lib_ext='$lib_ext'
21416 libc='$libc'
21417 libperl='$libperl'
21418 libpth='$libpth'
21419 libs='$libs'
21420 libsdirs='$libsdirs'
21421 libsfiles='$libsfiles'
21422 libsfound='$libsfound'
21423 libspath='$libspath'
21424 libswanted='$libswanted'
21425 libswanted_uselargefiles='$libswanted_uselargefiles'
21426 line='$line'
21427 lint='$lint'
21428 lkflags='$lkflags'
21429 ln='$ln'
21430 lns='$lns'
21431 localtime_r_proto='$localtime_r_proto'
21432 locincpth='$locincpth'
21433 loclibpth='$loclibpth'
21434 longdblsize='$longdblsize'
21435 longlongsize='$longlongsize'
21436 longsize='$longsize'
21437 lp='$lp'
21438 lpr='$lpr'
21439 ls='$ls'
21440 lseeksize='$lseeksize'
21441 lseektype='$lseektype'
21442 mail='$mail'
21443 mailx='$mailx'
21444 make='$make'
21445 make_set_make='$make_set_make'
21446 mallocobj='$mallocobj'
21447 mallocsrc='$mallocsrc'
21448 malloctype='$malloctype'
21449 man1dir='$man1dir'
21450 man1direxp='$man1direxp'
21451 man1ext='$man1ext'
21452 man3dir='$man3dir'
21453 man3direxp='$man3direxp'
21454 man3ext='$man3ext'
21455 mips_type='$mips_type'
21456 mistrustnm='$mistrustnm'
21457 mkdir='$mkdir'
21458 mmaptype='$mmaptype'
21459 modetype='$modetype'
21460 more='$more'
21461 multiarch='$multiarch'
21462 mv='$mv'
21463 myarchname='$myarchname'
21464 mydomain='$mydomain'
21465 myhostname='$myhostname'
21466 myuname='$myuname'
21467 n='$n'
21468 need_va_copy='$need_va_copy'
21469 netdb_hlen_type='$netdb_hlen_type'
21470 netdb_host_type='$netdb_host_type'
21471 netdb_name_type='$netdb_name_type'
21472 netdb_net_type='$netdb_net_type'
21473 nm='$nm'
21474 nm_opt='$nm_opt'
21475 nm_so_opt='$nm_so_opt'
21476 nonxs_ext='$nonxs_ext'
21477 nroff='$nroff'
21478 nvEUformat='$nvEUformat'
21479 nvFUformat='$nvFUformat'
21480 nvGUformat='$nvGUformat'
21481 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21482 nveformat='$nveformat'
21483 nvfformat='$nvfformat'
21484 nvgformat='$nvgformat'
21485 nvsize='$nvsize'
21486 nvtype='$nvtype'
21487 o_nonblock='$o_nonblock'
21488 obj_ext='$obj_ext'
21489 old_pthread_create_joinable='$old_pthread_create_joinable'
21490 optimize='$optimize'
21491 orderlib='$orderlib'
21492 osname='$osname'
21493 osvers='$osvers'
21494 otherlibdirs='$otherlibdirs'
21495 package='$package'
21496 pager='$pager'
21497 passcat='$passcat'
21498 patchlevel='$patchlevel'
21499 path_sep='$path_sep'
21500 perl5='$perl5'
21501 perl='$perl'
21502 perl_patchlevel='$perl_patchlevel'
21503 perladmin='$perladmin'
21504 perllibs='$perllibs'
21505 perlpath='$perlpath'
21506 pg='$pg'
21507 phostname='$phostname'
21508 pidtype='$pidtype'
21509 plibpth='$plibpth'
21510 pmake='$pmake'
21511 pr='$pr'
21512 prefix='$prefix'
21513 prefixexp='$prefixexp'
21514 privlib='$privlib'
21515 privlibexp='$privlibexp'
21516 procselfexe='$procselfexe'
21517 prototype='$prototype'
21518 ptrsize='$ptrsize'
21519 quadkind='$quadkind'
21520 quadtype='$quadtype'
21521 randbits='$randbits'
21522 randfunc='$randfunc'
21523 random_r_proto='$random_r_proto'
21524 randseedtype='$randseedtype'
21525 ranlib='$ranlib'
21526 rd_nodata='$rd_nodata'
21527 readdir64_r_proto='$readdir64_r_proto'
21528 readdir_r_proto='$readdir_r_proto'
21529 revision='$revision'
21530 rm='$rm'
21531 rmail='$rmail'
21532 run='$run'
21533 runnm='$runnm'
21534 sPRIEUldbl='$sPRIEUldbl'
21535 sPRIFUldbl='$sPRIFUldbl'
21536 sPRIGUldbl='$sPRIGUldbl'
21537 sPRIXU64='$sPRIXU64'
21538 sPRId64='$sPRId64'
21539 sPRIeldbl='$sPRIeldbl'
21540 sPRIfldbl='$sPRIfldbl'
21541 sPRIgldbl='$sPRIgldbl'
21542 sPRIi64='$sPRIi64'
21543 sPRIo64='$sPRIo64'
21544 sPRIu64='$sPRIu64'
21545 sPRIx64='$sPRIx64'
21546 sSCNfldbl='$sSCNfldbl'
21547 sched_yield='$sched_yield'
21548 scriptdir='$scriptdir'
21549 scriptdirexp='$scriptdirexp'
21550 sed='$sed'
21551 seedfunc='$seedfunc'
21552 selectminbits='$selectminbits'
21553 selecttype='$selecttype'
21554 sendmail='$sendmail'
21555 setgrent_r_proto='$setgrent_r_proto'
21556 sethostent_r_proto='$sethostent_r_proto'
21557 setlocale_r_proto='$setlocale_r_proto'
21558 setnetent_r_proto='$setnetent_r_proto'
21559 setprotoent_r_proto='$setprotoent_r_proto'
21560 setpwent_r_proto='$setpwent_r_proto'
21561 setservent_r_proto='$setservent_r_proto'
21562 sh='$sh'
21563 shar='$shar'
21564 sharpbang='$sharpbang'
21565 shmattype='$shmattype'
21566 shortsize='$shortsize'
21567 shrpenv='$shrpenv'
21568 shsharp='$shsharp'
21569 sig_count='$sig_count'
21570 sig_name='$sig_name'
21571 sig_name_init='$sig_name_init'
21572 sig_num='$sig_num'
21573 sig_num_init='$sig_num_init'
21574 sig_size='$sig_size'
21575 signal_t='$signal_t'
21576 sitearch='$sitearch'
21577 sitearchexp='$sitearchexp'
21578 sitebin='$sitebin'
21579 sitebinexp='$sitebinexp'
21580 sitehtml1dir='$sitehtml1dir'
21581 sitehtml1direxp='$sitehtml1direxp'
21582 sitehtml3dir='$sitehtml3dir'
21583 sitehtml3direxp='$sitehtml3direxp'
21584 sitelib='$sitelib'
21585 sitelib_stem='$sitelib_stem'
21586 sitelibexp='$sitelibexp'
21587 siteman1dir='$siteman1dir'
21588 siteman1direxp='$siteman1direxp'
21589 siteman3dir='$siteman3dir'
21590 siteman3direxp='$siteman3direxp'
21591 siteprefix='$siteprefix'
21592 siteprefixexp='$siteprefixexp'
21593 sitescript='$sitescript'
21594 sitescriptexp='$sitescriptexp'
21595 sizesize='$sizesize'
21596 sizetype='$sizetype'
21597 sleep='$sleep'
21598 smail='$smail'
21599 so='$so'
21600 sockethdr='$sockethdr'
21601 socketlib='$socketlib'
21602 socksizetype='$socksizetype'
21603 sort='$sort'
21604 spackage='$spackage'
21605 spitshell='$spitshell'
21606 srand48_r_proto='$srand48_r_proto'
21607 srandom_r_proto='$srandom_r_proto'
21608 src='$src'
21609 ssizetype='$ssizetype'
21610 startperl='$startperl'
21611 startsh='$startsh'
21612 static_ext='$static_ext'
21613 stdchar='$stdchar'
21614 stdio_base='$stdio_base'
21615 stdio_bufsiz='$stdio_bufsiz'
21616 stdio_cnt='$stdio_cnt'
21617 stdio_filbuf='$stdio_filbuf'
21618 stdio_ptr='$stdio_ptr'
21619 stdio_stream_array='$stdio_stream_array'
21620 strerror_r_proto='$strerror_r_proto'
21621 strings='$strings'
21622 submit='$submit'
21623 subversion='$subversion'
21624 sysman='$sysman'
21625 tail='$tail'
21626 tar='$tar'
21627 targetarch='$targetarch'
21628 tbl='$tbl'
21629 tee='$tee'
21630 test='$test'
21631 timeincl='$timeincl'
21632 timetype='$timetype'
21633 tmpnam_r_proto='$tmpnam_r_proto'
21634 to='$to'
21635 touch='$touch'
21636 tr='$tr'
21637 trnl='$trnl'
21638 troff='$troff'
21639 ttyname_r_proto='$ttyname_r_proto'
21640 u16size='$u16size'
21641 u16type='$u16type'
21642 u32size='$u32size'
21643 u32type='$u32type'
21644 u64size='$u64size'
21645 u64type='$u64type'
21646 u8size='$u8size'
21647 u8type='$u8type'
21648 uidformat='$uidformat'
21649 uidsign='$uidsign'
21650 uidsize='$uidsize'
21651 uidtype='$uidtype'
21652 uname='$uname'
21653 uniq='$uniq'
21654 uquadtype='$uquadtype'
21655 use5005threads='$use5005threads'
21656 use64bitall='$use64bitall'
21657 use64bitint='$use64bitint'
21658 usecrosscompile='$usecrosscompile'
21659 usedl='$usedl'
21660 usefaststdio='$usefaststdio'
21661 useithreads='$useithreads'
21662 uselargefiles='$uselargefiles'
21663 uselongdouble='$uselongdouble'
21664 usemallocwrap='$usemallocwrap'
21665 usemorebits='$usemorebits'
21666 usemultiplicity='$usemultiplicity'
21667 usemymalloc='$usemymalloc'
21668 usenm='$usenm'
21669 useopcode='$useopcode'
21670 useperlio='$useperlio'
21671 useposix='$useposix'
21672 usereentrant='$usereentrant'
21673 userelocatableinc='$userelocatableinc'
21674 usesfio='$usesfio'
21675 useshrplib='$useshrplib'
21676 usesitecustomize='$usesitecustomize'
21677 usesocks='$usesocks'
21678 usethreads='$usethreads'
21679 usevendorprefix='$usevendorprefix'
21680 usevfork='$usevfork'
21681 usrinc='$usrinc'
21682 uuname='$uuname'
21683 uvXUformat='$uvXUformat'
21684 uvoformat='$uvoformat'
21685 uvsize='$uvsize'
21686 uvtype='$uvtype'
21687 uvuformat='$uvuformat'
21688 uvxformat='$uvxformat'
21689 vendorarch='$vendorarch'
21690 vendorarchexp='$vendorarchexp'
21691 vendorbin='$vendorbin'
21692 vendorbinexp='$vendorbinexp'
21693 vendorhtml1dir='$vendorhtml1dir'
21694 vendorhtml1direxp='$vendorhtml1direxp'
21695 vendorhtml3dir='$vendorhtml3dir'
21696 vendorhtml3direxp='$vendorhtml3direxp'
21697 vendorlib='$vendorlib'
21698 vendorlib_stem='$vendorlib_stem'
21699 vendorlibexp='$vendorlibexp'
21700 vendorman1dir='$vendorman1dir'
21701 vendorman1direxp='$vendorman1direxp'
21702 vendorman3dir='$vendorman3dir'
21703 vendorman3direxp='$vendorman3direxp'
21704 vendorprefix='$vendorprefix'
21705 vendorprefixexp='$vendorprefixexp'
21706 vendorscript='$vendorscript'
21707 vendorscriptexp='$vendorscriptexp'
21708 version='$version'
21709 version_patchlevel_string='$version_patchlevel_string'
21710 versiononly='$versiononly'
21711 vi='$vi'
21712 voidflags='$voidflags'
21713 xlibpth='$xlibpth'
21714 yacc='$yacc'
21715 yaccflags='$yaccflags'
21716 zcat='$zcat'
21717 zip='$zip'
21718 EOT
21719
21720 : Add in command line options if available
21721 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21722
21723 : add special variables
21724 $test -f $src/patchlevel.h && \
21725 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21726 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21727 echo "PERL_CONFIG_SH=true" >>config.sh
21728
21729 : propagate old symbols
21730 if $test -f UU/config.sh; then
21731         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21732         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21733         $sort | $uniq -u >UU/oldsyms
21734         set X `cat UU/oldsyms`
21735         shift
21736         case $# in
21737         0) ;;
21738         *)
21739                 cat <<EOM
21740 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21741 EOM
21742                 echo "# Variables propagated from previous config.sh file." >>config.sh
21743                 for sym in `cat UU/oldsyms`; do
21744                         echo "    Propagating $hint variable "'$'"$sym..."
21745                         eval 'tmp="$'"${sym}"'"'
21746                         echo "$tmp" | \
21747                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21748                 done
21749                 ;;
21750         esac
21751 fi
21752
21753 : Finish up by extracting the .SH files
21754 case "$alldone" in
21755 exit)
21756         $rm -rf UU
21757         echo "Extraction done."
21758         exit 0
21759         ;;
21760 cont)
21761         ;;
21762 '')
21763         dflt=''
21764         nostick=true
21765         $cat <<EOM
21766
21767 If you'd like to make any changes to the config.sh file before I begin
21768 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21769
21770 EOM
21771         rp="Press return or use a shell escape to edit config.sh:"
21772         . UU/myread
21773         nostick=''
21774         case "$ans" in
21775         '') ;;
21776         *) : in case they cannot read
21777                 sh 1>&4 -c "$ans";;
21778         esac
21779         ;;
21780 esac
21781
21782 : if this fails, just run all the .SH files by hand
21783 . ./config.sh
21784
21785 echo " "
21786 exec 1>&4
21787 pwd=`pwd`
21788 . ./UU/extract
21789 cd "$pwd"
21790
21791 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21792         dflt=y
21793         case "$silent" in
21794         true) ;;
21795         *)
21796                 $cat <<EOM
21797
21798 Now you need to generate make dependencies by running "$make depend".
21799 You might prefer to run it in background: "$make depend > makedepend.out &"
21800 It can take a while, so you might not want to run it right now.
21801
21802 EOM
21803                 ;;
21804         esac
21805         rp="Run $make depend now?"
21806         . UU/myread
21807         case "$ans" in
21808         y*)
21809                 $make depend && echo "Now you must run '$make'."
21810                 ;;
21811         *)
21812                 echo "You must run '$make depend' then '$make'."
21813                 ;;
21814         esac
21815 elif test -f [Mm]akefile; then
21816         echo " "
21817         echo "Now you must run a $make."
21818 else
21819         echo "Configure done."
21820 fi
21821
21822 if $test -f Policy.sh; then
21823     $cat <<EOM
21824
21825 If you compile $package on a different machine or from a different object
21826 directory, copy the Policy.sh file from this object directory to the
21827 new one before you run Configure -- this will help you with most of
21828 the policy defaults.
21829
21830 EOM
21831 fi
21832 if $test -f config.msg; then
21833     echo "Hmm.  I also noted the following information while running:"
21834     echo " "
21835     $cat config.msg >&4
21836     $rm -f config.msg
21837 fi
21838 $rm -f kit*isdone ark*isdone
21839 $rm -rf UU
21840
21841 : End of Configure
21842