This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove :base_io from the set of default "safe" opcodes.
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Tue Jul 19 13:22:25 CEST 2005 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 installbin=''
323 byteorder=''
324 cc=''
325 ccflags=''
326 cppflags=''
327 ldflags=''
328 lkflags=''
329 locincpth=''
330 optimize=''
331 cf_email=''
332 cf_by=''
333 cf_time=''
334 charsize=''
335 contains=''
336 cpp_stuff=''
337 cpplast=''
338 cppminus=''
339 cpprun=''
340 cppstdin=''
341 d__fwalk=''
342 d_access=''
343 d_accessx=''
344 d_aintl=''
345 d_alarm=''
346 asctime_r_proto=''
347 d_asctime_r=''
348 d_attribute_format=''
349 d_attribute_malloc=''
350 d_attribute_nonnull=''
351 d_attribute_noreturn=''
352 d_attribute_pure=''
353 d_attribute_unused=''
354 d_attribute_warn_unused_result=''
355 d_bcmp=''
356 d_bcopy=''
357 d_bzero=''
358 d_casti32=''
359 castflags=''
360 d_castneg=''
361 d_chown=''
362 d_chroot=''
363 d_chsize=''
364 d_class=''
365 d_closedir=''
366 d_void_closedir=''
367 d_cmsghdr_s=''
368 d_const=''
369 d_copysignl=''
370 cryptlib=''
371 d_crypt=''
372 crypt_r_proto=''
373 d_crypt_r=''
374 d_csh=''
375 full_csh=''
376 ctermid_r_proto=''
377 d_ctermid_r=''
378 ctime_r_proto=''
379 d_ctime_r=''
380 d_cuserid=''
381 d_dbl_dig=''
382 d_dbminitproto=''
383 d_difftime=''
384 d_dirfd=''
385 d_dlerror=''
386 d_dlopen=''
387 d_dlsymun=''
388 d_dosuid=''
389 d_suidsafe=''
390 d_drand48_r=''
391 drand48_r_proto=''
392 d_drand48proto=''
393 d_dup2=''
394 d_eaccess=''
395 d_endgrent=''
396 d_endgrent_r=''
397 endgrent_r_proto=''
398 d_endhent=''
399 d_endhostent_r=''
400 endhostent_r_proto=''
401 d_endnent=''
402 d_endnetent_r=''
403 endnetent_r_proto=''
404 d_endpent=''
405 d_endprotoent_r=''
406 endprotoent_r_proto=''
407 d_endpwent=''
408 d_endpwent_r=''
409 endpwent_r_proto=''
410 d_endsent=''
411 d_endservent_r=''
412 endservent_r_proto=''
413 d_faststdio=''
414 d_fchdir=''
415 d_fchmod=''
416 d_fchown=''
417 d_fcntl=''
418 d_fcntl_can_lock=''
419 d_fd_macros=''
420 d_fd_set=''
421 d_fds_bits=''
422 d_fgetpos=''
423 d_finite=''
424 d_finitel=''
425 d_flexfnam=''
426 d_flock=''
427 d_flockproto=''
428 d_fork=''
429 d_fp_class=''
430 d_fpclass=''
431 d_fpclassify=''
432 d_fpclassl=''
433 d_fpos64_t=''
434 d_frexpl=''
435 d_fs_data_s=''
436 d_fseeko=''
437 d_fsetpos=''
438 d_fstatfs=''
439 d_fsync=''
440 d_ftello=''
441 d_ftime=''
442 d_gettimeod=''
443 d_Gconvert=''
444 d_getcwd=''
445 d_getespwnam=''
446 d_getfsstat=''
447 d_getgrent=''
448 d_getgrent_r=''
449 getgrent_r_proto=''
450 d_getgrgid_r=''
451 getgrgid_r_proto=''
452 d_getgrnam_r=''
453 getgrnam_r_proto=''
454 d_getgrps=''
455 d_gethbyaddr=''
456 d_gethbyname=''
457 d_gethent=''
458 aphostname=''
459 d_gethname=''
460 d_phostname=''
461 d_uname=''
462 d_gethostbyaddr_r=''
463 gethostbyaddr_r_proto=''
464 d_gethostbyname_r=''
465 gethostbyname_r_proto=''
466 d_gethostent_r=''
467 gethostent_r_proto=''
468 d_gethostprotos=''
469 d_getitimer=''
470 d_getlogin=''
471 d_getlogin_r=''
472 getlogin_r_proto=''
473 d_getmnt=''
474 d_getmntent=''
475 d_getnbyaddr=''
476 d_getnbyname=''
477 d_getnent=''
478 d_getnetbyaddr_r=''
479 getnetbyaddr_r_proto=''
480 d_getnetbyname_r=''
481 getnetbyname_r_proto=''
482 d_getnetent_r=''
483 getnetent_r_proto=''
484 d_getnetprotos=''
485 d_getpagsz=''
486 d_getpent=''
487 d_getpgid=''
488 d_getpgrp2=''
489 d_bsdgetpgrp=''
490 d_getpgrp=''
491 d_getppid=''
492 d_getprior=''
493 d_getpbyname=''
494 d_getpbynumber=''
495 d_getprotobyname_r=''
496 getprotobyname_r_proto=''
497 d_getprotobynumber_r=''
498 getprotobynumber_r_proto=''
499 d_getprotoent_r=''
500 getprotoent_r_proto=''
501 d_getprotoprotos=''
502 d_getprpwnam=''
503 d_getpwent=''
504 d_getpwent_r=''
505 getpwent_r_proto=''
506 d_getpwnam_r=''
507 getpwnam_r_proto=''
508 d_getpwuid_r=''
509 getpwuid_r_proto=''
510 d_getsent=''
511 d_getservbyname_r=''
512 getservbyname_r_proto=''
513 d_getservbyport_r=''
514 getservbyport_r_proto=''
515 d_getservent_r=''
516 getservent_r_proto=''
517 d_getservprotos=''
518 d_getspnam=''
519 d_getspnam_r=''
520 getspnam_r_proto=''
521 d_getsbyname=''
522 d_getsbyport=''
523 d_gmtime_r=''
524 gmtime_r_proto=''
525 d_gnulibc=''
526 gnulibc_version=''
527 d_hasmntopt=''
528 d_htonl=''
529 d_ilogbl=''
530 d_inetaton=''
531 d_int64_t=''
532 d_isascii=''
533 d_isfinite=''
534 d_isinf=''
535 d_isnan=''
536 d_isnanl=''
537 d_killpg=''
538 d_lchown=''
539 d_ldbl_dig=''
540 d_libm_lib_version=''
541 d_link=''
542 d_localtime_r=''
543 localtime_r_proto=''
544 d_locconv=''
545 d_lockf=''
546 d_longdbl=''
547 longdblsize=''
548 d_longlong=''
549 longlongsize=''
550 d_lseekproto=''
551 d_lstat=''
552 d_madvise=''
553 d_mblen=''
554 d_mbstowcs=''
555 d_mbtowc=''
556 d_memchr=''
557 d_memcmp=''
558 d_memcpy=''
559 d_memmove=''
560 d_memset=''
561 d_mkdir=''
562 d_mkdtemp=''
563 d_mkfifo=''
564 d_mkstemp=''
565 d_mkstemps=''
566 d_mktime=''
567 d_mmap=''
568 mmaptype=''
569 d_modfl=''
570 d_modfl_pow32_bug=''
571 d_modflproto=''
572 d_mprotect=''
573 d_msg=''
574 d_msgctl=''
575 d_msgget=''
576 d_msghdr_s=''
577 d_msgrcv=''
578 d_msgsnd=''
579 d_msync=''
580 d_munmap=''
581 d_nice=''
582 d_nl_langinfo=''
583 d_off64_t=''
584 d_open3=''
585 d_fpathconf=''
586 d_pathconf=''
587 d_pause=''
588 d_pipe=''
589 d_poll=''
590 d_portable=''
591 d_procselfexe=''
592 procselfexe=''
593 d_old_pthread_create_joinable=''
594 old_pthread_create_joinable=''
595 d_pthread_atfork=''
596 d_pthread_attr_setscope=''
597 d_pthread_yield=''
598 d_sched_yield=''
599 sched_yield=''
600 d_qgcvt=''
601 d_random_r=''
602 random_r_proto=''
603 d_readdir64_r=''
604 readdir64_r_proto=''
605 d_readdir=''
606 d_rewinddir=''
607 d_seekdir=''
608 d_telldir=''
609 d_readdir_r=''
610 readdir_r_proto=''
611 d_readlink=''
612 d_readv=''
613 d_recvmsg=''
614 d_rename=''
615 d_rmdir=''
616 d_safebcpy=''
617 d_safemcpy=''
618 d_sanemcmp=''
619 d_sbrkproto=''
620 d_scalbnl=''
621 d_select=''
622 d_sem=''
623 d_semctl=''
624 d_semget=''
625 d_semop=''
626 d_sendmsg=''
627 d_setegid=''
628 d_seteuid=''
629 d_setgrent=''
630 d_setgrent_r=''
631 setgrent_r_proto=''
632 d_setgrps=''
633 d_sethent=''
634 d_sethostent_r=''
635 sethostent_r_proto=''
636 d_setitimer=''
637 d_setlinebuf=''
638 d_setlocale=''
639 d_setlocale_r=''
640 setlocale_r_proto=''
641 d_setnent=''
642 d_setnetent_r=''
643 setnetent_r_proto=''
644 d_setpent=''
645 d_setpgid=''
646 d_setpgrp2=''
647 d_bsdsetpgrp=''
648 d_setpgrp=''
649 d_setprior=''
650 d_setproctitle=''
651 d_setprotoent_r=''
652 setprotoent_r_proto=''
653 d_setpwent=''
654 d_setpwent_r=''
655 setpwent_r_proto=''
656 d_setregid=''
657 d_setresgid=''
658 d_setresuid=''
659 d_setreuid=''
660 d_setrgid=''
661 d_setruid=''
662 d_setsent=''
663 d_setservent_r=''
664 setservent_r_proto=''
665 d_setsid=''
666 d_setvbuf=''
667 d_sfio=''
668 usesfio=''
669 d_shm=''
670 d_shmat=''
671 d_shmatprototype=''
672 shmattype=''
673 d_shmctl=''
674 d_shmdt=''
675 d_shmget=''
676 d_sigaction=''
677 d_sigprocmask=''
678 d_sigsetjmp=''
679 usesitecustomize=''
680 d_sockatmark=''
681 d_sockatmarkproto=''
682 d_msg_ctrunc=''
683 d_msg_dontroute=''
684 d_msg_oob=''
685 d_msg_peek=''
686 d_msg_proxy=''
687 d_oldsock=''
688 d_scm_rights=''
689 d_socket=''
690 d_sockpair=''
691 sockethdr=''
692 socketlib=''
693 d_socklen_t=''
694 d_socks5_init=''
695 d_sqrtl=''
696 d_srand48_r=''
697 srand48_r_proto=''
698 d_srandom_r=''
699 srandom_r_proto=''
700 d_sresgproto=''
701 d_sresuproto=''
702 d_statblks=''
703 d_statfs_f_flags=''
704 d_statfs_s=''
705 d_fstatvfs=''
706 d_statvfs=''
707 d_stdio_cnt_lval=''
708 d_stdio_ptr_lval=''
709 d_stdio_ptr_lval_nochange_cnt=''
710 d_stdio_ptr_lval_sets_cnt=''
711 d_stdiobase=''
712 d_stdstdio=''
713 stdio_base=''
714 stdio_bufsiz=''
715 stdio_cnt=''
716 stdio_filbuf=''
717 stdio_ptr=''
718 d_index=''
719 d_strchr=''
720 d_strcoll=''
721 d_strctcpy=''
722 d_strerrm=''
723 d_strerror=''
724 d_sysernlst=''
725 d_syserrlst=''
726 d_strerror_r=''
727 strerror_r_proto=''
728 d_strftime=''
729 d_strlcat=''
730 d_strlcpy=''
731 d_strtod=''
732 d_strtol=''
733 d_strtold=''
734 d_strtoll=''
735 d_strtoq=''
736 d_strtoul=''
737 d_strtoull=''
738 d_strtouq=''
739 d_strxfrm=''
740 d_symlink=''
741 d_syscall=''
742 d_syscallproto=''
743 d_sysconf=''
744 d_system=''
745 d_tcgetpgrp=''
746 d_tcsetpgrp=''
747 d_telldirproto=''
748 d_time=''
749 timetype=''
750 clocktype=''
751 d_times=''
752 d_tmpnam_r=''
753 tmpnam_r_proto=''
754 d_truncate=''
755 d_ttyname_r=''
756 ttyname_r_proto=''
757 d_tzname=''
758 d_u32align=''
759 d_ualarm=''
760 d_umask=''
761 d_semctl_semid_ds=''
762 d_semctl_semun=''
763 d_union_semun=''
764 d_unordered=''
765 d_usleep=''
766 d_usleepproto=''
767 d_ustat=''
768 d_vfork=''
769 usevfork=''
770 d_voidsig=''
771 signal_t=''
772 d_volatile=''
773 d_charvspr=''
774 d_vprintf=''
775 d_wait4=''
776 d_waitpid=''
777 d_wcstombs=''
778 d_wctomb=''
779 d_writev=''
780 dlext=''
781 cccdlflags=''
782 ccdlflags=''
783 dlsrc=''
784 ld=''
785 lddlflags=''
786 usedl=''
787 doublesize=''
788 ebcdic=''
789 fflushNULL=''
790 fflushall=''
791 fpossize=''
792 fpostype=''
793 gccansipedantic=''
794 gccosandvers=''
795 gccversion=''
796 gidformat=''
797 gidsign=''
798 gidsize=''
799 gidtype=''
800 groupstype=''
801 h_fcntl=''
802 h_sysfile=''
803 html1dir=''
804 html1direxp=''
805 installhtml1dir=''
806 html3dir=''
807 html3direxp=''
808 installhtml3dir=''
809 i_arpainet=''
810 i_crypt=''
811 db_hashtype=''
812 db_prefixtype=''
813 db_version_major=''
814 db_version_minor=''
815 db_version_patch=''
816 i_db=''
817 i_dbm=''
818 i_rpcsvcdbm=''
819 d_dirnamlen=''
820 direntrytype=''
821 i_dirent=''
822 i_dld=''
823 i_dlfcn=''
824 i_fcntl=''
825 i_float=''
826 i_fp=''
827 i_fp_class=''
828 i_gdbm=''
829 d_grpasswd=''
830 i_grp=''
831 i_ieeefp=''
832 i_inttypes=''
833 i_langinfo=''
834 i_libutil=''
835 i_limits=''
836 i_locale=''
837 i_machcthr=''
838 i_malloc=''
839 i_math=''
840 i_memory=''
841 i_mntent=''
842 i_ndbm=''
843 i_netdb=''
844 i_neterrno=''
845 i_netinettcp=''
846 i_niin=''
847 i_sysin=''
848 i_poll=''
849 i_prot=''
850 i_pthread=''
851 d_pwage=''
852 d_pwchange=''
853 d_pwclass=''
854 d_pwcomment=''
855 d_pwexpire=''
856 d_pwgecos=''
857 d_pwpasswd=''
858 d_pwquota=''
859 i_pwd=''
860 i_sfio=''
861 i_shadow=''
862 i_socks=''
863 i_stddef=''
864 i_stdlib=''
865 i_string=''
866 strings=''
867 i_sunmath=''
868 i_sysaccess=''
869 i_sysdir=''
870 i_sysfile=''
871 d_voidtty=''
872 i_bsdioctl=''
873 i_sysfilio=''
874 i_sysioctl=''
875 i_syssockio=''
876 i_syslog=''
877 i_sysmman=''
878 i_sysmode=''
879 i_sysmount=''
880 i_sysndir=''
881 i_sysparam=''
882 i_sysresrc=''
883 i_syssecrt=''
884 i_sysselct=''
885 i_sysstat=''
886 i_sysstatfs=''
887 i_sysstatvfs=''
888 i_systimes=''
889 i_systypes=''
890 i_sysuio=''
891 i_sysun=''
892 i_sysutsname=''
893 i_sysvfs=''
894 i_syswait=''
895 i_sgtty=''
896 i_termio=''
897 i_termios=''
898 d_tm_tm_gmtoff=''
899 d_tm_tm_zone=''
900 i_systime=''
901 i_systimek=''
902 i_time=''
903 timeincl=''
904 i_unistd=''
905 i_ustat=''
906 i_utime=''
907 i_values=''
908 i_stdarg=''
909 i_varargs=''
910 i_varhdr=''
911 i_vfork=''
912 inc_version_list=''
913 inc_version_list_init=''
914 installprefix=''
915 installprefixexp=''
916 installstyle=''
917 installusrbinperl=''
918 intsize=''
919 longsize=''
920 shortsize=''
921 issymlink=''
922 libc=''
923 ldlibpthname=''
924 libperl=''
925 shrpenv=''
926 useshrplib=''
927 glibpth=''
928 libpth=''
929 loclibpth=''
930 plibpth=''
931 xlibpth=''
932 ignore_versioned_solibs=''
933 libs=''
934 libsdirs=''
935 libsfiles=''
936 libsfound=''
937 libspath=''
938 lns=''
939 d_PRIEUldbl=''
940 d_PRIFUldbl=''
941 d_PRIGUldbl=''
942 d_PRIeldbl=''
943 d_PRIfldbl=''
944 d_PRIgldbl=''
945 d_SCNfldbl=''
946 sPRIEUldbl=''
947 sPRIFUldbl=''
948 sPRIGUldbl=''
949 sPRIeldbl=''
950 sPRIfldbl=''
951 sPRIgldbl=''
952 sSCNfldbl=''
953 lseeksize=''
954 lseektype=''
955 make_set_make=''
956 d_mymalloc=''
957 freetype=''
958 mallocobj=''
959 mallocsrc=''
960 malloctype=''
961 usemallocwrap=''
962 usemymalloc=''
963 installman1dir=''
964 man1dir=''
965 man1direxp=''
966 man1ext=''
967 installman3dir=''
968 man3dir=''
969 man3direxp=''
970 man3ext=''
971 modetype=''
972 multiarch=''
973 mydomain=''
974 myhostname=''
975 phostname=''
976 c=''
977 n=''
978 d_eofnblk=''
979 eagain=''
980 o_nonblock=''
981 rd_nodata=''
982 need_va_copy=''
983 netdb_hlen_type=''
984 netdb_host_type=''
985 netdb_name_type=''
986 netdb_net_type=''
987 groupcat=''
988 hostcat=''
989 passcat=''
990 orderlib=''
991 ranlib=''
992 d_perl_otherlibdirs=''
993 otherlibdirs=''
994 package=''
995 spackage=''
996 pager=''
997 api_revision=''
998 api_subversion=''
999 api_version=''
1000 api_versionstring=''
1001 patchlevel=''
1002 perl_patchlevel=''
1003 revision=''
1004 subversion=''
1005 version=''
1006 version_patchlevel_string=''
1007 perl5=''
1008 perladmin=''
1009 perlpath=''
1010 d_nv_preserves_uv=''
1011 d_nv_zero_is_allbits_zero=''
1012 i16size=''
1013 i16type=''
1014 i32size=''
1015 i32type=''
1016 i64size=''
1017 i64type=''
1018 i8size=''
1019 i8type=''
1020 ivsize=''
1021 ivtype=''
1022 nv_preserves_uv_bits=''
1023 nvsize=''
1024 nvtype=''
1025 u16size=''
1026 u16type=''
1027 u32size=''
1028 u32type=''
1029 u64size=''
1030 u64type=''
1031 u8size=''
1032 u8type=''
1033 uvsize=''
1034 uvtype=''
1035 ivdformat=''
1036 nvEUformat=''
1037 nvFUformat=''
1038 nvGUformat=''
1039 nveformat=''
1040 nvfformat=''
1041 nvgformat=''
1042 uvXUformat=''
1043 uvoformat=''
1044 uvuformat=''
1045 uvxformat=''
1046 pidtype=''
1047 prefix=''
1048 prefixexp=''
1049 installprivlib=''
1050 privlib=''
1051 privlibexp=''
1052 prototype=''
1053 ptrsize=''
1054 d_PRIXU64=''
1055 d_PRId64=''
1056 d_PRIi64=''
1057 d_PRIo64=''
1058 d_PRIu64=''
1059 d_PRIx64=''
1060 sPRIXU64=''
1061 sPRId64=''
1062 sPRIi64=''
1063 sPRIo64=''
1064 sPRIu64=''
1065 sPRIx64=''
1066 d_quad=''
1067 quadkind=''
1068 quadtype=''
1069 uquadtype=''
1070 drand01=''
1071 randbits=''
1072 randfunc=''
1073 randseedtype=''
1074 seedfunc=''
1075 installscript=''
1076 scriptdir=''
1077 scriptdirexp=''
1078 selectminbits=''
1079 selecttype=''
1080 sh=''
1081 sig_count=''
1082 sig_name=''
1083 sig_name_init=''
1084 sig_num=''
1085 sig_num_init=''
1086 sig_size=''
1087 installsitearch=''
1088 sitearch=''
1089 sitearchexp=''
1090 installsitebin=''
1091 sitebin=''
1092 sitebinexp=''
1093 installsitehtml1dir=''
1094 sitehtml1dir=''
1095 sitehtml1direxp=''
1096 installsitehtml3dir=''
1097 sitehtml3dir=''
1098 sitehtml3direxp=''
1099 installsitelib=''
1100 sitelib=''
1101 sitelib_stem=''
1102 sitelibexp=''
1103 installsiteman1dir=''
1104 siteman1dir=''
1105 siteman1direxp=''
1106 installsiteman3dir=''
1107 siteman3dir=''
1108 siteman3direxp=''
1109 siteprefix=''
1110 siteprefixexp=''
1111 installsitescript=''
1112 sitescript=''
1113 sitescriptexp=''
1114 sizesize=''
1115 sizetype=''
1116 so=''
1117 socksizetype=''
1118 sharpbang=''
1119 shsharp=''
1120 spitshell=''
1121 src=''
1122 ssizetype=''
1123 startperl=''
1124 startsh=''
1125 stdchar=''
1126 d_stdio_stream_array=''
1127 stdio_stream_array=''
1128 sysman=''
1129 trnl=''
1130 uidformat=''
1131 uidsign=''
1132 uidsize=''
1133 uidtype=''
1134 archname64=''
1135 use64bitall=''
1136 use64bitint=''
1137 usefaststdio=''
1138 ccflags_uselargefiles=''
1139 ldflags_uselargefiles=''
1140 libswanted_uselargefiles=''
1141 uselargefiles=''
1142 uselongdouble=''
1143 usemorebits=''
1144 usemultiplicity=''
1145 nm_opt=''
1146 nm_so_opt=''
1147 runnm=''
1148 usenm=''
1149 useperlio=''
1150 userelocatableinc=''
1151 usesocks=''
1152 d_oldpthreads=''
1153 use5005threads=''
1154 useithreads=''
1155 usereentrant=''
1156 usethreads=''
1157 incpath=''
1158 mips_type=''
1159 usrinc=''
1160 d_vendorarch=''
1161 installvendorarch=''
1162 vendorarch=''
1163 vendorarchexp=''
1164 d_vendorbin=''
1165 installvendorbin=''
1166 vendorbin=''
1167 vendorbinexp=''
1168 installvendorhtml1dir=''
1169 vendorhtml1dir=''
1170 vendorhtml1direxp=''
1171 installvendorhtml3dir=''
1172 vendorhtml3dir=''
1173 vendorhtml3direxp=''
1174 d_vendorlib=''
1175 installvendorlib=''
1176 vendorlib=''
1177 vendorlib_stem=''
1178 vendorlibexp=''
1179 installvendorman1dir=''
1180 vendorman1dir=''
1181 vendorman1direxp=''
1182 installvendorman3dir=''
1183 vendorman3dir=''
1184 vendorman3direxp=''
1185 usevendorprefix=''
1186 vendorprefix=''
1187 vendorprefixexp=''
1188 d_vendorscript=''
1189 installvendorscript=''
1190 vendorscript=''
1191 vendorscriptexp=''
1192 versiononly=''
1193 defvoidused=''
1194 voidflags=''
1195 yacc=''
1196 yaccflags=''
1197 CONFIG=''
1198
1199 define='define'
1200 undef='undef'
1201 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1202 rmlist=''
1203
1204 : We must find out about Eunice early
1205 eunicefix=':'
1206 if test -f /etc/unixtovms; then
1207         eunicefix=/etc/unixtovms
1208 fi
1209 if test -f /etc/unixtovms.exe; then
1210         eunicefix=/etc/unixtovms.exe
1211 fi
1212
1213 : Set executable suffix now -- needed before hints available
1214 if test -f "/libs/version.library"; then
1215 : Amiga OS
1216     _exe=""
1217 elif test -f "/system/gnu_library/bin/ar.pm"; then
1218 : Stratus VOS
1219     _exe=".pm"
1220 elif test -n "$DJGPP"; then
1221 : DOS DJGPP
1222     _exe=".exe"
1223 elif test -d c:/. -o -n "$is_os2" ; then
1224 : OS/2 or cygwin
1225     _exe=".exe"
1226 fi
1227
1228 i_whoami=''
1229 ccname=''
1230 ccversion=''
1231 perllibs=''
1232 : set useposix=false in your hint file to disable the POSIX extension.
1233 useposix=true
1234 : set useopcode=false in your hint file to disable the Opcode extension.
1235 useopcode=true
1236 : Trailing extension.  Override this in a hint file, if needed.
1237 : Extra object files, if any, needed on this platform.
1238 archobjs=''
1239 archname=''
1240 : Possible local include directories to search.
1241 : Set locincpth to "" in a hint file to defeat local include searches.
1242 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1243 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1244 :
1245 : no include file wanted by default
1246 inclwanted=''
1247
1248 groupstype=''
1249 libnames=''
1250 : change the next line if compiling for Xenix/286 on Xenix/386
1251 xlibpth='/usr/lib/386 /lib/386'
1252 : Possible local library directories to search.
1253 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1254 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1255
1256 : general looking path for locating libraries
1257 glibpth="/lib /usr/lib $xlibpth"
1258 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1259 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1260 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1261
1262 : Private path used by Configure to find libraries.  Its value
1263 : is prepended to libpth. This variable takes care of special
1264 : machines, like the mips.  Usually, it should be empty.
1265 plibpth=''
1266
1267 : default library list
1268 libswanted=''
1269 : some systems want to use only the non-versioned libso:s
1270 ignore_versioned_solibs=''
1271 siteman1dir=''
1272 siteman3dir=''
1273 sitescript=''
1274 archname64=''
1275 ccflags_uselargefiles=''
1276 ldflags_uselargefiles=''
1277 libswanted_uselargefiles=''
1278 : set usemultiplicity on the Configure command line to enable multiplicity.
1279 : set usesocks on the Configure command line to enable socks.
1280 : set usethreads on the Configure command line to enable threads.
1281 usereentrant='undef'
1282 : full support for void wanted by default
1283 defvoidused=15
1284
1285 : List of libraries we want.
1286 : If anyone needs extra -lxxx, put those in a hint file.
1287 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1288 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1289 : We probably want to search /usr/shlib before most other libraries.
1290 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1291 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1292 glibpth="/usr/shlib $glibpth"
1293 : Do not use vfork unless overridden by a hint file.
1294 usevfork=false
1295
1296 : Find the basic shell for Bourne shell scripts
1297 case "$sh" in
1298 '')
1299         case "$SYSTYPE" in
1300         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1301         *) xxx='/bin/sh';;
1302         esac
1303         if test -f "$xxx"; then
1304                 sh="$xxx"
1305         else
1306                 : Build up a list and do a single loop so we can 'break' out.
1307                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1308                 for xxx in sh bash ksh pdksh ash; do
1309                         for p in $pth; do
1310                                 try="$try ${p}/${xxx}"
1311                         done
1312                 done
1313                 for xxx in $try; do
1314                         if test -f "$xxx"; then
1315                                 sh="$xxx";
1316                                 break
1317                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1318                                 sh="$xxx";
1319                                 break
1320                         elif test -f "$xxx.exe"; then
1321                                 sh="$xxx";
1322                                 break
1323                         fi
1324                 done
1325         fi
1326         ;;
1327 esac
1328
1329 case "$sh" in
1330 '')     cat >&2 <<EOM
1331 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1332
1333 Usually it's in /bin/sh.  How did you even get this far?
1334 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1335 we'll try to straighten this all out.
1336 EOM
1337         exit 1
1338         ;;
1339 esac
1340
1341 : see if sh knows # comments
1342 if `$sh -c '#' >/dev/null 2>&1`; then
1343         shsharp=true
1344         spitshell=cat
1345         xcat=/bin/cat
1346         test -f $xcat$_exe || xcat=/usr/bin/cat
1347         if test ! -f $xcat$_exe; then
1348                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1349                         if test -f $p/cat$_exe; then
1350                                 xcat=$p/cat
1351                                 break
1352                         fi
1353                 done
1354                 if test ! -f $xcat$_exe; then
1355                         echo "Can't find cat anywhere!"
1356                         exit 1
1357                 fi
1358         fi
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                 echo "#! $xcat" > sharp
1367                 $eunicefix sharp
1368                 chmod +x sharp
1369                 ./sharp > today
1370                 if test -s today; then
1371                         sharpbang='#! '
1372                 else
1373                         sharpbang=': use '
1374                 fi
1375         fi
1376 else
1377         echo " "
1378         echo "Your $sh doesn't grok # comments--I will strip them later on."
1379         shsharp=false
1380         cd ..
1381         echo "exec grep -v '^[  ]*#'" >spitshell
1382         chmod +x spitshell
1383         $eunicefix spitshell
1384         spitshell=`pwd`/spitshell
1385         cd UU
1386         echo "I presume that if # doesn't work, #! won't work either!"
1387         sharpbang=': use '
1388 fi
1389 rm -f sharp today
1390
1391 : figure out how to guarantee sh startup
1392 case "$startsh" in
1393 '') startsh=${sharpbang}${sh} ;;
1394 *)
1395 esac
1396 cat >sharp <<EOSS
1397 $startsh
1398 set abc
1399 test "$?abc" != 1
1400 EOSS
1401
1402 chmod +x sharp
1403 $eunicefix sharp
1404 if ./sharp; then
1405         : echo "Yup, it does."
1406 else
1407         echo "Hmm... '$startsh' does not guarantee sh startup..."
1408         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1409 fi
1410 rm -f sharp
1411
1412
1413 : Save command line options in file UU/cmdline.opt for later use in
1414 : generating config.sh.
1415 cat > cmdline.opt <<EOSH
1416 # Configure command line arguments.
1417 config_arg0='$0'
1418 config_args='$*'
1419 config_argc=$#
1420 EOSH
1421 argn=1
1422 args_exp=''
1423 args_sep=''
1424 for arg in "$@"; do
1425         cat >>cmdline.opt <<EOSH
1426 config_arg$argn='$arg'
1427 EOSH
1428         # Extreme backslashitis: replace each ' by '"'"'
1429         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1430 $arg
1431 EOC
1432         arg_exp=`cat cmdl.opt`
1433         args_exp="$args_exp$args_sep'$arg_exp'"
1434         argn=`expr $argn + 1`
1435         args_sep=' '
1436 done
1437 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1438 # used by ./hints/os2.sh
1439 rm -f cmdl.opt
1440
1441 : produce awk script to parse command line options
1442 cat >options.awk <<'EOF'
1443 BEGIN {
1444         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1445
1446         len = length(optstr);
1447         for (i = 1; i <= len; i++) {
1448                 c = substr(optstr, i, 1);
1449                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1450                 if (a == ":") {
1451                         arg[c] = 1;
1452                         i++;
1453                 }
1454                 opt[c] = 1;
1455         }
1456 }
1457 {
1458         expect = 0;
1459         str = $0;
1460         if (substr(str, 1, 1) != "-") {
1461                 printf("'%s'\n", str);
1462                 next;
1463         }
1464         len = length($0);
1465         for (i = 2; i <= len; i++) {
1466                 c = substr(str, i, 1);
1467                 if (!opt[c]) {
1468                         printf("-%s\n", substr(str, i));
1469                         next;
1470                 }
1471                 printf("-%s\n", c);
1472                 if (arg[c]) {
1473                         if (i < len)
1474                                 printf("'%s'\n", substr(str, i + 1));
1475                         else
1476                                 expect = 1;
1477                         next;
1478                 }
1479         }
1480 }
1481 END {
1482         if (expect)
1483                 print "?";
1484 }
1485 EOF
1486
1487 : process the command line options
1488 set X `for arg in "$@"; do echo "X$arg"; done |
1489         sed -e s/X// | awk -f options.awk`
1490 eval "set $*"
1491 shift
1492 rm -f options.awk
1493
1494 : set up default values
1495 fastread=''
1496 reuseval=false
1497 config_sh=''
1498 alldone=''
1499 error=''
1500 silent=''
1501 extractsh=''
1502 override=''
1503 knowitall=''
1504 rm -f optdef.sh posthint.sh
1505 cat >optdef.sh <<EOS
1506 $startsh
1507 EOS
1508
1509
1510 : option parsing
1511 while test $# -gt 0; do
1512         case "$1" in
1513         -d) shift; fastread=yes;;
1514         -e) shift; alldone=cont;;
1515         -f)
1516                 shift
1517                 cd ..
1518                 if test -r "$1"; then
1519                         config_sh="$1"
1520                 else
1521                         echo "$me: cannot read config file $1." >&2
1522                         error=true
1523                 fi
1524                 cd UU
1525                 shift;;
1526         -h) shift; error=true;;
1527         -r) shift; reuseval=true;;
1528         -s) shift; silent=true; realsilent=true;;
1529         -E) shift; alldone=exit;;
1530         -K) shift; knowitall=true;;
1531         -O) shift; override=true;;
1532         -S) shift; silent=true; extractsh=true;;
1533         -D)
1534                 shift
1535                 case "$1" in
1536                 *=)
1537                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1538                         echo "$me: ignoring -D $1" >&2
1539                         ;;
1540                 *=*) echo "$1" | \
1541                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1542                 *) echo "$1='define'" >> optdef.sh;;
1543                 esac
1544                 shift
1545                 ;;
1546         -U)
1547                 shift
1548                 case "$1" in
1549                 *=) echo "$1" >> optdef.sh;;
1550                 *=*)
1551                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1552                         echo "$me: ignoring -U $1" >&2
1553                         ;;
1554                 *) echo "$1='undef'" >> optdef.sh;;
1555                 esac
1556                 shift
1557                 ;;
1558         -A)
1559             shift
1560             xxx=''
1561             yyy="$1"
1562             zzz=''
1563             uuu=undef
1564             case "$yyy" in
1565             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1566                  case "$zzz" in
1567                  *:*) zzz='' ;;
1568                  *)   xxx=append
1569                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1570                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1571                  esac
1572                  ;;
1573             esac
1574             case "$xxx" in
1575             '')  case "$yyy" in
1576                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1577                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1578                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1579                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1580                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1581                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1582                  esac
1583                  ;;       
1584             esac
1585             case "$xxx" in
1586             append)
1587                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1588             clear)
1589                 echo "$yyy=''"                  >> posthint.sh ;;
1590             define)
1591                 case "$zzz" in
1592                 '') zzz=define ;;
1593                 esac
1594                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1595             eval)
1596                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1597             prepend)
1598                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1599             undef)
1600                 case "$zzz" in
1601                 '') zzz="$uuu" ;;
1602                 esac
1603                 echo "$yyy=$zzz"                >> posthint.sh ;;
1604             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1605             esac
1606             shift
1607             ;;
1608         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1609             exit 0;;
1610         --) break;;
1611         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1612         *) break;;
1613         esac
1614 done
1615
1616 case "$error" in
1617 true)
1618         cat >&2 <<EOM
1619 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1620                  [-U symbol] [-U symbol=] [-A command:symbol...]
1621   -d : use defaults for all answers.
1622   -e : go on without questioning past the production of config.sh.
1623   -f : specify an alternate default configuration file.
1624   -h : print this help message and exit (with an error status).
1625   -r : reuse C symbols value if possible (skips costly nm extraction).
1626   -s : silent mode, only echoes questions and essential information.
1627   -D : define symbol to have some value:
1628          -D symbol         symbol gets the value 'define'
1629          -D symbol=value   symbol gets the value 'value'
1630   -E : stop at the end of questions, after having produced config.sh.
1631   -K : do not use unless you know what you are doing.
1632   -O : let -D and -U override definitions from loaded configuration file.
1633   -S : perform variable substitutions on all .SH files (can mix with -f)
1634   -U : undefine symbol:
1635          -U symbol    symbol gets the value 'undef'
1636          -U symbol=   symbol gets completely empty
1637   -A : manipulate symbol after the platform specific hints have been applied:
1638          -A symbol=value                append " "value to symbol
1639          -A append:symbol=value         append value to symbol
1640          -A define:symbol=value         define symbol to have value
1641          -A clear:symbol                define symbol to be ''
1642          -A define:symbol               define symbol to be 'define'
1643          -A eval:symbol=value           define symbol to be eval of value
1644          -A prepend:symbol=value        prepend value to symbol
1645          -A undef:symbol                define symbol to be 'undef'
1646          -A undef:symbol=               define symbol to be ''
1647   -V : print version number and exit (with a zero status).
1648 EOM
1649         exit 1
1650         ;;
1651 esac
1652
1653 : Sanity checks
1654 case "$fastread$alldone" in
1655 yescont|yesexit) ;;
1656 *)
1657         case "$extractsh" in
1658         true) ;;
1659         *)
1660                 if test ! -t 0; then
1661                         echo "Say 'sh Configure', not 'sh <Configure'"
1662                         exit 1
1663                 fi
1664                 ;;
1665         esac
1666         ;;
1667 esac
1668
1669 exec 4>&1
1670 case "$silent" in
1671 true) exec 1>/dev/null;;
1672 esac
1673
1674 : run the defines and the undefines, if any, but leave the file out there...
1675 touch optdef.sh
1676 . ./optdef.sh
1677 : create the posthint manipulation script and leave the file out there...
1678 touch posthint.sh
1679
1680 : set package name
1681 package=perl5
1682 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1683 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1684 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1685 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1686 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1687 esac
1688
1689 : Some greps do not return status, grrr.
1690 echo "grimblepritz" >grimble
1691 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1692         contains=contains
1693 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1694         contains=grep
1695 else
1696         contains=contains
1697 fi
1698 rm -f grimble
1699 : the following should work in any shell
1700 case "$contains" in
1701 contains*)
1702         echo " "
1703         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1704         cat >contains <<'EOSS'
1705 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1706 EOSS
1707 chmod +x contains
1708 esac
1709
1710 : Find the path to the source tree
1711 case "$src" in
1712 '') case "$0" in
1713     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1714          case "$src" in
1715          /*)    ;;
1716          .)     ;;
1717          *)     src=`cd ../$src && pwd` ;;
1718          esac
1719          ;;
1720     *)   src='.';;
1721     esac;;
1722 esac
1723 case "$src" in
1724 '')     src=/
1725         rsrc=/
1726         ;;
1727 /*) rsrc="$src";;
1728 *) rsrc="../$src";;
1729 esac
1730 if test -f $rsrc/Configure && \
1731         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1732 then
1733    : found it, so we are ok.
1734 else
1735         rsrc=''
1736         for src in . .. ../.. ../../.. ../../../..; do
1737                 if test -f ../$src/Configure && \
1738                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1739                 then
1740                         rsrc=../$src
1741                         break
1742                 fi
1743         done
1744 fi
1745 case "$rsrc" in
1746 '')
1747         cat <<EOM >&4
1748
1749 Sorry, I can't seem to locate the source dir for $package.  Please start
1750 Configure with an explicit path -- i.e. /some/path/Configure.
1751
1752 EOM
1753         exit 1
1754         ;;
1755 ../.)   rsrc='..';;
1756 *)
1757         echo " "
1758         echo "Sources for $package found in \"$src\"." >&4
1759         ;;
1760 esac
1761
1762 : script used to extract .SH files with variable substitutions
1763 cat >extract <<'EOS'
1764 PERL_CONFIG_SH=true
1765 echo "Doing variable substitutions on .SH files..."
1766 if test -f MANIFEST; then
1767         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1768 else
1769         echo "(Looking for .SH files under the source directory.)"
1770         set x `(cd "$src"; find . -name "*.SH" -print)`
1771 fi
1772 shift
1773 case $# in
1774 0) set x `(cd "$src"; echo *.SH)`; shift;;
1775 esac
1776 if test ! -f "$src/$1"; then
1777         shift
1778 fi
1779 mkdir_p='
1780 name=$1;
1781 create="";
1782 while test $name; do
1783         if test ! -d "$name"; then
1784                 create="$name $create";
1785                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1786                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1787         else
1788                 name="";
1789         fi;
1790 done;
1791 for file in $create; do
1792         mkdir $file;
1793 done
1794 '
1795 for file in $*; do
1796         case "$src" in
1797         ".")
1798                 case "$file" in
1799                 */*)
1800                         dir=`expr X$file : 'X\(.*\)/'`
1801                         file=`expr X$file : 'X.*/\(.*\)'`
1802                         (cd "$dir" && . ./$file)
1803                         ;;
1804                 *)
1805                         . ./$file
1806                         ;;
1807                 esac
1808                 ;;
1809         *)
1810                 case "$file" in
1811                 */*)
1812                         dir=`expr X$file : 'X\(.*\)/'`
1813                         file=`expr X$file : 'X.*/\(.*\)'`
1814                         (set x $dir; shift; eval $mkdir_p)
1815                         sh <"$src/$dir/$file"
1816                         ;;
1817                 *)
1818                         sh <"$src/$file"
1819                         ;;
1820                 esac
1821                 ;;
1822         esac
1823 done
1824 if test -f "$src/config_h.SH"; then
1825         if test ! -f config.h; then
1826         : oops, they left it out of MANIFEST, probably, so do it anyway.
1827         . "$src/config_h.SH"
1828         fi
1829 fi
1830 EOS
1831
1832 : extract files and exit if asked to do so
1833 case "$extractsh" in
1834 true)
1835         case "$realsilent" in
1836         true) ;;
1837         *) exec 1>&4;;
1838         esac
1839         case "$config_sh" in
1840         '') config_sh='config.sh';;
1841         esac
1842         echo " "
1843         echo "Fetching answers from $config_sh..."
1844         cd ..
1845         . $config_sh
1846         test "$override" && . ./optdef.sh
1847         echo " "
1848         . UU/extract
1849         rm -rf UU
1850         echo "Extraction done."
1851         exit 0
1852         ;;
1853 esac
1854
1855 : Eunice requires " " instead of "", can you believe it
1856 echo " "
1857 : Here we go...
1858 echo "Beginning of configuration questions for $package."
1859
1860 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1861
1862 : first determine how to suppress newline on echo command
1863 echo " "
1864 echo "Checking echo to see how to suppress newlines..."
1865 (echo "hi there\c" ; echo " ") >.echotmp
1866 if $contains c .echotmp >/dev/null 2>&1 ; then
1867         echo "...using -n."
1868         n='-n'
1869         c=''
1870 else
1871         cat <<'EOM'
1872 ...using \c
1873 EOM
1874         n=''
1875         c='\c'
1876 fi
1877 echo $n "The star should be here-->$c"
1878 echo '*'
1879 rm -f .echotmp
1880
1881 : Now test for existence of everything in MANIFEST
1882 echo " "
1883 if test -f "$rsrc/MANIFEST"; then
1884         echo "First let's make sure your kit is complete.  Checking..." >&4
1885         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1886         rm -f missing
1887         tmppwd=`pwd`
1888         for filelist in x??; do
1889                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1890         done
1891         if test -s missing; then
1892                 cat missing >&4
1893                 cat >&4 <<'EOM'
1894
1895 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1896
1897 You have the option of continuing the configuration process, despite the
1898 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1899 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1900 and contact the author (perlbug@perl.org).
1901
1902 EOM
1903                 echo $n "Continue? [n] $c" >&4
1904                 read ans
1905                 case "$ans" in
1906                 y*)
1907                         echo "Continuing..." >&4
1908                         rm -f missing
1909                         ;;
1910                 *)
1911                         echo "ABORTING..." >&4
1912                         kill $$
1913                         ;;
1914                 esac
1915         else
1916                 echo "Looks good..."
1917         fi
1918 else
1919         echo "There is no MANIFEST file.  I hope your kit is complete !"
1920 fi
1921 rm -f missing x??
1922
1923 echo " "
1924 : Find the appropriate value for a newline for tr
1925 if test -n "$DJGPP"; then
1926        trnl='\012'
1927 fi
1928 if test X"$trnl" = X; then
1929         case "`echo foo|tr '\n' x 2>/dev/null`" in
1930         foox) trnl='\n' ;;
1931         esac
1932 fi
1933 if test X"$trnl" = X; then
1934         case "`echo foo|tr '\012' x 2>/dev/null`" in
1935         foox) trnl='\012' ;;
1936         esac
1937 fi
1938 if test X"$trnl" = X; then
1939        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1940        fooxy) trnl='\n\r' ;;
1941        esac
1942 fi
1943 if test X"$trnl" = X; then
1944         cat <<EOM >&2
1945
1946 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1947
1948 EOM
1949         exit 1
1950 fi
1951
1952 : compute the number of columns on the terminal for proper question formatting
1953 case "$COLUMNS" in
1954 '') COLUMNS='80';;
1955 esac
1956
1957 : set up the echo used in my read
1958 myecho="case \"\$xxxm\" in
1959 '') echo $n \"\$rp $c\" >&4;;
1960 *) case \"\$rp\" in
1961         '') echo $n \"[\$xxxm] $c\";;
1962         *)
1963                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1964                         echo \"\$rp\" >&4
1965                         echo $n \"[\$xxxm] $c\" >&4
1966                 else
1967                         echo $n \"\$rp [\$xxxm] $c\" >&4
1968                 fi
1969                 ;;
1970         esac;;
1971 esac"
1972
1973 : now set up to do reads with possible shell escape and default assignment
1974 cat <<EOSC >myread
1975 $startsh
1976 xxxm=\$dflt
1977 $myecho
1978 ans='!'
1979 case "\$fastread" in
1980 yes) case "\$dflt" in
1981         '') ;;
1982         *) ans='';
1983                 case "\$silent-\$rp" in
1984                 true-) ;;
1985                 *) echo " " >&4;;
1986                 esac;;
1987         esac;;
1988 *) case "\$silent" in
1989         true) case "\$rp" in
1990                 '') ans='';;
1991                 esac;;
1992         esac;;
1993 esac
1994 while expr "X\$ans" : "X!" >/dev/null; do
1995         read answ
1996         set x \$xxxm
1997         shift
1998         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1999         case  "\$answ" in
2000         "!")
2001                 sh 1>&4
2002                 echo " "
2003                 $myecho
2004                 ;;
2005         !*)
2006                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2007                 shift
2008                 sh 1>&4 -c "\$*"
2009                 echo " "
2010                 $myecho
2011                 ;;
2012         "\$ans")
2013                 case "\$ans" in
2014                 \\&*)
2015                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2016                         shift
2017                         case "\$1" in
2018                         -d)
2019                                 fastread=yes
2020                                 echo "(OK, I'll run with -d after this question.)" >&4
2021                                 ;;
2022                         -*)
2023                                 echo "*** Sorry, \$1 not supported yet." >&4
2024                                 ;;
2025                         esac
2026                         $myecho
2027                         ans=!
2028                         ;;
2029                 esac;;
2030         *)
2031                 case "\$aok" in
2032                 y)
2033                         echo "*** Substitution done -- please confirm."
2034                         xxxm="\$ans"
2035                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2036                         xxxm="\$ans"
2037                         ans=!
2038                         ;;
2039                 *)
2040                         echo "*** Error -- try again."
2041                         ans=!
2042                         ;;
2043                 esac
2044                 $myecho
2045                 ;;
2046         esac
2047         case "\$ans\$xxxm\$nostick" in
2048         '')
2049                 ans=!
2050                 $myecho
2051                 ;;
2052         esac
2053 done
2054 case "\$ans" in
2055 '') ans="\$xxxm";;
2056 esac
2057 EOSC
2058
2059 : create .config dir to save info across Configure sessions
2060 test -d ../.config || mkdir ../.config
2061 cat >../.config/README <<EOF
2062 This directory created by Configure to save information that should
2063 persist across sessions for $package.
2064
2065 You may safely delete it if you wish.
2066 EOF
2067
2068 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2069 case "$usedevel" in
2070 $define|true|[yY]*) ;;
2071 *) case "$xversion" in
2072    *[13579])
2073         cat >&4 <<EOH
2074 *** WHOA THERE!!! ***
2075
2076     This is an UNSTABLE DEVELOPMENT release.
2077     The version of this $package distribution is $xversion, that is, odd,
2078     (as opposed to even) and that signifies a development release.
2079     If you want a maintenance release, you want an even-numbered version.
2080
2081     Do ***NOT*** install this into production use.
2082     Data corruption and crashes are possible.
2083
2084     It is most seriously suggested that you do not continue any further
2085     unless you want to help in developing and debugging Perl.
2086
2087     If you *still* want to build perl, you can answer 'y' now,
2088     or pass -Dusedevel to Configure.
2089
2090 EOH
2091         rp='Do you really want to continue?'
2092         dflt='n'
2093         . ./myread
2094         case "$ans" in
2095         [yY]) echo >&4 "Okay, continuing."
2096               usedevel="$define" ;;
2097         *) echo >&4 "Okay, bye."
2098            exit 1
2099            ;;
2100         esac
2101         ;;
2102     esac
2103     ;;
2104 esac
2105 case "$usedevel" in
2106 $define|true|[yY]*)
2107         case "$versiononly" in
2108         '') versiononly="$define" ;;
2109         esac
2110         case "$installusrbinperl" in
2111         '') installusrbinperl="$undef" ;;
2112         esac
2113         ;;
2114 esac
2115
2116 : general instructions
2117 needman=true
2118 firsttime=true
2119 user=`(logname) 2>/dev/null`
2120 case "$user" in
2121 '') user=`whoami 2>&1`;;
2122 esac
2123 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2124         firsttime=false
2125         echo " "
2126         rp='Would you like to see the instructions?'
2127         dflt=n
2128         . ./myread
2129         case "$ans" in
2130         [yY]*) ;;
2131         *) needman=false;;
2132         esac
2133 fi
2134 if $needman; then
2135         cat <<EOH
2136
2137 This installation shell script will examine your system and ask you questions
2138 to determine how the perl5 package should be installed. If you get
2139 stuck on a question, you may use a ! shell escape to start a subshell or
2140 execute a command.  Many of the questions will have default answers in square
2141 brackets; typing carriage return will give you the default.
2142
2143 On some of the questions which ask for file or directory names you are allowed
2144 to use the ~name construct to specify the login directory belonging to "name",
2145 even if you don't have a shell which knows about that.  Questions where this is
2146 allowed will be marked "(~name ok)".
2147
2148 EOH
2149         rp=''
2150         dflt='Type carriage return to continue'
2151         . ./myread
2152         cat <<'EOH'
2153
2154 The prompter used in this script allows you to use shell variables and
2155 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2156 in the default answer, as if the default line was a set of arguments given to a
2157 script shell.  This means you may also use $* to repeat the whole default line,
2158 so you do not have to re-type everything to add something to the default.
2159
2160 Everytime there is a substitution, you will have to confirm.  If there is an
2161 error (e.g. an unmatched backtick), the default answer will remain unchanged
2162 and you will be prompted again.
2163
2164 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2165 the questions and use the computed defaults (or the previous answers if there
2166 was already a config.sh file). Type 'Configure -h' for a list of options.
2167 You may also start interactively and then answer '& -d' at any prompt to turn
2168 on the non-interactive behaviour for the remainder of the execution.
2169
2170 EOH
2171         . ./myread
2172         cat <<EOH
2173
2174 Much effort has been expended to ensure that this shell script will run on any
2175 Unix system.  If despite that it blows up on yours, your best bet is to edit
2176 Configure and run it again.  If you can't run Configure for some reason,
2177 you'll have to generate a config.sh file by hand.  Whatever problems you
2178 have, let me (perlbug@perl.org) know how I blew it.
2179
2180 This installation script affects things in two ways:
2181
2182 1) it may do direct variable substitutions on some of the files included
2183    in this kit.
2184 2) it builds a config.h file for inclusion in C programs.  You may edit
2185    any of these files as the need arises after running this script.
2186
2187 If you make a mistake on a question, there is no easy way to back up to it
2188 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2189 files.  Configure will offer to let you do this before it runs the SH files.
2190
2191 EOH
2192         dflt='Type carriage return to continue'
2193         . ./myread
2194         case "$firsttime" in
2195         true) echo $user >>../.config/instruct;;
2196         esac
2197 fi
2198
2199 : find out where common programs are
2200 echo " "
2201 echo "Locating common programs..." >&4
2202 cat <<EOSC >loc
2203 $startsh
2204 case \$# in
2205 0) exit 1;;
2206 esac
2207 thing=\$1
2208 shift
2209 dflt=\$1
2210 shift
2211 for dir in \$*; do
2212         case "\$thing" in
2213         .)
2214         if test -d \$dir/\$thing; then
2215                 echo \$dir
2216                 exit 0
2217         fi
2218         ;;
2219         *)
2220         for thisthing in \$dir/\$thing; do
2221                 : just loop through to pick last item
2222         done
2223         if test -f \$thisthing; then
2224                 echo \$thisthing
2225                 exit 0
2226         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2227                 echo \$thisthing
2228                 exit 0
2229         elif test -f \$dir/\$thing.exe; then
2230                 if test -n "$DJGPP"; then
2231                         echo \$dir/\$thing.exe
2232                 elif test "$eunicefix" != ":"; then
2233                         : on Eunice apparently
2234                         echo \$dir/\$thing
2235                         exit 0
2236                 fi
2237                 exit 0
2238         fi
2239         ;;
2240         esac
2241 done
2242 echo \$dflt
2243 exit 1
2244 EOSC
2245 chmod +x loc
2246 $eunicefix loc
2247 loclist="
2248 awk
2249 cat
2250 chmod
2251 comm
2252 cp
2253 echo
2254 expr
2255 grep
2256 ls
2257 mkdir
2258 rm
2259 sed
2260 sort
2261 touch
2262 tr
2263 uniq
2264 "
2265 trylist="
2266 Mcc
2267 ar
2268 bison
2269 byacc
2270 cpp
2271 csh
2272 date
2273 egrep
2274 gmake
2275 gzip
2276 less
2277 ln
2278 make
2279 more
2280 nm
2281 nroff
2282 pg
2283 test
2284 uname
2285 zip
2286 "
2287 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2288 pth="$pth /lib /usr/lib"
2289 for file in $loclist; do
2290         eval xxx=\$$file
2291         case "$xxx" in
2292         /*|?:[\\/]*)
2293                 if test -f "$xxx"; then
2294                         : ok
2295                 else
2296                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2297                         xxx=`./loc $file $file $pth`
2298                 fi
2299                 ;;
2300         '') xxx=`./loc $file $file $pth`;;
2301         *) xxx=`./loc $xxx $xxx $pth`;;
2302         esac
2303         eval $file=$xxx$_exe
2304         eval _$file=$xxx
2305         case "$xxx" in
2306         /*)
2307                 echo $file is in $xxx.
2308                 ;;
2309         ?:[\\/]*)
2310                 echo $file is in $xxx.
2311                 ;;
2312         *)
2313                 echo "I don't know where '$file' is, and my life depends on it." >&4
2314                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2315                 exit 1
2316                 ;;
2317         esac
2318 done
2319 echo " "
2320 echo "Don't worry if any of the following aren't found..."
2321 say=offhand
2322 for file in $trylist; do
2323         eval xxx=\$$file
2324         case "$xxx" in
2325         /*|?:[\\/]*)
2326                 if test -f "$xxx"; then
2327                         : ok
2328                 else
2329                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2330                         xxx=`./loc $file $file $pth`
2331                 fi
2332                 ;;
2333         '') xxx=`./loc $file $file $pth`;;
2334         *) xxx=`./loc $xxx $xxx $pth`;;
2335         esac
2336         eval $file=$xxx$_exe
2337         eval _$file=$xxx
2338         case "$xxx" in
2339         /*)
2340                 echo $file is in $xxx.
2341                 ;;
2342         ?:[\\/]*)
2343                 echo $file is in $xxx.
2344                 ;;
2345         *)
2346                 echo "I don't see $file out there, $say."
2347                 say=either
2348                 ;;
2349         esac
2350 done
2351 case "$egrep" in
2352 egrep)
2353         echo "Substituting grep for egrep."
2354         egrep=$grep
2355         _egrep=$grep
2356         ;;
2357 esac
2358 case "$ln" in
2359 ln)
2360         echo "Substituting cp for ln."
2361         ln=$cp
2362         _ln=$cp
2363         ;;
2364 esac
2365 case "$make" in
2366 make)   
2367         case "$gmake" in
2368         gmake)
2369         echo "I can't find make or gmake, and my life depends on it." >&4
2370         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2371         exit 1
2372         ;;
2373         esac
2374         ;;
2375 esac    
2376 case "$gmake" in
2377 gmake)  ;;
2378 *)      # We can't have osname yet.
2379         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2380                 # Assume that gmake, if found, is definitely GNU make
2381                 # and prefer it over the system make.
2382                 echo "Substituting gmake for make."
2383                 make=$gmake
2384                 _make=$gmake
2385         fi
2386         ;;
2387 esac
2388 case "$test" in
2389 test)
2390         echo "Hopefully test is built into your sh."
2391         ;;
2392 *)
2393         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2394                 echo "Using the test built into your sh."
2395                 test=test
2396                 _test=test
2397         fi
2398         ;;
2399 esac
2400 case "$echo" in
2401 echo)
2402         echo "Hopefully echo is built into your sh."
2403         ;;
2404 '') ;;
2405 *)
2406         echo " "
2407 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2408         $echo $n "hi there$c" >foo1
2409         echo $n "hi there$c" >foo2
2410         if cmp foo1 foo2 >/dev/null 2>&1; then
2411                 echo "They are compatible.  In fact, they may be identical."
2412         else
2413                 case "$n" in
2414                 '-n') n='' c='\c';;
2415                 *) n='-n' c='';;
2416                 esac
2417                 cat <<FOO
2418 They are not compatible!  You are probably running ksh on a non-USG system.
2419 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2420 have echo built in and we may have to run some Bourne shell scripts.  That
2421 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2422
2423 FOO
2424                 $echo $n "The star should be here-->$c"
2425                 $echo "*"
2426         fi
2427         $rm -f foo1 foo2
2428         ;;
2429 esac
2430
2431 cat <<EOS >trygcc
2432 $startsh
2433 EOS
2434 cat <<'EOSC' >>trygcc
2435 case "$cc" in
2436 '') ;;
2437 *)  $rm -f try try.*
2438     $cat >try.c <<EOM
2439 int main(int argc, char *argv[]) {
2440   return 0;
2441 }
2442 EOM
2443     if $cc -o try $ccflags $ldflags try.c; then
2444        :
2445     else
2446         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2447         despair=yes
2448         trygcc=yes
2449         case "$cc" in
2450         *gcc*) trygcc=no ;;
2451         esac
2452         case "`$cc -v -c try.c 2>&1`" in
2453         *gcc*) trygcc=no ;;
2454         esac
2455         if $test X"$trygcc" = Xyes; then
2456             if gcc -o try -c try.c; then
2457                 echo " "
2458                 echo "You seem to have a working gcc, though." >&4
2459                 rp="Would you like to use it?"
2460                 dflt=y
2461                 if $test -f myread; then
2462                     . ./myread
2463                 else
2464                     if $test -f UU/myread; then
2465                         . ./UU/myread
2466                     else
2467                         echo "Cannot find myread, sorry.  Aborting." >&2
2468                         exit 1
2469                     fi
2470                 fi  
2471                 case "$ans" in
2472                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2473                        if $test -f usethreads.cbu; then
2474                            $cat >&4 <<EOM 
2475
2476 *** However, any setting of the C compiler flags (e.g. for thread support)
2477 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2478 *** (together with e.g. -Dusethreads).
2479
2480 EOM
2481                        fi;;
2482                 esac
2483             fi
2484         fi
2485     fi
2486     $rm -f try try.*
2487     ;;
2488 esac
2489 EOSC
2490
2491 cat <<EOS >checkcc
2492 $startsh
2493 EOS
2494 cat <<'EOSC' >>checkcc
2495 case "$cc" in        
2496 '') ;;
2497 *)  $rm -f try try.*              
2498     $cat >try.c <<EOM
2499 int main(int argc, char *argv[]) {
2500   return 0;
2501 }
2502 EOM
2503     if $cc -o try $ccflags $ldflags try.c; then
2504        :
2505     else
2506         if $test X"$despair" = Xyes; then
2507            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2508         fi
2509         $cat >&4 <<EOM         
2510 You need to find a working C compiler.
2511 Either (purchase and) install the C compiler supplied by your OS vendor,
2512 or for a free C compiler try http://gcc.gnu.org/
2513 I cannot continue any further, aborting.
2514 EOM
2515         exit 1
2516     fi
2517     $rm -f try try.*
2518     ;;
2519 esac
2520 EOSC
2521
2522 : determine whether symbolic links are supported
2523 echo " "
2524 $touch blurfl
2525 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2526         echo "Symbolic links are supported." >&4
2527         lns="$ln -s"
2528 else
2529         echo "Symbolic links are NOT supported." >&4
2530         lns="$ln"
2531 fi
2532 $rm -f blurfl sym
2533
2534 : determine whether symbolic links are supported
2535 echo " "
2536 case "$lns" in
2537 *"ln"*" -s")
2538         echo "Checking how to test for symbolic links..." >&4
2539         $lns blurfl sym
2540         if $test "X$issymlink" = X; then
2541                 case "$newsh" in
2542                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2543                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2544                 esac
2545                 if test $? = 0; then
2546                         issymlink="test -h"
2547                 else
2548                         echo "Your builtin 'test -h' may be broken." >&4
2549                         case "$test" in
2550                         /*)     ;;
2551                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2552                                 for p in $pth
2553                                 do
2554                                         if test -f "$p/$test"; then
2555                                                 test="$p/$test"
2556                                                 break
2557                                         fi
2558                                 done
2559                                 ;;
2560                         esac
2561                         case "$test" in
2562                         /*)
2563                                 echo "Trying external '$test -h'." >&4
2564                                 issymlink="$test -h"
2565                                 if $test ! -h sym >/dev/null 2>&1; then
2566                                         echo "External '$test -h' is broken, too." >&4
2567                                         issymlink=''
2568                                 fi
2569                                 ;;
2570                         *)      issymlink='' ;;
2571                         esac
2572                 fi              
2573         fi
2574         if $test "X$issymlink" = X; then
2575                 if $test -L sym 2>/dev/null; then
2576                         issymlink="$test -L"
2577                         echo "The builtin '$test -L' worked." >&4
2578                 fi
2579         fi
2580         if $test "X$issymlink" != X; then
2581                 echo "You can test for symbolic links with '$issymlink'." >&4
2582         else
2583                 echo "I do not know how you can test for symbolic links." >&4
2584         fi
2585         $rm -f blurfl sym
2586         ;;
2587 *)      echo "No symbolic links, so not testing for their testing..." >&4
2588         ;;
2589 esac
2590 echo " "
2591
2592
2593 case "$mksymlinks" in
2594 $define|true|[yY]*)
2595         case "$src" in
2596         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2597                 exit 1
2598                 ;;
2599         *)      case "$lns:$issymlink" in
2600                 *"ln"*" -s:"*"test -"?)
2601                         echo "Creating the symbolic links..." >&4
2602                         echo "(First creating the subdirectories...)" >&4
2603                         cd ..
2604                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2605                                 read directory
2606                                 test -z "$directory" && break
2607                                 mkdir -p $directory
2608                         done
2609                         # Sanity check 1.
2610                         if test ! -d t/base; then
2611                                 echo "Failed to create the subdirectories.  Aborting." >&4
2612                                 exit 1
2613                         fi
2614                         echo "(Then creating the symlinks...)" >&4
2615                         awk '{print $1}' $src/MANIFEST | while true; do
2616                                 read filename
2617                                 test -z "$filename" && break
2618                                 if test -f $filename; then
2619                                         if $issymlink $filename; then
2620                                                 rm -f $filename
2621                                         fi
2622                                 fi
2623                                 if test -f $filename; then
2624                                         echo "$filename already exists, not symlinking."
2625                                 else
2626                                         ln -s $src/$filename $filename
2627                                 fi
2628                         done
2629                         # Sanity check 2.
2630                         if test ! -f t/base/lex.t; then
2631                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2632                                 exit 1
2633                         fi
2634                         cd UU
2635                         ;;
2636                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2637                         ;;
2638                 esac
2639                 ;;
2640         esac
2641         ;;
2642 esac
2643
2644
2645 case "$usecrosscompile" in
2646 $define|true|[yY]*)
2647         $echo "Cross-compiling..."
2648         croak=''
2649         case "$cc" in
2650         *-*-gcc) # A cross-compiling gcc, probably.
2651             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2652             ar=$targetarch-ar
2653             # leave out ld, choosing it is more complex
2654             nm=$targetarch-nm
2655             ranlib=$targetarch-ranlib
2656             $echo 'extern int foo;' > try.c
2657             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2658             shift
2659             if $test $# -gt 0; then
2660                 incpth="$incpth $*"
2661                 incpth="`$echo $incpth|$sed 's/^ //'`"
2662                 echo "Guessing incpth '$incpth'." >&4
2663                 for i in $*; do
2664                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2665                     if $test -d $j; then
2666                         libpth="$libpth $j"
2667                     fi
2668                 done   
2669                 libpth="`$echo $libpth|$sed 's/^ //'`"
2670                 echo "Guessing libpth '$libpth'." >&4
2671             fi
2672             $rm -f try.c
2673             ;;
2674         esac
2675         case "$targetarch" in
2676         '') echo "Targetarch not defined." >&4; croak=y ;;
2677         *)  echo "Using targetarch $targetarch." >&4 ;;
2678         esac
2679         case "$incpth" in
2680         '') echo "Incpth not defined." >&4; croak=y ;;
2681         *)  echo "Using incpth '$incpth'." >&4 ;;
2682         esac
2683         case "$libpth" in
2684         '') echo "Libpth not defined." >&4; croak=y ;;
2685         *)  echo "Using libpth '$libpth'." >&4 ;;
2686         esac
2687         case "$usrinc" in
2688         '') for i in $incpth; do
2689                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2690                     usrinc=$i
2691                     echo "Guessing usrinc $usrinc." >&4
2692                     break
2693                 fi
2694             done
2695             case "$usrinc" in
2696             '') echo "Usrinc not defined." >&4; croak=y ;;
2697             esac
2698             ;;
2699         *)  echo "Using usrinc $usrinc." >&4 ;;
2700         esac
2701         case "$targethost" in
2702         '') echo "Targethost not defined." >&4; croak=y ;;
2703         *)  echo "Using targethost $targethost." >&4
2704         esac
2705         locincpth=' '
2706         loclibpth=' '
2707         case "$croak" in
2708         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2709         esac
2710         case "$src" in
2711         /*) run=$src/Cross/run
2712             targetmkdir=$src/Cross/mkdir
2713             to=$src/Cross/to
2714             from=$src/Cross/from
2715             ;;
2716         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2717             run=$pwd/Cross/run
2718             targetmkdir=$pwd/Cross/mkdir
2719             to=$pwd/Cross/to
2720             from=$pwd/Cross/from
2721             ;;
2722         esac
2723         case "$targetrun" in
2724         '') targetrun=ssh ;;
2725         esac
2726         case "$targetto" in
2727         '') targetto=scp ;;
2728         esac
2729         case "$targetfrom" in
2730         '') targetfrom=scp ;;
2731         esac
2732         run=$run-$targetrun
2733         to=$to-$targetto
2734         from=$from-$targetfrom
2735         case "$targetdir" in
2736         '')  targetdir=/tmp
2737              echo "Guessing targetdir $targetdir." >&4
2738              ;;
2739         esac
2740         case "$targetuser" in
2741         '')  targetuser=root
2742              echo "Guessing targetuser $targetuser." >&4
2743              ;;
2744         esac
2745         case "$targetfrom" in
2746         scp)    q=-q ;;
2747         *)      q='' ;;
2748         esac
2749         case "$targetrun" in
2750         ssh|rsh)
2751             cat >$run <<EOF
2752 #!/bin/sh
2753 case "\$1" in
2754 -cwd)
2755   shift
2756   cwd=\$1
2757   shift
2758   ;;
2759 esac
2760 case "\$cwd" in
2761 '') cwd=$targetdir ;;
2762 esac
2763 exe=\$1
2764 shift
2765 if $test ! -f \$exe.xok; then
2766   $to \$exe
2767   $touch \$exe.xok
2768 fi
2769 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2770 EOF
2771             ;;
2772         *)  echo "Unknown targetrun '$targetrun'" >&4
2773             exit 1
2774             ;;
2775         esac
2776         case "$targetmkdir" in
2777         */Cross/mkdir)
2778             cat >$targetmkdir <<EOF
2779 #!/bin/sh
2780 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2781 EOF
2782             $chmod a+rx $targetmkdir
2783             ;;
2784         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2785             exit 1
2786             ;;
2787         esac
2788         case "$targetto" in
2789         scp|rcp)
2790             cat >$to <<EOF
2791 #!/bin/sh
2792 for f in \$@
2793 do
2794   case "\$f" in
2795   /*)
2796     $targetmkdir \`dirname \$f\`
2797     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2798     ;;
2799   *)
2800     $targetmkdir $targetdir/\`dirname \$f\`
2801     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2802     ;;
2803   esac
2804 done
2805 exit 0
2806 EOF
2807             ;;
2808         cp) cat >$to <<EOF
2809 #!/bin/sh
2810 for f in \$@
2811 do
2812   case "\$f" in
2813   /*)
2814     $mkdir -p $targetdir/\`dirname \$f\`
2815     $cp \$f $targetdir/\$f || exit 1
2816     ;;
2817   *)
2818     $targetmkdir $targetdir/\`dirname \$f\`
2819     $cp \$f $targetdir/\$f || exit 1
2820     ;;
2821   esac
2822 done
2823 exit 0
2824 EOF
2825             ;;
2826         *)  echo "Unknown targetto '$targetto'" >&4
2827             exit 1
2828             ;;
2829         esac
2830         case "$targetfrom" in
2831         scp|rcp)
2832           cat >$from <<EOF
2833 #!/bin/sh
2834 for f in \$@
2835 do
2836   $rm -f \$f
2837   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2838 done
2839 exit 0
2840 EOF
2841             ;;
2842         cp) cat >$from <<EOF
2843 #!/bin/sh
2844 for f in \$@
2845 do
2846   $rm -f \$f
2847   cp $targetdir/\$f . || exit 1
2848 done
2849 exit 0
2850 EOF
2851             ;;
2852         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2853             exit 1
2854             ;;
2855         esac
2856         if $test ! -f $run; then
2857             echo "Target 'run' script '$run' not found." >&4
2858         else
2859             $chmod a+rx $run
2860         fi
2861         if $test ! -f $to; then
2862             echo "Target 'to' script '$to' not found." >&4
2863         else
2864             $chmod a+rx $to
2865         fi
2866         if $test ! -f $from; then
2867             echo "Target 'from' script '$from' not found." >&4
2868         else
2869             $chmod a+rx $from
2870         fi
2871         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2872             exit 1
2873         fi
2874         cat >&4 <<EOF
2875 Using '$run' for remote execution,
2876 and '$from' and '$to'
2877 for remote file transfer.
2878 EOF
2879         ;;
2880 *)      run=''
2881         to=:
2882         from=:
2883         usecrosscompile='undef'
2884         targetarch=''
2885         ;;
2886 esac
2887
2888 : see whether [:lower:] and [:upper:] are supported character classes
2889 echo " "
2890 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2891 ABYZ)
2892         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2893         up='[:upper:]'
2894         low='[:lower:]'
2895         ;;
2896 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2897         # (0xd9 and 0xe2), therefore that is a nice testing point.
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 | $tr R-S r-s 2>/dev/null`" in
2907             rs) up='A-Z'
2908                 low='a-z'
2909                 ;;
2910             esac
2911         fi
2912         if test "X$up" = X -o "X$low" = X; then
2913             case "`echo RS | od -x 2>/dev/null`" in
2914             *D9E2*|*d9e2*)
2915                 echo "Hey, this might be EBCDIC." >&4
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                 if test "X$up" = X -o "X$low" = X; then
2924                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2925                     rs) up='A-IJ-RS-Z'
2926                         low='a-ij-rs-z'
2927                         ;;
2928                     esac
2929                 fi
2930                 ;;
2931             esac
2932         fi
2933 esac
2934 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2935 rs)
2936     echo "Using $up and $low to convert case." >&4
2937     ;;
2938 *)
2939     echo "I don't know how to translate letters from upper to lower case." >&4
2940     echo "Your tr is not acting any way I know of." >&4
2941     exit 1
2942     ;;
2943 esac
2944 : set up the translation script tr, must be called with ./tr of course
2945 cat >tr <<EOSC
2946 $startsh
2947 case "\$1\$2" in
2948 '[A-Z][a-z]') exec $tr '$up' '$low';;
2949 '[a-z][A-Z]') exec $tr '$low' '$up';;
2950 esac
2951 exec $tr "\$@"
2952 EOSC
2953 chmod +x tr
2954 $eunicefix tr
2955
2956 : Try to determine whether config.sh was made on this system
2957 case "$config_sh" in
2958 '')
2959 myuname=`$uname -a 2>/dev/null`
2960 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2961 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2962 # because the A-Z/a-z are not consecutive.
2963 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2964         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2965 newmyuname="$myuname"
2966 dflt=n
2967 case "$knowitall" in
2968 '')
2969         if test -f ../config.sh; then
2970                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2971                         eval "`grep myuname= ../config.sh`"
2972                 fi
2973                 if test "X$myuname" = "X$newmyuname"; then
2974                         dflt=y
2975                 fi
2976         fi
2977         ;;
2978 *) dflt=y;;
2979 esac
2980
2981 : Get old answers from old config file if Configure was run on the
2982 : same system, otherwise use the hints.
2983 hint=default
2984 cd ..
2985 if test -f config.sh; then
2986         echo " "
2987         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2988         . UU/myread
2989         case "$ans" in
2990         n*|N*) echo "OK, I'll ignore it."
2991                 mv config.sh config.sh.old
2992                 myuname="$newmyuname"
2993                 ;;
2994         *)  echo "Fetching default answers from your old config.sh file..." >&4
2995                 tmp_n="$n"
2996                 tmp_c="$c"
2997                 tmp_sh="$sh"
2998                 . ./config.sh
2999                 cp config.sh UU
3000                 n="$tmp_n"
3001                 c="$tmp_c"
3002                 : Older versions did not always set $sh.  Catch re-use of such
3003                 : an old config.sh.
3004                 case "$sh" in
3005                 '') sh="$tmp_sh" ;;
3006                 esac
3007                 hint=previous
3008                 ;;
3009         esac
3010 fi
3011 . ./UU/checkcc
3012 if test ! -f config.sh; then
3013         $cat <<EOM
3014
3015 First time through, eh?  I have some defaults handy for some systems
3016 that need some extra help getting the Configure answers right:
3017
3018 EOM
3019         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3020         dflt=''
3021         : Half the following guesses are probably wrong... If you have better
3022         : tests or hints, please send them to perlbug@perl.org
3023         : The metaconfig authors would also appreciate a copy...
3024         $test -f /irix && osname=irix
3025         $test -f /xenix && osname=sco_xenix
3026         $test -f /dynix && osname=dynix
3027         $test -f /dnix && osname=dnix
3028         $test -f /lynx.os && osname=lynxos
3029         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3030         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3031         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3032         $test -f /bin/mips && /bin/mips && osname=mips
3033         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3034                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3035         $test -d /usr/apollo/bin && osname=apollo
3036         $test -f /etc/saf/_sactab && osname=svr4
3037         $test -d /usr/include/minix && osname=minix
3038         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3039         if $test -d /MachTen -o -d /MachTen_Folder; then
3040                 osname=machten
3041                 if $test -x /sbin/version; then
3042                         osvers=`/sbin/version | $awk '{print $2}' |
3043                         $sed -e 's/[A-Za-z]$//'`
3044                 elif $test -x /usr/etc/version; then
3045                         osvers=`/usr/etc/version | $awk '{print $2}' |
3046                         $sed -e 's/[A-Za-z]$//'`
3047                 else
3048                         osvers="$2.$3"
3049                 fi
3050         fi
3051
3052         $test -f /sys/posix.dll &&
3053                 $test -f /usr/bin/what &&
3054                 set X `/usr/bin/what /sys/posix.dll` &&
3055                 $test "$3" = UWIN &&
3056                 osname=uwin &&
3057                 osvers="$5"
3058
3059         if $test -f $uname; then
3060                 set X $myuname
3061                 shift
3062
3063                 case "$5" in
3064                 fps*) osname=fps ;;
3065                 mips*)
3066                         case "$4" in
3067                         umips) osname=umips ;;
3068                         *) osname=mips ;;
3069                         esac;;
3070                 [23]100) osname=mips ;;
3071                 next*) osname=next ;;
3072                 i386*)
3073                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3074                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3075                                 osname='sco'
3076                                 osvers=$tmp
3077                         elif $test -f /etc/kconfig; then
3078                                 osname=isc
3079                                 if test "$lns" = "$ln -s"; then
3080                                         osvers=4
3081                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3082                                         osvers=3
3083                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3084                                         osvers=2
3085                                 fi
3086                         fi
3087                         tmp=''
3088                         ;;
3089                 pc*)
3090                         if test -n "$DJGPP"; then
3091                                 osname=dos
3092                                 osvers=djgpp
3093                         fi
3094                         ;;
3095                 esac
3096
3097                 case "$1" in
3098                 aix) osname=aix
3099                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3100                         case "$tmp" in
3101                         # oslevel can fail with:
3102                         # oslevel: Unable to acquire lock.
3103                         *not\ found) osvers="$4"."$3" ;;
3104                         '<3240'|'<>3240') osvers=3.2.0 ;;
3105                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3106                         '=3250'|'>3250') osvers=3.2.5 ;;
3107                         *) osvers=$tmp;;
3108                         esac
3109                         ;;
3110                 bsd386) osname=bsd386
3111                         osvers=`$uname -r`
3112                         ;;
3113                 cygwin*) osname=cygwin
3114                         osvers="$3"
3115                         ;;
3116                 *dc.osx) osname=dcosx
3117                         osvers="$3"
3118                         ;;
3119                 dnix) osname=dnix
3120                         osvers="$3"
3121                         ;;
3122                 domainos) osname=apollo
3123                         osvers="$3"
3124                         ;;
3125                 dgux)   osname=dgux 
3126                         osvers="$3"
3127                         ;;
3128                 dynixptx*) osname=dynixptx
3129                         osvers=`echo "$4"|sed 's/^v//'`
3130                         ;;
3131                 freebsd) osname=freebsd 
3132                         osvers="$3" ;;
3133                 genix)  osname=genix ;;
3134                 gnu)    osname=gnu
3135                         osvers="$3" ;;
3136                 hp*)    osname=hpux 
3137                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3138                         ;;
3139                 irix*)  osname=irix
3140                         case "$3" in
3141                         4*) osvers=4 ;;
3142                         5*) osvers=5 ;;
3143                         *)      osvers="$3" ;;
3144                         esac
3145                         ;;
3146                 linux)  osname=linux
3147                         case "$3" in
3148                         *)      osvers="$3" ;;
3149                         esac
3150                         ;;
3151                 MiNT)   osname=mint
3152                         ;;
3153                 netbsd*) osname=netbsd
3154                         osvers="$3"
3155                         ;;
3156                 news-os) osvers="$3"
3157                         case "$3" in
3158                         4*) osname=newsos4 ;;
3159                         *) osname=newsos ;;
3160                         esac
3161                         ;;
3162                 next*) osname=next ;;
3163                 nonstop-ux) osname=nonstopux ;;
3164                 openbsd) osname=openbsd
3165                         osvers="$3"
3166                         ;;
3167                 os2)    osname=os2
3168                         osvers="$4"
3169                         ;;
3170                 POSIX-BC | posix-bc ) osname=posix-bc
3171                         osvers="$3"
3172                         ;;
3173                 powerux | power_ux | powermax_os | powermaxos | \
3174                 powerunix | power_unix) osname=powerux
3175                         osvers="$3"
3176                         ;;
3177                 qnx) osname=qnx
3178                         osvers="$4"
3179                         ;;
3180                 solaris) osname=solaris
3181                         case "$3" in
3182                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3183                         *)      osvers="$3" ;;
3184                         esac
3185                         ;;
3186                 sunos) osname=sunos
3187                         case "$3" in
3188                         5*) osname=solaris
3189                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3190                         *)      osvers="$3" ;;
3191                         esac
3192                         ;;
3193                 titanos) osname=titanos
3194                         case "$3" in
3195                         1*) osvers=1 ;;
3196                         2*) osvers=2 ;;
3197                         3*) osvers=3 ;;
3198                         4*) osvers=4 ;;
3199                         *)      osvers="$3" ;;
3200                         esac
3201                         ;;
3202                 ultrix) osname=ultrix
3203                         osvers="$3"
3204                         ;;
3205                 osf1|mls+)      case "$5" in
3206                                 alpha)
3207                                         osname=dec_osf
3208                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3209                                         case "$osvers" in
3210                                         [1-9].[0-9]*) ;;
3211                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3212                                         esac
3213                                         ;;
3214                         hp*)    osname=hp_osf1  ;;
3215                         mips)   osname=mips_osf1 ;;
3216                         esac
3217                         ;;
3218                 # UnixWare 7.1.2 is known as Open UNIX 8
3219                 openunix|unixware) osname=svr5
3220                         osvers="$4"
3221                         ;;
3222                 uts)    osname=uts
3223                         osvers="$3"
3224                         ;;
3225                 vos) osvers="$3"
3226                         ;;
3227                 $2) case "$osname" in
3228                         *isc*) ;;
3229                         *freebsd*) ;;
3230                         svr*)
3231                                 : svr4.x or possibly later
3232                                 case "svr$3" in 
3233                                 ${osname}*)
3234                                         osname=svr$3
3235                                         osvers=$4
3236                                         ;;
3237                                 esac
3238                                 case "$osname" in
3239                                 svr4.0)
3240                                         : Check for ESIX
3241                                         if test -f /stand/boot ; then
3242                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3243                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3244                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3245                                                         if test -n "$isesix"; then
3246                                                                 osname=esix4
3247                                                         fi
3248                                                 fi
3249                                         fi
3250                                         ;;
3251                                 esac
3252                                 ;;
3253                         *)      if test -f /etc/systemid; then
3254                                         osname=sco
3255                                         set `echo $3 | $sed 's/\./ /g'` $4
3256                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3257                                                 osvers=$1.$2.$3
3258                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3259                                                 osvers=$1.$2
3260                                         elif $test -f $src/hints/sco_$1.sh; then
3261                                                 osvers=$1
3262                                         fi
3263                                 else
3264                                         case "$osname" in
3265                                         '') : Still unknown.  Probably a generic Sys V.
3266                                                 osname="sysv"
3267                                                 osvers="$3"
3268                                                 ;;
3269                                         esac
3270                                 fi
3271                                 ;;
3272                         esac
3273                         ;;
3274                 *)      case "$osname" in
3275                         '') : Still unknown.  Probably a generic BSD.
3276                                 osname="$1"
3277                                 osvers="$3"
3278                                 ;;
3279                         esac
3280                         ;;
3281                 esac
3282         else
3283                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3284                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3285                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3286                                 osname=news_os
3287                         fi
3288                         $rm -f UU/kernel.what
3289                 elif test -d c:/. -o -n "$is_os2" ; then
3290                         set X $myuname
3291                         osname=os2
3292                         osvers="$5"
3293                 fi
3294         fi
3295         
3296         case "$targetarch" in
3297         '') ;;
3298         *)  hostarch=$osname
3299             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3300             osvers=''
3301             ;;
3302         esac
3303
3304         : Now look for a hint file osname_osvers, unless one has been
3305         : specified already.
3306         case "$hintfile" in
3307         ''|' ')
3308                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3309                 : Also try without trailing minor version numbers.
3310                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3311                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3312                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3313                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3314                 case "$file" in
3315                 '') dflt=none ;;
3316                 *)  case "$osvers" in
3317                         '') dflt=$file
3318                                 ;;
3319                         *)  if $test -f $src/hints/$file.sh ; then
3320                                         dflt=$file
3321                                 elif $test -f $src/hints/$xfile.sh ; then
3322                                         dflt=$xfile
3323                                 elif $test -f $src/hints/$xxfile.sh ; then
3324                                         dflt=$xxfile
3325                                 elif $test -f $src/hints/$xxxfile.sh ; then
3326                                         dflt=$xxxfile
3327                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3328                                         dflt=$xxxxfile
3329                                 elif $test -f "$src/hints/${osname}.sh" ; then
3330                                         dflt="${osname}"
3331                                 else
3332                                         dflt=none
3333                                 fi
3334                                 ;;
3335                         esac
3336                         ;;
3337                 esac
3338                 if $test -f Policy.sh ; then
3339                         case "$dflt" in
3340                         *Policy*) ;;
3341                         none) dflt="Policy" ;;
3342                         *) dflt="Policy $dflt" ;;
3343                         esac
3344                 fi
3345                 ;;
3346         *)
3347                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3348                 ;;
3349         esac
3350
3351         if $test -f Policy.sh ; then
3352                 $cat <<EOM
3353
3354 There's also a Policy hint file available, which should make the
3355 site-specific (policy) questions easier to answer.
3356 EOM
3357
3358         fi
3359
3360         $cat <<EOM
3361
3362 You may give one or more space-separated answers, or "none" if appropriate.
3363 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3364 is a good thing.  DO NOT give a wrong version or a wrong OS.
3365
3366 EOM
3367
3368         rp="Which of these apply, if any?"
3369         . UU/myread
3370         tans=$ans
3371         for file in $tans; do
3372                 if $test X$file = XPolicy -a -f Policy.sh; then
3373                         . Policy.sh
3374                         $cat Policy.sh >> UU/config.sh
3375                 elif $test -f $src/hints/$file.sh; then
3376                         . $src/hints/$file.sh
3377                         $cat $src/hints/$file.sh >> UU/config.sh
3378                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3379                         : nothing
3380                 else
3381                         : Give one chance to correct a possible typo.
3382                         echo "$file.sh does not exist"
3383                         dflt=$file
3384                         rp="hint to use instead?"
3385                         . UU/myread
3386                         for file in $ans; do
3387                                 if $test -f "$src/hints/$file.sh"; then
3388                                         . $src/hints/$file.sh
3389                                         $cat $src/hints/$file.sh >> UU/config.sh
3390                                 elif $test X$ans = X -o X$ans = Xnone ; then
3391                                         : nothing
3392                                 else
3393                                         echo "$file.sh does not exist -- ignored."
3394                                 fi
3395                         done
3396                 fi
3397         done
3398
3399         hint=recommended
3400         : Remember our hint file for later.
3401         if $test -f "$src/hints/$file.sh" ; then
3402                 hintfile="$file"
3403         else
3404                 hintfile=''
3405         fi
3406 fi
3407 cd UU
3408 ;;
3409 *)
3410         echo " "
3411         echo "Fetching default answers from $config_sh..." >&4
3412         tmp_n="$n"
3413         tmp_c="$c"
3414         cd ..
3415         cp $config_sh config.sh 2>/dev/null
3416         chmod +w config.sh
3417         . ./config.sh
3418         cd UU
3419         cp ../config.sh .
3420         n="$tmp_n"
3421         c="$tmp_c"
3422         hint=previous
3423         ;;
3424 esac
3425 test "$override" && . ./optdef.sh
3426
3427 : Restore computed paths
3428 for file in $loclist $trylist; do
3429         eval $file="\$_$file"
3430 done
3431
3432 cat << EOM
3433
3434 Configure uses the operating system name and version to set some defaults.
3435 The default value is probably right if the name rings a bell. Otherwise,
3436 since spelling matters for me, either accept the default or answer "none"
3437 to leave it blank.
3438
3439 EOM
3440 case "$osname" in
3441         ''|' ')
3442                 case "$hintfile" in
3443                 ''|' '|none) dflt=none ;;
3444                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3445                 esac
3446                 ;;
3447         *) dflt="$osname" ;;
3448 esac
3449 rp="Operating system name?"
3450 . ./myread
3451 case "$ans" in
3452 none)  osname='' ;;
3453 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3454 esac
3455 echo " "
3456 case "$osvers" in
3457         ''|' ')
3458                 case "$hintfile" in
3459                 ''|' '|none) dflt=none ;;
3460                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3461                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3462                         case "$dflt" in
3463                         ''|' ') dflt=none ;;
3464                         esac
3465                         ;;
3466                 esac
3467                 ;;
3468         *) dflt="$osvers" ;;
3469 esac
3470 rp="Operating system version?"
3471 . ./myread
3472 case "$ans" in
3473 none)  osvers='' ;;
3474 *) osvers="$ans" ;;
3475 esac
3476
3477
3478 . ./posthint.sh
3479
3480 : who configured the system
3481 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3482 case "$cf_by" in
3483 "")
3484         cf_by=`(logname) 2>/dev/null`
3485         case "$cf_by" in
3486         "")
3487                 cf_by=`(whoami) 2>/dev/null`
3488                 case "$cf_by" in
3489                 "") cf_by=unknown ;;
3490                 esac ;;
3491         esac ;;
3492 esac
3493
3494 : set up the script used to warn in case of inconsistency
3495 cat <<EOS >whoa
3496 $startsh
3497 EOS
3498 cat <<'EOSC' >>whoa
3499 dflt=y
3500 echo " "
3501 echo "*** WHOA THERE!!! ***" >&4
3502 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3503 rp="    Keep the $hint value?"
3504 . ./myread
3505 case "$ans" in
3506 y) td=$was; tu=$was;;
3507 esac
3508 EOSC
3509
3510 : function used to set $1 to $val
3511 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3512 case "$val$was" in
3513 $define$undef) . ./whoa; eval "$var=\$td";;
3514 $undef$define) . ./whoa; eval "$var=\$tu";;
3515 *) eval "$var=$val";;
3516 esac'
3517
3518 case "$usesocks" in
3519 $define|true|[yY]*)     dflt='y';;
3520 *) dflt='n';;
3521 esac
3522 cat <<EOM
3523
3524 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3525 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3526 to use the PerlIO abstraction layer, this will be implicitly selected.
3527
3528 If this doesn't make any sense to you, just accept the default '$dflt'.
3529 EOM
3530 rp='Build Perl for SOCKS?'
3531 . ./myread
3532 case "$ans" in
3533 y|Y)    val="$define" ;;     
3534 *)      val="$undef" ;;
3535 esac
3536 set usesocks
3537 eval $setvar
3538
3539 case "$usesocks" in
3540 $define|true|[yY]*) useperlio="$define";;
3541 esac
3542
3543 case "$useperlio" in
3544 $define|true|[yY]*|'')  dflt='y';;
3545 *) dflt='n';;
3546 esac
3547 cat <<EOM
3548
3549 Previous version of $package used the standard IO mechanisms as
3550 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3551 alternate IO mechanisms via the PerlIO abstraction layer, but the
3552 stdio mechanism is still available if needed.  The abstraction layer
3553 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3554 Using PerlIO with sfio may cause problems with some extension modules.
3555
3556 If this doesn't make any sense to you, just accept the default '$dflt'.
3557 EOM
3558 rp='Use the PerlIO abstraction layer?'
3559 . ./myread
3560 case "$ans" in
3561 y|Y) 
3562         val="$define"
3563         ;;
3564 *)      
3565         echo "Ok, doing things the stdio way."
3566         val="$undef"
3567         ;;
3568 esac
3569 set useperlio
3570 eval $setvar 
3571
3572 case "$usesocks" in
3573 $define|true|[yY]*)
3574         case "$useperlio" in
3575         $define|true|[yY]*) ;;
3576         *)      cat >&4 <<EOM
3577
3578 You are using the SOCKS proxy protocol library which means that you
3579 should also use the PerlIO layer.  You may be headed for trouble.
3580
3581 EOM
3582                 ;;
3583         esac
3584         ;;
3585 esac
3586
3587         
3588 case "$usethreads" in
3589 $define|true|[yY]*)     dflt='y';;
3590 *)     # Catch case where user specified ithreads or 5005threads but
3591        # forgot -Dusethreads (A.D. 4/2002)
3592        case "$useithreads$use5005threads" in
3593        *$define*)      
3594                 case "$useperlio" in
3595                 "$define")      dflt='y' ;;
3596                 *)              dflt='n' ;;
3597                 esac
3598                 ;;
3599        *)       dflt='n';;
3600        esac
3601        ;;
3602 esac
3603 cat <<EOM
3604
3605 Perl can be built to take advantage of threads on some systems.
3606 To do so, Configure can be run with -Dusethreads.
3607
3608 Note that Perl built with threading support runs slightly slower
3609 and uses more memory than plain Perl. The current implementation
3610 is believed to be stable, but it is fairly new, and so should be
3611 treated with caution.
3612
3613 If this doesn't make any sense to you, just accept the default '$dflt'.
3614 EOM
3615 rp='Build a threading Perl?'
3616 . ./myread
3617 case "$ans" in
3618 y|Y)    val="$define" ;;
3619 *)      val="$undef" ;;
3620 esac
3621 set usethreads
3622 eval $setvar
3623
3624 case "$usethreads" in
3625 $define)
3626         $cat <<EOM
3627
3628 Since release 5.6, Perl has had two different threading implementations,
3629 the newer interpreter-based version (ithreads) with one interpreter per
3630 thread, and the older 5.005 version (5005threads).
3631 The 5005threads version is effectively unmaintained and will probably be
3632 removed in Perl 5.10, so there should be no need to build a Perl using it
3633 unless needed for backwards compatibility with some existing 5.005threads
3634 code.
3635
3636 EOM
3637         : Default to ithreads unless overridden on command line or with
3638         : old config.sh
3639         dflt='y'
3640         case "$use5005threads" in
3641                 $define|true|[yY]*) dflt='n';;
3642         esac
3643         case "$useithreads" in
3644                 $undef|false|[nN]*) dflt='n';;
3645         esac
3646         rp='Use the newer interpreter-based ithreads?'
3647         . ./myread
3648         case "$ans" in
3649         y|Y)    val="$define" ;;
3650         *)      val="$undef" ;;
3651         esac
3652         set useithreads
3653         eval $setvar
3654         : Now set use5005threads to the opposite value.
3655         case "$useithreads" in
3656         $define) val="$undef" ;;
3657         *) val="$define" ;;
3658         esac
3659         set use5005threads
3660         eval $setvar
3661         ;;
3662 *)
3663         useithreads="$undef"
3664         use5005threads="$undef"
3665         ;;
3666 esac
3667
3668 case "$useithreads$use5005threads" in
3669 "$define$define")
3670         $cat >&4 <<EOM
3671
3672 You cannot have both the ithreads and the 5.005 threads enabled
3673 at the same time.  Disabling the 5.005 threads since they are
3674 much less stable than the ithreads.
3675
3676 EOM
3677         use5005threads="$undef"
3678         ;;
3679 esac
3680
3681 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3682         cat >&4 <<EOF
3683 ***
3684 *** To build with ithreads you must also use the PerlIO layer.
3685 *** Cannot continue, aborting.
3686 ***
3687 EOF
3688         exit 1
3689 fi
3690
3691 case "$d_oldpthreads" in
3692 '')     : Configure tests would be welcome here.  For now, assume undef.
3693         val="$undef" ;;
3694 *)      val="$d_oldpthreads" ;;
3695 esac
3696 set d_oldpthreads
3697 eval $setvar
3698
3699
3700 : Look for a hint-file generated 'call-back-unit'.  If the
3701 : user has specified that a threading perl is to be built,
3702 : we may need to set or change some other defaults.
3703 if $test -f usethreads.cbu; then
3704     echo "Your platform has some specific hints regarding threaded builds, using them..."
3705     . ./usethreads.cbu
3706 else
3707     case "$usethreads" in
3708         "$define"|true|[yY]*)
3709                 $cat <<EOM
3710 (Your platform does not have any specific hints for threaded builds.
3711  Assuming POSIX threads, then.)
3712 EOM
3713         ;;
3714     esac
3715 fi
3716
3717 cat <<EOM
3718
3719 Perl can be built so that multiple Perl interpreters can coexist
3720 within the same Perl executable.
3721 EOM
3722
3723 case "$useithreads" in
3724 $define)
3725         cat <<EOM
3726 This multiple interpreter support is required for interpreter-based threads.
3727 EOM
3728         val="$define"
3729         ;;
3730 *)      case "$usemultiplicity" in
3731         $define|true|[yY]*)     dflt='y';;
3732         *) dflt='n';;
3733         esac
3734         echo " "
3735         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3736         rp='Build Perl for multiplicity?'
3737         . ./myread
3738         case "$ans" in
3739         y|Y)    val="$define" ;;
3740         *)      val="$undef" ;;
3741         esac
3742         ;;
3743 esac
3744 set usemultiplicity
3745 eval $setvar
3746
3747
3748 case "$usemorebits" in
3749 "$define"|true|[yY]*)
3750         use64bitint="$define"
3751         uselongdouble="$define"
3752         usemorebits="$define"
3753         ;;
3754 *)      usemorebits="$undef"
3755         ;;
3756 esac
3757
3758 : make some quick guesses about what we are up against
3759 echo " "
3760 $echo $n "Hmm...  $c"
3761 echo exit 1 >bsd
3762 echo exit 1 >usg
3763 echo exit 1 >v7
3764 echo exit 1 >osf1
3765 echo exit 1 >eunice
3766 echo exit 1 >xenix
3767 echo exit 1 >venix
3768 echo exit 1 >os2
3769 d_bsd="$undef"
3770 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3771 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3772 then
3773         echo "Looks kind of like an OSF/1 system, but we'll see..."
3774         echo exit 0 >osf1
3775 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3776         xxx=`./loc addbib blurfl $pth`
3777         if $test -f $xxx; then
3778         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3779                 echo exit 0 >bsd
3780                 echo exit 0 >usg
3781         else
3782                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3783                         echo "Looks kind of like an extended USG system, but we'll see..."
3784                 else
3785                         echo "Looks kind of like a USG system, but we'll see..."
3786                 fi
3787                 echo exit 0 >usg
3788         fi
3789 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3790         echo "Looks kind of like a BSD system, but we'll see..."
3791         d_bsd="$define"
3792         echo exit 0 >bsd
3793 else
3794         echo "Looks kind of like a Version 7 system, but we'll see..."
3795         echo exit 0 >v7
3796 fi
3797 case "$eunicefix" in
3798 *unixtovms*)
3799         $cat <<'EOI'
3800 There is, however, a strange, musty smell in the air that reminds me of
3801 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3802 EOI
3803         echo exit 0 >eunice
3804         d_eunice="$define"
3805 : it so happens the Eunice I know will not run shell scripts in Unix format
3806         ;;
3807 *)
3808         echo " "
3809         echo "Congratulations.  You aren't running Eunice."
3810         d_eunice="$undef"
3811         ;;
3812 esac
3813 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3814 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3815 : semicolon as a patch separator
3816 case "$p_" in
3817 :) ;;
3818 *)
3819         $cat <<'EOI'
3820 I have the feeling something is not exactly right, however...don't tell me...
3821 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3822 (Or you may be running DOS with DJGPP.)
3823 EOI
3824         echo exit 0 >os2
3825         ;;
3826 esac
3827 if test -f /xenix; then
3828         echo "Actually, this looks more like a XENIX system..."
3829         echo exit 0 >xenix
3830         d_xenix="$define"
3831 else
3832         echo " "
3833         echo "It's not Xenix..."
3834         d_xenix="$undef"
3835 fi
3836 chmod +x xenix
3837 $eunicefix xenix
3838 if test -f /venix; then
3839         echo "Actually, this looks more like a VENIX system..."
3840         echo exit 0 >venix
3841 else
3842         echo " "
3843         if ./xenix; then
3844                 : null
3845         else
3846                 echo "Nor is it Venix..."
3847         fi
3848 fi
3849 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3850 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3851 $rm -f foo
3852
3853 case "$cc" in
3854 '') dflt=cc;;
3855 *) dflt="$cc";;
3856 esac
3857 rp="Use which C compiler?"
3858 . ./myread
3859 cc="$ans"
3860
3861 : See if they have not cc but they do have gcc
3862 . ./trygcc
3863 : Look for a hint-file generated 'call-back-unit'.  Now that the
3864 : user has specified the compiler, we may need to set or change some
3865 : other defaults.
3866 if $test -f cc.cbu; then
3867     . ./cc.cbu
3868 fi
3869 . ./checkcc
3870
3871 echo " "
3872 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3873 $cat >try.c <<EOM
3874 #include <stdio.h>
3875 int main() {
3876 #ifdef __GNUC__
3877 #ifdef __VERSION__
3878         printf("%s\n", __VERSION__);
3879 #else
3880         printf("%s\n", "1");
3881 #endif
3882 #endif
3883         return(0);
3884 }
3885 EOM
3886 if $cc -o try $ccflags $ldflags try.c; then
3887         gccversion=`$run ./try`
3888         case "$gccversion" in
3889         '') echo "You are not using GNU cc." ;;
3890         *)  echo "You are using GNU cc $gccversion."
3891             ccname=gcc
3892             ;;
3893         esac
3894 else
3895         echo " "
3896         echo "*** WHOA THERE!!! ***" >&4
3897         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3898         case "$knowitall" in
3899         '')
3900         echo "    You'd better start hunting for one and let me know about it." >&4
3901                 exit 1
3902                 ;;
3903         esac
3904 fi
3905 $rm -f try try.*
3906 case "$gccversion" in
3907 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3908 esac
3909 case "$gccversion" in
3910 '') gccosandvers='' ;;
3911 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3912    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3913    gccshortvers=''
3914    case "$gccosandvers" in
3915    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3916    $osname$osvers) ;; # looking good
3917    $osname*) cat <<EOM >&4
3918
3919 *** WHOA THERE!!! ***
3920
3921     Your gcc has not been compiled for the exact release of
3922     your operating system ($gccosandvers versus $osname$osvers).
3923
3924     In general it is a good idea to keep gcc synchronized with
3925     the operating system because otherwise serious problems
3926     may ensue when trying to compile software, like Perl.
3927
3928     I'm trying to be optimistic here, though, and will continue.
3929     If later during the configuration and build icky compilation
3930     problems appear (headerfile conflicts being the most common
3931     manifestation), I suggest reinstalling the gcc to match
3932     your operating system release.
3933
3934 EOM
3935       ;;
3936    *) gccosandvers='' ;; # failed to parse, better be silent
3937    esac
3938    ;;
3939 esac
3940 case "$ccname" in
3941 '') ccname="$cc" ;;
3942 esac
3943
3944 # gcc 3.* complain about adding -Idirectories that they already know about,
3945 # so we will take those off from locincpth.
3946 case "$gccversion" in
3947 3*)
3948     echo "main(){}">try.c
3949     for incdir in $locincpth; do
3950        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3951              grep '^c[cp]p*[01]: warning: changing search order '`
3952        if test "X$warn" != X; then
3953            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3954        fi
3955     done
3956     $rm -f try try.*
3957 esac
3958
3959 : decide how portable to be.  Allow command line overrides.
3960 case "$d_portable" in
3961 "$undef") ;;
3962 *)      d_portable="$define" ;;
3963 esac
3964
3965 : set up shell script to do ~ expansion
3966 cat >filexp <<EOSS
3967 $startsh
3968 : expand filename
3969 case "\$1" in
3970  ~/*|~)
3971         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3972         ;;
3973  ~*)
3974         if $test -f /bin/csh; then
3975                 /bin/csh -f -c "glob \$1"
3976                 failed=\$?
3977                 echo ""
3978                 exit \$failed
3979         else
3980                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3981                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3982                 if $test ! -d "\$dir"; then
3983                         me=\`basename \$0\`
3984                         echo "\$me: can't locate home directory for: \$name" >&2
3985                         exit 1
3986                 fi
3987                 case "\$1" in
3988                 */*)
3989                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3990                         ;;
3991                 *)
3992                         echo \$dir
3993                         ;;
3994                 esac
3995         fi
3996         ;;
3997 *)
3998         echo \$1
3999         ;;
4000 esac
4001 EOSS
4002 chmod +x filexp
4003 $eunicefix filexp
4004
4005 : now set up to get a file name
4006 cat <<EOS >getfile
4007 $startsh
4008 EOS
4009 cat <<'EOSC' >>getfile
4010 tilde=''
4011 fullpath=''
4012 already=''
4013 skip=''
4014 none_ok=''
4015 exp_file=''
4016 nopath_ok=''
4017 orig_rp="$rp"
4018 orig_dflt="$dflt"
4019 case "$gfpth" in
4020 '') gfpth='.' ;;
4021 esac
4022
4023 case "$fn" in
4024 *\(*)
4025         : getfile will accept an answer from the comma-separated list
4026         : enclosed in parentheses even if it does not meet other criteria.
4027         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4028         fn=`echo $fn | sed 's/(.*)//'`
4029         ;;
4030 esac
4031
4032 case "$fn" in
4033 *:*)
4034         loc_file=`expr $fn : '.*:\(.*\)'`
4035         fn=`expr $fn : '\(.*\):.*'`
4036         ;;
4037 esac
4038
4039 case "$fn" in
4040 *~*) tilde=true;;
4041 esac
4042 case "$fn" in
4043 */*) fullpath=true;;
4044 esac
4045 case "$fn" in
4046 *+*) skip=true;;
4047 esac
4048 case "$fn" in
4049 *n*) none_ok=true;;
4050 esac
4051 case "$fn" in
4052 *e*) exp_file=true;;
4053 esac
4054 case "$fn" in
4055 *p*) nopath_ok=true;;
4056 esac
4057
4058 case "$fn" in
4059 *f*) type='File';;
4060 *d*) type='Directory';;
4061 *l*) type='Locate';;
4062 esac
4063
4064 what="$type"
4065 case "$what" in
4066 Locate) what='File';;
4067 esac
4068
4069 case "$exp_file" in
4070 '')
4071         case "$d_portable" in
4072         "$define") ;;
4073         *) exp_file=true;;
4074         esac
4075         ;;
4076 esac
4077
4078 cd ..
4079 while test "$type"; do
4080         redo=''
4081         rp="$orig_rp"
4082         dflt="$orig_dflt"
4083         case "$tilde" in
4084         true) rp="$rp (~name ok)";;
4085         esac
4086         . UU/myread
4087         if test -f UU/getfile.ok && \
4088                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4089         then
4090                 value="$ans"
4091                 ansexp="$ans"
4092                 break
4093         fi
4094         case "$ans" in
4095         none)
4096                 value=''
4097                 ansexp=''
4098                 case "$none_ok" in
4099                 true) type='';;
4100                 esac
4101                 ;;
4102         *)
4103                 case "$tilde" in
4104                 '') value="$ans"
4105                         ansexp="$ans";;
4106                 *)
4107                         value=`UU/filexp $ans`
4108                         case $? in
4109                         0)
4110                                 if test "$ans" != "$value"; then
4111                                         echo "(That expands to $value on this system.)"
4112                                 fi
4113                                 ;;
4114                         *) value="$ans";;
4115                         esac
4116                         ansexp="$value"
4117                         case "$exp_file" in
4118                         '') value="$ans";;
4119                         esac
4120                         ;;
4121                 esac
4122                 case "$fullpath" in
4123                 true)
4124                         case "$ansexp" in
4125                         /*) value="$ansexp" ;;
4126                         [a-zA-Z]:/*) value="$ansexp" ;;
4127                         *)
4128                                 redo=true
4129                                 case "$already" in
4130                                 true)
4131                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4132                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4133                                         ;;
4134                                 *)
4135                                 echo "Please give a full path name, starting with slash." >&4
4136                                         case "$tilde" in
4137                                         true)
4138                                 echo "Note that using ~name is ok provided it expands well." >&4
4139                                                 already=true
4140                                                 ;;
4141                                         esac
4142                                 esac
4143                                 ;;
4144                         esac
4145                         ;;
4146                 esac
4147                 case "$redo" in
4148                 '')
4149                         case "$type" in
4150                         File)
4151                                 for fp in $gfpth; do
4152                                         if test "X$fp" = X.; then
4153                                             pf="$ansexp"
4154                                         else    
4155                                             pf="$fp/$ansexp"
4156                                         fi
4157                                         if test -f "$pf"; then
4158                                                 type=''
4159                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4160                                         then
4161                                                 echo "($value is not a plain file, but that's ok.)"
4162                                                 type=''
4163                                         fi
4164                                         if test X"$type" = X; then
4165                                             value="$pf"
4166                                             break
4167                                         fi
4168                                 done
4169                                 ;;
4170                         Directory)
4171                                 for fp in $gfpth; do
4172                                         if test "X$fp" = X.; then
4173                                             dir="$ans"
4174                                             direxp="$ansexp"
4175                                         else    
4176                                             dir="$fp/$ansexp"
4177                                             direxp="$fp/$ansexp"
4178                                         fi
4179                                         if test -d "$direxp"; then
4180                                                 type=''
4181                                                 value="$dir"
4182                                                 break
4183                                         fi
4184                                 done
4185                                 ;;
4186                         Locate)
4187                                 if test -d "$ansexp"; then
4188                                         echo "(Looking for $loc_file in directory $value.)"
4189                                         value="$value/$loc_file"
4190                                         ansexp="$ansexp/$loc_file"
4191                                 fi
4192                                 if test -f "$ansexp"; then
4193                                         type=''
4194                                 fi
4195                                 case "$nopath_ok" in
4196                                 true)   case "$value" in
4197                                         */*) ;;
4198                                         *)      echo "Assuming $value will be in people's path."
4199                                                 type=''
4200                                                 ;;
4201                                         esac
4202                                         ;;
4203                                 esac
4204                                 ;;
4205                         esac
4206
4207                         case "$skip" in
4208                         true) type='';
4209                         esac
4210
4211                         case "$type" in
4212                         '') ;;
4213                         *)
4214                                 if test "$fastread" = yes; then
4215                                         dflt=y
4216                                 else
4217                                         dflt=n
4218                                 fi
4219                                 rp="$what $value doesn't exist.  Use that name anyway?"
4220                                 . UU/myread
4221                                 dflt=''
4222                                 case "$ans" in
4223                                 y*) type='';;
4224                                 *) echo " ";;
4225                                 esac
4226                                 ;;
4227                         esac
4228                         ;;
4229                 esac
4230                 ;;
4231         esac
4232 done
4233 cd UU
4234 ans="$value"
4235 rp="$orig_rp"
4236 dflt="$orig_dflt"
4237 rm -f getfile.ok
4238 test "X$gfpthkeep" != Xy && gfpth=""
4239 EOSC
4240
4241 : What should the include directory be ?
4242 echo " "
4243 $echo $n "Hmm...  $c"
4244 dflt='/usr/include'
4245 incpath=''
4246 mips_type=''
4247 if $test -f /bin/mips && /bin/mips; then
4248         echo "Looks like a MIPS system..."
4249         $cat >usr.c <<'EOCP'
4250 #ifdef SYSTYPE_BSD43
4251 /bsd43
4252 #endif
4253 EOCP
4254         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4255                 dflt='/bsd43/usr/include'
4256                 incpath='/bsd43'
4257                 mips_type='BSD 4.3'
4258         else
4259                 mips_type='System V'
4260         fi
4261         $rm -f usr.c usr.out
4262         echo "and you're compiling with the $mips_type compiler and libraries."
4263         xxx_prompt=y
4264         echo "exit 0" >mips
4265 else
4266         echo "Doesn't look like a MIPS system."
4267         xxx_prompt=n
4268         echo "exit 1" >mips
4269 fi
4270 chmod +x mips
4271 $eunicefix mips
4272 case "$usrinc" in
4273 '') ;;
4274 *) dflt="$usrinc";;
4275 esac
4276 case "$xxx_prompt" in
4277 y)      fn=d/
4278         echo " "
4279         rp='Where are the include files you want to use?'
4280         . ./getfile
4281         usrinc="$ans"
4282         ;;
4283 *)      usrinc="$dflt"
4284         ;;
4285 esac
4286
4287 : see how we invoke the C preprocessor
4288 echo " "
4289 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4290 cat <<'EOT' >testcpp.c
4291 #define ABC abc
4292 #define XYZ xyz
4293 ABC.XYZ
4294 EOT
4295 cd ..
4296 if test ! -f cppstdin; then
4297         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4298                 # AIX cc -E doesn't show the absolute headerfile
4299                 # locations but we'll cheat by using the -M flag.
4300                 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
4301         else
4302                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4303         fi
4304 else
4305         echo "Keeping your $hint cppstdin wrapper."
4306 fi
4307 chmod 755 cppstdin
4308 wrapper=`pwd`/cppstdin
4309 ok='false'
4310 cd UU
4311
4312 if $test "X$cppstdin" != "X" && \
4313         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4314         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4315 then
4316         echo "You used to use $cppstdin $cppminus so we'll use that again."
4317         case "$cpprun" in
4318         '') echo "But let's see if we can live without a wrapper..." ;;
4319         *)
4320                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4321                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4322                 then
4323                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4324                         ok='true'
4325                 else
4326                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4327                 fi
4328                 ;;
4329         esac
4330 else
4331         case "$cppstdin" in
4332         '') ;;
4333         *)
4334                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4335                 ;;
4336         esac
4337 fi
4338
4339 if $ok; then
4340         : nothing
4341 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4342         $cc -E <testcpp.c >testcpp.out 2>&1; \
4343         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4344         echo "Yup, it does."
4345         x_cpp="$cc -E"
4346         x_minus='';
4347 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4348         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4349         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350         echo "Yup, it does."
4351         x_cpp="$cc -E"
4352         x_minus='-';
4353 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4354         $cc -P <testcpp.c >testcpp.out 2>&1; \
4355         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4356         echo "Yipee, that works!"
4357         x_cpp="$cc -P"
4358         x_minus='';
4359 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4360         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4361         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4362         echo "At long last!"
4363         x_cpp="$cc -P"
4364         x_minus='-';
4365 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4366         $cpp <testcpp.c >testcpp.out 2>&1; \
4367         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4368         echo "It works!"
4369         x_cpp="$cpp"
4370         x_minus='';
4371 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4372         $cpp - <testcpp.c >testcpp.out 2>&1; \
4373         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4374         echo "Hooray, it works!  I was beginning to wonder."
4375         x_cpp="$cpp"
4376         x_minus='-';
4377 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4378         $wrapper <testcpp.c >testcpp.out 2>&1; \
4379         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4380         x_cpp="$wrapper"
4381         x_minus=''
4382         echo "Eureka!"
4383 else
4384         dflt=''
4385         rp="No dice.  I can't find a C preprocessor.  Name one:"
4386         . ./myread
4387         x_cpp="$ans"
4388         x_minus=''
4389         $x_cpp <testcpp.c >testcpp.out 2>&1
4390         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4391                 echo "OK, that will do." >&4
4392         else
4393 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4394                 exit 1
4395         fi
4396 fi
4397
4398 case "$ok" in
4399 false)
4400         cppstdin="$x_cpp"
4401         cppminus="$x_minus"
4402         cpprun="$x_cpp"
4403         cpplast="$x_minus"
4404         set X $x_cpp
4405         shift
4406         case "$1" in
4407         "$cpp")
4408                 echo "Perhaps can we force $cc -E using a wrapper..."
4409                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4410                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4411                 then
4412                         echo "Yup, we can."
4413                         cppstdin="$wrapper"
4414                         cppminus='';
4415                 else
4416                         echo "Nope, we'll have to live without it..."
4417                 fi
4418                 ;;
4419         esac
4420         case "$cpprun" in
4421         "$wrapper")
4422                 cpprun=''
4423                 cpplast=''
4424                 ;;
4425         esac
4426         ;;
4427 esac
4428
4429 case "$cppstdin" in
4430 "$wrapper"|'cppstdin') ;;
4431 *) $rm -f $wrapper;;
4432 esac
4433 $rm -f testcpp.c testcpp.out
4434
4435 : Set private lib path
4436 case "$plibpth" in
4437 '') if ./mips; then
4438                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4439         fi;;
4440 esac
4441 case "$libpth" in
4442 ' ') dlist='';;
4443 '') dlist="$loclibpth $plibpth $glibpth";;
4444 *) dlist="$libpth";;
4445 esac
4446
4447 : Now check and see which directories actually exist, avoiding duplicates
4448 libpth=''
4449 for xxx in $dlist
4450 do
4451     if $test -d $xxx; then
4452                 case " $libpth " in
4453                 *" $xxx "*) ;;
4454                 *) libpth="$libpth $xxx";;
4455                 esac
4456     fi
4457 done
4458 $cat <<'EOM'
4459
4460 Some systems have incompatible or broken versions of libraries.  Among
4461 the directories listed in the question below, please remove any you
4462 know not to be holding relevant libraries, and add any that are needed.
4463 Say "none" for none.
4464
4465 EOM
4466 case "$libpth" in
4467 '') dflt='none';;
4468 *)
4469         set X $libpth
4470         shift
4471         dflt=${1+"$@"}
4472         ;;
4473 esac
4474 rp="Directories to use for library searches?"
4475 . ./myread
4476 case "$ans" in
4477 none) libpth=' ';;
4478 *) libpth="$ans";;
4479 esac
4480
4481 : compute shared library extension
4482 case "$so" in
4483 '')
4484         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4485                 dflt='sl'
4486         else
4487                 dflt='so'
4488         fi
4489         ;;
4490 *) dflt="$so";;
4491 esac
4492 $cat <<EOM
4493
4494 On some systems, shared libraries may be available.  Answer 'none' if
4495 you want to suppress searching of shared libraries for the remainder
4496 of this configuration.
4497
4498 EOM
4499 rp='What is the file extension used for shared libraries?'
4500 . ./myread
4501 so="$ans"
4502
4503 : Define several unixisms.
4504 : Hints files or command line option can be used to override them.
4505 : The convoluted testing is in case hints files set either the old
4506 : or the new name.
4507 case "$_exe" in
4508 '')     case "$exe_ext" in
4509         '')     ;;
4510         *)      _exe="$exe_ext" ;;
4511         esac
4512         ;;
4513 esac
4514 case "$_a" in
4515 '')     case "$lib_ext" in
4516     '') _a='.a';;
4517         *)      _a="$lib_ext" ;;
4518         esac
4519         ;;
4520 esac
4521 case "$_o" in
4522 '') case "$obj_ext" in
4523         '')     _o='.o';;
4524         *)      _o="$obj_ext";;
4525         esac
4526         ;;
4527 esac
4528 case "$p_" in
4529 '') case "$path_sep" in
4530         '')     p_=':';;
4531         *)      p_="$path_sep";;
4532         esac
4533         ;;
4534 esac
4535 exe_ext=$_exe
4536 lib_ext=$_a
4537 obj_ext=$_o
4538 path_sep=$p_
4539
4540 : Which makefile gets called first.  This is used by make depend.
4541 case "$firstmakefile" in
4542 '') firstmakefile='makefile';;
4543 esac
4544
4545 case "$ccflags" in
4546 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4547 esac
4548
4549 case "$uselongdouble" in
4550 $define|true|[yY]*)     dflt='y';;
4551 *) dflt='n';;
4552 esac
4553 cat <<EOM
4554
4555 Perl can be built to take advantage of long doubles which
4556 (if available) may give more accuracy and range for floating point numbers.
4557
4558 If this doesn't make any sense to you, just accept the default '$dflt'.
4559 EOM
4560 rp='Try to use long doubles if available?'
4561 . ./myread
4562 case "$ans" in
4563 y|Y)    val="$define"   ;;
4564 *)      val="$undef"    ;;
4565 esac
4566 set uselongdouble
4567 eval $setvar
4568
4569 case "$uselongdouble" in
4570 true|[yY]*) uselongdouble="$define" ;;
4571 esac
4572
4573 : Look for a hint-file generated 'call-back-unit'.  If the
4574 : user has specified that long doubles should be used,
4575 : we may need to set or change some other defaults.
4576 if $test -f uselongdouble.cbu; then
4577     echo "Your platform has some specific hints regarding long doubles, using them..."
4578     . ./uselongdouble.cbu
4579 else
4580     case "$uselongdouble" in
4581         $define)
4582                 $cat <<EOM
4583 (Your platform does not have any specific hints for long doubles.)
4584 EOM
4585         ;;
4586     esac
4587 fi
4588
4589 : Looking for optional libraries
4590 echo " "
4591 echo "Checking for optional libraries..." >&4
4592 case "$libs" in
4593 ' '|'') dflt='';;
4594 *) dflt="$libs";;
4595 esac
4596 case "$libswanted" in
4597 '') libswanted='c_s';;
4598 esac
4599 case "$usesocks" in
4600 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4601 esac
4602 libsfound=''
4603 libsfiles=''
4604 libsdirs=''
4605 libspath=''
4606 for thisdir in $libpth $xlibpth; do
4607   test -d $thisdir && libspath="$libspath $thisdir"
4608 done
4609 for thislib in $libswanted; do
4610         for thisdir in $libspath; do
4611             xxx=''
4612             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4613                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4614                 $test -f "$xxx" && eval $libscheck
4615                 $test -f "$xxx" && libstyle=shared
4616             fi
4617             if test ! -f "$xxx"; then
4618                 xxx=$thisdir/lib$thislib.$so
4619                 $test -f "$xxx" && eval $libscheck
4620                 $test -f "$xxx" && libstyle=shared
4621             fi  
4622             if test ! -f "$xxx"; then
4623                 xxx=$thisdir/lib$thislib$_a
4624                 $test -f "$xxx" && eval $libscheck
4625                 $test -f "$xxx" && libstyle=static
4626             fi
4627             if test ! -f "$xxx"; then
4628                 xxx=$thisdir/$thislib$_a
4629                 $test -f "$xxx" && eval $libscheck
4630                 $test -f "$xxx" && libstyle=static
4631             fi
4632             if test ! -f "$xxx"; then
4633                 xxx=$thisdir/lib${thislib}_s$_a
4634                 $test -f "$xxx" && eval $libscheck
4635                 $test -f "$xxx" && libstyle=static
4636                 $test -f "$xxx" && thislib=${thislib}_s
4637             fi
4638             if test ! -f "$xxx"; then
4639                 xxx=$thisdir/Slib$thislib$_a
4640                 $test -f "$xxx" && eval $libscheck
4641                 $test -f "$xxx" && libstyle=static
4642             fi
4643             if $test -f "$xxx"; then
4644                 case "$libstyle" in
4645                 shared) echo "Found -l$thislib (shared)." ;;
4646                 static) echo "Found -l$thislib." ;;
4647                 *)      echo "Found -l$thislib ($libstyle)." ;;
4648                 esac
4649                 case " $dflt " in
4650                 *"-l$thislib "*);;
4651                 *) dflt="$dflt -l$thislib"
4652                    libsfound="$libsfound $xxx"
4653                    yyy=`basename $xxx`
4654                    libsfiles="$libsfiles $yyy"
4655                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4656                    case " $libsdirs " in
4657                    *" $yyy "*) ;;
4658                    *) libsdirs="$libsdirs $yyy" ;;
4659                    esac
4660                    ;;
4661                 esac
4662                 break
4663             fi  
4664         done
4665         if $test ! -f "$xxx"; then
4666             echo "No -l$thislib."
4667         fi
4668 done
4669 set X $dflt
4670 shift
4671 dflt="$*"
4672 case "$libs" in
4673 '') dflt="$dflt";;
4674 *) dflt="$libs";;
4675 esac
4676 case "$dflt" in
4677 ' '|'') dflt='none';;
4678 esac
4679
4680 $cat <<EOM
4681
4682 In order to compile $package on your machine, a number of libraries
4683 are usually needed.  Include any other special libraries here as well.
4684 Say "none" for none.  The default list is almost always right.
4685 EOM
4686
4687 echo " "
4688 rp="What libraries to use?"
4689 . ./myread
4690 case "$ans" in
4691 none) libs=' ';;
4692 *) libs="$ans";;
4693 esac
4694
4695 : determine optimization, if desired, or use for debug flag also
4696 case "$optimize" in
4697 ' '|$undef) dflt='none';;
4698 '') dflt='-O';;
4699 *) dflt="$optimize";;
4700 esac
4701 $cat <<EOH
4702
4703 By default, $package compiles with the -O flag to use the optimizer.
4704 Alternately, you might want to use the symbolic debugger, which uses
4705 the -g flag (on traditional Unix systems).  Either flag can be
4706 specified here.  To use neither flag, specify the word "none".
4707
4708 EOH
4709 rp="What optimizer/debugger flag should be used?"
4710 . ./myread
4711 optimize="$ans"
4712 case "$optimize" in
4713 'none') optimize=" ";;
4714 esac
4715
4716 dflt=''
4717 : We will not override a previous value, but we might want to
4718 : augment a hint file
4719 case "$hint" in
4720 default|recommended)
4721         case "$gccversion" in
4722         1*) dflt='-fpcc-struct-return' ;;
4723         esac
4724         case "$optimize" in
4725         *-g*) dflt="$dflt -DDEBUGGING";;
4726         esac
4727         case "$gccversion" in
4728         2*) if test -d /etc/conf/kconfig.d &&
4729                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4730                 then
4731                         # Interactive Systems (ISC) POSIX mode.
4732                         dflt="$dflt -posix"
4733                 fi
4734                 ;;
4735         esac
4736         case "$gccversion" in
4737         1*) ;;
4738         2.[0-8]*) ;;
4739         ?*)     echo " "
4740                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4741                 echo 'int main(void) { return 0; }' > gcctest.c
4742                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4743                         echo "Yes, it does." 2>&1
4744                         case "$ccflags" in
4745                         *strict-aliasing*)
4746                                 echo "Leaving current flags $ccflags alone." 2>&1
4747                                 ;;
4748                         *) dflt="$dflt -fno-strict-aliasing" ;;
4749                         esac
4750                 else
4751                         echo "Nope, it doesn't, but that's ok." 2>&1
4752                 fi
4753                 ;;
4754         esac
4755         # For gcc, adding -pipe speeds up compilations for some, but apparently
4756         # some assemblers can't read from stdin.  (It also slows down compilations
4757         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4758         case "$gccversion" in
4759         ?*)     echo " "
4760                 echo "Checking if your compiler accepts -pipe" 2>&1
4761                 echo 'int main(void) { return 0; }' > gcctest.c
4762                 if $cc -pipe -o gcctest gcctest.c; then
4763                         echo "Yes, it does." 2>&1
4764                         case "$ccflags" in
4765                         *-pipe*)
4766                                 echo "Leaving current flags $ccflags alone." 2>&1
4767                                 ;;
4768                         *) dflt="$dflt -pipe" ;;
4769                         esac
4770                 else
4771                         echo "Nope, it doesn't, but that's ok." 2>&1
4772                 fi
4773
4774                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4775                 echo 'int main(void) { return 0; }' > gcctest.c
4776                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4777                         echo "Yes, it does." 2>&1
4778                         case "$ccflags" in
4779                         *-Wdeclaration-after-statement*)
4780                                 echo "Leaving current flags $ccflags alone." 2>&1
4781                                 ;;
4782                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4783                         esac
4784                 else
4785                         echo "Nope, it doesn't, but that's ok." 2>&1
4786                 fi
4787                 ;;
4788         esac
4789         ;;
4790 esac
4791
4792 case "$mips_type" in
4793 *BSD*|'') inclwanted="$locincpth $usrinc";;
4794 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4795 esac
4796 for thisincl in $inclwanted; do
4797         if $test -d $thisincl; then
4798                 if $test x$thisincl != x$usrinc; then
4799                         case "$dflt" in
4800                         *" -I$thisincl "*);;
4801                         *) dflt="$dflt -I$thisincl ";;
4802                         esac
4803                 fi
4804         fi
4805 done
4806
4807 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4808         xxx=true;
4809 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4810         xxx=true;
4811 else
4812         xxx=false;
4813 fi;
4814 if $xxx; then
4815         case "$dflt" in
4816         *$2*);;
4817         *) dflt="$dflt -D$2";;
4818         esac;
4819 fi'
4820
4821 set signal.h LANGUAGE_C; eval $inctest
4822
4823 case "$usesocks" in
4824 $define)
4825         ccflags="$ccflags -DSOCKS"
4826         ;;
4827 esac
4828
4829 case "$hint" in
4830 default|recommended) dflt="$ccflags $dflt" ;;
4831 *) dflt="$ccflags";;
4832 esac
4833
4834 case "$dflt" in
4835 ''|' ') dflt=none;;
4836 esac
4837
4838 $cat <<EOH
4839
4840 Your C compiler may want other flags.  For this question you should include
4841 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4842 but you should NOT include libraries or ld flags like -lwhatever.  If you
4843 want $package to honor its debug switch, you should include -DDEBUGGING here.
4844 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4845
4846 To use no flags, specify the word "none".
4847
4848 EOH
4849 set X $dflt
4850 shift
4851 dflt=${1+"$@"}
4852 rp="Any additional cc flags?"
4853 . ./myread
4854 case "$ans" in
4855 none) ccflags='';;
4856 *) ccflags="$ans";;
4857 esac
4858
4859 : the following weeds options from ccflags that are of no interest to cpp
4860 case "$cppflags" in
4861 '') cppflags="$ccflags" ;;
4862 *)  cppflags="$cppflags $ccflags" ;;
4863 esac
4864 case "$gccversion" in
4865 1*) cppflags="$cppflags -D__GNUC__"
4866 esac
4867 case "$mips_type" in
4868 '');;
4869 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4870 esac
4871 case "$cppflags" in
4872 '');;
4873 *)
4874         echo " "
4875         echo "Let me guess what the preprocessor flags are..." >&4
4876         set X $cppflags
4877         shift
4878         cppflags=''
4879         $cat >cpp.c <<'EOM'
4880 #define BLURFL foo
4881
4882 BLURFL xx LFRULB
4883 EOM
4884         previous=''
4885         for flag in $*
4886         do
4887                 case "$flag" in
4888                 -*) ftry="$flag";;
4889                 *) ftry="$previous $flag";;
4890                 esac
4891                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4892                         >cpp1.out 2>/dev/null && \
4893                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4894                         >cpp2.out 2>/dev/null && \
4895                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4896                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4897                 then
4898                         cppflags="$cppflags $ftry"
4899                         previous=''
4900                 else
4901                         previous="$flag"
4902                 fi
4903         done
4904         set X $cppflags
4905         shift
4906         cppflags=${1+"$@"}
4907         case "$cppflags" in
4908         *-*)  echo "They appear to be: $cppflags";;
4909         esac
4910         $rm -f cpp.c cpp?.out
4911         ;;
4912 esac
4913
4914 : flags used in final linking phase
4915 case "$ldflags" in
4916 '') if ./venix; then
4917                 dflt='-i -z'
4918         else
4919                 dflt=''
4920         fi
4921         case "$ccflags" in
4922         *-posix*) dflt="$dflt -posix" ;;
4923         esac
4924         ;;
4925 *) dflt="$ldflags";;
4926 esac
4927
4928 : Try to guess additional flags to pick up local libraries.
4929 for thislibdir in $libpth; do
4930         case " $loclibpth " in
4931         *" $thislibdir "*)
4932                 case "$dflt " in
4933                 *"-L$thislibdir "*) ;;
4934                 *)  dflt="$dflt -L$thislibdir" ;;
4935                 esac
4936                 ;;
4937         esac
4938 done
4939
4940 case "$dflt" in
4941 '') dflt='none' ;;
4942 esac
4943
4944 $cat <<EOH
4945
4946 Your C linker may need flags.  For this question you should
4947 include -L/whatever and any other flags used by the C linker, but you
4948 should NOT include libraries like -lwhatever.
4949
4950 Make sure you include the appropriate -L/path flags if your C linker
4951 does not normally search all of the directories you specified above,
4952 namely
4953         $libpth
4954 To use no flags, specify the word "none".
4955
4956 EOH
4957
4958 rp="Any additional ld flags (NOT including libraries)?"
4959 . ./myread
4960 case "$ans" in
4961 none) ldflags='';;
4962 *) ldflags="$ans";;
4963 esac
4964 rmlist="$rmlist pdp11"
4965
4966 : coherency check
4967 echo " "
4968 echo "Checking your choice of C compiler and flags for coherency..." >&4
4969 $cat > try.c <<'EOF'
4970 #include <stdio.h>
4971 int main() { printf("Ok\n"); return(0); }
4972 EOF
4973 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4974 shift
4975 $cat >try.msg <<'EOM'
4976 I've tried to compile and run the following simple program:
4977
4978 EOM
4979 $cat try.c >> try.msg
4980
4981 $cat >> try.msg <<EOM
4982
4983 I used the command:
4984
4985         $*
4986         $run ./try
4987
4988 and I got the following output:
4989
4990 EOM
4991 dflt=y
4992 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4993         if $sh -c "$run ./try" >>try.msg 2>&1; then
4994                 xxx=`$run ./try`
4995                 case "$xxx" in
4996                 "Ok") dflt=n ;;
4997                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4998                         case " $libs " in
4999                         *" -lsfio "*)
5000                                 cat >> try.msg <<'EOQS'
5001 If $libs contains -lsfio, and sfio is mis-configured, then it
5002 sometimes (apparently) runs and exits with a 0 status, but with no
5003 output!  It may have to do with sfio's use of _exit vs. exit.
5004
5005 EOQS
5006                                 rp="You have a big problem.  Shall I abort Configure"
5007                                 dflt=y
5008                                 ;;
5009                         esac
5010                         ;;
5011                 esac
5012         else
5013                 echo "The program compiled OK, but exited with status $?." >>try.msg
5014                 rp="You have a problem.  Shall I abort Configure"
5015                 dflt=y
5016         fi
5017 else
5018         echo "I can't compile the test program." >>try.msg
5019         rp="You have a BIG problem.  Shall I abort Configure"
5020         dflt=y
5021 fi
5022 case "$dflt" in
5023 y)
5024         $cat try.msg >&4
5025         case "$knowitall" in
5026         '')
5027                 echo "(The supplied flags or libraries might be incorrect.)"
5028                 ;;
5029         *) dflt=n;;
5030         esac
5031         echo " "
5032         . ./myread
5033         case "$ans" in
5034         n*|N*) ;;
5035         *)      echo "Ok.  Stopping Configure." >&4
5036                 exit 1
5037                 ;;
5038         esac
5039         ;;
5040 n) echo "OK, that should do.";;
5041 esac
5042 $rm -f try try.* core
5043
5044 : define a shorthand compile call
5045 compile='
5046 mc_file=$1;
5047 shift;
5048 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5049 : define a shorthand compile call for compilations that should be ok.
5050 compile_ok='
5051 mc_file=$1;
5052 shift;
5053 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5054
5055 : determine filename position in cpp output
5056 echo " "
5057 echo "Computing filename position in cpp output for #include directives..." >&4
5058 case "$osname" in
5059 vos) testaccess=-e ;;
5060 *)   testaccess=-r ;;
5061 esac
5062 echo '#include <stdio.h>' > foo.c
5063 $cat >fieldn <<EOF
5064 $startsh
5065 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5066 $grep '^[       ]*#.*stdio\.h' | \
5067 while read cline; do
5068         pos=1
5069         set \$cline
5070         while $test \$# -gt 0; do
5071                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5072                         echo "\$pos"
5073                         exit 0
5074                 fi
5075                 shift
5076                 pos=\`expr \$pos + 1\`
5077         done
5078 done
5079 EOF
5080 chmod +x fieldn
5081 fieldn=`./fieldn`
5082 $rm -f foo.c fieldn
5083 case $fieldn in
5084 '') pos='???';;
5085 1) pos=first;;
5086 2) pos=second;;
5087 3) pos=third;;
5088 *) pos="${fieldn}th";;
5089 esac
5090 echo "Your cpp writes the filename in the $pos field of the line."
5091
5092 case "$osname" in
5093 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5094 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5095 *)   cppfilter='' ;;
5096 esac
5097 : locate header file
5098 $cat >findhdr <<EOF
5099 $startsh
5100 wanted=\$1
5101 name=''
5102 for usrincdir in $usrinc
5103 do
5104         if test -f \$usrincdir/\$wanted; then
5105                 echo "\$usrincdir/\$wanted"
5106                 exit 0
5107         fi
5108 done
5109 awkprg='{ print \$$fieldn }'
5110 echo "#include <\$wanted>" > foo\$\$.c
5111 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5112 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5113 while read cline; do
5114         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5115         case "\$name" in
5116         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5117         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5118         *) exit 2;;
5119         esac;
5120 done;
5121 #
5122 # status = 0: grep returned 0 lines, case statement not executed
5123 # status = 1: headerfile found
5124 # status = 2: while loop executed, no headerfile found
5125 #
5126 status=\$?
5127 $rm -f foo\$\$.c;
5128 if test \$status -eq 1; then
5129         exit 0;
5130 fi
5131 exit 1
5132 EOF
5133 chmod +x findhdr
5134
5135 : define an alternate in-header-list? function
5136 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5137 cont=true; xxf="echo \"<\$1> found.\" >&4";
5138 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5139 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5140 esac;
5141 case $# in 4) instead=instead;; *) instead="at last";; esac;
5142 while $test "$cont"; do
5143         xxx=`./findhdr $1`
5144         var=$2; eval "was=\$$2";
5145         if $test "$xxx" && $test -r "$xxx";
5146         then eval $xxf;
5147         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5148                 cont="";
5149         else eval $xxnf;
5150         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5151         set $yyy; shift; shift; yyy=$@;
5152         case $# in 0) cont="";;
5153         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5154                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5155         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5156                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5157         esac;
5158 done;
5159 while $test "$yyy";
5160 do set $yyy; var=$2; eval "was=\$$2";
5161         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5162         set $yyy; shift; shift; yyy=$@;
5163 done'
5164
5165 : see if stdlib is available
5166 set stdlib.h i_stdlib
5167 eval $inhdr
5168
5169 : check for lengths of integral types
5170 echo " "
5171 case "$intsize" in
5172 '')
5173         echo "Checking to see how big your integers are..." >&4
5174         $cat >try.c <<EOCP
5175 #include <stdio.h>
5176 #$i_stdlib I_STDLIB
5177 #ifdef I_STDLIB
5178 #include <stdlib.h>
5179 #endif
5180 int main()
5181 {
5182         printf("intsize=%d;\n", (int)sizeof(int));
5183         printf("longsize=%d;\n", (int)sizeof(long));
5184         printf("shortsize=%d;\n", (int)sizeof(short));
5185         exit(0);
5186 }
5187 EOCP
5188         set try
5189         if eval $compile_ok && $run ./try > /dev/null; then
5190                 eval `$run ./try`
5191                 echo "Your integers are $intsize bytes long."
5192                 echo "Your long integers are $longsize bytes long."
5193                 echo "Your short integers are $shortsize bytes long."
5194         else
5195                 $cat >&4 <<EOM
5196 !
5197 Help! I can't compile and run the intsize test program: please enlighten me!
5198 (This is probably a misconfiguration in your system or libraries, and
5199 you really ought to fix it.  Still, I'll try anyway.)
5200 !
5201 EOM
5202                 dflt=4
5203                 rp="What is the size of an integer (in bytes)?"
5204                 . ./myread
5205                 intsize="$ans"
5206                 dflt=$intsize
5207                 rp="What is the size of a long integer (in bytes)?"
5208                 . ./myread
5209                 longsize="$ans"
5210                 dflt=2
5211                 rp="What is the size of a short integer (in bytes)?"
5212                 . ./myread
5213                 shortsize="$ans"
5214         fi
5215         ;;
5216 esac
5217 $rm -f try try.*
5218
5219 : check for long long
5220 echo " "
5221 echo "Checking to see if you have long long..." >&4
5222 echo 'int main() { long long x = 7; return 0; }' > try.c
5223 set try
5224 if eval $compile; then
5225         val="$define"
5226         echo "You have long long."
5227 else
5228         val="$undef"
5229         echo "You do not have long long."
5230 fi
5231 $rm try.*
5232 set d_longlong
5233 eval $setvar
5234
5235 : check for length of long long
5236 case "${d_longlong}${longlongsize}" in
5237 $define)
5238         echo " "
5239         echo "Checking to see how big your long longs are..." >&4
5240         $cat >try.c <<'EOCP'
5241 #include <stdio.h>
5242 int main()
5243 {
5244     printf("%d\n", (int)sizeof(long long));
5245     return(0);
5246 }
5247 EOCP
5248         set try
5249         if eval $compile_ok; then
5250                 longlongsize=`$run ./try`
5251                 echo "Your long longs are $longlongsize bytes long."
5252         else
5253                 dflt='8'
5254                 echo " "
5255                 echo "(I can't seem to compile the test program.  Guessing...)"
5256                 rp="What is the size of a long long (in bytes)?"
5257                 . ./myread
5258                 longlongsize="$ans"
5259         fi
5260         if $test "X$longsize" = "X$longlongsize"; then
5261                 echo "(That isn't any different from an ordinary long.)"
5262         fi      
5263         ;;
5264 esac
5265 $rm -f try.* try
5266
5267 : see if inttypes.h is available
5268 : we want a real compile instead of Inhdr because some systems
5269 : have an inttypes.h which includes non-existent headers
5270 echo " "
5271 $cat >try.c <<EOCP
5272 #include <inttypes.h>
5273 int main() {
5274         static int32_t foo32 = 0x12345678;
5275 }
5276 EOCP
5277 set try
5278 if eval $compile; then
5279         echo "<inttypes.h> found." >&4
5280         val="$define"
5281 else
5282         echo "<inttypes.h> NOT found." >&4
5283         val="$undef"
5284 fi
5285 $rm -f try.c try
5286 set i_inttypes
5287 eval $setvar
5288
5289 : check for int64_t
5290 echo " "
5291 echo "Checking to see if you have int64_t..." >&4
5292 $cat >try.c <<EOCP
5293 #include <sys/types.h>
5294 #$i_inttypes I_INTTYPES
5295 #ifdef I_INTTYPES
5296 #include <inttypes.h>
5297 #endif
5298 int main() { int64_t x = 7; }
5299 EOCP
5300 set try
5301 if eval $compile; then
5302         val="$define"
5303         echo "You have int64_t."
5304 else
5305         val="$undef"
5306         echo "You do not have int64_t."
5307 fi
5308 $rm -f try try.*
5309 set d_int64_t
5310 eval $setvar
5311
5312
5313 echo " "
5314 echo "Checking which 64-bit integer type we could use..." >&4
5315
5316 case "$intsize" in
5317 8) val=int
5318    set quadtype
5319    eval $setvar
5320    val='"unsigned int"'
5321    set uquadtype
5322    eval $setvar
5323    quadkind=1
5324    ;;
5325 *) case "$longsize" in
5326    8) val=long
5327       set quadtype
5328       eval $setvar
5329       val='"unsigned long"'
5330       set uquadtype
5331       eval $setvar
5332       quadkind=2
5333       ;;
5334    *) case "$d_longlong:$longlongsize" in
5335       define:8)
5336         val='"long long"'
5337         set quadtype
5338         eval $setvar
5339         val='"unsigned long long"'
5340         set uquadtype
5341         eval $setvar
5342         quadkind=3
5343         ;;
5344       *) case "$d_int64_t" in
5345          define)
5346            val=int64_t
5347            set quadtype
5348            eval $setvar
5349            val=uint64_t
5350            set uquadtype
5351            eval $setvar
5352            quadkind=4
5353            ;;
5354          esac
5355          ;;
5356       esac
5357       ;;
5358    esac
5359    ;;
5360 esac
5361
5362 case "$quadtype" in
5363 '')     echo "Alas, no 64-bit integer types in sight." >&4
5364         d_quad="$undef"
5365         ;;
5366 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5367         d_quad="$define"
5368         ;;
5369 esac
5370
5371
5372 case "$uselonglong" in
5373 "$define"|true|[yY]*)
5374         cat <<EOM >&4
5375
5376 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5377 EOM
5378         use64bitint="$define"
5379         ;;
5380 esac                          
5381 case "$use64bits" in
5382 "$define"|true|[yY]*)
5383         cat <<EOM >&4
5384
5385 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5386 EOM
5387         use64bitint="$define"
5388         ;;
5389 esac                          
5390 case "$use64bitints" in
5391 "$define"|true|[yY]*)
5392         cat <<EOM >&4
5393
5394 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5395 EOM
5396         use64bitint="$define"
5397         ;;
5398 esac                          
5399 case "$use64bitsint" in
5400 "$define"|true|[yY]*)
5401         cat <<EOM >&4
5402
5403 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5404 EOM
5405         use64bitint="$define"
5406         ;;
5407 esac                          
5408 case "$uselonglongs" in
5409 "$define"|true|[yY]*)
5410         cat <<EOM >&4
5411
5412 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5413 EOM
5414         use64bitint="$define"
5415         ;;
5416 esac                          
5417 case "$use64bitsall" in
5418 "$define"|true|[yY]*)
5419         cat <<EOM >&4
5420
5421 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5422 EOM
5423         use64bitall="$define"
5424         ;;
5425 esac                          
5426
5427 case "$ccflags" in
5428 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5429 esac
5430 case "$use64bitall" in
5431 "$define"|true|[yY]*) use64bitint="$define" ;;
5432 esac
5433
5434 case "$longsize" in
5435 8) cat <<EOM
5436
5437 You have natively 64-bit long integers.
5438 EOM
5439    val="$define"
5440    ;;
5441 *) case "$use64bitint" in
5442    "$define"|true|[yY]*) dflt='y';;
5443    *) dflt='n';;
5444    esac
5445    case "$d_quad" in
5446    "$define") ;;
5447    *) dflt='n' ;;
5448    esac
5449    cat <<EOM
5450
5451 Perl can be built to take advantage of 64-bit integer types
5452 on some systems.  To do so, Configure can be run with -Duse64bitint.
5453 Choosing this option will most probably introduce binary incompatibilities.
5454
5455 If this doesn't make any sense to you, just accept the default '$dflt'.
5456 (The default has been chosen based on your configuration.)
5457 EOM
5458    rp='Try to use 64-bit integers, if available?'
5459    . ./myread
5460    case "$ans" in
5461    [yY]*) val="$define" ;;
5462    *)     val="$undef"  ;;
5463    esac
5464    ;;
5465 esac
5466 set use64bitint
5467 eval $setvar
5468
5469 case "$use64bitall" in
5470 "$define"|true|[yY]*) dflt='y' ;;
5471 *) case "$longsize" in
5472    8) dflt='y' ;;
5473    *) dflt='n' ;;
5474    esac
5475    ;;
5476 esac    
5477 cat <<EOM
5478
5479 You may also choose to try maximal 64-bitness.  It means using as much
5480 64-bitness as possible on the platform.  This in turn means even more
5481 binary incompatibilities.  On the other hand, your platform may not
5482 have any more 64-bitness available than what you already have chosen.
5483
5484 If this doesn't make any sense to you, just accept the default '$dflt'.
5485 (The default has been chosen based on your configuration.)
5486 EOM
5487 rp='Try to use maximal 64-bit support, if available?'
5488 . ./myread
5489 case "$ans" in
5490 [yY]*) val="$define" ;;
5491 *)     val="$undef"  ;;
5492 esac
5493 set use64bitall
5494 eval $setvar
5495 case "$use64bitall" in
5496 "$define")
5497         case "$use64bitint" in
5498         "$undef")
5499                 cat <<EOM
5500
5501 Since you have chosen a maximally 64-bit build, I'm also turning on
5502 the use of 64-bit integers.
5503 EOM
5504                 use64bitint="$define" ;;
5505         esac
5506         ;;
5507 esac
5508
5509 : Look for a hint-file generated 'call-back-unit'.  If the
5510 : user has specified that a 64-bit perl is to be built,
5511 : we may need to set or change some other defaults.
5512 if $test -f use64bitint.cbu; then
5513         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5514         . ./use64bitint.cbu
5515 fi
5516 case "$use64bitint" in
5517 "$define"|true|[yY]*)
5518         case "$longsize" in
5519         4) case "$archname64" in
5520            '') archname64=64int ;;
5521            esac
5522            ;;
5523         esac
5524         ;;
5525 esac
5526
5527 : Look for a hint-file generated 'call-back-unit'.  If the
5528 : user has specified that a maximally 64-bit perl is to be built,
5529 : we may need to set or change some other defaults.
5530 if $test -f use64bitall.cbu; then
5531         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5532         . ./use64bitall.cbu
5533 fi
5534 case "$use64bitall" in
5535 "$define"|true|[yY]*)
5536         case "$longsize" in
5537         4) case "$archname64" in
5538            ''|64int) archname64=64all ;;
5539            esac
5540            ;;
5541         esac
5542         ;;
5543 esac
5544
5545 case "$d_quad:$use64bitint" in
5546 $undef:$define)
5547         cat >&4 <<EOF
5548
5549 *** You have chosen to use 64-bit integers,
5550 *** but none can be found.
5551 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5552 *** Cannot continue, aborting.
5553
5554 EOF
5555         exit 1
5556         ;;
5557 esac
5558
5559 : check for length of double
5560 echo " "
5561 case "$doublesize" in
5562 '')
5563         echo "Checking to see how big your double precision numbers are..." >&4
5564         $cat >try.c <<EOCP
5565 #include <stdio.h>
5566 #$i_stdlib I_STDLIB
5567 #ifdef I_STDLIB
5568 #include <stdlib.h>
5569 #endif
5570 int main()
5571 {
5572     printf("%d\n", (int)sizeof(double));
5573     exit(0);
5574 }
5575 EOCP
5576         set try
5577         if eval $compile_ok; then
5578                 doublesize=`$run ./try`
5579                 echo "Your double is $doublesize bytes long."
5580         else
5581                 dflt='8'
5582                 echo "(I can't seem to compile the test program.  Guessing...)"
5583                 rp="What is the size of a double precision number (in bytes)?"
5584                 . ./myread
5585                 doublesize="$ans"
5586         fi
5587         ;;
5588 esac
5589 $rm -f try.c try
5590
5591 : check for long doubles
5592 echo " "
5593 echo "Checking to see if you have long double..." >&4
5594 echo 'int main() { long double x = 7.0; }' > try.c
5595 set try
5596 if eval $compile; then
5597         val="$define"
5598         echo "You have long double."
5599 else
5600         val="$undef"
5601         echo "You do not have long double."
5602 fi
5603 $rm try.*
5604 set d_longdbl
5605 eval $setvar
5606
5607 : check for length of long double
5608 case "${d_longdbl}${longdblsize}" in
5609 $define)
5610         echo " "
5611         echo "Checking to see how big your long doubles are..." >&4
5612         $cat >try.c <<'EOCP'
5613 #include <stdio.h>
5614 int main()
5615 {
5616         printf("%d\n", sizeof(long double));
5617 }
5618 EOCP
5619         set try
5620         set try
5621         if eval $compile; then
5622                 longdblsize=`$run ./try`
5623                 echo "Your long doubles are $longdblsize bytes long."
5624         else
5625                 dflt='8'
5626                 echo " "
5627                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5628                 rp="What is the size of a long double (in bytes)?"
5629                 . ./myread
5630                 longdblsize="$ans"
5631         fi
5632         if $test "X$doublesize" = "X$longdblsize"; then
5633                 echo "That isn't any different from an ordinary double."
5634                 echo "I'll keep your setting anyway, but you may see some"
5635                 echo "harmless compilation warnings."
5636         fi      
5637         ;;
5638 esac
5639 $rm -f try.* try
5640
5641 : determine the architecture name
5642 echo " "
5643 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5644         tarch=`arch`"-$osname"
5645 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5646         if uname -m > tmparch 2>&1 ; then
5647                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5648                         -e 's/$/'"-$osname/" tmparch`
5649         else
5650                 tarch="$osname"
5651         fi
5652         $rm -f tmparch
5653 else
5654         tarch="$osname"
5655 fi
5656 case "$myarchname" in
5657 ''|"$tarch") ;;
5658 *)
5659         echo "(Your architecture name used to be $myarchname.)"
5660         archname=''
5661         ;;
5662 esac
5663 case "$targetarch" in
5664 '') ;;
5665 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5666 esac
5667 myarchname="$tarch"
5668 case "$archname" in
5669 '') dflt="$tarch";;
5670 *) dflt="$archname";;
5671 esac
5672 rp='What is your architecture name'
5673 . ./myread
5674 archname="$ans"
5675 case "$usethreads" in
5676 $define)
5677         echo "Threads selected." >&4
5678         case "$archname" in
5679         *-thread*) echo "...and architecture name already has -thread." >&4
5680                 ;;
5681         *)      archname="$archname-thread"
5682                 echo "...setting architecture name to $archname." >&4
5683                 ;;
5684         esac
5685         ;;
5686 esac
5687 case "$usemultiplicity" in
5688 $define)
5689         echo "Multiplicity selected." >&4
5690         case "$archname" in
5691         *-multi*) echo "...and architecture name already has -multi." >&4
5692                 ;;
5693         *)      archname="$archname-multi"
5694                 echo "...setting architecture name to $archname." >&4
5695                 ;;
5696         esac
5697         ;;
5698 esac
5699 case "$use64bitint$use64bitall" in
5700 *"$define"*)
5701         case "$archname64" in
5702         '')
5703                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5704                 ;;
5705         *)
5706                 case "$use64bitint" in
5707                 "$define") echo "64 bit integers selected." >&4 ;;
5708                 esac
5709                 case "$use64bitall" in
5710                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5711                 esac
5712                 case "$archname" in
5713                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5714                         ;;
5715                 *)      archname="$archname-$archname64"
5716                         echo "...setting architecture name to $archname." >&4
5717                         ;;
5718                 esac
5719                 ;;
5720         esac
5721 esac
5722 case "$uselongdouble" in
5723 $define)
5724         echo "Long doubles selected." >&4
5725         case "$longdblsize" in
5726         $doublesize)
5727                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5728                 ;;
5729         *)
5730                 case "$archname" in
5731                 *-ld*) echo "...and architecture name already has -ld." >&4
5732                         ;;
5733                 *)      archname="$archname-ld"
5734                         echo "...setting architecture name to $archname." >&4
5735                         ;;
5736                 esac
5737                 ;;
5738         esac
5739         ;;
5740 esac
5741 case "$useperlio" in
5742 $define)
5743         echo "Perlio selected." >&4
5744         ;;
5745 *)
5746         echo "Perlio not selected, using stdio." >&4
5747         case "$archname" in
5748         *-stdio*) echo "...and architecture name already has -stdio." >&4
5749                 ;;
5750         *)      archname="$archname-stdio"
5751                 echo "...setting architecture name to $archname." >&4
5752                 ;;
5753         esac
5754         ;;
5755 esac
5756 if $test -f archname.cbu; then
5757         echo "Your platform has some specific hints for architecture name, using them..."
5758         . ./archname.cbu
5759 fi
5760
5761 : determine root of directory hierarchy where package will be installed.
5762 case "$prefix" in
5763 '')
5764         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5765         ;;
5766 *?/)
5767         dflt=`echo "$prefix" | sed 's/.$//'`
5768         ;;
5769 *)
5770         dflt="$prefix"
5771         ;;
5772 esac
5773 $cat <<EOM
5774
5775 By default, $package will be installed in $dflt/bin, manual pages
5776 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5777 installation directories. Typically this is something like /usr/local.
5778 If you wish to have binaries under /usr/bin but other parts of the
5779 installation under /usr/local, that's ok: you will be prompted
5780 separately for each of the installation directories, the prefix being
5781 only used to set the defaults.
5782
5783 EOM
5784 fn=d~
5785 rp='Installation prefix to use?'
5786 . ./getfile
5787 oldprefix=''
5788 case "$prefix" in
5789 '') ;;
5790 *)
5791         case "$ans" in
5792         "$prefix") ;;
5793         *) oldprefix="$prefix";;
5794         esac
5795         ;;
5796 esac
5797 prefix="$ans"
5798 prefixexp="$ansexp"
5799
5800 case "$afsroot" in
5801 '')     afsroot=/afs ;;
5802 *)      afsroot=$afsroot ;;
5803 esac
5804
5805 : is AFS running?
5806 echo " "
5807 case "$afs" in
5808 $define|true)   afs=true ;;
5809 $undef|false)   afs=false ;;
5810 *)      if test -d $afsroot; then
5811                 afs=true
5812         else
5813                 afs=false
5814         fi
5815         ;;
5816 esac
5817 if $afs; then
5818         echo "AFS may be running... I'll be extra cautious then..." >&4
5819 else
5820         echo "AFS does not seem to be running..." >&4
5821 fi
5822
5823 : determine installation prefix for where package is to be installed.
5824 if $afs; then 
5825 $cat <<EOM
5826
5827 Since you are running AFS, I need to distinguish the directory in which
5828 files will reside from the directory in which they are installed (and from
5829 which they are presumably copied to the former directory by occult means).
5830
5831 EOM
5832         case "$installprefix" in
5833         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5834         *) dflt="$installprefix";;
5835         esac
5836 else
5837 $cat <<EOM
5838
5839 In some special cases, particularly when building $package for distribution,
5840 it is convenient to distinguish the directory in which files should be
5841 installed from the directory ($prefix) in which they will
5842 eventually reside.  For most users, these two directories are the same.
5843
5844 EOM
5845         case "$installprefix" in
5846         '') dflt=$prefix ;;
5847         *) dflt=$installprefix;;
5848         esac
5849 fi
5850 fn=d~
5851 rp='What installation prefix should I use for installing files?'
5852 . ./getfile
5853 installprefix="$ans"
5854 installprefixexp="$ansexp"
5855
5856 : set the prefixit variable, to compute a suitable default value
5857 prefixit='case "$3" in
5858 ""|none)
5859         case "$oldprefix" in
5860         "") eval "$1=\"\$$2\"";;
5861         *)
5862                 case "$3" in
5863                 "") eval "$1=";;
5864                 none)
5865                         eval "tp=\"\$$2\"";
5866                         case "$tp" in
5867                         ""|" ") eval "$1=\"\$$2\"";;
5868                         *) eval "$1=";;
5869                         esac;;
5870                 esac;;
5871         esac;;
5872 *)
5873         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5874         case "$tp" in
5875         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5876         /*-$oldprefix/*|\~*-$oldprefix/*)
5877                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5878         *) eval "$1=\"\$$2\"";;
5879         esac;;
5880 esac'
5881
5882 : get the patchlevel
5883 echo " "
5884 echo "Getting the current patchlevel..." >&4
5885 if $test -r $rsrc/patchlevel.h;then
5886         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5887         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5888         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5889         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5890         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5891         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5892        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5893 else
5894         revision=0
5895         patchlevel=0
5896         subversion=0
5897         api_revision=0
5898         api_version=0
5899         api_subversion=0
5900         perl_patchlevel=0
5901         $echo "(You do not have patchlevel.h.  Eek.)"
5902 fi
5903 if $test -r $rsrc/.patch ; then  
5904         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5905                 perl_patchlevel=`cat $rsrc/.patch`
5906         fi
5907 fi
5908 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5909 version_patchlevel_string="version $patchlevel subversion $subversion"
5910 case "$perl_patchlevel" in
5911 0|'') ;;
5912 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5913 esac
5914
5915 $echo "(You have $package $version_patchlevel_string.)"
5916
5917 case "$osname" in
5918 dos|vms)
5919         : XXX Should be a Configure test for double-dots in filenames.
5920         version=`echo $revision $patchlevel $subversion | \
5921                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5922         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5923                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5924         ;;
5925 *)
5926         version=`echo $revision $patchlevel $subversion | \
5927                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5928         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5929                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5930         ;;
5931 esac
5932 : Special case the 5.005_xx maintenance series, which used 5.005
5933 : without any subversion label as a subdirectory in $sitelib
5934 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5935         api_versionstring='5.005'
5936 fi
5937
5938 : determine installation style
5939 : For now, try to deduce it from prefix unless it is already set.
5940 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5941 case "$installstyle" in
5942 '')     case "$prefix" in
5943                 *perl*) dflt='lib';;
5944                 *) dflt='lib/perl5' ;;
5945         esac
5946         ;;
5947 *)      dflt="$installstyle" ;;
5948 esac
5949 : Probably not worth prompting for this since we prompt for all
5950 : the directories individually, and the prompt would be too long and
5951 : confusing anyway.
5952 installstyle=$dflt
5953
5954 : determine where private library files go
5955 : Usual default is /usr/local/lib/perl5/$version.
5956 : Also allow things like /opt/perl/lib/$version, since 
5957 : /opt/perl/lib/perl5... would be redundant.
5958 : The default "style" setting is made in installstyle.U
5959 case "$installstyle" in
5960 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5961 *)       set dflt privlib lib/$version ;;
5962 esac
5963 eval $prefixit
5964 $cat <<EOM
5965
5966 There are some auxiliary files for $package that need to be put into a
5967 private library directory that is accessible by everyone.
5968
5969 EOM
5970 fn=d~+
5971 rp='Pathname where the private library files will reside?'
5972 . ./getfile
5973 privlib="$ans"
5974 privlibexp="$ansexp"
5975 : Change installation prefix, if necessary.
5976 if $test X"$prefix" != X"$installprefix"; then
5977         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5978 else
5979         installprivlib="$privlibexp"
5980 fi
5981
5982 : set the prefixup variable, to restore leading tilda escape
5983 prefixup='case "$prefixexp" in
5984 "$prefix") ;;
5985 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5986 esac'
5987
5988 : determine where public architecture dependent libraries go
5989 set archlib archlib
5990 eval $prefixit
5991 : privlib default is /usr/local/lib/$package/$version
5992 : archlib default is /usr/local/lib/$package/$version/$archname
5993 : privlib may have an optional trailing /share.
5994 tdflt=`echo $privlib | $sed 's,/share$,,'`
5995 tdflt=$tdflt/$archname
5996 case "$archlib" in
5997 '')     dflt=$tdflt
5998         ;;
5999 *)      dflt="$archlib"
6000     ;;
6001 esac
6002 $cat <<EOM
6003
6004 $spackage contains architecture-dependent library files.  If you are
6005 sharing libraries in a heterogeneous environment, you might store
6006 these files in a separate location.  Otherwise, you can just include
6007 them with the rest of the public library files.
6008
6009 EOM
6010 fn=d+~
6011 rp='Where do you want to put the public architecture-dependent libraries?'
6012 . ./getfile
6013 archlib="$ans"
6014 archlibexp="$ansexp"
6015 if $test X"$archlib" = X"$privlib"; then
6016         d_archlib="$undef"
6017 else
6018         d_archlib="$define"
6019 fi
6020 : Change installation prefix, if necessary.
6021 if $test X"$prefix" != X"$installprefix"; then
6022         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6023 else
6024         installarchlib="$archlibexp"
6025 fi
6026
6027 : see if setuid scripts can be secure
6028 $cat <<EOM
6029
6030 Some kernels have a bug that prevents setuid #! scripts from being
6031 secure.  Some sites have disabled setuid #! scripts because of this.
6032
6033 First let's decide if your kernel supports secure setuid #! scripts.
6034 (If setuid #! scripts would be secure but have been disabled anyway,
6035 don't say that they are secure if asked.)
6036
6037 EOM
6038
6039 val="$undef"
6040 if $test -d /dev/fd; then
6041         echo "#!$ls" >reflect
6042         chmod +x,u+s reflect
6043         ./reflect >flect 2>&1
6044         if $contains "/dev/fd" flect >/dev/null; then
6045                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6046                 val="$define"
6047         else
6048                 $cat <<EOM
6049 If you are not sure if they are secure, I can check but I'll need a
6050 username and password different from the one you are using right now.
6051 If you don't have such a username or don't want me to test, simply
6052 enter 'none'.
6053
6054 EOM
6055                 rp='Other username to test security of setuid scripts with?'
6056                 dflt='none'
6057                 . ./myread
6058                 case "$ans" in
6059                 n|none)
6060                         case "$d_suidsafe" in
6061                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6062                                 dflt=n;;
6063                         "$undef")
6064                                 echo "Well, the $hint value is *not* secure." >&4
6065                                 dflt=n;;
6066                         *)      echo "Well, the $hint value *is* secure." >&4
6067                                 dflt=y;;
6068                         esac
6069                         ;;
6070                 *)
6071                         $rm -f reflect flect
6072                         echo "#!$ls" >reflect
6073                         chmod +x,u+s reflect
6074                         echo >flect
6075                         chmod a+w flect
6076                         echo '"su" will (probably) prompt you for '"$ans's password."
6077                         su $ans -c './reflect >flect'
6078                         if $contains "/dev/fd" flect >/dev/null; then
6079                                 echo "Okay, it looks like setuid scripts are secure." >&4
6080                                 dflt=y
6081                         else
6082                                 echo "I don't think setuid scripts are secure." >&4
6083                                 dflt=n
6084                         fi
6085                         ;;
6086                 esac
6087                 rp='Does your kernel have *secure* setuid scripts?'
6088                 . ./myread
6089                 case "$ans" in
6090                 [yY]*)  val="$define";;
6091                 *)      val="$undef";;
6092                 esac
6093         fi
6094 else
6095         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6096         echo "(That's for file descriptors, not floppy disks.)"
6097         val="$undef"
6098 fi
6099 set d_suidsafe
6100 eval $setvar
6101
6102 $rm -f reflect flect
6103
6104 : now see if they want to do setuid emulation
6105 echo " "
6106 val="$undef"
6107 case "$d_suidsafe" in
6108 "$define")
6109         val="$undef"
6110         echo "No need to emulate SUID scripts since they are secure here." >&4
6111         ;;
6112 *)
6113         $cat <<EOM
6114 Some systems have disabled setuid scripts, especially systems where
6115 setuid scripts cannot be secure.  On systems where setuid scripts have
6116 been disabled, the setuid/setgid bits on scripts are currently
6117 useless.  It is possible for $package to detect those bits and emulate
6118 setuid/setgid in a secure fashion.  This emulation will only work if
6119 setuid scripts have been disabled in your kernel.
6120
6121 EOM
6122         case "$d_dosuid" in
6123         "$define") dflt=y ;;
6124         *) dflt=n ;;
6125         esac
6126         rp="Do you want to do setuid/setgid emulation?"
6127         . ./myread
6128         case "$ans" in
6129         [yY]*)  val="$define";;
6130         *)      val="$undef";;
6131         esac
6132         ;;
6133 esac
6134 set d_dosuid
6135 eval $setvar
6136
6137 : see if this is a malloc.h system
6138 : we want a real compile instead of Inhdr because some systems have a
6139 : malloc.h that just gives a compile error saying to use stdlib.h instead
6140 echo " "
6141 $cat >try.c <<EOCP
6142 #include <stdlib.h>
6143 #include <malloc.h>
6144 int main () { return 0; }
6145 EOCP
6146 set try
6147 if eval $compile; then
6148     echo "<malloc.h> found." >&4
6149     val="$define"
6150 else
6151     echo "<malloc.h> NOT found." >&4
6152     val="$undef"
6153 fi
6154 $rm -f try.c try
6155 set i_malloc
6156 eval $setvar
6157
6158 : check for void type
6159 echo " "
6160 echo "Checking to see how well your C compiler groks the void type..." >&4
6161 case "$voidflags" in
6162 '')
6163         $cat >try.c <<EOCP
6164 #$i_stdlib I_STDLIB
6165 #ifdef I_STDLIB
6166 #include <stdlib.h>
6167 #endif
6168 #if TRY & 1
6169 void sub() {
6170 #else
6171 sub() {
6172 #endif
6173         extern void moo();      /* function returning void */
6174         void (*goo)();          /* ptr to func returning void */
6175 #if TRY & 8
6176         void *hue;              /* generic ptr */
6177 #endif
6178 #if TRY & 2
6179         void (*foo[10])();
6180 #endif
6181
6182 #if TRY & 4
6183         if(goo == moo) {
6184                 exit(0);
6185         }
6186 #endif
6187         exit(0);
6188 }
6189 int main() { sub(); }
6190 EOCP
6191         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6192                 voidflags=$defvoidused
6193         echo "Good.  It appears to support void to the level $package wants.">&4
6194                 if $contains warning .out >/dev/null 2>&1; then
6195                         echo "However, you might get some warnings that look like this:"
6196                         $cat .out
6197                 fi
6198         else
6199 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6200                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6201                         echo "It supports 1..."
6202                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6203                                 echo "It also supports 2..."
6204                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6205                                         voidflags=7
6206                                         echo "And it supports 4 but not 8 definitely."
6207                                 else
6208                                         echo "It doesn't support 4..."
6209                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6210                                                 voidflags=11
6211                                                 echo "But it supports 8."
6212                                         else
6213                                                 voidflags=3
6214                                                 echo "Neither does it support 8."
6215                                         fi
6216                                 fi
6217                         else
6218                                 echo "It does not support 2..."
6219                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6220                                         voidflags=13
6221                                         echo "But it supports 4 and 8."
6222                                 else
6223                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6224                                                 voidflags=5
6225                                                 echo "And it supports 4 but has not heard about 8."
6226                                         else
6227                                                 echo "However it supports 8 but not 4."
6228                                         fi
6229                                 fi
6230                         fi
6231                 else
6232                         echo "There is no support at all for void."
6233                         voidflags=0
6234                 fi
6235         fi
6236 esac
6237 case "$voidflags" in
6238 "$defvoidused") ;;
6239 *)      $cat >&4 <<'EOM'
6240   Support flag bits are:
6241     1: basic void declarations.
6242     2: arrays of pointers to functions returning void.
6243     4: operations between pointers to and addresses of void functions.
6244     8: generic void pointers.
6245 EOM
6246         dflt="$voidflags";
6247         rp="Your void support flags add up to what?"
6248         . ./myread
6249         voidflags="$ans"
6250         ;;
6251 esac
6252 $rm -f try.* .out
6253
6254 : check for length of pointer
6255 echo " "
6256 case "$ptrsize" in
6257 '')
6258         echo "Checking to see how big your pointers are..." >&4
6259         if test "$voidflags" -gt 7; then
6260                 echo '#define VOID_PTR char *' > try.c
6261         else
6262                 echo '#define VOID_PTR void *' > try.c
6263         fi
6264         $cat >>try.c <<EOCP
6265 #include <stdio.h>
6266 #$i_stdlib I_STDLIB
6267 #ifdef I_STDLIB
6268 #include <stdlib.h>
6269 #endif
6270 int main()
6271 {
6272     printf("%d\n", (int)sizeof(VOID_PTR));
6273     exit(0);
6274 }
6275 EOCP
6276         set try
6277         if eval $compile_ok; then
6278                 ptrsize=`$run ./try`
6279                 echo "Your pointers are $ptrsize bytes long."
6280         else
6281                 dflt='4'
6282                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6283                 rp="What is the size of a pointer (in bytes)?"
6284                 . ./myread
6285                 ptrsize="$ans"
6286         fi
6287         ;;
6288 esac
6289 $rm -f try.c try
6290 case "$use64bitall" in
6291 "$define"|true|[yY]*)
6292         case "$ptrsize" in
6293         4)      cat <<EOM >&4
6294
6295 *** You have chosen a maximally 64-bit build,
6296 *** but your pointers are only 4 bytes wide.
6297 *** Please rerun Configure without -Duse64bitall.
6298 EOM
6299                 case "$d_quad" in
6300                 define)
6301                         cat <<EOM >&4
6302 *** Since you have quads, you could possibly try with -Duse64bitint.
6303 EOM
6304                         ;;
6305                 esac
6306                 cat <<EOM >&4
6307 *** Cannot continue, aborting.
6308
6309 EOM
6310
6311                 exit 1
6312                 ;;
6313         esac
6314         ;;
6315 esac
6316
6317
6318 : determine whether to use malloc wrapping
6319 echo " "
6320 case "$usemallocwrap" in
6321 [yY]*|true|$define)     dflt='y' ;;
6322 [nN]*|false|$undef)     dflt='n' ;;
6323 *)      case "$usedevel" in
6324         [yY]*|true|$define)     dflt='y' ;;
6325         *) dflt='n' ;;
6326         esac
6327         ;;
6328 esac
6329 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6330 . ./myread
6331 usemallocwrap="$ans"
6332 case "$ans" in
6333 y*|true)
6334         usemallocwrap="$define" ;;
6335 *)
6336         usemallocwrap="$undef" ;;
6337 esac
6338
6339 : determine which malloc to compile in
6340 echo " "
6341 case "$usemymalloc" in
6342 [yY]*|true|$define)     dflt='y' ;;
6343 [nN]*|false|$undef)     dflt='n' ;;
6344 *)      case "$ptrsize" in
6345         4) dflt='y' ;;
6346         *) dflt='n' ;;
6347         esac
6348         ;;
6349 esac
6350 rp="Do you wish to attempt to use the malloc that comes with $package?"
6351 . ./myread
6352 usemymalloc="$ans"
6353 case "$ans" in
6354 y*|true)
6355         usemymalloc='y'
6356         mallocsrc='malloc.c'
6357         mallocobj="malloc$_o"
6358         d_mymalloc="$define"
6359         case "$libs" in
6360         *-lmalloc*)
6361                 : Remove malloc from list of libraries to use
6362                 echo "Removing unneeded -lmalloc from library list" >&4
6363                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6364                 shift
6365                 libs="$*"
6366                 echo "libs = $libs" >&4
6367                 ;;
6368         esac
6369         ;;
6370 *)
6371         usemymalloc='n'
6372         mallocsrc=''
6373         mallocobj=''
6374         d_mymalloc="$undef"
6375         ;;
6376 esac
6377
6378 : compute the return types of malloc and free
6379 echo " "
6380 $cat >malloc.c <<END
6381 #$i_malloc I_MALLOC
6382 #$i_stdlib I_STDLIB
6383 #include <stdio.h>
6384 #include <sys/types.h>
6385 #ifdef I_MALLOC
6386 #include <malloc.h>
6387 #endif
6388 #ifdef I_STDLIB
6389 #include <stdlib.h>
6390 #endif
6391 #ifdef TRY_MALLOC
6392 void *malloc();
6393 #endif
6394 #ifdef TRY_FREE
6395 void free();
6396 #endif
6397 END
6398 case "$malloctype" in
6399 '')
6400         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6401                 malloctype='void *'
6402         else
6403                 malloctype='char *'
6404         fi
6405         ;;
6406 esac
6407 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6408
6409 case "$freetype" in
6410 '')
6411         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6412                 freetype='void'
6413         else
6414                 freetype='int'
6415         fi
6416         ;;
6417 esac
6418 echo "Your system uses $freetype free(), it would seem." >&4
6419 $rm -f malloc.[co]
6420 $cat <<EOM
6421
6422 After $package is installed, you may wish to install various
6423 add-on modules and utilities.  Typically, these add-ons will
6424 be installed under $prefix with the rest
6425 of this package.  However, you may wish to install such add-ons
6426 elsewhere under a different prefix.
6427
6428 If you do not wish to put everything under a single prefix, that's
6429 ok.  You will be prompted for the individual locations; this siteprefix
6430 is only used to suggest the defaults.
6431
6432 The default should be fine for most people.
6433
6434 EOM
6435 fn=d~+
6436 rp='Installation prefix to use for add-on modules and utilities?'
6437 : XXX Here might be another good place for an installstyle setting.
6438 case "$siteprefix" in
6439 '') dflt=$prefix ;;
6440 *)  dflt=$siteprefix ;;
6441 esac
6442 . ./getfile
6443 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6444 oldsiteprefix=''
6445 case "$siteprefix" in
6446 '') ;;
6447 *)      case "$ans" in
6448         "$prefix") ;;
6449         *) oldsiteprefix="$prefix";;
6450         esac
6451         ;;
6452 esac
6453 siteprefix="$ans"
6454 siteprefixexp="$ansexp"
6455
6456 : determine where site specific libraries go.
6457 : Usual default is /usr/local/lib/perl5/site_perl/$version
6458 : The default "style" setting is made in installstyle.U
6459 : XXX No longer works with Prefixit stuff.
6460 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6461 case "$sitelib" in
6462 '') case "$installstyle" in
6463         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6464         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6465         esac
6466         ;;
6467 *)      dflt="$sitelib"
6468         ;;
6469 esac
6470 $cat <<EOM
6471
6472 The installation process will create a directory for
6473 site-specific extensions and modules.  Most users find it convenient
6474 to place all site-specific files in this directory rather than in the
6475 main distribution directory.
6476
6477 EOM
6478 fn=d~+
6479 rp='Pathname for the site-specific library files?'
6480 . ./getfile
6481 sitelib="$ans"
6482 sitelibexp="$ansexp"
6483 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6484 : Change installation prefix, if necessary.
6485 if $test X"$prefix" != X"$installprefix"; then
6486         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6487 else
6488         installsitelib="$sitelibexp"
6489 fi
6490
6491 : determine where site specific architecture-dependent libraries go.
6492 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6493 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6494 : sitelib may have an optional trailing /share.
6495 case "$sitearch" in
6496 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6497         dflt="$dflt/$archname"
6498         ;;
6499 *)      dflt="$sitearch"
6500         ;;
6501 esac
6502 set sitearch sitearch none
6503 eval $prefixit
6504 $cat <<EOM
6505
6506 The installation process will also create a directory for
6507 architecture-dependent site-specific extensions and modules.
6508
6509 EOM
6510 fn=d~+
6511 rp='Pathname for the site-specific architecture-dependent library files?'
6512 . ./getfile
6513 sitearch="$ans"
6514 sitearchexp="$ansexp"
6515 : Change installation prefix, if necessary.
6516 if $test X"$prefix" != X"$installprefix"; then
6517         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6518 else
6519         installsitearch="$sitearchexp"
6520 fi
6521
6522 $cat <<EOM
6523
6524 The installation process will also create a directory for
6525 vendor-supplied add-ons.  Vendors who supply perl with their system
6526 may find it convenient to place all vendor-supplied files in this
6527 directory rather than in the main distribution directory.  This will
6528 ease upgrades between binary-compatible maintenance versions of perl.
6529
6530 Of course you may also use these directories in whatever way you see
6531 fit.  For example, you might use them to access modules shared over a
6532 company-wide network.
6533
6534 The default answer should be fine for most people.
6535 This causes further questions about vendor add-ons to be skipped
6536 and no vendor-specific directories will be configured for perl.
6537
6538 EOM
6539 rp='Do you want to configure vendor-specific add-on directories?'
6540 case "$usevendorprefix" in
6541 define|true|[yY]*) dflt=y ;;
6542 *)      : User may have set vendorprefix directly on Configure command line.
6543         case "$vendorprefix" in
6544         ''|' ') dflt=n ;;
6545         *)      dflt=y ;;
6546         esac
6547         ;;
6548 esac
6549 . ./myread
6550 case "$ans" in
6551 [yY]*)  fn=d~+
6552         rp='Installation prefix to use for vendor-supplied add-ons?'
6553         case "$vendorprefix" in
6554         '') dflt='' ;;
6555         *)  dflt=$vendorprefix ;;
6556         esac
6557         . ./getfile
6558         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6559         oldvendorprefix=''
6560         case "$vendorprefix" in
6561         '') ;;
6562         *)      case "$ans" in
6563                 "$prefix") ;;
6564                 *) oldvendorprefix="$prefix";;
6565                 esac
6566                 ;;
6567         esac
6568         usevendorprefix="$define"
6569         vendorprefix="$ans"
6570         vendorprefixexp="$ansexp"
6571         ;;
6572 *)      usevendorprefix="$undef"
6573         vendorprefix=''
6574         vendorprefixexp=''
6575         ;;
6576 esac
6577
6578 case "$vendorprefix" in
6579 '')     d_vendorlib="$undef"
6580         vendorlib=''
6581         vendorlibexp=''
6582         ;;
6583 *)      d_vendorlib="$define"
6584         : determine where vendor-supplied modules go.
6585         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6586         case "$vendorlib" in
6587         '')
6588                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6589                 case "$installstyle" in
6590                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6591                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6592                 esac
6593                 ;;
6594         *)      dflt="$vendorlib"
6595                 ;;
6596         esac
6597         fn=d~+
6598         rp='Pathname for the vendor-supplied library files?'
6599         . ./getfile
6600         vendorlib="$ans"
6601         vendorlibexp="$ansexp"
6602         ;;
6603 esac
6604 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6605 : Change installation prefix, if necessary.
6606 if $test X"$prefix" != X"$installprefix"; then
6607         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6608 else
6609         installvendorlib="$vendorlibexp"
6610 fi
6611
6612 case "$vendorprefix" in
6613 '')     d_vendorarch="$undef"
6614         vendorarch=''
6615         vendorarchexp=''
6616         ;;
6617 *)      d_vendorarch="$define"
6618         : determine where vendor-supplied architecture-dependent libraries go.
6619         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6620         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6621         : vendorlib may have an optional trailing /share.
6622         case "$vendorarch" in
6623         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6624                 dflt="$dflt/$archname"
6625                 ;;
6626         *)      dflt="$vendorarch" ;;
6627         esac
6628         fn=d~+
6629         rp='Pathname for vendor-supplied architecture-dependent files?'
6630         . ./getfile
6631         vendorarch="$ans"
6632         vendorarchexp="$ansexp"
6633         ;;
6634 esac
6635 : Change installation prefix, if necessary.
6636 if $test X"$prefix" != X"$installprefix"; then
6637         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6638 else
6639         installvendorarch="$vendorarchexp"
6640 fi
6641
6642 : Final catch-all directories to search
6643 $cat <<EOM
6644
6645 Lastly, you can have perl look in other directories for extensions and
6646 modules in addition to those already specified.
6647 These directories will be searched after 
6648         $sitearch 
6649         $sitelib 
6650 EOM
6651 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6652 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6653 echo ' '
6654 case "$otherlibdirs" in
6655 ''|' ') dflt='none' ;;
6656 *)      dflt="$otherlibdirs" ;;
6657 esac
6658 $cat <<EOM
6659 Enter a colon-separated set of extra paths to include in perl's @INC
6660 search path, or enter 'none' for no extra paths.
6661
6662 EOM
6663
6664 rp='Colon-separated list of additional directories for perl to search?'
6665 . ./myread
6666 case "$ans" in
6667 ' '|''|none)    otherlibdirs=' ' ;;     
6668 *)      otherlibdirs="$ans" ;;
6669 esac
6670 case "$otherlibdirs" in
6671 ' ') val=$undef ;;
6672 *)      val=$define ;;
6673 esac
6674 set d_perl_otherlibdirs
6675 eval $setvar
6676
6677 : Cruising for prototypes
6678 echo " "
6679 echo "Checking out function prototypes..." >&4
6680 $cat >prototype.c <<EOCP
6681 #$i_stdlib I_STDLIB
6682 #ifdef I_STDLIB
6683 #include <stdlib.h>
6684 #endif
6685 int main(int argc, char *argv[]) {
6686         exit(0);}
6687 EOCP
6688 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6689         echo "Your C compiler appears to support function prototypes."
6690         val="$define"
6691 else
6692         echo "Your C compiler doesn't seem to understand function prototypes."
6693         val="$undef"
6694 fi
6695 set prototype
6696 eval $setvar
6697 $rm -f prototype*
6698
6699 case "$prototype" in
6700 "$define") ;;
6701 *)      ansi2knr='ansi2knr'
6702         echo " "
6703         cat <<EOM >&4
6704
6705 $me:  FATAL ERROR:
6706 This version of $package can only be compiled by a compiler that 
6707 understands function prototypes.  Unfortunately, your C compiler 
6708         $cc $ccflags
6709 doesn't seem to understand them.  Sorry about that.
6710
6711 If GNU cc is available for your system, perhaps you could try that instead.  
6712
6713 Eventually, we hope to support building Perl with pre-ANSI compilers.
6714 If you would like to help in that effort, please contact <perlbug@perl.org>.
6715
6716 Aborting Configure now.
6717 EOM
6718         exit 2
6719         ;;
6720 esac
6721
6722 : determine where public executables go
6723 echo " "
6724 set dflt bin bin
6725 eval $prefixit
6726 fn=d~
6727 rp='Pathname where the public executables will reside?'
6728 . ./getfile
6729 if $test "X$ansexp" != "X$binexp"; then
6730         installbin=''
6731 fi
6732 bin="$ans"
6733 binexp="$ansexp"
6734 : Change installation prefix, if necessary.
6735 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6736 if $test X"$prefix" != X"$installprefix"; then
6737         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6738 else
6739         installbin="$binexp"
6740 fi
6741
6742 echo " "
6743 case "$extras" in
6744 '') dflt='n';;
6745 *) dflt='y';;
6746 esac
6747 cat <<EOM
6748 Perl can be built with extra modules or bundles of modules which
6749 will be fetched from the CPAN and installed alongside Perl.
6750
6751 Notice that you will need access to the CPAN; either via the Internet,
6752 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6753 be asked later to configure the CPAN.pm module which will in turn do
6754 the installation of the rest of the extra modules or bundles.)
6755
6756 Notice also that if the modules require any external software such as
6757 libraries and headers (the libz library and the zlib.h header for the
6758 Compress::Zlib module, for example) you MUST have any such software
6759 already installed, this configuration process will NOT install such
6760 things for you.
6761
6762 If this doesn't make any sense to you, just accept the default '$dflt'.
6763 EOM
6764 rp='Install any extra modules (y or n)?'
6765 . ./myread
6766 case "$ans" in
6767 y|Y)
6768         cat <<EOM
6769
6770 Please list any extra modules or bundles to be installed from CPAN,
6771 with spaces between the names.  The names can be in any format the
6772 'install' command of CPAN.pm will understand.  (Answer 'none',
6773 without the quotes, to install no extra modules or bundles.)
6774 EOM
6775         rp='Extras?'
6776         dflt="$extras"
6777         . ./myread
6778         extras="$ans"
6779 esac
6780 case "$extras" in
6781 ''|'none')
6782         val=''
6783         $rm -f ../extras.lst
6784         ;;
6785 *)      echo "(Saving the list of extras for later...)"
6786         echo "$extras" > ../extras.lst
6787         val="'$extras'"
6788         ;;
6789 esac
6790 set extras
6791 eval $setvar
6792 echo " "
6793
6794 : determine where html pages for programs go
6795 set html1dir html1dir none
6796 eval $prefixit
6797 $cat <<EOM
6798
6799 If you wish to install html files for programs in $spackage, indicate 
6800 the appropriate directory here.  To skip installing html files,
6801 answer "none".
6802 EOM
6803 case "$html1dir" in
6804 ''|none|$undef|' ') dflt=none ;;
6805 *) dflt=$html1dir ;;
6806 esac
6807 fn=dn+~
6808 rp="Directory for the main $spackage html pages?"
6809 . ./getfile
6810 html1dir="$ans"
6811 html1direxp="$ansexp"
6812 : Use ' ' for none so value is preserved next time through Configure
6813 $test X"$html1dir" = "X" && html1dir=' '
6814 : Change installation prefix, if necessary.
6815 if $test X"$prefix" != X"$installprefix"; then
6816         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6817 else
6818         installhtml1dir="$html1direxp"
6819 fi
6820
6821 : determine where html pages for libraries and modules go
6822 set html3dir html3dir none
6823 eval $prefixit
6824 $cat <<EOM
6825
6826 If you wish to install html files for modules associated with $spackage,
6827 indicate the appropriate directory here.  To skip installing html files,
6828 answer "none".
6829 EOM
6830 : There is no obvious default.  If they have specified html1dir, then
6831 : try to key off that, possibly changing .../html1 into .../html3.
6832 case "$html3dir" in
6833 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6834 *) dflt=$html3dir ;;
6835 esac
6836 fn=dn+~
6837 rp="Directory for the $spackage module html pages?"
6838 . ./getfile
6839 html3dir="$ans"
6840 html3direxp="$ansexp"
6841 : Use ' ' for none so value is preserved next time through Configure
6842 $test X"$html3dir" = "X" && html3dir=' '
6843 : Change installation prefix, if necessary.
6844 if $test X"$prefix" != X"$installprefix"; then
6845         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6846 else
6847         installhtml3dir="$html3direxp"
6848 fi
6849
6850 : Find perl5.005 or later.
6851 echo "Looking for a previously installed perl5.005 or later... "
6852 case "$perl5" in
6853 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6854                 : Check if this perl is recent and can load a simple module
6855                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6856                         perl5=$tdir/perl
6857                         break;
6858                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6859                         perl5=$tdir/perl5
6860                         break;
6861                 fi
6862         done
6863         ;;
6864 *)      perl5="$perl5"
6865         ;;
6866 esac
6867 case "$perl5" in
6868 '')     echo "None found.  That's ok.";;
6869 *)      echo "Using $perl5." ;;
6870 esac
6871
6872 : Determine list of previous versions to include in @INC
6873 $cat > getverlist <<EOPL
6874 #!$perl5 -w
6875 use File::Basename;
6876 \$api_versionstring = "$api_versionstring";
6877 \$version = "$version";
6878 \$stem = "$sitelib_stem";
6879 \$archname = "$archname";
6880 EOPL
6881         $cat >> getverlist <<'EOPL'
6882 # Can't have leading @ because metaconfig interprets it as a command!
6883 ;@inc_version_list=();
6884 # XXX Redo to do opendir/readdir? 
6885 if (-d $stem) {
6886     chdir($stem);
6887     ;@candidates = glob("5.*");
6888 }
6889 else {
6890     ;@candidates = ();
6891 }
6892
6893 # XXX ToDo:  These comparisons must be reworked when two-digit
6894 # subversions come along, so that 5.7.10 compares as greater than
6895 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6896 # widespread that we can use the built-in version vectors rather
6897 # than reinventing them here.  For 5.6.0, however, we must
6898 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6899 foreach $d (@candidates) {
6900     if ($d lt $version) {
6901         if ($d ge $api_versionstring) {
6902             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6903         }
6904         elsif ($d ge "5.005") {
6905             unshift(@inc_version_list, grep { -d } $d);
6906         }
6907     }
6908     else {
6909         # Skip newer version.  I.e. don't look in
6910         # 5.7.0 if we're installing 5.6.1.
6911     }
6912 }
6913
6914 if (@inc_version_list) {
6915     print join(' ', @inc_version_list);
6916 }
6917 else {
6918     # Blank space to preserve value for next Configure run.
6919     print " ";
6920 }
6921 EOPL
6922 chmod +x getverlist
6923 case "$inc_version_list" in
6924 '')     if test -x "$perl5$exe_ext"; then
6925                 dflt=`$perl5 getverlist`
6926         else
6927                 dflt='none'
6928         fi
6929         ;;
6930 $undef) dflt='none' ;;
6931 *)  eval dflt=\"$inc_version_list\" ;;
6932 esac
6933 case "$dflt" in
6934 ''|' ') dflt=none ;;
6935 esac
6936 case "$dflt" in
6937 5.005) dflt=none ;;
6938 esac
6939 $cat <<EOM
6940
6941 In order to ease the process of upgrading, this version of perl 
6942 can be configured to use modules built and installed with earlier 
6943 versions of perl that were installed under $prefix.  Specify here
6944 the list of earlier versions that this version of perl should check.
6945 If Configure detected no earlier versions of perl installed under
6946 $prefix, then the list will be empty.  Answer 'none' to tell perl
6947 to not search earlier versions.
6948
6949 The default should almost always be sensible, so if you're not sure,
6950 just accept the default.
6951 EOM
6952
6953 rp='List of earlier versions to include in @INC?'
6954 . ./myread
6955 case "$ans" in
6956 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6957 *) inc_version_list="$ans" ;;
6958 esac
6959 case "$inc_version_list" in
6960 ''|' ') 
6961         inc_version_list_init='0';;
6962 *)      inc_version_list_init=`echo $inc_version_list |
6963                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6964         ;;
6965 esac
6966 $rm -f getverlist
6967
6968 : determine whether to install perl also as /usr/bin/perl
6969
6970 echo " "
6971 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6972         $cat <<EOM
6973 Many scripts expect perl to be installed as /usr/bin/perl.
6974
6975 If you want to, I can install the perl you are about to compile
6976 as /usr/bin/perl (in addition to $bin/perl).
6977 EOM
6978         if test -f /usr/bin/perl; then
6979             $cat <<EOM
6980
6981 However, please note that because you already have a /usr/bin/perl,
6982 overwriting that with a new Perl would very probably cause problems.
6983 Therefore I'm assuming you don't want to do that (unless you insist).
6984
6985 EOM
6986             case "$installusrbinperl" in
6987             "$define"|[yY]*)    dflt='y';;
6988             *)                  dflt='n';;
6989             esac
6990         else
6991             $cat <<EOM
6992
6993 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6994
6995 EOM
6996             case "$installusrbinperl" in
6997             "$undef"|[nN]*)     dflt='n';;
6998             *)                  dflt='y';;
6999             esac
7000         fi
7001         rp="Do you want to install perl as /usr/bin/perl?"
7002         . ./myread
7003         case "$ans" in
7004         [yY]*)  val="$define";;
7005         *)      val="$undef" ;;
7006         esac
7007 else
7008         val="$undef"
7009 fi
7010 set installusrbinperl
7011 eval $setvar
7012
7013 echo " "
7014 echo "Checking for GNU C Library..." >&4
7015 cat >try.c <<'EOCP'
7016 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7017    alone are insufficient to distinguish different versions, such as
7018    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7019    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7020 */
7021 #include <stdio.h>
7022 int main(void)
7023 {
7024 #ifdef __GLIBC__
7025 #   ifdef __GLIBC_MINOR__
7026 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7027 #           include <gnu/libc-version.h>
7028             printf("%s\n",  gnu_get_libc_version());
7029 #       else
7030             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7031 #       endif
7032 #   else
7033         printf("%d\n",  __GLIBC__);
7034 #   endif
7035     return 0;
7036 #else
7037     return 1;
7038 #endif
7039 }
7040 EOCP
7041 set try
7042 if eval $compile_ok && $run ./try > glibc.ver; then
7043         val="$define"
7044         gnulibc_version=`$cat glibc.ver`
7045         echo "You are using the GNU C Library version $gnulibc_version"
7046 else
7047         val="$undef"
7048         gnulibc_version=''
7049         echo "You are not using the GNU C Library"
7050 fi
7051 $rm -f try try.* glibc.ver
7052 set d_gnulibc
7053 eval $setvar
7054
7055 : see if nm is to be used to determine whether a symbol is defined or not
7056 case "$usenm" in
7057 '')
7058         dflt=''
7059         case "$d_gnulibc" in
7060         "$define")
7061                 echo " "
7062                 echo "nm probably won't work on the GNU C Library." >&4
7063                 dflt=n
7064                 ;;
7065         esac
7066         case "$dflt" in
7067         '') 
7068                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7069                         echo " "
7070                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7071                         echo "'nm' won't be sufficient on this sytem." >&4
7072                         dflt=n
7073                 fi
7074                 ;;
7075         esac
7076         case "$dflt" in
7077         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7078                 if $test $dflt -gt 20; then
7079                         dflt=y
7080                 else
7081                         dflt=n
7082                 fi
7083                 ;;
7084         esac
7085         ;;
7086 *)
7087         case "$usenm" in
7088         true|$define) dflt=y;;
7089         *) dflt=n;;
7090         esac
7091         ;;
7092 esac
7093 $cat <<EOM
7094
7095 I can use $nm to extract the symbols from your C libraries. This
7096 is a time consuming task which may generate huge output on the disk (up
7097 to 3 megabytes) but that should make the symbols extraction faster. The
7098 alternative is to skip the 'nm' extraction part and to compile a small
7099 test program instead to determine whether each symbol is present. If
7100 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7101 this may be the best solution.
7102
7103 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7104
7105 EOM
7106 rp="Shall I use $nm to extract C symbols from the libraries?"
7107 . ./myread
7108 case "$ans" in
7109 [Nn]*) usenm=false;;
7110 *) usenm=true;;
7111 esac
7112
7113 runnm=$usenm
7114 case "$reuseval" in
7115 true) runnm=false;;
7116 esac
7117
7118 : nm options which may be necessary
7119 case "$nm_opt" in
7120 '') if $test -f /mach_boot; then
7121                 nm_opt=''       # Mach
7122         elif $test -d /usr/ccs/lib; then
7123                 nm_opt='-p'     # Solaris (and SunOS?)
7124         elif $test -f /dgux; then
7125                 nm_opt='-p'     # DG-UX
7126         elif $test -f /lib64/rld; then
7127                 nm_opt='-p'     # 64-bit Irix
7128         else
7129                 nm_opt=''
7130         fi;;
7131 esac
7132
7133 : nm options which may be necessary for shared libraries but illegal
7134 : for archive libraries.  Thank you, Linux.
7135 case "$nm_so_opt" in
7136 '')     case "$myuname" in
7137         *linux*|gnu*)
7138                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7139                         nm_so_opt='--dynamic'
7140                 fi
7141                 ;;
7142         esac
7143         ;;
7144 esac
7145
7146 case "$runnm" in
7147 true)
7148 : get list of predefined functions in a handy place
7149 echo " "
7150 case "$libc" in
7151 '') libc=unknown
7152         case "$libs" in
7153         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7154         esac
7155         ;;
7156 esac
7157 case "$libs" in
7158 '') ;;
7159 *)  for thislib in $libs; do
7160         case "$thislib" in
7161         -lc|-lc_s)
7162                 : Handle C library specially below.
7163                 ;;
7164         -l*)
7165                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7166                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7167                         :
7168                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7169                         :
7170                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7171                         :
7172                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7173                         :
7174                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7175                         :
7176                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7177                         :
7178                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7179                         :
7180                 else
7181                         try=''
7182                 fi
7183                 libnames="$libnames $try"
7184                 ;;
7185         *) libnames="$libnames $thislib" ;;
7186         esac
7187         done
7188         ;;
7189 esac
7190 xxx=normal
7191 case "$libc" in
7192 unknown)
7193         set /lib/libc.$so
7194         for xxx in $libpth; do
7195                 $test -r $1 || set $xxx/libc.$so
7196                 : The messy sed command sorts on library version numbers.
7197                 $test -r $1 || \
7198                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7199                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7200                                 h
7201                                 s/[0-9][0-9]*/0000&/g
7202                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7203                                 G
7204                                 s/\n/ /' | \
7205                          $sort | $sed -e 's/^.* //'`
7206                 eval set \$$#
7207         done
7208         $test -r $1 || set /usr/ccs/lib/libc.$so
7209         $test -r $1 || set /lib/libsys_s$_a
7210         ;;
7211 *)
7212         set blurfl
7213         ;;
7214 esac
7215 if $test -r "$1"; then
7216         echo "Your (shared) C library seems to be in $1."
7217         libc="$1"
7218 elif $test -r /lib/libc && $test -r /lib/clib; then
7219         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7220         xxx=apollo
7221         libc='/lib/clib /lib/libc'
7222         if $test -r /lib/syslib; then
7223                 echo "(Your math library is in /lib/syslib.)"
7224                 libc="$libc /lib/syslib"
7225         fi
7226 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7227         echo "Your C library seems to be in $libc, as you said before."
7228 elif $test -r $incpath/usr/lib/libc$_a; then
7229         libc=$incpath/usr/lib/libc$_a;
7230         echo "Your C library seems to be in $libc.  That's fine."
7231 elif $test -r /lib/libc$_a; then
7232         libc=/lib/libc$_a;
7233         echo "Your C library seems to be in $libc.  You're normal."
7234 else
7235         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7236                 :
7237         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7238                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7239         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7240                 :
7241         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7242                 :
7243         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7244                 :
7245         else
7246                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7247         fi
7248         if $test -r "$tans"; then
7249                 echo "Your C library seems to be in $tans, of all places."
7250                 libc=$tans
7251         else
7252                 libc='blurfl'
7253         fi
7254 fi
7255 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7256         dflt="$libc"
7257         cat <<EOM
7258
7259 If the guess above is wrong (which it might be if you're using a strange
7260 compiler, or your machine supports multiple models), you can override it here.
7261
7262 EOM
7263 else
7264         dflt=''
7265         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7266         cat >&4 <<EOM
7267 I can't seem to find your C library.  I've looked in the following places:
7268
7269 EOM
7270         $sed 's/^/      /' libpath
7271         cat <<EOM
7272
7273 None of these seems to contain your C library. I need to get its name...
7274
7275 EOM
7276 fi
7277 fn=f
7278 rp='Where is your C library?'
7279 . ./getfile
7280 libc="$ans"
7281
7282 echo " "
7283 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7284 set X `cat libnames`
7285 shift
7286 xxx=files
7287 case $# in 1) xxx=file; esac
7288 echo "Extracting names from the following $xxx for later perusal:" >&4
7289 echo " "
7290 $sed 's/^/      /' libnames >&4
7291 echo " "
7292 $echo $n "This may take a while...$c" >&4
7293
7294 for file in $*; do
7295         case $file in
7296         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7297         *) $nm $nm_opt $file 2>/dev/null;;
7298         esac
7299 done >libc.tmp
7300
7301 $echo $n ".$c"
7302 $grep fprintf libc.tmp > libc.ptf
7303 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7304 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7305 xxx='[ADTSIW]'
7306 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7307         eval $xscan;\
7308         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7309                 eval $xrun
7310 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7311         eval $xscan;\
7312         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7313                 eval $xrun
7314 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7315         eval $xscan;\
7316         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7317                 eval $xrun
7318 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7319         eval $xscan;\
7320         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7321                 eval $xrun
7322 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7323         eval $xscan;\
7324         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7325                 eval $xrun
7326 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7327         eval $xscan;\
7328         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7329                 eval $xrun
7330 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7331                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7332         eval $xscan;\
7333         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7334                 eval $xrun
7335 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7336         eval $xscan;\
7337         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7338                 eval $xrun
7339 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7340         eval $xscan;\
7341         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7342                 eval $xrun
7343 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7344         eval $xscan;\
7345         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7346                 eval $xrun
7347 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7348         eval $xscan;\
7349         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7350                 eval $xrun
7351 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7352         eval $xscan;\
7353         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7354                 eval $xrun
7355 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7356         eval $xscan;\
7357         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7358                 eval $xrun
7359 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7360         eval $xscan;\
7361         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7362                 eval $xrun
7363 else
7364         $nm -p $* 2>/dev/null >libc.tmp
7365         $grep fprintf libc.tmp > libc.ptf
7366         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7367                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7368         then
7369                 nm_opt='-p'
7370                 eval $xrun
7371         else
7372                 echo " "
7373                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7374                 com=''
7375                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7376                         for thisname in $libnames $libc; do
7377                                 $ar t $thisname >>libc.tmp
7378                         done
7379                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7380                         echo "Ok." >&4
7381                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7382                         # Repeat libc to extract forwarders to DLL entries too
7383                         for thisname in $libnames $libc; do
7384                                 $ar tv $thisname >>libc.tmp
7385                                 # Revision 50 of EMX has bug in $ar.
7386                                 # it will not extract forwarders to DLL entries
7387                                 # Use emximp which will extract exactly them.
7388                                 emximp -o tmp.imp $thisname \
7389                                     2>/dev/null && \
7390                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7391                                     < tmp.imp >>libc.tmp
7392                                 $rm tmp.imp
7393                         done
7394                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7395                         echo "Ok." >&4
7396                 else
7397                         echo "$ar didn't seem to work right." >&4
7398                         echo "Maybe this is a Cray...trying bld instead..." >&4
7399                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7400                         then
7401                                 for thisname in $libnames; do
7402                                         bld t $libnames | \
7403                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7404                                         $ar t $thisname >>libc.tmp
7405                                 done
7406                                 echo "Ok." >&4
7407                         else
7408                                 echo "That didn't work either.  Giving up." >&4
7409                                 exit 1
7410                         fi
7411                 fi
7412         fi
7413 fi
7414 nm_extract="$com"
7415 case "$PASE" in
7416 define)
7417     echo " "
7418     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7419     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7420     ;;
7421 *)  if $test -f /lib/syscalls.exp; then
7422         echo " "
7423         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7424         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7425     fi
7426     ;;
7427 esac
7428 ;;
7429 esac
7430 $rm -f libnames libpath
7431
7432 : see if dld is available
7433 set dld.h i_dld
7434 eval $inhdr
7435
7436 : is a C symbol defined?
7437 csym='tlook=$1;
7438 case "$3" in
7439 -v) tf=libc.tmp; tdc="";;
7440 -a) tf=libc.tmp; tdc="[]";;
7441 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7442 esac;
7443 tx=yes;
7444 case "$reuseval-$4" in
7445 true-) ;;
7446 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7447 esac;
7448 case "$tx" in
7449 yes)
7450         tval=false;
7451         if $test "$runnm" = true; then
7452                 if $contains $tlook $tf >/dev/null 2>&1; then
7453                         tval=true;
7454                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7455                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7456                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7457                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7458                         $rm -f try$_exe try.c core core.* try.core;
7459                 fi;
7460         else
7461                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7462                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7463                 $rm -f try$_exe try.c;
7464         fi;
7465         ;;
7466 *)
7467         case "$tval" in
7468         $define) tval=true;;
7469         *) tval=false;;
7470         esac;
7471         ;;
7472 esac;
7473 eval "$2=$tval"'
7474
7475 : define an is-in-libc? function
7476 inlibc='echo " "; td=$define; tu=$undef;
7477 sym=$1; var=$2; eval "was=\$$2";
7478 tx=yes;
7479 case "$reuseval$was" in
7480 true) ;;
7481 true*) tx=no;;
7482 esac;
7483 case "$tx" in
7484 yes)
7485         set $sym tres -f;
7486         eval $csym;
7487         case "$tres" in
7488         true)
7489                 echo "$sym() found." >&4;
7490                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7491         *)
7492                 echo "$sym() NOT found." >&4;
7493                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7494         esac;;
7495 *)
7496         case "$was" in
7497         $define) echo "$sym() found." >&4;;
7498         *) echo "$sym() NOT found." >&4;;
7499         esac;;
7500 esac'
7501
7502 : see if dlopen exists
7503 xxx_runnm="$runnm"
7504 runnm=false
7505 set dlopen d_dlopen
7506 eval $inlibc
7507 runnm="$xxx_runnm"
7508
7509 : determine which dynamic loading, if any, to compile in
7510 echo " "
7511 dldir="ext/DynaLoader"
7512 case "$usedl" in
7513 $define|y|true)
7514         dflt='y'
7515         usedl="$define"
7516         ;;
7517 $undef|n|false)
7518         dflt='n'
7519         usedl="$undef"
7520         ;;
7521 *) 
7522         dflt='n'
7523         case "$d_dlopen" in
7524             $define) dflt='y' ;;
7525         esac
7526         case "$i_dld" in
7527             $define) dflt='y' ;;
7528         esac
7529         : Does a dl_xxx.xs file exist for this operating system
7530         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7531         ;;
7532 esac
7533 rp="Do you wish to use dynamic loading?"
7534 . ./myread
7535 usedl="$ans"
7536 case "$ans" in
7537 y*) usedl="$define"
7538         case "$dlsrc" in
7539         '')
7540                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7541                         dflt="$dldir/dl_${osname}.xs"
7542                 elif $test "$d_dlopen" = "$define" ; then
7543                         dflt="$dldir/dl_dlopen.xs"
7544                 elif $test "$i_dld" = "$define" ; then
7545                         dflt="$dldir/dl_dld.xs"
7546                 else
7547                         dflt=''
7548                 fi
7549                 ;;
7550         *)      dflt="$dldir/$dlsrc"
7551                 ;;
7552         esac
7553     echo "The following dynamic loading files are available:"
7554         : Can not go over to $dldir because getfile has path hard-coded in.
7555         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7556         rp="Source file to use for dynamic loading"
7557         fn="fne"
7558         gfpth="$src"
7559         . ./getfile
7560         usedl="$define"
7561         : emulate basename
7562         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7563
7564         $cat << EOM
7565
7566 Some systems may require passing special flags to $cc -c to
7567 compile modules that will be used to create a shared library.
7568 To use no flags, say "none".
7569
7570 EOM
7571     case "$cccdlflags" in
7572     '') case "$gccversion" in
7573                 '') case "$osname" in
7574                         hpux)   dflt='+z' ;;
7575                         next)   dflt='none' ;;
7576                         irix*)  dflt='-KPIC' ;;
7577                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7578                         sunos)  dflt='-pic' ;;
7579                         *)      dflt='none' ;;
7580                     esac
7581                         ;;
7582                 *)  case "$osname" in
7583                         darwin) dflt='none' ;;
7584                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7585                         *)      dflt='-fpic' ;;
7586                     esac ;;
7587             esac ;;
7588         ' ') dflt='none' ;;
7589     *)  dflt="$cccdlflags" ;;
7590     esac
7591     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7592     . ./myread
7593     case "$ans" in
7594     none) cccdlflags=' ' ;;
7595     *) cccdlflags="$ans" ;;
7596     esac
7597
7598     cat << EOM
7599
7600 Some systems use ld to create libraries that can be dynamically loaded,
7601 while other systems (such as those using ELF) use $cc.
7602
7603 EOM
7604         case "$ld" in
7605         '')     $cat >try.c <<EOM
7606 /* Test for whether ELF binaries are produced */
7607 #include <fcntl.h>
7608 #$i_stdlib I_STDLIB
7609 #ifdef I_STDLIB
7610 #include <stdlib.h>
7611 #endif
7612 int main() {
7613         char b[4];
7614         int i = open("a.out",O_RDONLY);
7615         if(i == -1) 
7616                 exit(1); /* fail */
7617         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7618                 exit(0); /* succeed (yes, it's ELF) */
7619         else
7620                 exit(1); /* fail */
7621 }
7622 EOM
7623                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7624                         cat <<EOM
7625 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7626 EOM
7627                         dflt="$cc"
7628                 else
7629                         echo "I'll use ld to build dynamic libraries."
7630                         dflt='ld'
7631                 fi
7632                 rm -f try.c a.out
7633                 ;;
7634         *)      dflt="$ld"
7635                 ;;
7636         esac
7637
7638     rp="What command should be used to create dynamic libraries?"
7639     . ./myread
7640         ld="$ans"
7641
7642     cat << EOM
7643
7644 Some systems may require passing special flags to $ld to create a
7645 library that can be dynamically loaded.  If your ld flags include
7646 -L/other/path options to locate libraries outside your loader's normal
7647 search path, you may need to specify those -L options here as well.  To
7648 use no flags, say "none".
7649
7650 EOM
7651     case "$lddlflags" in
7652     '') case "$osname" in
7653                         beos) dflt='-nostart' ;;
7654                         hpux) dflt='-b';
7655                               case "$gccversion" in
7656                               '') dflt="$dflt +vnocompatwarnings" ;;
7657                               esac
7658                               ;;        
7659                         linux|irix*|gnu*)       dflt='-shared' ;;
7660                         next)  dflt='none' ;;
7661                         solaris) dflt='-G' ;;
7662                         sunos) dflt='-assert nodefinitions' ;;
7663                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7664                 *)     dflt='none' ;;
7665                         esac
7666                         ;;
7667     *) dflt="$lddlflags" ;;
7668     esac
7669
7670         : Try to guess additional flags to pick up local libraries.
7671         : Be careful not to append to a plain 'none'
7672         case "$dflt" in
7673         none) dflt='' ;;
7674         esac
7675         for thisflag in $ldflags; do
7676                 case "$thisflag" in
7677                 -L*|-R*|-Wl,-R*)
7678                         case " $dflt " in
7679                         *" $thisflag "*) ;;
7680                         *) dflt="$dflt $thisflag" ;;
7681                         esac
7682                         ;;
7683                 esac
7684         done
7685
7686         case "$dflt" in
7687         ''|' ') dflt='none' ;;
7688         esac
7689
7690     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7691     . ./myread
7692     case "$ans" in
7693     none) lddlflags=' ' ;;
7694     *) lddlflags="$ans" ;;
7695     esac
7696
7697         cat <<EOM
7698
7699 Some systems may require passing special flags to $cc to indicate that
7700 the resulting executable will use dynamic linking.  To use no flags,
7701 say "none".
7702
7703 EOM
7704     case "$ccdlflags" in
7705     '') case "$osname" in
7706             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7707             next|sunos) dflt='none' ;;
7708             *)          dflt='none' ;;
7709             esac ;;
7710     ' ')  dflt='none' ;;
7711     *)  dflt="$ccdlflags" ;;
7712     esac
7713     rp="Any special flags to pass to $cc to use dynamic linking?"
7714     . ./myread
7715     case "$ans" in
7716     none) ccdlflags=' ' ;;
7717     *) ccdlflags="$ans" ;;
7718     esac
7719     ;;
7720 *)  usedl="$undef"
7721         ld='ld'
7722     dlsrc='dl_none.xs'
7723     lddlflags=''
7724     ccdlflags=''
7725     ;;
7726 esac
7727
7728 also=''
7729 case "$usedl" in
7730 $undef)
7731         # No dynamic loading being used, so don't bother even to prompt.
7732         useshrplib='false'
7733         ;;
7734 *)      case "$useshrplib" in
7735         '')     case "$osname" in
7736                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7737                         dflt=y
7738                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7739                         ;;
7740                 next*)
7741                         case "$osvers" in
7742                         4*)     dflt=y
7743                                 also='Building a shared libperl is needed for MAB support.'
7744                                 ;;
7745                         *)      dflt=n
7746                                 ;;
7747                         esac
7748                         ;;
7749                 *)      dflt=n
7750                         ;;
7751                 esac
7752                 ;;
7753         $define|true|[Yy]*)
7754                 dflt=y
7755                 ;;
7756         *)      dflt=n
7757                 ;;
7758         esac
7759         $cat << EOM
7760
7761 The perl executable is normally obtained by linking perlmain.c with
7762 libperl${_a}, any static extensions (usually just DynaLoader), and
7763 any other libraries needed on this system (such as -lm, etc.).  Since
7764 your system supports dynamic loading, it is probably possible to build
7765 a shared libperl.$so.  If you will have more than one executable linked
7766 to libperl.$so, this will significantly reduce the size of each
7767 executable, but it may have a noticeable effect on performance.  The
7768 default is probably sensible for your system.
7769 $also
7770
7771 EOM
7772         rp="Build a shared libperl.$so (y/n)"
7773         . ./myread
7774         case "$ans" in
7775         true|$define|[Yy]*)
7776                 useshrplib='true'  ;;
7777         *)      useshrplib='false' ;;
7778         esac
7779         ;;
7780 esac
7781
7782 case "$useshrplib" in
7783 true)
7784         case "$libperl" in
7785         '')
7786                 # Figure out a good name for libperl.so.  Since it gets stored in
7787                 # a version-specific architecture-dependent library, the version
7788                 # number isn't really that important, except for making cc/ld happy.
7789                 #
7790                 # A name such as libperl.so.3.1
7791                 majmin="libperl.$so.$patchlevel.$subversion"
7792                 # A name such as libperl.so.301
7793                 majonly=`echo $patchlevel $subversion |
7794                         $awk '{printf "%d%02d", $1, $2}'`
7795                 majonly=libperl.$so.$majonly
7796                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7797                 # rely on figuring it out from the naming of libc.
7798                 case "${osname}${osvers}" in
7799                 next4*)
7800                         dflt=libperl.5.$so
7801                         # XXX How handle the --version stuff for MAB?
7802                         ;;
7803                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7804                         dflt=libperl.$so
7805                         ;;
7806                 cygwin*) # ld links against an importlib
7807                         dflt=libperl$lib_ext
7808                         ;;
7809                 *)      # Try to guess based on whether libc has major.minor.
7810                         case "$libc" in
7811                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7812                         *libc.$so.[0-9]*) dflt=$majonly ;;
7813                         *)      dflt=libperl.$so ;;
7814                         esac
7815                         ;;
7816                 esac
7817                 ;;
7818         *)      dflt=$libperl
7819                 ;;
7820         esac
7821         cat << EOM
7822
7823 I need to select a good name for the shared libperl.  If your system uses
7824 library names with major and minor numbers, then you might want something
7825 like $majmin.  Alternatively, if your system uses a single version
7826 number for shared libraries, then you might want to use $majonly.
7827 Or, your system might be quite happy with a simple libperl.$so.
7828
7829 Since the shared libperl will get installed into a version-specific
7830 architecture-dependent directory, the version number of the shared perl
7831 library probably isn't important, so the default should be o.k.
7832
7833 EOM
7834         rp='What name do you want to give to the shared libperl?'
7835         . ./myread
7836         libperl=$ans
7837         echo "Ok, I'll use $libperl"
7838         ;;
7839 *)
7840         libperl="libperl${_a}"
7841         ;;
7842 esac
7843
7844 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7845 case "$shrpdir" in
7846 '') ;;
7847 *)      $cat >&4 <<EOM
7848 WARNING:  Use of the shrpdir variable for the installation location of
7849 the shared $libperl is not supported.  It was never documented and
7850 will not work in this version.  Let me (perlbug@perl.org)
7851 know of any problems this may cause.
7852
7853 EOM
7854         case "$shrpdir" in
7855         "$archlibexp/CORE")
7856                 $cat >&4 <<EOM
7857 But your current setting of $shrpdir is
7858 the default anyway, so it's harmless.
7859 EOM
7860                 ;;
7861         *)
7862                 $cat >&4 <<EOM
7863 Further, your current attempted setting of $shrpdir
7864 conflicts with the value of $archlibexp/CORE
7865 that installperl will use.
7866 EOM
7867                 ;;
7868         esac
7869         ;;
7870 esac
7871
7872 # How will the perl executable find the installed shared $libperl?
7873 # Add $xxx to ccdlflags.
7874 # If we can't figure out a command-line option, use $shrpenv to
7875 # set env LD_RUN_PATH.  The main perl makefile uses this.
7876 shrpdir=$archlibexp/CORE
7877 xxx=''
7878 tmp_shrpenv=''
7879 if "$useshrplib"; then
7880     case "$osname" in 
7881         aix)
7882                 # We'll set it in Makefile.SH...
7883                 ;;
7884         solaris)
7885                 xxx="-R $shrpdir"
7886                 ;;
7887         freebsd|netbsd|openbsd|interix)
7888                 xxx="-Wl,-R$shrpdir"
7889                 ;;
7890         bsdos|linux|irix*|dec_osf|gnu*)
7891                 xxx="-Wl,-rpath,$shrpdir"
7892                 ;;
7893         next)
7894                 # next doesn't like the default...
7895                 ;;
7896         beos)
7897                 # beos doesn't like the default, either.
7898                 ;;
7899         hpux*)
7900                 # hpux doesn't like the default, either.
7901                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7902                 ;;
7903         *)
7904                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7905                 ;;
7906         esac
7907         case "$xxx" in
7908         '') ;;
7909         *)      
7910                 # Only add $xxx if it isn't already in ccdlflags.
7911                 case " $ccdlflags " in
7912                 *" $xxx "*)     ;;
7913                 *)      ccdlflags="$ccdlflags $xxx"
7914                         cat <<EOM >&4
7915
7916 Adding $xxx to the flags
7917 passed to $ld so that the perl executable will find the 
7918 installed shared $libperl.
7919
7920 EOM
7921                         ;;
7922                 esac
7923                 ;;
7924         esac
7925 fi
7926 # Fix ccdlflags in AIX for building external extensions.
7927 # (For building Perl itself bare -bE:perl.exp is needed,
7928 #  Makefile.SH takes care of this.)
7929 case "$osname" in
7930 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7931 esac
7932 # Respect a hint or command-line value.
7933 case "$shrpenv" in
7934 '') shrpenv="$tmp_shrpenv" ;;
7935 esac
7936 case "$ldlibpthname" in
7937 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7938 none)   ldlibpthname='' ;;
7939 esac
7940
7941 : determine where manual pages are on this system
7942 echo " "
7943 case "$sysman" in
7944 '') 
7945         syspath='/usr/share/man/man1 /usr/man/man1'
7946         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7947         syspath="$syspath /usr/man/u_man/man1"
7948         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7949         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7950         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7951         sysman=`./loc . /usr/man/man1 $syspath`
7952         ;;
7953 esac
7954 if $test -d "$sysman"; then
7955         echo "System manual is in $sysman." >&4
7956 else
7957         echo "Could not find manual pages in source form." >&4
7958 fi
7959
7960 : determine where manual pages go
7961 set man1dir man1dir none
7962 eval $prefixit
7963 $cat <<EOM
7964
7965 $spackage has manual pages available in source form.
7966 EOM
7967 case "$nroff" in
7968 nroff)
7969         echo "However, you don't have nroff, so they're probably useless to you."
7970         case "$man1dir" in
7971         '') man1dir="none";;
7972         esac;;
7973 esac
7974 echo "If you don't want the manual sources installed, answer 'none'."
7975 case "$man1dir" in
7976 ' ') dflt=none
7977         ;;
7978 '')
7979         lookpath="$prefixexp/share/man/man1"
7980         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7981         lookpath="$lookpath $prefixexp/man/p_man/man1"
7982         lookpath="$lookpath $prefixexp/man/u_man/man1"
7983         lookpath="$lookpath $prefixexp/man/man.1"
7984         case "$sysman" in
7985         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7986         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7987         esac
7988         set dflt
7989         eval $prefixup
7990         ;;
7991 *)  dflt="$man1dir"
7992         ;;
7993 esac
7994 echo " "
7995 fn=dn+~
7996 rp="Where do the main $spackage manual pages (source) go?"
7997 . ./getfile
7998 if $test "X$man1direxp" != "X$ansexp"; then
7999         installman1dir=''
8000 fi
8001 man1dir="$ans"
8002 man1direxp="$ansexp"
8003 case "$man1dir" in
8004 '')     man1dir=' '
8005         installman1dir='';;
8006 esac
8007
8008 : Change installation prefix, if necessary.
8009 if $test X"$prefix" != X"$installprefix"; then
8010         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8011 else
8012         installman1dir="$man1direxp"
8013 fi
8014
8015 : What suffix to use on installed man pages
8016
8017 case "$man1dir" in
8018 ' ')
8019         man1ext='0'
8020         ;;
8021 *)
8022         rp="What suffix should be used for the main $spackage man pages?"
8023         case "$man1ext" in
8024         '')     case "$man1dir" in
8025                 *1)  dflt=1 ;;
8026                 *1p) dflt=1p ;;
8027                 *1pm) dflt=1pm ;;
8028                 *l) dflt=l;;
8029                 *n) dflt=n;;
8030                 *o) dflt=o;;
8031                 *p) dflt=p;;
8032                 *C) dflt=C;;
8033                 *L) dflt=L;;
8034                 *L1) dflt=L1;;
8035                 *) dflt=1;;
8036                 esac
8037                 ;;
8038         *)      dflt="$man1ext";;
8039         esac
8040         . ./myread
8041         man1ext="$ans"
8042         ;;
8043 esac
8044
8045 : see if we can have long filenames
8046 echo " "
8047 first=123456789abcdef
8048 $rm -f $first
8049 if (echo hi >$first) 2>/dev/null; then
8050         if $test -f 123456789abcde; then
8051                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8052                 val="$undef"
8053         else
8054                 echo 'You can have filenames longer than 14 characters.'>&4
8055                 val="$define"
8056         fi
8057 else
8058         $cat <<'EOM'
8059 You can't have filenames longer than 14 chars.
8060 You can't even think about them!
8061 EOM
8062         val="$undef"
8063 fi 
8064 set d_flexfnam
8065 eval $setvar
8066 $rm -rf 123456789abcde*
8067
8068 : determine where library module manual pages go
8069 set man3dir man3dir none
8070 eval $prefixit
8071 $cat <<EOM
8072
8073 $spackage has manual pages for many of the library modules.
8074 EOM
8075
8076 case "$nroff" in
8077 nroff)
8078         $cat <<'EOM'
8079 However, you don't have nroff, so they're probably useless to you.
8080 EOM
8081         case "$man3dir" in
8082         '') man3dir="none";;
8083         esac;;
8084 esac
8085
8086 case "$d_flexfnam" in
8087 undef)
8088         $cat <<'EOM'
8089 However, your system can't handle the long file names like File::Basename.3. 
8090 EOM
8091         case "$man3dir" in
8092         '') man3dir="none";;
8093         esac;;
8094 esac
8095
8096 echo "If you don't want the manual sources installed, answer 'none'."
8097 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8098 case "$man3dir" in
8099 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8100         if $test -d "$privlib/man/man3"; then
8101                 cat <<EOM >&4
8102
8103 WARNING:  Previous versions of perl installed man3 pages into
8104 $privlib/man/man3.  This version will suggest a 
8105 new default of $dflt.  
8106 EOM
8107                 tdflt=$dflt
8108                 dflt='n'
8109                 rp='Do you wish to preserve the old behavior?(y/n)'
8110                 . ./myread
8111                 case "$ans" in
8112                 y*) dflt="$privlib/man/man3" ;;
8113                 *)  dflt=$tdflt ;;
8114                 esac
8115     fi
8116         ;;
8117 *)      dflt="$man3dir" ;;
8118 esac
8119 case "$dflt" in
8120 ' ') dflt=none ;;
8121 esac
8122 echo " "
8123 fn=dn+~
8124 rp="Where do the $package library man pages (source) go?"
8125 . ./getfile
8126 man3dir="$ans"
8127 man3direxp="$ansexp"
8128 case "$man3dir" in
8129 '')     man3dir=' '
8130         installman3dir='';;
8131 esac
8132
8133 : Change installation prefix, if necessary.
8134 if $test X"$prefix" != X"$installprefix"; then
8135         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8136 else
8137         installman3dir="$man3direxp"
8138 fi
8139
8140 : What suffix to use on installed man pages
8141 case "$man3dir" in
8142 ' ')
8143         man3ext='0'
8144         ;;
8145 *)
8146         rp="What suffix should be used for the $package library man pages?"
8147         case "$man3ext" in
8148         '')     case "$man3dir" in
8149                 *3)  dflt=3 ;;
8150                 *3p) dflt=3p ;;
8151                 *3pm) dflt=3pm ;;
8152                 *l) dflt=l;;
8153                 *n) dflt=n;;
8154                 *o) dflt=o;;
8155                 *p) dflt=p;;
8156                 *C) dflt=C;;
8157                 *L) dflt=L;;
8158                 *L3) dflt=L3;;
8159                 *) dflt=3;;
8160                 esac
8161                 ;;
8162         *)      dflt="$man3ext";;
8163         esac
8164         . ./myread
8165         man3ext="$ans"
8166         ;;
8167 esac
8168
8169 : see if we have to deal with yellow pages, now NIS.
8170 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8171         if $test -f /usr/etc/nibindd; then
8172                 echo " "
8173                 echo "I'm fairly confident you're on a NeXT."
8174                 echo " "
8175                 rp='Do you get the hosts file via NetInfo?'
8176                 dflt=y
8177                 case "$hostcat" in
8178                 nidump*) ;;
8179                 '') ;;
8180                 *) dflt=n;;
8181                 esac
8182                 . ./myread
8183                 case "$ans" in
8184                 y*) hostcat='nidump hosts .';;
8185                 *)      case "$hostcat" in
8186                         nidump*) hostcat='';;
8187                         esac
8188                         ;;
8189                 esac
8190         fi
8191         case "$hostcat" in
8192         nidump*) ;;
8193         *)
8194                 case "$hostcat" in
8195                 *ypcat*) dflt=y;;
8196                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8197                                 dflt=y
8198                         else
8199                                 dflt=n
8200                         fi;;
8201                 *) dflt=n;;
8202                 esac
8203                 echo " "
8204                 rp='Are you getting the hosts file via yellow pages?'
8205                 . ./myread
8206                 case "$ans" in
8207                 y*) hostcat='ypcat hosts';;
8208                 *) hostcat='cat /etc/hosts';;
8209                 esac
8210                 ;;
8211         esac
8212 fi
8213 case "$hostcat" in
8214 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8215 esac
8216 case "$groupcat" in
8217 '') test -f /etc/group && groupcat='cat /etc/group';;
8218 esac
8219 case "$passcat" in
8220 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8221 esac
8222
8223 : now get the host name
8224 echo " "
8225 echo "Figuring out host name..." >&4
8226 case "$myhostname" in
8227 '') cont=true
8228         echo 'Maybe "hostname" will work...'
8229         if tans=`sh -c hostname 2>&1` ; then
8230                 myhostname=$tans
8231                 phostname=hostname
8232                 cont=''
8233         fi
8234         ;;
8235 *) cont='';;
8236 esac
8237 if $test "$cont"; then
8238         if ./xenix; then
8239                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8240                 if tans=`cat /etc/systemid 2>&1` ; then
8241                         myhostname=$tans
8242                         phostname='cat /etc/systemid'
8243                         echo "Whadyaknow.  Xenix always was a bit strange..."
8244                         cont=''
8245                 fi
8246         elif $test -r /etc/systemid; then
8247                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8248         fi
8249 fi
8250 if $test "$cont"; then
8251         echo 'No, maybe "uuname -l" will work...'
8252         if tans=`sh -c 'uuname -l' 2>&1` ; then
8253                 myhostname=$tans
8254                 phostname='uuname -l'
8255         else
8256                 echo 'Strange.  Maybe "uname -n" will work...'
8257                 if tans=`sh -c 'uname -n' 2>&1` ; then
8258                         myhostname=$tans
8259                         phostname='uname -n'
8260                 else
8261                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8262                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8263                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8264                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8265                         else
8266                                 case "$myhostname" in
8267                                 '') echo "Does this machine have an identity crisis or something?"
8268                                         phostname='';;
8269                                 *)
8270                                         echo "Well, you said $myhostname before..."
8271                                         phostname='echo $myhostname';;
8272                                 esac
8273                         fi
8274                 fi
8275         fi
8276 fi
8277 case "$myhostname" in
8278 '') myhostname=noname ;;
8279 esac
8280 : you do not want to know about this
8281 set $myhostname
8282 myhostname=$1
8283
8284 : verify guess
8285 if $test "$myhostname" ; then
8286         dflt=y
8287         rp='Your host name appears to be "'$myhostname'".'" Right?"
8288         . ./myread
8289         case "$ans" in
8290         y*) ;;
8291         *) myhostname='';;
8292         esac
8293 fi
8294
8295 : bad guess or no guess
8296 while $test "X$myhostname" = X ; do
8297         dflt=''
8298         rp="Please type the (one word) name of your host:"
8299         . ./myread
8300         myhostname="$ans"
8301 done
8302
8303 : translate upper to lower if necessary
8304 case "$myhostname" in
8305 *[A-Z]*)
8306         echo "(Normalizing case in your host name)"
8307         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8308         ;;
8309 esac
8310
8311 case "$myhostname" in
8312 *.*)
8313         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8314         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8315         echo "(Trimming domain name from host name--host name is now $myhostname)"
8316         ;;
8317 *) case "$mydomain" in
8318         '')
8319                 {
8320                         test "X$hostcat" = "Xypcat hosts" &&
8321                         ypmatch "$myhostname" hosts 2>/dev/null |\
8322                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8323                         $test -s hosts
8324                 } || {
8325                         test "X$hostcat" != "X" &&
8326                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8327                                         /[       ]$myhostname[  . ]/p" > hosts
8328                 }
8329                 tmp_re="[       . ]"
8330                 if $test -f hosts; then
8331                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8332                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8333                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8334                                 hosts | $sort | $uniq | \
8335                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8336                         case `$echo X$dflt` in
8337                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8338                                 dflt=.
8339                                 ;;
8340                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8341                                 ;;
8342                         esac
8343                 else
8344                         echo "(I cannot locate a hosts database anywhere)"
8345                         dflt=.
8346                 fi
8347                 case "$dflt" in
8348                 .)
8349                         tans=`./loc resolv.conf X /etc /usr/etc`
8350                         if $test -f "$tans"; then
8351                                 echo "(Attempting domain name extraction from $tans)"
8352                                 dflt=.`$sed -n -e 's/   / /g' \
8353                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8354                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8355                                 case "$dflt" in
8356                                 .) dflt=.`$sed -n -e 's/        / /g' \
8357                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8358                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8359                                         ;;
8360                                 esac
8361                         fi
8362                         ;;
8363                 esac
8364                 case "$dflt" in
8365                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8366                         dflt=.`sh -c domainname 2>/dev/null`
8367                         case "$dflt" in
8368                         '') dflt='.';;
8369                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8370                         esac
8371                         ;;
8372                 esac
8373                 case "$dflt$osname" in
8374                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8375                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8376                         ;;
8377                 esac
8378                 case "$dflt" in
8379                 .) echo "(Lost all hope -- silly guess then)"
8380                         dflt='.nonet'
8381                         ;;
8382                 esac
8383                 $rm -f hosts
8384                 ;;
8385         *) dflt="$mydomain";;
8386         esac;;
8387 esac
8388 echo " "
8389 rp="What is your domain name?"
8390 . ./myread
8391 tans="$ans"
8392 case "$ans" in
8393 '') ;;
8394 .*) ;;
8395 *) tans=".$tans";;
8396 esac
8397 mydomain="$tans"
8398
8399 : translate upper to lower if necessary
8400 case "$mydomain" in
8401 *[A-Z]*)
8402         echo "(Normalizing case in your domain name)"
8403         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8404         ;;
8405 esac
8406
8407 : a little sanity check here
8408 case "$phostname" in
8409 '') ;;
8410 *)
8411         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8412         $myhostname$mydomain|$myhostname) ;;
8413         *)
8414                 case "$phostname" in
8415                 sed*)
8416                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8417                         ;;
8418                 *)
8419                         echo "(That doesn't agree with your $phostname command, by the way.)"
8420                         ;;
8421                 esac
8422         ;;
8423         esac
8424         ;;
8425 esac
8426
8427 $cat <<EOM
8428
8429 I need to get your e-mail address in Internet format if possible, i.e.
8430 something like user@host.domain. Please answer accurately since I have
8431 no easy means to double check it. The default value provided below
8432 is most probably close to reality but may not be valid from outside
8433 your organization...
8434
8435 EOM
8436 cont=x
8437 while test "$cont"; do
8438         case "$cf_email" in
8439         '') dflt="$cf_by@$myhostname$mydomain";;
8440         *) dflt="$cf_email";;
8441         esac
8442         rp='What is your e-mail address?'
8443         . ./myread
8444         cf_email="$ans"
8445         case "$cf_email" in
8446         *@*.*) cont='' ;;
8447         *)
8448                 rp='Address does not look like an Internet one.  Use it anyway?'
8449                 case "$fastread" in
8450                 yes) dflt=y ;;
8451                 *) dflt=n ;;
8452                 esac
8453                 . ./myread
8454                 case "$ans" in
8455                 y*) cont='' ;;
8456                 *) echo " " ;;
8457                 esac
8458                 ;;
8459         esac
8460 done
8461
8462 $cat <<EOM
8463
8464 If you or somebody else will be maintaining perl at your site, please
8465 fill in the correct e-mail address here so that they may be contacted
8466 if necessary. Currently, the "perlbug" program included with perl
8467 will send mail to this address in addition to perlbug@perl.org. You may
8468 enter "none" for no administrator.
8469
8470 EOM
8471 case "$perladmin" in
8472 '') dflt="$cf_email";;
8473 *) dflt="$perladmin";;
8474 esac
8475 rp='Perl administrator e-mail address'
8476 . ./myread
8477 perladmin="$ans"
8478
8479 : determine whether to only install version-specific parts.
8480 echo " "
8481 $cat <<EOM
8482 Do you want to install only the version-specific parts of the perl
8483 distribution?  Usually you do *not* want to do this.
8484 EOM
8485 case "$versiononly" in
8486 "$define"|[Yy]*|true) dflt='y' ;;
8487 *) dflt='n';
8488 esac
8489 rp="Do you want to install only the version-specific parts of perl?"
8490 . ./myread
8491 case "$ans" in
8492 [yY]*)  val="$define";;
8493 *)      val="$undef" ;;
8494 esac
8495 set versiononly
8496 eval $setvar
8497
8498 case "$versiononly" in
8499 "$define") inc_version_list=''
8500            inc_version_list_init=0
8501            ;;
8502 esac
8503
8504 : figure out how to guarantee perl startup
8505 case "$startperl" in
8506 '')
8507         case "$sharpbang" in
8508         *!)
8509                 $cat <<EOH
8510
8511 I can use the #! construct to start perl on your system. This will
8512 make startup of perl scripts faster, but may cause problems if you
8513 want to share those scripts and perl is not in a standard place
8514 ($binexp/perl) on all your platforms. The alternative is to force
8515 a shell by starting the script with a single ':' character.
8516
8517 EOH
8518                 case "$versiononly" in
8519                 "$define")      dflt="$binexp/perl$version";;  
8520                 *)              dflt="$binexp/perl";;
8521                 esac
8522                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8523                 . ./myread
8524                 case "$ans" in
8525                 none)   startperl=": # use perl";;
8526                 *)      startperl="#!$ans"
8527                         if $test 30 -lt `echo "$ans" | wc -c`; then
8528                                 $cat >&4 <<EOM
8529
8530 WARNING:  Some systems limit the #! command to 32 characters.
8531 If you experience difficulty running Perl scripts with #!, try
8532 installing Perl in a directory with a shorter pathname.
8533
8534 EOM
8535                         fi ;;
8536                 esac
8537                 ;;
8538         *) startperl=": # use perl"
8539                 ;;
8540         esac
8541         ;;
8542 esac
8543 echo "I'll use $startperl to start perl scripts."
8544
8545 : figure best path for perl in scripts
8546 case "$perlpath" in
8547 '')
8548         case "$versiononly" in
8549         "$define")      perlpath="$binexp/perl$version";;
8550         *)              perlpath="$binexp/perl";;
8551         esac
8552         case "$startperl" in
8553         *!*) ;;
8554         *)
8555                 $cat <<EOH
8556
8557 I will use the "eval 'exec'" idiom to start Perl on your system.
8558 I can use the full path of your Perl binary for this purpose, but
8559 doing so may cause problems if you want to share those scripts and
8560 Perl is not always in a standard place ($binexp/perl).
8561
8562 EOH
8563                 dflt="$binexp/perl"
8564                 rp="What path shall I use in \"eval 'exec'\"?"
8565                 . ./myread
8566                 perlpath="$ans"
8567                 ;;
8568         esac
8569         ;;
8570 esac
8571 case "$startperl" in
8572 *!*)    ;;
8573 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8574 esac
8575
8576 : determine where public executable scripts go
8577 set scriptdir scriptdir
8578 eval $prefixit
8579 case "$scriptdir" in
8580 '')
8581         dflt="$bin"
8582         : guess some guesses
8583         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8584         $test -d /usr/share/bin     && dflt=/usr/share/bin
8585         $test -d /usr/local/script  && dflt=/usr/local/script
8586         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8587         $test -d $prefixexp/script  && dflt=$prefixexp/script
8588         set dflt
8589         eval $prefixup
8590         ;;
8591 *)  dflt="$scriptdir"
8592         ;;
8593 esac
8594 $cat <<EOM
8595  
8596 Some installations have a separate directory just for executable scripts so
8597 that they can mount it across multiple architectures but keep the scripts in
8598 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8599 Or you might just lump your scripts in with all your other executables.
8600  
8601 EOM
8602 fn=d~
8603 rp='Where do you keep publicly executable scripts?'
8604 . ./getfile
8605 if $test "X$ansexp" != "X$scriptdirexp"; then
8606         installscript=''
8607 fi
8608 scriptdir="$ans"
8609 scriptdirexp="$ansexp"
8610 : Change installation prefix, if necessary.
8611 if $test X"$prefix" != X"$installprefix"; then
8612         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8613 else
8614         installscript="$scriptdirexp"
8615 fi
8616
8617 : determine where add-on public executables go
8618 case "$sitebin" in
8619 '')     dflt=$siteprefix/bin ;;
8620 *)      dflt=$sitebin ;;
8621 esac
8622 fn=d~
8623 rp='Pathname where the add-on public executables should be installed?'
8624 . ./getfile
8625 sitebin="$ans"
8626 sitebinexp="$ansexp"
8627 : Change installation prefix, if necessary.
8628 if $test X"$prefix" != X"$installprefix"; then
8629         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8630 else
8631         installsitebin="$sitebinexp"
8632 fi
8633
8634 : determine where add-on html pages go
8635 : There is no standard location, so try to copy the previously-selected
8636 : directory structure for the core html pages.
8637 case "$sitehtml1dir" in
8638 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8639 *)     dflt=$sitehtml1dir ;;
8640 esac
8641 case "$dflt" in
8642 ''|' ') dflt=none ;;
8643 esac
8644 fn=dn+~
8645 rp='Pathname where the site-specific html pages should be installed?'
8646 . ./getfile
8647 sitehtml1dir="$ans"
8648 sitehtml1direxp="$ansexp"
8649 : Change installation prefix, if necessary.
8650 if $test X"$prefix" != X"$installprefix"; then
8651         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8652 else
8653         installsitehtml1dir="$sitehtml1direxp"
8654 fi
8655
8656 : determine where add-on library html pages go
8657 : There is no standard location, so try to copy the previously-selected
8658 : directory structure for the core html pages.
8659 case "$sitehtml3dir" in
8660 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8661 *)     dflt=$sitehtml3dir ;;
8662 esac
8663 case "$dflt" in
8664 ''|' ') dflt=none ;;
8665 esac
8666 fn=dn+~
8667 rp='Pathname where the site-specific library html pages should be installed?'
8668 . ./getfile
8669 sitehtml3dir="$ans"
8670 sitehtml3direxp="$ansexp"
8671 : Change installation prefix, if necessary.
8672 if $test X"$prefix" != X"$installprefix"; then
8673         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8674 else
8675         installsitehtml3dir="$sitehtml3direxp"
8676 fi
8677
8678 : determine where add-on manual pages go
8679 case "$siteman1dir" in
8680 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8681 *)      dflt=$siteman1dir ;;
8682 esac
8683 case "$dflt" in
8684 ''|' ') dflt=none ;;
8685 esac
8686 fn=dn+~
8687 rp='Pathname where the site-specific manual pages should be installed?'
8688 . ./getfile
8689 siteman1dir="$ans"
8690 siteman1direxp="$ansexp"
8691 : Change installation prefix, if necessary.
8692 if $test X"$prefix" != X"$installprefix"; then
8693         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8694 else
8695         installsiteman1dir="$siteman1direxp"
8696 fi
8697
8698 : determine where add-on library man pages go
8699 case "$siteman3dir" in
8700 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8701 *)      dflt=$siteman3dir ;;
8702 esac
8703 case "$dflt" in
8704 ''|' ') dflt=none ;;
8705 esac
8706 fn=dn+~
8707 rp='Pathname where the site-specific library manual pages should be installed?'
8708 . ./getfile
8709 siteman3dir="$ans"
8710 siteman3direxp="$ansexp"
8711 : Change installation prefix, if necessary.
8712 if $test X"$prefix" != X"$installprefix"; then
8713         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8714 else
8715         installsiteman3dir="$siteman3direxp"
8716 fi
8717
8718 : determine where add-on public executable scripts go
8719 case "$sitescript" in
8720 '')     dflt=$siteprefix/script
8721         $test -d $dflt || dflt=$sitebin ;;
8722 *)  dflt="$sitescript" ;;
8723 esac
8724 fn=d~+
8725 rp='Pathname where add-on public executable scripts should be installed?'
8726 . ./getfile
8727 sitescript="$ans"
8728 sitescriptexp="$ansexp"
8729 : Change installation prefix, if necessary.
8730 if $test X"$prefix" != X"$installprefix"; then
8731         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8732 else
8733         installsitescript="$sitescriptexp"
8734 fi
8735
8736 case "$usefaststdio" in
8737 $define|true|[yY]*|'')
8738         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8739         case "$xversion" in
8740         [68])   dflt='y' ;;
8741         *)      dflt='n' ;;
8742         esac
8743         ;;
8744 *) dflt='n';;
8745 esac
8746 cat <<EOM
8747
8748 Perl can be built to use 'fast stdio', which means using the stdio
8749 library but also directly manipulating the stdio buffers to enable
8750 faster I/O.  Using stdio is better for backward compatibility (especially
8751 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8752 interface has been preferred instead of stdio.
8753
8754 If this doesn't make any sense to you, just accept the default '$dflt'.
8755 EOM
8756 rp='Use the "fast stdio" if available?'
8757 . ./myread
8758 case "$ans" in
8759 y|Y)    val="$define" ;;     
8760 *)      val="$undef" ;;
8761 esac
8762 set usefaststdio
8763 eval $setvar
8764
8765
8766 : define an is-a-typedef? function
8767 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8768 case "$inclist" in
8769 "") inclist="sys/types.h";;
8770 esac;
8771 eval "varval=\$$var";
8772 case "$varval" in
8773 "")
8774         $rm -f temp.c;
8775         for inc in $inclist; do
8776                 echo "#include <$inc>" >>temp.c;
8777         done;
8778         echo "#ifdef $type" >> temp.c;
8779         echo "printf(\"We have $type\");" >> temp.c;
8780         echo "#endif" >> temp.c;
8781         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8782         if $contains $type temp.E >/dev/null 2>&1; then
8783                 eval "$var=\$type";
8784         else
8785                 eval "$var=\$def";
8786         fi;
8787         $rm -f temp.?;;
8788 *) eval "$var=\$varval";;
8789 esac'
8790
8791 : define an is-a-typedef? function that prompts if the type is not available.
8792 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8793 case "$inclist" in
8794 "") inclist="sys/types.h";;
8795 esac;
8796 eval "varval=\$$var";
8797 case "$varval" in
8798 "")
8799         $rm -f temp.c;
8800         for inc in $inclist; do
8801                 echo "#include <$inc>" >>temp.c;
8802         done;
8803         echo "#ifdef $type" >> temp.c;
8804         echo "printf(\"We have $type\");" >> temp.c;
8805         echo "#endif" >> temp.c;
8806         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8807         echo " " ;
8808         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8809         if $contains $type temp.E >/dev/null 2>&1; then
8810                 echo "$type found." >&4;
8811                 eval "$var=\$type";
8812         else
8813                 echo "$type NOT found." >&4;
8814                 dflt="$def";
8815                 . ./myread ;
8816                 eval "$var=\$ans";
8817         fi;
8818         $rm -f temp.?;;
8819 *) eval "$var=\$varval";;
8820 esac'
8821
8822 : see what type lseek is declared as in the kernel
8823 rp="What is the type used for lseek's offset on this system?"
8824 set off_t lseektype long stdio.h sys/types.h
8825 eval $typedef_ask
8826
8827 echo " "
8828 echo "Checking to see how big your file offsets are..." >&4
8829 $cat >try.c <<EOCP
8830 #include <sys/types.h>
8831 #include <stdio.h>
8832 int main()
8833 {
8834     printf("%d\n", (int)sizeof($lseektype));
8835     return(0); 
8836 }
8837 EOCP
8838 set try
8839 if eval $compile_ok; then
8840         lseeksize=`$run ./try`
8841         echo "Your file offsets are $lseeksize bytes long."
8842 else
8843         dflt=$longsize
8844         echo " "
8845         echo "(I can't seem to compile the test program.  Guessing...)"
8846         rp="What is the size of your file offsets (in bytes)?"
8847         . ./myread
8848         lseeksize="$ans"
8849 fi
8850 $rm -f try.c try
8851
8852 : see what type file positions are declared as in the library
8853 rp="What is the type for file position used by fsetpos()?"
8854 set fpos_t fpostype long stdio.h sys/types.h
8855 eval $typedef_ask
8856
8857 echo " "
8858 case "$fpostype" in
8859 *_t) zzz="$fpostype"    ;;
8860 *)   zzz="fpos_t"       ;;
8861 esac
8862 echo "Checking the size of $zzz..." >&4 
8863 cat > try.c <<EOCP
8864 #include <sys/types.h>
8865 #include <stdio.h>
8866 #$i_stdlib I_STDLIB
8867 #ifdef I_STDLIB
8868 #include <stdlib.h>
8869 #endif
8870 int main() {
8871     printf("%d\n", (int)sizeof($fpostype));
8872     exit(0);
8873 }
8874 EOCP
8875 set try
8876 if eval $compile_ok; then
8877         yyy=`$run ./try`
8878         case "$yyy" in
8879         '')     fpossize=4
8880                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8881                 ;;
8882         *)      fpossize=$yyy
8883                 echo "Your $zzz is $fpossize bytes long."
8884                 ;;
8885         esac
8886 else
8887         dflt="$longsize"
8888         echo " " >&4
8889         echo "(I can't compile the test program.  Guessing...)" >&4
8890         rp="What is the size of your file positions (in bytes)?"
8891         . ./myread
8892         fpossize="$ans"
8893 fi
8894
8895 # Backward compatibility (uselfs is deprecated).
8896 case "$uselfs" in
8897 "$define"|true|[yY]*)
8898         cat <<EOM >&4
8899
8900 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8901 EOM
8902         uselargefiles="$define"
8903         ;;
8904 esac                          
8905
8906 case "$lseeksize:$fpossize" in
8907 8:8) cat <<EOM
8908
8909 You can have files larger than 2 gigabytes.
8910 EOM
8911    val="$define" ;;
8912 *)    case "$uselargefiles" in
8913    "$undef"|false|[nN]*) dflt='n' ;;
8914    *)   dflt='y' ;;
8915    esac
8916    cat <<EOM
8917
8918 Perl can be built to understand large files (files larger than 2 gigabytes)
8919 on some systems.  To do so, Configure can be run with -Duselargefiles.
8920
8921 If this doesn't make any sense to you, just accept the default '$dflt'.
8922 EOM
8923    rp='Try to understand large files, if available?'
8924    . ./myread
8925    case "$ans" in
8926    y|Y)         val="$define" ;;
8927    *)           val="$undef"  ;;
8928    esac
8929    ;;
8930 esac
8931 set uselargefiles
8932 eval $setvar
8933 : Look for a hint-file generated 'call-back-unit'.  If the
8934 : user has specified that a large files perl is to be built,
8935 : we may need to set or change some other defaults.
8936 if $test -f uselargefiles.cbu; then
8937         echo "Your platform has some specific hints regarding large file builds, using them..."
8938         . ./uselargefiles.cbu
8939 fi
8940 case "$uselargefiles" in
8941 "$define")
8942         if $test -f uselargefiles.cbu; then
8943                 echo " "
8944                 echo "Rechecking to see how big your file offsets are..." >&4
8945                 $cat >try.c <<EOCP
8946 #include <sys/types.h>
8947 #include <stdio.h>
8948 int main()
8949 {
8950     printf("%d\n", (int)sizeof($lseektype));
8951     return(0); 
8952 }
8953 EOCP
8954                 set try
8955                 if eval $compile_ok; then
8956                         lseeksize=`$run ./try`
8957                         $echo "Your file offsets are now $lseeksize bytes long."
8958                 else
8959                         dflt="$lseeksize"
8960                         echo " "
8961                         echo "(I can't seem to compile the test program.  Guessing...)"
8962                         rp="What is the size of your file offsets (in bytes)?"
8963                         . ./myread
8964                         lseeksize="$ans"
8965                 fi
8966                 case "$fpostype" in
8967                 *_t) zzz="$fpostype"    ;;
8968                 *)   zzz="fpos_t"       ;;
8969                 esac
8970                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8971                 $cat > try.c <<EOCP
8972 #include <sys/types.h>
8973 #include <stdio.h>
8974 #$i_stdlib I_STDLIB
8975 #ifdef I_STDLIB
8976 #include <stdlib.h>
8977 #endif
8978 int main() {
8979     printf("%d\n", (int)sizeof($fpostype));
8980     return(0);
8981 }
8982 EOCP
8983                 set try
8984                 if eval $compile_ok; then
8985                         yyy=`$run ./try`
8986                         dflt="$lseeksize"
8987                         case "$yyy" in
8988                         '')     echo " "
8989                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8990                                 ;;
8991                         *)      fpossize=$yyy
8992                                 echo " $fpossize bytes." >&4
8993                                 ;;
8994                         esac
8995                 else
8996                         dflt="$fpossize"
8997                         echo " "
8998                         echo "(I can't compile the test program.  Guessing...)" >&4
8999                         rp="What is the size of your file positions (in bytes)?"
9000                         . ./myread
9001                         fpossize="$ans"
9002                 fi
9003                 $rm -f try.c try
9004         fi
9005         ;;
9006 esac
9007
9008 # probably will refer to
9009 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9010 need_relocation=0
9011 userelocatableinc=undef
9012
9013 case "$vendorprefix" in
9014 '')     d_vendorbin="$undef"
9015         vendorbin=''
9016         vendorbinexp=''
9017         ;;
9018 *)      d_vendorbin="$define"
9019         : determine where vendor-supplied executables go.
9020         case "$vendorbin" in
9021         '') dflt=$vendorprefix/bin ;;
9022         *)      dflt="$vendorbin" ;;
9023         esac
9024         fn=d~+
9025         rp='Pathname for the vendor-supplied executables directory?'
9026         . ./getfile
9027         vendorbin="$ans"
9028         vendorbinexp="$ansexp"
9029         ;;
9030 esac
9031 : Change installation prefix, if necessary.
9032 if $test X"$prefix" != X"$installprefix"; then
9033         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9034 else
9035         installvendorbin="$vendorbinexp"
9036 fi
9037
9038 case "$vendorprefix" in
9039 '')     vendorhtml1dir=''
9040         vendorhtml1direxp=''
9041         ;;
9042 *)      : determine where vendor-supplied html pages go.
9043         : There is no standard location, so try to copy the previously-selected
9044         : directory structure for the core html pages.
9045         : XXX Better default suggestions would be welcome.
9046         case "$vendorhtml1dir" in
9047         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9048         *)      dflt=$vendorhtml1dir ;;
9049         esac
9050         case "$dflt" in
9051         ''|' ') dflt=none ;;
9052         esac
9053         fn=dn+~
9054         rp='Pathname for the vendor-supplied html pages?'
9055         . ./getfile
9056         vendorhtml1dir="$ans"
9057         vendorhtml1direxp="$ansexp"
9058         ;;
9059 esac
9060 : Use ' ' for none so value is preserved next time through Configure
9061 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9062 : Change installation prefix, if necessary.
9063 if $test X"$prefix" != X"$installprefix"; then
9064         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9065 else
9066         installvendorhtml1dir="$vendorhtml1direxp"
9067 fi
9068
9069 case "$vendorprefix" in
9070 '')     vendorhtml3dir=''
9071         vendorhtml3direxp=''
9072         ;;
9073 *)      : determine where vendor-supplied module html pages go.
9074         : There is no standard location, so try to copy the previously-selected
9075         : directory structure for the core html pages.
9076         : XXX Better default suggestions would be welcome.
9077         case "$vendorhtml3dir" in
9078         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9079         *)      dflt=$vendorhtml3dir ;;
9080         esac
9081         case "$dflt" in
9082         ''|' ') dflt=none ;;
9083         esac
9084         fn=dn+~
9085         rp='Pathname for the vendor-supplied html pages?'
9086         . ./getfile
9087         vendorhtml3dir="$ans"
9088         vendorhtml3direxp="$ansexp"
9089         ;;
9090 esac
9091 : Use ' ' for none so value is preserved next time through Configure
9092 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9093 : Change installation prefix, if necessary.
9094 if $test X"$prefix" != X"$installprefix"; then
9095         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9096 else
9097         installvendorhtml3dir="$vendorhtml3direxp"
9098 fi
9099
9100 case "$vendorprefix" in
9101 '')     vendorman1dir=''
9102         vendorman1direxp=''
9103         ;;
9104 *)      : determine where vendor-supplied manual pages go.
9105         case "$vendorman1dir" in
9106         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9107         *)      dflt=$vendorman1dir ;;
9108         esac
9109         case "$dflt" in
9110         ''|' ') dflt=none ;;
9111         esac
9112         fn=nd~+
9113         rp='Pathname for the vendor-supplied manual section 1 pages?'
9114         . ./getfile
9115         vendorman1dir="$ans"
9116         vendorman1direxp="$ansexp"
9117         ;;
9118 esac
9119 : Use ' ' for none so value is preserved next time through Configure
9120 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9121 : Change installation prefix, if necessary.
9122 if $test X"$prefix" != X"$installprefix"; then
9123         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9124 else
9125         installvendorman1dir="$vendorman1direxp"
9126 fi
9127
9128 case "$vendorprefix" in
9129 '')     vendorman3dir=''
9130         vendorman3direxp=''
9131         ;;
9132 *)      : determine where vendor-supplied module manual pages go.
9133         case "$vendorman3dir" in
9134         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9135         *)      dflt=$vendorman3dir ;;
9136         esac
9137         case "$dflt" in
9138         ''|' ') dflt=none ;;
9139         esac
9140         fn=nd~+
9141         rp='Pathname for the vendor-supplied manual section 3 pages?'
9142         . ./getfile
9143         vendorman3dir="$ans"
9144         vendorman3direxp="$ansexp"
9145         ;;
9146 esac
9147 : Use ' ' for none so value is preserved next time through Configure
9148 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9149 : Change installation prefix, if necessary.
9150 if $test X"$prefix" != X"$installprefix"; then
9151         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9152 else
9153         installvendorman3dir="$vendorman3direxp"
9154 fi
9155
9156 case "$vendorprefix" in
9157 '')     d_vendorscript="$undef"
9158         vendorscript=''
9159         vendorscriptexp=''
9160         ;;
9161 *)      d_vendorscript="$define"
9162         : determine where vendor-supplied scripts go.
9163         case "$vendorscript" in
9164         '')     dflt=$vendorprefix/script
9165                 $test -d $dflt || dflt=$vendorbin ;;
9166         *)  dflt="$vendorscript" ;;
9167         esac
9168         $cat <<EOM
9169
9170 The installation process will create a directory for 
9171 vendor-supplied scripts.
9172
9173 EOM
9174         fn=d~+
9175         rp='Pathname for the vendor-supplied scripts directory?'
9176         . ./getfile
9177         vendorscript="$ans"
9178         vendorscriptexp="$ansexp"
9179         ;;
9180 esac
9181 : Change installation prefix, if necessary.
9182 if $test X"$prefix" != X"$installprefix"; then
9183         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9184 else
9185         installvendorscript="$vendorscriptexp"
9186 fi
9187
9188 : see if qgcvt exists
9189 set qgcvt d_qgcvt
9190 eval $inlibc
9191
9192 echo " "
9193
9194 if $test X"$d_longdbl" = X"$define"; then
9195
9196 echo "Checking how to print long doubles..." >&4
9197
9198 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9199         $cat >try.c <<'EOCP'
9200 #include <sys/types.h>
9201 #include <stdio.h>
9202 int main() {
9203   double d = 123.456;
9204   printf("%.3f\n", d);
9205 }
9206 EOCP
9207         set try
9208         if eval $compile; then
9209                 yyy=`$run ./try`
9210                 case "$yyy" in
9211                 123.456)
9212                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9213                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9214                         echo "We will use %f."
9215                         ;;
9216                 esac
9217         fi
9218 fi
9219
9220 if $test X"$sPRIfldbl" = X; then
9221         $cat >try.c <<'EOCP'
9222 #include <sys/types.h>
9223 #include <stdio.h>
9224 int main() {
9225   long double d = 123.456;
9226   printf("%.3Lf\n", d);
9227 }
9228 EOCP
9229         set try
9230         if eval $compile; then
9231                 yyy=`$run ./try`
9232                 case "$yyy" in
9233                 123.456)
9234                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9235                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9236                         echo "We will use %Lf."
9237                         ;;
9238                 esac
9239         fi
9240 fi
9241
9242 if $test X"$sPRIfldbl" = X; then
9243         $cat >try.c <<'EOCP'
9244 #include <sys/types.h>
9245 #include <stdio.h>
9246 int main() {
9247   long double d = 123.456;
9248   printf("%.3llf\n", d);
9249 }
9250 EOCP
9251         set try
9252         if eval $compile; then
9253                 yyy=`$run ./try`
9254                 case "$yyy" in
9255                 123.456)
9256                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9257                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9258                         echo "We will use %llf."
9259                         ;;
9260                 esac
9261         fi
9262 fi
9263
9264 if $test X"$sPRIfldbl" = X; then
9265         $cat >try.c <<'EOCP'
9266 #include <sys/types.h>
9267 #include <stdio.h>
9268 int main() {
9269   long double d = 123.456;
9270   printf("%.3lf\n", d);
9271 }
9272 EOCP
9273         set try
9274         if eval $compile; then
9275                 yyy=`$run ./try`
9276                 case "$yyy" in
9277                 123.456)
9278                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9279                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9280                         echo "We will use %lf."
9281                         ;;
9282                 esac
9283         fi
9284 fi
9285
9286 if $test X"$sPRIfldbl" = X; then
9287         echo "Cannot figure out how to print long doubles." >&4
9288 else
9289         sSCNfldbl=$sPRIfldbl    # expect consistency
9290 fi
9291
9292 $rm -f try try.*
9293
9294 fi # d_longdbl
9295
9296 case "$sPRIfldbl" in
9297 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9298         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9299         d_SCNfldbl="$undef";
9300         ;;
9301 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9302         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9303         d_SCNfldbl="$define";
9304         ;;
9305 esac
9306
9307 : Check how to convert floats to strings.
9308
9309 if test "X$d_Gconvert" = X; then
9310
9311 echo " "
9312 echo "Checking for an efficient way to convert floats to strings."
9313 echo " " > try.c
9314 case "$uselongdouble" in
9315 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9316 esac
9317 case "$d_longdbl" in
9318 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9319 esac
9320 case "$d_PRIgldbl" in
9321 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9322 esac
9323 $cat >>try.c <<EOP
9324 #ifdef TRY_gconvert
9325 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9326 char *myname = "gconvert";
9327 #endif
9328 #ifdef TRY_gcvt
9329 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9330 char *myname = "gcvt";
9331 #endif
9332 #ifdef TRY_qgcvt
9333 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9334 char *myname = "qgcvt";
9335 #define DOUBLETYPE long double
9336 #endif
9337 #ifdef TRY_sprintf
9338 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9339 #ifdef HAS_PRIgldbl
9340 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9341 #else
9342 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9343 #endif
9344 #else
9345 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9346 #endif
9347 char *myname = "sprintf";
9348 #endif
9349
9350 #ifndef DOUBLETYPE
9351 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9352 #define DOUBLETYPE long double
9353 #else
9354 #define DOUBLETYPE double
9355 #endif
9356 #endif
9357
9358 #include <stdio.h>
9359
9360 #define I_STDLIB $i_stdlib
9361 #ifdef I_STDLIB
9362 #include <stdlib.h>
9363 #endif
9364
9365 int
9366 checkit(expect, got)
9367 char *expect;
9368 char *got;
9369 {
9370     if (strcmp(expect, got)) {
9371                 printf("%s oddity:  Expected %s, got %s\n",
9372                         myname, expect, got);
9373                 exit(1);
9374         }
9375 }
9376
9377 int main()
9378
9379         char buf[64]; 
9380         buf[63] = '\0';
9381
9382         /* This must be 1st test on (which?) platform */
9383         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9384         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9385         checkit("0.1", buf);
9386
9387         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9388         checkit("0.01", buf);
9389
9390         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9391         checkit("0.001", buf);
9392
9393         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9394         checkit("0.0001", buf);
9395
9396         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9397         if (strlen(buf) > 5)
9398             checkit("9e-005", buf); /* for Microsoft ?? */
9399         else
9400             checkit("9e-05", buf);
9401
9402         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9403         checkit("1", buf);
9404
9405         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9406         checkit("1.1", buf);
9407
9408         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9409         checkit("1.01", buf);
9410
9411         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9412         checkit("1.001", buf);
9413
9414         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9415         checkit("1.0001", buf);
9416
9417         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9418         checkit("1.00001", buf);
9419
9420         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9421         checkit("1.000001", buf);
9422
9423         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9424         checkit("0", buf);
9425
9426         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9427         checkit("-1", buf);
9428
9429         /* Some Linux gcvt's give 1.e+5 here. */
9430         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9431         checkit("100000", buf);
9432         
9433         /* Some Linux gcvt's give -1.e+5 here. */
9434         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9435         checkit("-100000", buf);
9436
9437         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9438         checkit("123.456", buf);
9439
9440         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9441         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9442         /* 34 should be enough to scare even long double
9443          * places into using the e notation. */
9444         if (strlen(buf) > 5)
9445             checkit("1e+034", buf); /* for Microsoft */
9446         else
9447             checkit("1e+34", buf);
9448
9449         /* For Perl, if you add additional tests here, also add them to
9450          * t/base/num.t for benefit of platforms not using Configure or
9451          * overriding d_Gconvert */
9452
9453         exit(0);
9454 }
9455 EOP
9456 : first add preferred functions to our list
9457 xxx_list=""
9458 for xxx_convert in $gconvert_preference; do
9459     case $xxx_convert in
9460     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9461     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9462     esac 
9463 done
9464 : then add any others
9465 for xxx_convert in gconvert gcvt sprintf; do
9466     case "$xxx_list" in
9467     *$xxx_convert*) ;;
9468     *) xxx_list="$xxx_list $xxx_convert" ;;
9469     esac 
9470 done
9471
9472 case "$d_longdbl$uselongdouble" in
9473 "$define$define")
9474     : again, add prefered functions to our list first
9475     xxx_ld_list=""
9476     for xxx_convert in $gconvert_ld_preference; do
9477         case $xxx_convert in
9478         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9479         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9480         esac
9481     done
9482     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9483     for xxx_convert in qgcvt sprintf $xxx_list; do
9484         case "$xxx_ld_list" in
9485         $xxx_convert*|*" $xxx_convert"*) ;;
9486         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9487         esac
9488     done
9489     : if sprintf cannot do long doubles, move it to the end
9490     if test "$d_PRIgldbl" != "$define"; then
9491         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9492     fi
9493     : if no qgcvt, remove it
9494     if test "$d_qgcvt" != "$define"; then
9495         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9496     fi
9497     : use the ld_list
9498     xxx_list="$xxx_ld_list"
9499     ;;
9500 esac
9501
9502 for xxx_convert in $xxx_list; do
9503         echo "Trying $xxx_convert..."
9504         $rm -f try try$_o
9505         set try -DTRY_$xxx_convert
9506         if eval $compile; then
9507                 echo "$xxx_convert() found." >&4
9508                 if $run ./try; then
9509                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9510                         break;
9511                 else
9512                         echo "...But $xxx_convert didn't work as I expected."
9513                         xxx_convert=''
9514                 fi
9515         else
9516                 echo "$xxx_convert NOT found." >&4
9517         fi
9518 done
9519
9520 if test X$xxx_convert = X; then
9521     echo "*** WHOA THERE!!! ***" >&4
9522     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9523     xxx_convert=sprintf
9524 fi
9525
9526 case "$xxx_convert" in
9527 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9528 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9529 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9530 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9531    "$define$define$define")
9532       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9533    "$define$define$undef")
9534       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9535    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9536    esac
9537    ;;  
9538 esac
9539
9540 fi
9541
9542 : see if _fwalk exists
9543 set fwalk d__fwalk
9544 eval $inlibc
9545
9546 : Initialize h_fcntl
9547 h_fcntl=false
9548
9549 : Initialize h_sysfile
9550 h_sysfile=false
9551
9552 : access call always available on UNIX
9553 set access d_access
9554 eval $inlibc
9555
9556 : locate the flags for 'access()'
9557 case "$d_access" in
9558 "$define")
9559         echo " "
9560         $cat >access.c <<EOCP
9561 #include <sys/types.h>
9562 #ifdef I_FCNTL
9563 #include <fcntl.h>
9564 #endif
9565 #ifdef I_SYS_FILE
9566 #include <sys/file.h>
9567 #endif
9568 #ifdef I_UNISTD
9569 #include <unistd.h>
9570 #endif
9571 #$i_stdlib I_STDLIB
9572 #ifdef I_STDLIB
9573 #include <stdlib.h>
9574 #endif
9575 int main() {
9576         exit(R_OK);
9577 }
9578 EOCP
9579         : check sys/file.h first, no particular reason here
9580         if $test `./findhdr sys/file.h` && \
9581                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9582                 h_sysfile=true;
9583                 echo "<sys/file.h> defines the *_OK access constants." >&4
9584         elif $test `./findhdr fcntl.h` && \
9585                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9586                 h_fcntl=true;
9587                 echo "<fcntl.h> defines the *_OK access constants." >&4
9588         elif $test `./findhdr unistd.h` && \
9589                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9590                 echo "<unistd.h> defines the *_OK access constants." >&4
9591         else
9592                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9593         fi
9594         ;;
9595 esac
9596 $rm -f access*
9597
9598 : see if accessx exists
9599 set accessx d_accessx
9600 eval $inlibc
9601
9602 : see if aintl exists
9603 set aintl d_aintl
9604 eval $inlibc
9605
9606 : see if alarm exists
9607 set alarm d_alarm
9608 eval $inlibc
9609
9610 : see if POSIX threads are available
9611 set pthread.h i_pthread
9612 eval $inhdr
9613
9614 : define a fucntion to check prototypes
9615 $cat > protochk <<EOSH
9616 $startsh
9617 cc="$cc"
9618 optimize="$optimize"
9619 ccflags="$ccflags"
9620 prototype="$prototype"
9621 define="$define"
9622 rm=$rm
9623 usethreads=$usethreads
9624 i_pthread=$i_pthread
9625 pthread_h_first=$pthread_h_first
9626 EOSH
9627
9628 $cat >> protochk <<'EOSH'
9629
9630 $rm -f try.c
9631 foo="$1"
9632 shift
9633 while test $# -ge 2; do
9634         case "$1" in
9635                 $define) echo "#include <$2>" >> try.c ;;
9636                 literal) echo "$2" >> try.c ;;
9637         esac
9638     # Extra magic for the benefit of systems that need pthread.h
9639     # to be included early to correctly detect threadsafe functions.
9640     # Such functions must guarantee themselves, though, that the usethreads
9641     # and i_pthread have been defined, before calling protochk.
9642     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9643         echo "#include <pthread.h>" >> try.c
9644         pthread_h_done=yes
9645     fi
9646     shift 2
9647 done
9648 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9649 cat >> try.c <<'EOCP'
9650 #ifdef CAN_PROTOTYPE
9651 #define _(args) args
9652 #else
9653 #define _(args) ()
9654 #endif
9655 EOCP
9656 echo "$foo" >> try.c
9657 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9658 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9659 status=$?
9660 $rm -f try.[co]
9661 exit $status
9662 EOSH
9663 chmod +x protochk
9664 $eunicefix protochk
9665
9666 hasproto='varname=$1; func=$2; shift; shift;
9667 while $test $# -ge 2; do
9668         case "$1" in
9669         $define) echo "#include <$2>";;
9670         esac ;
9671     shift 2;
9672 done > try.c;
9673 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9674 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9675         echo "$func() prototype found.";
9676         val="$define";
9677 else
9678         echo "$func() prototype NOT found.";
9679         val="$undef";
9680 fi;
9681 set $varname;
9682 eval $setvar;
9683 $rm -f try.c tryout.c'
9684
9685 : see if sys/types.h has to be included
9686 set sys/types.h i_systypes
9687 eval $inhdr
9688
9689 : see if sys/select.h has to be included
9690 set sys/select.h i_sysselct
9691 eval $inhdr
9692
9693 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9694 while $test $# -ge 2; do
9695         case "$1" in
9696         $define) echo "#include <$2>";;
9697         esac ;
9698     shift 2;
9699 done > try.c;
9700 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9701 set try;
9702 if eval $compile; then
9703         val="$define";
9704 else
9705         val="$undef";
9706 fi;
9707 set $varname;
9708 eval $setvar;
9709 $rm -f try.c try.o'
9710
9711 : see if we should include time.h, sys/time.h, or both
9712 echo " "
9713 if test "X$timeincl" = X; then
9714         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9715         $echo $n "I'm now running the test program...$c"
9716         $cat >try.c <<EOCP
9717 #include <sys/types.h>
9718 #ifdef I_TIME
9719 #include <time.h>
9720 #endif
9721 #ifdef I_SYSTIME
9722 #ifdef SYSTIMEKERNEL
9723 #define KERNEL
9724 #endif
9725 #include <sys/time.h>
9726 #endif
9727 #ifdef I_SYSSELECT
9728 #include <sys/select.h>
9729 #endif
9730 #$i_stdlib I_STDLIB
9731 #ifdef I_STDLIB
9732 #include <stdlib.h>
9733 #endif
9734 int main()
9735 {
9736         struct tm foo;
9737 #ifdef S_TIMEVAL
9738         struct timeval bar;
9739 #endif
9740 #ifdef S_TIMEZONE
9741         struct timezone tzp;
9742 #endif
9743         if (foo.tm_sec == foo.tm_sec)
9744                 exit(0);
9745 #ifdef S_TIMEVAL
9746         if (bar.tv_sec == bar.tv_sec)
9747                 exit(0);
9748 #endif
9749         exit(1);
9750 }
9751 EOCP
9752         flags=''
9753         for s_timezone in '-DS_TIMEZONE' ''; do
9754         sysselect=''
9755         for s_timeval in '-DS_TIMEVAL' ''; do
9756         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9757         for i_time in '' '-DI_TIME'; do
9758         for i_systime in '-DI_SYSTIME' ''; do
9759                 case "$flags" in
9760                 '') $echo $n ".$c"
9761                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9762                         if eval $compile; then
9763                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9764                                 shift
9765                                 flags="$*"
9766                                 echo " "
9767                                 $echo $n "Succeeded with $flags$c"
9768                         fi
9769                         ;;
9770                 esac
9771         done
9772         done
9773         done
9774         done
9775         done
9776         timeincl=''
9777         echo " "
9778         case "$flags" in
9779         *SYSTIMEKERNEL*) i_systimek="$define"
9780                 timeincl=`./findhdr sys/time.h`
9781                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9782         *) i_systimek="$undef";;
9783         esac
9784         case "$flags" in
9785         *I_TIME*) i_time="$define"
9786                 timeincl=`./findhdr time.h`" $timeincl"
9787                 echo "We'll include <time.h>." >&4;;
9788         *) i_time="$undef";;
9789         esac
9790         case "$flags" in
9791         *I_SYSTIME*) i_systime="$define"
9792                 timeincl=`./findhdr sys/time.h`" $timeincl"
9793                 echo "We'll include <sys/time.h>." >&4;;
9794         *) i_systime="$undef";;
9795         esac
9796         $rm -f try.c try
9797 fi
9798 : see if struct tm knows about tm_zone
9799 case "$i_systime$i_time" in
9800 *$define*) 
9801         echo " "
9802         echo "Checking to see if your struct tm has tm_zone field..." >&4
9803         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9804         eval $hasfield
9805         ;;
9806 *)      val="$undef"
9807         set d_tm_tm_zone
9808         eval $setvar
9809         ;;
9810 esac
9811 case "$d_tm_tm_zone" in
9812 "$define")      echo "Yes, it does."   ;;
9813 *)              echo "No, it doesn't." ;;
9814 esac
9815 : see if struct tm knows about tm_gmtoff
9816 case "$i_systime$i_time" in
9817 *$define*) 
9818         echo " "
9819         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9820         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9821         eval $hasfield
9822         ;;
9823 *)      val="$undef"
9824         set d_tm_tm_gmtoff
9825         eval $setvar
9826         ;;
9827 esac
9828 case "$d_tm_tm_gmtoff" in
9829 "$define")      echo "Yes, it does."   ;;
9830 *)              echo "No, it doesn't." ;;
9831 esac
9832
9833 : see if asctime_r exists
9834 set asctime_r d_asctime_r
9835 eval $inlibc
9836 case "$d_asctime_r" in
9837 "$define")
9838         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9839         case "$d_asctime_r_proto:$usethreads" in
9840         ":define")      d_asctime_r_proto=define
9841                 set d_asctime_r_proto asctime_r $hdrs
9842                 eval $hasproto ;;
9843         *)      ;;
9844         esac
9845         case "$d_asctime_r_proto" in
9846         define)
9847         case "$asctime_r_proto" in
9848         ''|0) try='char* asctime_r(const struct tm*, char*);'
9849         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9850         esac
9851         case "$asctime_r_proto" in
9852         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9853         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9854         esac
9855         case "$asctime_r_proto" in
9856         ''|0) try='int asctime_r(const struct tm*, char*);'
9857         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9858         esac
9859         case "$asctime_r_proto" in
9860         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9861         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9862         esac
9863         case "$asctime_r_proto" in
9864         ''|0)   d_asctime_r=undef
9865                 asctime_r_proto=0
9866                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9867         * )     case "$asctime_r_proto" in
9868                 REENTRANT_PROTO*) ;;
9869                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9870                 esac
9871                 echo "Prototype: $try" ;;
9872         esac
9873         ;;
9874         *)      case "$usethreads" in
9875                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9876                 esac
9877                 d_asctime_r=undef
9878                 asctime_r_proto=0
9879                 ;;
9880         esac
9881         ;;
9882 *)      asctime_r_proto=0
9883         ;;
9884 esac
9885
9886 : see if atolf exists
9887 set atolf d_atolf
9888 eval $inlibc
9889
9890 : see if atoll exists
9891 set atoll d_atoll
9892 eval $inlibc
9893
9894 : Look for GCC-style attribute format
9895 case "$d_attribute_format" in
9896 '')
9897 echo " "
9898 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9899 $cat >attrib.c <<'EOCP'
9900 #include <stdio.h>
9901 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9902 EOCP
9903 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9904         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9905                 echo "Your C compiler doesn't support __attribute__((format))."
9906                 val="$undef"
9907         else
9908                 echo "Your C compiler supports __attribute__((format))."
9909                 val="$define"
9910         fi
9911 else
9912         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9913         val="$undef"
9914 fi
9915 ;;
9916 *) val="$d_attribute_format" ;;
9917 esac
9918 set d_attribute_format
9919 eval $setvar
9920 $rm -f attrib*
9921
9922 : Look for GCC-style attribute malloc
9923 case "$d_attribute_malloc" in
9924 '')
9925 echo " "
9926 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9927 $cat >attrib.c <<'EOCP'
9928 #include <stdio.h>
9929 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9930 EOCP
9931 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9932         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9933                 echo "Your C compiler doesn't support __attribute__((malloc))."
9934                 val="$undef"
9935         else
9936                 echo "Your C compiler supports __attribute__((malloc))."
9937                 val="$define"
9938         fi
9939 else
9940         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9941         val="$undef"
9942 fi
9943 ;;
9944 *) val="$d_attribute_malloc" ;;
9945 esac
9946 set d_attribute_malloc
9947 eval $setvar
9948 $rm -f attrib*
9949
9950 : Look for GCC-style attribute nonnull
9951 case "$d_attribute_nonnull" in
9952 '')
9953 echo " "
9954 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9955 $cat >attrib.c <<'EOCP'
9956 #include <stdio.h>
9957 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9958 EOCP
9959 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9960         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9961                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9962                 val="$undef"
9963         else
9964                 echo "Your C compiler supports __attribute__((nonnull))."
9965                 val="$define"
9966         fi
9967 else
9968         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9969         val="$undef"
9970 fi
9971 ;;
9972 *) val="$d_attribute_nonnull" ;;
9973 esac
9974 set d_attribute_nonnull
9975 eval $setvar
9976 $rm -f attrib*
9977
9978 : Look for GCC-style attribute noreturn
9979 case "$d_attribute_noreturn" in
9980 '')
9981 echo " "
9982 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9983 $cat >attrib.c <<'EOCP'
9984 #include <stdio.h>
9985 void fall_over_dead( void ) __attribute__((noreturn));
9986 EOCP
9987 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9988         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9989                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9990                 val="$undef"
9991         else
9992                 echo "Your C compiler supports __attribute__((noreturn))."
9993                 val="$define"
9994         fi
9995 else
9996         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9997         val="$undef"
9998 fi
9999 ;;
10000 *) val="$d_attribute_noreturn" ;;
10001 esac
10002 set d_attribute_noreturn
10003 eval $setvar
10004 $rm -f attrib*
10005
10006 : Look for GCC-style attribute pure
10007 case "$d_attribute_pure" in
10008 '')
10009 echo " "
10010 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10011 $cat >attrib.c <<'EOCP'
10012 #include <stdio.h>
10013 int square( int n ) __attribute__((pure));
10014 EOCP
10015 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10016         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10017                 echo "Your C compiler doesn't support __attribute__((pure))."
10018                 val="$undef"
10019         else
10020                 echo "Your C compiler supports __attribute__((pure))."
10021                 val="$define"
10022         fi
10023 else
10024         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10025         val="$undef"
10026 fi
10027 ;;
10028 *) val="$d_attribute_pure" ;;
10029 esac
10030 set d_attribute_pure
10031 eval $setvar
10032 $rm -f attrib*
10033
10034 : Look for GCC-style attribute unused
10035 case "$d_attribute_unused" in
10036 '')
10037 echo " "
10038 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10039 $cat >attrib.c <<'EOCP'
10040 #include <stdio.h>
10041 int do_something( int dummy __attribute__((unused)), int n );
10042 EOCP
10043 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10044         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10045                 echo "Your C compiler doesn't support __attribute__((unused))."
10046                 val="$undef"
10047         else
10048                 echo "Your C compiler supports __attribute__((unused))."
10049                 val="$define"
10050         fi
10051 else
10052         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10053         val="$undef"
10054 fi
10055 ;;
10056 *) val="$d_attribute_unused" ;;
10057 esac
10058 set d_attribute_unused
10059 eval $setvar
10060 $rm -f attrib*
10061
10062 : Look for GCC-style attribute warn_unused_result
10063 case "$d_attribute_warn_unused_result" in
10064 '')
10065 echo " "
10066 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10067 $cat >attrib.c <<'EOCP'
10068 #include <stdio.h>
10069 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10070 EOCP
10071 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10072         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10073                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10074                 val="$undef"
10075         else
10076                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10077                 val="$define"
10078         fi
10079 else
10080         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10081         val="$undef"
10082 fi
10083 ;;
10084 *) val="$d_attribute_warn_unused_result" ;;
10085 esac
10086 set d_attribute_warn_unused_result
10087 eval $setvar
10088 $rm -f attrib*
10089
10090 : see if bcmp exists
10091 set bcmp d_bcmp
10092 eval $inlibc
10093
10094 : see if bcopy exists
10095 set bcopy d_bcopy
10096 eval $inlibc
10097
10098 : see if this is a unistd.h system
10099 set unistd.h i_unistd
10100 eval $inhdr
10101
10102 : see if getpgrp exists
10103 set getpgrp d_getpgrp
10104 eval $inlibc
10105
10106 case "$d_getpgrp" in
10107 "$define")
10108         echo " "
10109         echo "Checking to see which flavor of getpgrp is in use..."
10110         $cat >try.c <<EOP
10111 #$i_unistd I_UNISTD
10112 #include <sys/types.h>
10113 #ifdef I_UNISTD
10114 #  include <unistd.h>
10115 #endif
10116 #$i_stdlib I_STDLIB
10117 #ifdef I_STDLIB
10118 #include <stdlib.h>
10119 #endif
10120 int main()
10121 {
10122         if (getuid() == 0) {
10123                 printf("(I see you are running Configure as super-user...)\n");
10124                 setuid(1);
10125         }
10126 #ifdef TRY_BSD_PGRP
10127         if (getpgrp(1) == 0)
10128                 exit(0);
10129 #else
10130         if (getpgrp() > 0)
10131                 exit(0);
10132 #endif
10133         exit(1);
10134 }
10135 EOP
10136         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10137                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10138                 val="$define"
10139         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10140                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10141                 val="$undef"
10142         else
10143                 echo "I can't seem to compile and run the test program."
10144                 if ./usg; then
10145                         xxx="a USG one, i.e. you use getpgrp()."
10146                 else
10147                         # SVR4 systems can appear rather BSD-ish.
10148                         case "$i_unistd" in
10149                         $undef)
10150                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10151                                 val="$define"
10152                                 ;;
10153                         $define)
10154                                 xxx="probably a USG one, i.e. you use getpgrp()."
10155                                 val="$undef"
10156                                 ;;
10157                         esac
10158                 fi
10159                 echo "Assuming your getpgrp is $xxx" >&4
10160         fi
10161         ;;
10162 *) val="$undef";;
10163 esac
10164 set d_bsdgetpgrp
10165 eval $setvar
10166 $rm -f try try.*
10167
10168 : see if setpgrp exists
10169 set setpgrp d_setpgrp
10170 eval $inlibc
10171
10172 case "$d_setpgrp" in
10173 "$define")
10174         echo " "
10175         echo "Checking to see which flavor of setpgrp is in use..."
10176         $cat >try.c <<EOP
10177 #$i_unistd I_UNISTD
10178 #include <sys/types.h>
10179 #ifdef I_UNISTD
10180 #  include <unistd.h>
10181 #endif
10182 #$i_stdlib I_STDLIB
10183 #ifdef I_STDLIB
10184 #include <stdlib.h>
10185 #endif
10186 int main()
10187 {
10188         if (getuid() == 0) {
10189                 printf("(I see you are running Configure as super-user...)\n");
10190                 setuid(1);
10191         }
10192 #ifdef TRY_BSD_PGRP
10193         if (-1 == setpgrp(1, 1))
10194                 exit(0);
10195 #else
10196         if (setpgrp() != -1)
10197                 exit(0);
10198 #endif
10199         exit(1);
10200 }
10201 EOP
10202         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10203                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10204                 val="$define"
10205         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10206                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10207                 val="$undef"
10208         else
10209                 echo "(I can't seem to compile and run the test program.)"
10210                 if ./usg; then
10211                         xxx="a USG one, i.e. you use setpgrp()."
10212                 else
10213                         # SVR4 systems can appear rather BSD-ish.
10214                         case "$i_unistd" in
10215                         $undef)
10216                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10217                                 val="$define"
10218                                 ;;
10219                         $define)
10220                                 xxx="probably a USG one, i.e. you use setpgrp()."
10221                                 val="$undef"
10222                                 ;;
10223                         esac
10224                 fi
10225                 echo "Assuming your setpgrp is $xxx" >&4
10226         fi
10227         ;;
10228 *) val="$undef";;
10229 esac
10230 set d_bsdsetpgrp
10231 eval $setvar
10232 $rm -f try try.*
10233 : see if bzero exists
10234 set bzero d_bzero
10235 eval $inlibc
10236
10237 : see if signal is declared as pointer to function returning int or void
10238 echo " "
10239 xxx=`./findhdr signal.h`
10240 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10241 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10242         echo "You have int (*signal())() instead of void." >&4
10243         val="$undef"
10244 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10245         echo "You have void (*signal())()." >&4
10246         val="$define"
10247 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10248         echo "You have int (*signal())() instead of void." >&4
10249         val="$undef"
10250 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10251         echo "You have void (*signal())()." >&4
10252         val="$define"
10253 else
10254         case "$d_voidsig" in
10255         '')
10256         echo "I can't determine whether signal handler returns void or int..." >&4
10257                 dflt=void
10258                 rp="What type does your signal handler return?"
10259                 . ./myread
10260                 case "$ans" in
10261                 v*) val="$define";;
10262                 *) val="$undef";;
10263                 esac;;
10264         "$define")
10265                 echo "As you already told me, signal handler returns void." >&4
10266                 val="$define"
10267                 ;;
10268         *)      echo "As you already told me, signal handler returns int." >&4
10269                 val="$undef"
10270                 ;;
10271         esac
10272 fi
10273 set d_voidsig
10274 eval $setvar
10275 case "$d_voidsig" in
10276 "$define") signal_t="void";;
10277 *) signal_t="int";;
10278 esac
10279 $rm -f $$.tmp
10280
10281 : check for ability to cast large floats to 32-bit ints.
10282 echo " "
10283 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10284 if $test "$intsize" -ge 4; then
10285         xxx=int
10286 else
10287         xxx=long
10288 fi
10289 $cat >try.c <<EOCP
10290 #include <stdio.h>
10291 #$i_stdlib I_STDLIB
10292 #ifdef I_STDLIB
10293 #include <stdlib.h>
10294 #endif
10295 #include <sys/types.h>
10296 #include <signal.h>
10297 $signal_t blech(s) int s; { exit(3); }
10298 int main()
10299 {
10300         $xxx i32;
10301         double f, g;
10302         int result = 0;
10303         char str[16];
10304         signal(SIGFPE, blech);
10305
10306         /* Don't let compiler optimize the test away.  Store the number 
10307            in a writable string for gcc to pass to sscanf under HP/UX.
10308         */
10309         sprintf(str, "2147483647");
10310         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10311         g = 10 * f;
10312         i32  = ($xxx) g;
10313
10314         /* x86 processors will probably give 0x8000 0000, which is a
10315            sign change.  We don't want that.  We want to mimic SPARC
10316            behavior here, which is to preserve the sign and give
10317            back 0x7fff ffff.
10318         */
10319         if (i32 != ($xxx) f)
10320                 result |= 1;
10321         exit(result);
10322 }
10323 EOCP
10324 set try
10325 if eval $compile_ok; then
10326         $run ./try
10327         yyy=$?
10328 else
10329         echo "(I can't seem to compile the test program--assuming it can't)"
10330         yyy=1
10331 fi
10332 case "$yyy" in
10333 0)      val="$define"
10334         echo "Yup, it can."
10335         ;;
10336 *)      val="$undef"
10337         echo "Nope, it can't."
10338         ;;
10339 esac
10340 set d_casti32
10341 eval $setvar
10342 $rm -f try try.*
10343
10344 : check for ability to cast negative floats to unsigned
10345 echo " "
10346 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10347 $cat >try.c <<EOCP
10348 #include <stdio.h>
10349 #$i_stdlib I_STDLIB
10350 #ifdef I_STDLIB
10351 #include <stdlib.h>
10352 #endif
10353 #include <sys/types.h>
10354 #include <signal.h>
10355 $signal_t blech(s) int s; { exit(7); }
10356 $signal_t blech_in_list(s) int s; { exit(4); }
10357 unsigned long dummy_long(p) unsigned long p; { return p; }
10358 unsigned int dummy_int(p) unsigned int p; { return p; }
10359 unsigned short dummy_short(p) unsigned short p; { return p; }
10360 int main()
10361 {
10362         double f;
10363         unsigned long along;
10364         unsigned int aint;
10365         unsigned short ashort;
10366         int result = 0;
10367         char str[16];
10368         
10369         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10370            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10371            optimized the whole file away
10372         */
10373         /* Store the number in a writable string for gcc to pass to 
10374            sscanf under HP/UX.
10375         */
10376         sprintf(str, "-123");
10377         sscanf(str, "%lf", &f);  /* f = -123.; */
10378
10379         signal(SIGFPE, blech);
10380         along = (unsigned long)f;
10381         aint = (unsigned int)f;
10382         ashort = (unsigned short)f;
10383         if (along != (unsigned long)-123)
10384                 result |= 1;
10385         if (aint != (unsigned int)-123)
10386                 result |= 1;
10387         if (ashort != (unsigned short)-123)
10388                 result |= 1;
10389         sprintf(str, "1073741824.");
10390         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10391         f = f + f;
10392         along = 0;
10393         along = (unsigned long)f;
10394         if (along != 0x80000000)
10395                 result |= 2;
10396         f -= 1.;
10397         along = 0;
10398         along = (unsigned long)f;
10399         if (along != 0x7fffffff)
10400                 result |= 1;
10401         f += 2.;
10402         along = 0;
10403         along = (unsigned long)f;
10404         if (along != 0x80000001)
10405                 result |= 2;
10406         if (result)
10407                 exit(result);
10408         signal(SIGFPE, blech_in_list);
10409         sprintf(str, "123.");
10410         sscanf(str, "%lf", &f);  /* f = 123.; */
10411         along = dummy_long((unsigned long)f);
10412         aint = dummy_int((unsigned int)f);
10413         ashort = dummy_short((unsigned short)f);
10414         if (along != (unsigned long)123)
10415                 result |= 4;
10416         if (aint != (unsigned int)123)
10417                 result |= 4;
10418         if (ashort != (unsigned short)123)
10419                 result |= 4;
10420         exit(result);
10421
10422 }
10423 EOCP
10424 set try
10425 if eval $compile_ok; then
10426         $run ./try
10427         castflags=$?
10428 else
10429         echo "(I can't seem to compile the test program--assuming it can't)"
10430         castflags=7
10431 fi
10432 case "$castflags" in
10433 0)      val="$define"
10434         echo "Yup, it can."
10435         ;;
10436 *)      val="$undef"
10437         echo "Nope, it can't."
10438         ;;
10439 esac
10440 set d_castneg
10441 eval $setvar
10442 $rm -f try.*
10443
10444 : see if vprintf exists
10445 echo " "
10446 if set vprintf val -f d_vprintf; eval $csym; $val; then
10447         echo 'vprintf() found.' >&4
10448         val="$define"
10449         $cat >try.c <<EOF
10450 #include <varargs.h>
10451 #$i_stdlib I_STDLIB
10452 #ifdef I_STDLIB
10453 #include <stdlib.h>
10454 #endif
10455
10456 int main() { xxx("foo"); }
10457
10458 xxx(va_alist)
10459 va_dcl
10460 {
10461         va_list args;
10462         char buf[10];
10463
10464         va_start(args);
10465         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10466 }
10467 EOF
10468         set try
10469         if eval $compile && $run ./try; then
10470                 echo "Your vsprintf() returns (int)." >&4
10471                 val2="$undef"
10472         else
10473                 echo "Your vsprintf() returns (char*)." >&4
10474                 val2="$define"
10475         fi
10476 else
10477         echo 'vprintf() NOT found.' >&4
10478                 val="$undef"
10479                 val2="$undef"
10480 fi
10481 $rm -f try try.*
10482 set d_vprintf
10483 eval $setvar
10484 val=$val2
10485 set d_charvspr
10486 eval $setvar
10487
10488 : see if chown exists
10489 set chown d_chown
10490 eval $inlibc
10491
10492 : see if chroot exists
10493 set chroot d_chroot
10494 eval $inlibc
10495
10496 : see if chsize exists
10497 set chsize d_chsize
10498 eval $inlibc
10499
10500 : see if class exists
10501 set class d_class
10502 eval $inlibc
10503
10504 hasstruct='varname=$1; struct=$2; shift; shift;
10505 while $test $# -ge 2; do
10506         case "$1" in
10507         $define) echo "#include <$2>";;
10508         esac ;
10509     shift 2;
10510 done > try.c;
10511 echo "int main () { struct $struct foo; }" >> try.c;
10512 set try;
10513 if eval $compile; then
10514         val="$define";
10515 else
10516         val="$undef";
10517 fi;
10518 set $varname;
10519 eval $setvar;
10520 $rm -f try.c try.o'
10521
10522 socketlib=''
10523 sockethdr=''
10524 : see whether socket exists
10525 echo " "
10526 $echo $n "Hmm... $c" >&4
10527 if set socket val -f d_socket; eval $csym; $val; then
10528         echo "Looks like you have Berkeley networking support." >&4
10529         d_socket="$define"
10530         if set setsockopt val -f; eval $csym; $val; then
10531                 d_oldsock="$undef"
10532         else
10533                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10534                 d_oldsock="$define"
10535         fi
10536 else
10537         if $contains socklib libc.list >/dev/null 2>&1; then
10538                 echo "Looks like you have Berkeley networking support." >&4
10539                 d_socket="$define"
10540                 : we will have to assume that it supports the 4.2 BSD interface
10541                 d_oldsock="$undef"
10542         else
10543                 echo "You don't have Berkeley networking in libc$_a..." >&4
10544                 if test "X$d_socket" = "X$define"; then
10545                    echo "...but you seem to believe that you have sockets." >&4
10546                 else
10547                         for net in net socket
10548                         do
10549                                 if test -f /usr/lib/lib$net$_a; then
10550                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10551                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10552                                         if $contains socket libc.list >/dev/null 2>&1; then
10553                                                 d_socket="$define"
10554                                                 socketlib="-l$net"
10555                                                 case "$net" in
10556                                                 net)
10557                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10558                                                         sockethdr="-I/usr/netinclude"
10559                                                         ;;
10560                                                 esac
10561                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10562                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10563                                                         d_oldsock="$undef"
10564                                                 else
10565                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10566                                                         d_oldsock="$define"
10567                                                 fi
10568                                                 break
10569                                         fi
10570                                 fi
10571                         done
10572                         if test "X$d_socket" != "X$define"; then
10573                            echo "or anywhere else I see." >&4
10574                            d_socket="$undef"
10575                            d_oldsock="$undef"
10576                         fi
10577                 fi
10578         fi
10579 fi
10580
10581 : see if socketpair exists
10582 set socketpair d_sockpair
10583 eval $inlibc
10584
10585
10586 echo " "
10587 echo "Checking the availability of certain socket constants..." >&4
10588 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10589         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10590         $cat >try.c <<EOF
10591 #include <sys/types.h>
10592 #include <sys/socket.h>
10593 int main() {
10594     int i = $ENUM;
10595 }
10596 EOF
10597         val="$undef"
10598         set try; if eval $compile; then
10599                 val="$define"
10600         fi
10601         set d_${enum}; eval $setvar
10602         $rm -f try.c try
10603 done
10604
10605 : see if this is a sys/uio.h system
10606 set sys/uio.h i_sysuio
10607 eval $inhdr
10608
10609
10610 echo " "
10611 echo "Checking to see if your system supports struct cmsghdr..." >&4
10612 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10613 eval $hasstruct
10614 case "$d_cmsghdr_s" in
10615 "$define")      echo "Yes, it does."   ;;
10616 *)              echo "No, it doesn't." ;;
10617 esac
10618
10619
10620 : check for const keyword
10621 echo " "
10622 echo 'Checking to see if your C compiler knows about "const"...' >&4
10623 $cat >const.c <<'EOCP'
10624 typedef struct spug { int drokk; } spug;
10625 int main()
10626 {
10627         const char *foo;
10628         const spug y;
10629 }
10630 EOCP
10631 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10632         val="$define"
10633         echo "Yup, it does."
10634 else
10635         val="$undef"
10636         echo "Nope, it doesn't."
10637 fi
10638 set d_const
10639 eval $setvar
10640
10641 : see if copysignl exists
10642 set copysignl d_copysignl
10643 eval $inlibc
10644
10645 : see if crypt exists
10646 echo " "
10647 set crypt d_crypt
10648 eval $inlibc
10649 case "$d_crypt" in
10650 $define) cryptlib='' ;;
10651 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10652                 echo 'crypt() found.' >&4
10653                 val="$define"
10654                 cryptlib=''
10655         else
10656                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10657                 if $test -z "$cryptlib"; then
10658                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10659                 else
10660                         cryptlib=-lcrypt
10661                 fi
10662                 if $test -z "$cryptlib"; then
10663                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10664                 else
10665                         cryptlib=-lcrypt
10666                 fi
10667                 if $test -z "$cryptlib"; then
10668                         cryptlib=`./loc libcrypt$_a "" $libpth`
10669                 else
10670                         cryptlib=-lcrypt
10671                 fi
10672                 if $test -z "$cryptlib"; then
10673                         echo 'crypt() NOT found.' >&4
10674                         val="$undef"
10675                 else
10676                         val="$define"
10677                 fi
10678         fi
10679         set d_crypt
10680         eval $setvar
10681         ;;
10682 esac
10683
10684 : see if this is a crypt.h system
10685 set crypt.h i_crypt
10686 eval $inhdr
10687
10688 : see if crypt_r exists
10689 set crypt_r d_crypt_r
10690 eval $inlibc
10691 case "$d_crypt_r" in
10692 "$define")
10693         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10694         case "$d_crypt_r_proto:$usethreads" in
10695         ":define")      d_crypt_r_proto=define
10696                 set d_crypt_r_proto crypt_r $hdrs
10697                 eval $hasproto ;;
10698         *)      ;;
10699         esac
10700         case "$d_crypt_r_proto" in
10701         define)
10702         case "$crypt_r_proto" in
10703         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10704         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10705         esac
10706         case "$crypt_r_proto" in
10707         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10708         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10709         esac
10710         case "$crypt_r_proto" in
10711         ''|0)   d_crypt_r=undef
10712                 crypt_r_proto=0
10713                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10714         * )     case "$crypt_r_proto" in
10715                 REENTRANT_PROTO*) ;;
10716                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10717                 esac
10718                 echo "Prototype: $try" ;;
10719         esac
10720         ;;
10721         *)      case "$usethreads" in
10722                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10723                 esac
10724                 d_crypt_r=undef
10725                 crypt_r_proto=0
10726                 ;;
10727         esac
10728         ;;
10729 *)      crypt_r_proto=0
10730         ;;
10731 esac
10732
10733 : get csh whereabouts
10734 case "$csh" in
10735 'csh') val="$undef" ;;
10736 *) val="$define" ;;
10737 esac
10738 set d_csh
10739 eval $setvar
10740 : Respect a hint or command line value for full_csh.
10741 case "$full_csh" in
10742 '') full_csh=$csh ;;
10743 esac
10744
10745 : see if ctermid_r exists
10746 set ctermid_r d_ctermid_r
10747 eval $inlibc
10748 case "$d_ctermid_r" in
10749 "$define")
10750         hdrs="$i_systypes sys/types.h define stdio.h "
10751         case "$d_ctermid_r_proto:$usethreads" in
10752         ":define")      d_ctermid_r_proto=define
10753                 set d_ctermid_r_proto ctermid_r $hdrs
10754                 eval $hasproto ;;
10755         *)      ;;
10756         esac
10757         case "$d_ctermid_r_proto" in
10758         define)
10759         case "$ctermid_r_proto" in
10760         ''|0) try='char* ctermid_r(char*);'
10761         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10762         esac
10763         case "$ctermid_r_proto" in
10764         ''|0)   d_ctermid_r=undef
10765                 ctermid_r_proto=0
10766                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10767         * )     case "$ctermid_r_proto" in
10768                 REENTRANT_PROTO*) ;;
10769                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10770                 esac
10771                 echo "Prototype: $try" ;;
10772         esac
10773         ;;
10774         *)      case "$usethreads" in
10775                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10776                 esac
10777                 d_ctermid_r=undef
10778                 ctermid_r_proto=0
10779                 ;;
10780         esac
10781         ;;
10782 *)      ctermid_r_proto=0
10783         ;;
10784 esac
10785
10786 : see if ctime_r exists
10787 set ctime_r d_ctime_r
10788 eval $inlibc
10789 case "$d_ctime_r" in
10790 "$define")
10791         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10792         case "$d_ctime_r_proto:$usethreads" in
10793         ":define")      d_ctime_r_proto=define
10794                 set d_ctime_r_proto ctime_r $hdrs
10795                 eval $hasproto ;;
10796         *)      ;;
10797         esac
10798         case "$d_ctime_r_proto" in
10799         define)
10800         case "$ctime_r_proto" in
10801         ''|0) try='char* ctime_r(const time_t*, char*);'
10802         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10803         esac
10804         case "$ctime_r_proto" in
10805         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10806         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10807         esac
10808         case "$ctime_r_proto" in
10809         ''|0) try='int ctime_r(const time_t*, char*);'
10810         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10811         esac
10812         case "$ctime_r_proto" in
10813         ''|0) try='int ctime_r(const time_t*, char*, int);'
10814         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10815         esac
10816         case "$ctime_r_proto" in
10817         ''|0)   d_ctime_r=undef
10818                 ctime_r_proto=0
10819                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10820         * )     case "$ctime_r_proto" in
10821                 REENTRANT_PROTO*) ;;
10822                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10823                 esac
10824                 echo "Prototype: $try" ;;
10825         esac
10826         ;;
10827         *)      case "$usethreads" in
10828                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10829                 esac
10830                 d_ctime_r=undef
10831                 ctime_r_proto=0
10832                 ;;
10833         esac
10834         ;;
10835 *)      ctime_r_proto=0
10836         ;;
10837 esac
10838
10839 : see if cuserid exists
10840 set cuserid d_cuserid
10841 eval $inlibc
10842
10843 : see if this is a limits.h system
10844 set limits.h i_limits
10845 eval $inhdr
10846
10847 : see if this is a float.h system
10848 set float.h i_float
10849 eval $inhdr
10850
10851 : See if number of significant digits in a double precision number is known
10852 echo " "
10853 $cat >dbl_dig.c <<EOM
10854 #$i_limits I_LIMITS
10855 #$i_float I_FLOAT
10856 #ifdef I_LIMITS
10857 #include <limits.h>
10858 #endif
10859 #ifdef I_FLOAT
10860 #include <float.h>
10861 #endif
10862 #ifdef DBL_DIG
10863 printf("Contains DBL_DIG");
10864 #endif
10865 EOM
10866 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10867 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10868         echo "DBL_DIG found." >&4
10869         val="$define"
10870 else
10871         echo "DBL_DIG NOT found." >&4
10872         val="$undef"
10873 fi
10874 $rm -f dbl_dig.?
10875 set d_dbl_dig
10876 eval $setvar
10877
10878 : see if dbm.h is available
10879 : see if dbmclose exists
10880 set dbmclose d_dbmclose
10881 eval $inlibc
10882
10883 case "$d_dbmclose" in
10884 $define)
10885         set dbm.h i_dbm
10886         eval $inhdr
10887         case "$i_dbm" in
10888         $define)
10889                 val="$undef"
10890                 set i_rpcsvcdbm
10891                 eval $setvar
10892                 ;;
10893         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10894                 eval $inhdr
10895                 ;;
10896         esac
10897         ;;
10898 *)      echo "We won't be including <dbm.h>"
10899         val="$undef"
10900         set i_dbm
10901         eval $setvar
10902         val="$undef"
10903         set i_rpcsvcdbm
10904         eval $setvar
10905         ;;
10906 esac
10907
10908 : see if prototype for dbminit is available
10909 echo " "
10910 set d_dbminitproto dbminit $i_dbm dbm.h
10911 eval $hasproto
10912
10913 : see if difftime exists
10914 set difftime d_difftime
10915 eval $inlibc
10916
10917 : see if this is a dirent system
10918 echo " "
10919 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10920         val="$define"
10921         echo "<dirent.h> found." >&4
10922 else
10923         val="$undef"
10924         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10925                 echo "<sys/dir.h> found." >&4
10926                 echo " "
10927         else
10928                 xinc=`./findhdr sys/ndir.h`
10929         fi
10930         echo "<dirent.h> NOT found." >&4
10931 fi
10932 set i_dirent
10933 eval $setvar
10934
10935 : Look for type of directory structure.
10936 echo " "
10937 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10938
10939 case "$direntrytype" in
10940 ''|' ')
10941         case "$i_dirent" in
10942         $define) guess1='struct dirent' ;;
10943         *) guess1='struct direct'  ;;
10944         esac
10945         ;;
10946 *)      guess1="$direntrytype"
10947         ;;
10948 esac
10949
10950 case "$guess1" in
10951 'struct dirent') guess2='struct direct' ;;
10952 *) guess2='struct dirent' ;;
10953 esac
10954                 
10955 if $contains "$guess1" try.c >/dev/null 2>&1; then
10956         direntrytype="$guess1"
10957         echo "Your directory entries are $direntrytype." >&4
10958 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10959         direntrytype="$guess2"
10960         echo "Your directory entries seem to be $direntrytype." >&4
10961 else
10962         echo "I don't recognize your system's directory entries." >&4
10963         rp="What type is used for directory entries on this system?"
10964         dflt="$guess1"
10965         . ./myread
10966         direntrytype="$ans"
10967 fi
10968 $rm -f try.c
10969
10970
10971 : see if the directory entry stores field length
10972 echo " "
10973 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10974 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10975         echo "Good, your directory entry keeps length information in d_namlen." >&4
10976         val="$define"
10977 else
10978         echo "Your directory entry does not know about the d_namlen field." >&4
10979         val="$undef"
10980 fi
10981 set d_dirnamlen
10982 eval $setvar
10983 $rm -f try.c
10984
10985 : see if this is an sysdir system
10986 set sys/dir.h i_sysdir
10987 eval $inhdr
10988
10989 : see if this is an sysndir system
10990 set sys/ndir.h i_sysndir
10991 eval $inhdr
10992
10993 : Look for dirfd
10994 echo " "
10995 $cat >dirfd.c <<EOM
10996 #include <stdio.h>
10997 #$i_stdlib I_STDLIB
10998 #ifdef I_STDLIB
10999 #include <stdlib.h>
11000 #endif
11001 #$i_dirent I_DIRENT             /**/
11002 #$i_sysdir I_SYS_DIR            /**/
11003 #$i_sysndir I_SYS_NDIR          /**/
11004 #$i_systypes I_SYS_TYPES        /**/
11005 #if defined(I_SYS_TYPES)
11006 #include <sys/types.h>
11007 #endif
11008 #if defined(I_DIRENT)
11009 #include <dirent.h>
11010 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11011 #include <sys/dir.h>
11012 #endif
11013 #else
11014 #ifdef I_SYS_NDIR
11015 #include <sys/ndir.h>
11016 #else
11017 #ifdef I_SYS_DIR
11018 #ifdef hp9000s500
11019 #include <ndir.h>       /* may be wrong in the future */
11020 #else
11021 #include <sys/dir.h>
11022 #endif
11023 #endif
11024 #endif
11025 #endif 
11026 int main() {
11027         DIR *dirp = opendir(".");
11028         if (dirfd(dirp) >= 0)
11029                 exit(0);
11030         else
11031                 exit(1);
11032 }
11033 EOM
11034 val=$undef
11035 set dirfd
11036 if eval $compile; then
11037         val="$define"
11038 fi
11039 case "$val" in
11040 $define)        echo "dirfd() found." >&4       ;;
11041 *)              echo "dirfd() NOT found." >&4   ;;
11042 esac
11043 set d_dirfd
11044 eval $setvar
11045 $rm -f dirfd*
11046
11047 : see if dlerror exists
11048 xxx_runnm="$runnm"
11049 runnm=false
11050 set dlerror d_dlerror
11051 eval $inlibc
11052 runnm="$xxx_runnm"
11053
11054 : see if dlfcn is available
11055 set dlfcn.h i_dlfcn
11056 eval $inhdr
11057
11058 case "$usedl" in
11059 $define|y|true)
11060         $cat << EOM
11061
11062 On a few systems, the dynamically loaded modules that perl generates and uses
11063 will need a different extension than shared libs. The default will probably
11064 be appropriate.
11065
11066 EOM
11067         case "$dlext" in
11068         '')     dflt="$so" ;;
11069         *)      dflt="$dlext" ;;
11070         esac
11071         rp='What is the extension of dynamically loaded modules'
11072         . ./myread
11073         dlext="$ans"
11074         ;;
11075 *)
11076         dlext="none"
11077         ;;
11078 esac
11079
11080 : Check if dlsym need a leading underscore
11081 echo " "
11082 val="$undef"
11083
11084 case "$dlsrc" in
11085 dl_dlopen.xs)
11086         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11087         $cat >dyna.c <<'EOM'
11088 fred () { }
11089 EOM
11090
11091 $cat >fred.c<<EOM
11092
11093 #include <stdio.h>
11094 #$i_stdlib I_STDLIB
11095 #ifdef I_STDLIB
11096 #include <stdlib.h>
11097 #endif
11098 #$i_dlfcn I_DLFCN
11099 #ifdef I_DLFCN
11100 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11101 #else
11102 #include <sys/types.h>
11103 #include <nlist.h>
11104 #include <link.h>
11105 #endif
11106
11107 extern int fred() ;
11108
11109 int main()
11110 {
11111     void * handle ;
11112     void * symbol ;
11113 #ifndef RTLD_LAZY
11114     int mode = 1 ;
11115 #else
11116     int mode = RTLD_LAZY ;
11117 #endif
11118     handle = dlopen("./dyna.$dlext", mode) ;
11119     if (handle == NULL) {
11120         printf ("1\n") ;
11121         fflush (stdout) ;
11122         exit(0);
11123     }
11124     symbol = dlsym(handle, "fred") ;
11125     if (symbol == NULL) {
11126         /* try putting a leading underscore */
11127         symbol = dlsym(handle, "_fred") ;
11128         if (symbol == NULL) {
11129             printf ("2\n") ;
11130             fflush (stdout) ;
11131             exit(0);
11132         }
11133         printf ("3\n") ;
11134     }
11135     else
11136         printf ("4\n") ;
11137     fflush (stdout) ;
11138     exit(0);
11139 }
11140 EOM
11141         : Call the object file tmp-dyna.o in case dlext=o.
11142         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11143                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11144                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11145                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11146                 xxx=`$run ./fred`
11147                 case $xxx in
11148                 1)      echo "Test program failed using dlopen." >&4
11149                         echo "Perhaps you should not use dynamic loading." >&4;;
11150                 2)      echo "Test program failed using dlsym." >&4
11151                         echo "Perhaps you should not use dynamic loading." >&4;;
11152                 3)      echo "dlsym needs a leading underscore" >&4
11153                         val="$define" ;;
11154                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11155                 esac
11156         else
11157                 echo "I can't compile and run the test program." >&4
11158                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11159         fi
11160         ;;
11161 esac
11162                 
11163 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11164
11165 set d_dlsymun
11166 eval $setvar
11167
11168 : see if drand48_r exists
11169 set drand48_r d_drand48_r
11170 eval $inlibc
11171 case "$d_drand48_r" in
11172 "$define")
11173         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11174         case "$d_drand48_r_proto:$usethreads" in
11175         ":define")      d_drand48_r_proto=define
11176                 set d_drand48_r_proto drand48_r $hdrs
11177                 eval $hasproto ;;
11178         *)      ;;
11179         esac
11180         case "$d_drand48_r_proto" in
11181         define)
11182         case "$drand48_r_proto" in
11183         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11184         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11185         esac
11186         case "$drand48_r_proto" in
11187         ''|0)   d_drand48_r=undef
11188                 drand48_r_proto=0
11189                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11190         * )     case "$drand48_r_proto" in
11191                 REENTRANT_PROTO*) ;;
11192                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11193                 esac
11194                 echo "Prototype: $try" ;;
11195         esac
11196         ;;
11197         *)      case "$usethreads" in
11198                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11199                 esac
11200                 d_drand48_r=undef
11201                 drand48_r_proto=0
11202                 ;;
11203         esac
11204         ;;
11205 *)      drand48_r_proto=0
11206         ;;
11207 esac
11208
11209 : see if prototype for drand48 is available
11210 echo " "
11211 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11212 eval $hasproto
11213
11214 : see if dup2 exists
11215 set dup2 d_dup2
11216 eval $inlibc
11217
11218 : see if eaccess exists
11219 set eaccess d_eaccess
11220 eval $inlibc
11221
11222 : see if endgrent exists
11223 set endgrent d_endgrent
11224 eval $inlibc
11225
11226 : see if this is an grp system
11227 set grp.h i_grp
11228 eval $inhdr
11229
11230 case "$i_grp" in
11231 $define)
11232         xxx=`./findhdr grp.h`
11233         $cppstdin $cppflags $cppminus < $xxx >$$.h
11234
11235         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11236                 val="$define"
11237         else
11238                 val="$undef"
11239         fi
11240         set d_grpasswd
11241         eval $setvar
11242
11243         $rm -f $$.h
11244         ;;
11245 *)
11246         val="$undef";
11247         set d_grpasswd; eval $setvar
11248         ;;
11249 esac
11250
11251 : see if endgrent_r exists
11252 set endgrent_r d_endgrent_r
11253 eval $inlibc
11254 case "$d_endgrent_r" in
11255 "$define")
11256         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11257         case "$d_endgrent_r_proto:$usethreads" in
11258         ":define")      d_endgrent_r_proto=define
11259                 set d_endgrent_r_proto endgrent_r $hdrs
11260                 eval $hasproto ;;
11261         *)      ;;
11262         esac
11263         case "$d_endgrent_r_proto" in
11264         define)
11265         case "$endgrent_r_proto" in
11266         ''|0) try='int endgrent_r(FILE**);'
11267         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11268         esac
11269         case "$endgrent_r_proto" in
11270         ''|0) try='void endgrent_r(FILE**);'
11271         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11272         esac
11273         case "$endgrent_r_proto" in
11274         ''|0)   d_endgrent_r=undef
11275                 endgrent_r_proto=0
11276                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11277         * )     case "$endgrent_r_proto" in
11278                 REENTRANT_PROTO*) ;;
11279                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11280                 esac
11281                 echo "Prototype: $try" ;;
11282         esac
11283         ;;
11284         *)      case "$usethreads" in
11285                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11286                 esac
11287                 d_endgrent_r=undef
11288                 endgrent_r_proto=0
11289                 ;;
11290         esac
11291         ;;
11292 *)      endgrent_r_proto=0
11293         ;;
11294 esac
11295
11296 : see if endhostent exists
11297 set endhostent d_endhent
11298 eval $inlibc
11299
11300 : see if this is a netdb.h system
11301 set netdb.h i_netdb
11302 eval $inhdr
11303
11304 : see if endhostent_r exists
11305 set endhostent_r d_endhostent_r
11306 eval $inlibc
11307 case "$d_endhostent_r" in
11308 "$define")
11309         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11310         case "$d_endhostent_r_proto:$usethreads" in
11311         ":define")      d_endhostent_r_proto=define
11312                 set d_endhostent_r_proto endhostent_r $hdrs
11313                 eval $hasproto ;;
11314         *)      ;;
11315         esac
11316         case "$d_endhostent_r_proto" in
11317         define)
11318         case "$endhostent_r_proto" in
11319         ''|0) try='int endhostent_r(struct hostent_data*);'
11320         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11321         esac
11322         case "$endhostent_r_proto" in
11323         ''|0) try='void endhostent_r(struct hostent_data*);'
11324         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11325         esac
11326         case "$endhostent_r_proto" in
11327         ''|0)   d_endhostent_r=undef
11328                 endhostent_r_proto=0
11329                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11330         * )     case "$endhostent_r_proto" in
11331                 REENTRANT_PROTO*) ;;
11332                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11333                 esac
11334                 echo "Prototype: $try" ;;
11335         esac
11336         ;;
11337         *)      case "$usethreads" in
11338                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11339                 esac
11340                 d_endhostent_r=undef
11341                 endhostent_r_proto=0
11342                 ;;
11343         esac
11344         ;;
11345 *)      endhostent_r_proto=0
11346         ;;
11347 esac
11348
11349 : see if endnetent exists
11350 set endnetent d_endnent
11351 eval $inlibc
11352
11353 : see if endnetent_r exists
11354 set endnetent_r d_endnetent_r
11355 eval $inlibc
11356 case "$d_endnetent_r" in
11357 "$define")
11358         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11359         case "$d_endnetent_r_proto:$usethreads" in
11360         ":define")      d_endnetent_r_proto=define
11361                 set d_endnetent_r_proto endnetent_r $hdrs
11362                 eval $hasproto ;;
11363         *)      ;;
11364         esac
11365         case "$d_endnetent_r_proto" in
11366         define)
11367         case "$endnetent_r_proto" in
11368         ''|0) try='int endnetent_r(struct netent_data*);'
11369         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11370         esac
11371         case "$endnetent_r_proto" in
11372         ''|0) try='void endnetent_r(struct netent_data*);'
11373         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11374         esac
11375         case "$endnetent_r_proto" in
11376         ''|0)   d_endnetent_r=undef
11377                 endnetent_r_proto=0
11378                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11379         * )     case "$endnetent_r_proto" in
11380                 REENTRANT_PROTO*) ;;
11381                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11382                 esac
11383                 echo "Prototype: $try" ;;
11384         esac
11385         ;;
11386         *)      case "$usethreads" in
11387                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11388                 esac
11389                 d_endnetent_r=undef
11390                 endnetent_r_proto=0
11391                 ;;
11392         esac
11393         ;;
11394 *)      endnetent_r_proto=0
11395         ;;
11396 esac
11397
11398 : see if endprotoent exists
11399 set endprotoent d_endpent
11400 eval $inlibc
11401
11402 : see if endprotoent_r exists
11403 set endprotoent_r d_endprotoent_r
11404 eval $inlibc
11405 case "$d_endprotoent_r" in
11406 "$define")
11407         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11408         case "$d_endprotoent_r_proto:$usethreads" in
11409         ":define")      d_endprotoent_r_proto=define
11410                 set d_endprotoent_r_proto endprotoent_r $hdrs
11411                 eval $hasproto ;;
11412         *)      ;;
11413         esac
11414         case "$d_endprotoent_r_proto" in
11415         define)
11416         case "$endprotoent_r_proto" in
11417         ''|0) try='int endprotoent_r(struct protoent_data*);'
11418         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11419         esac
11420         case "$endprotoent_r_proto" in
11421         ''|0) try='void endprotoent_r(struct protoent_data*);'
11422         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11423         esac
11424         case "$endprotoent_r_proto" in
11425         ''|0)   d_endprotoent_r=undef
11426                 endprotoent_r_proto=0
11427                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11428         * )     case "$endprotoent_r_proto" in
11429                 REENTRANT_PROTO*) ;;
11430                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11431                 esac
11432                 echo "Prototype: $try" ;;
11433         esac
11434         ;;
11435         *)      case "$usethreads" in
11436                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11437                 esac
11438                 d_endprotoent_r=undef
11439                 endprotoent_r_proto=0
11440                 ;;
11441         esac
11442         ;;
11443 *)      endprotoent_r_proto=0
11444         ;;
11445 esac
11446
11447 : see if endpwent exists
11448 set endpwent d_endpwent
11449 eval $inlibc
11450
11451 : see if this is a pwd.h system
11452 set pwd.h i_pwd
11453 eval $inhdr
11454
11455 case "$i_pwd" in
11456 $define)
11457         xxx=`./findhdr pwd.h`
11458         $cppstdin $cppflags $cppminus < $xxx >$$.h
11459
11460         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11461                 val="$define"
11462         else
11463                 val="$undef"
11464         fi
11465         set d_pwquota
11466         eval $setvar
11467
11468         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11469                 val="$define"
11470         else
11471                 val="$undef"
11472         fi
11473         set d_pwage
11474         eval $setvar
11475
11476         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11477                 val="$define"
11478         else
11479                 val="$undef"
11480         fi
11481         set d_pwchange
11482         eval $setvar
11483
11484         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11485                 val="$define"
11486         else
11487                 val="$undef"
11488         fi
11489         set d_pwclass
11490         eval $setvar
11491
11492         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11493                 val="$define"
11494         else
11495                 val="$undef"
11496         fi
11497         set d_pwexpire
11498         eval $setvar
11499
11500         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11501                 val="$define"
11502         else
11503                 val="$undef"
11504         fi
11505         set d_pwcomment
11506         eval $setvar
11507
11508         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11509                 val="$define"
11510         else
11511                 val="$undef"
11512         fi
11513         set d_pwgecos
11514         eval $setvar
11515
11516         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11517                 val="$define"
11518         else
11519                 val="$undef"
11520         fi
11521         set d_pwpasswd
11522         eval $setvar
11523
11524         $rm -f $$.h
11525         ;;
11526 *)
11527         val="$undef"; 
11528         set d_pwquota; eval $setvar
11529         set d_pwage; eval $setvar
11530         set d_pwchange; eval $setvar
11531         set d_pwclass; eval $setvar
11532         set d_pwexpire; eval $setvar
11533         set d_pwcomment; eval $setvar
11534         set d_pwgecos; eval $setvar
11535         set d_pwpasswd; eval $setvar
11536         ;;
11537 esac
11538
11539 : see if endpwent_r exists
11540 set endpwent_r d_endpwent_r
11541 eval $inlibc
11542 case "$d_endpwent_r" in
11543 "$define")
11544         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11545         case "$d_endpwent_r_proto:$usethreads" in
11546         ":define")      d_endpwent_r_proto=define
11547                 set d_endpwent_r_proto endpwent_r $hdrs
11548                 eval $hasproto ;;
11549         *)      ;;
11550         esac
11551         case "$d_endpwent_r_proto" in
11552         define)
11553         case "$endpwent_r_proto" in
11554         ''|0) try='int endpwent_r(FILE**);'
11555         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11556         esac
11557         case "$endpwent_r_proto" in
11558         ''|0) try='void endpwent_r(FILE**);'
11559         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11560         esac
11561         case "$endpwent_r_proto" in
11562         ''|0)   d_endpwent_r=undef
11563                 endpwent_r_proto=0
11564                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11565         * )     case "$endpwent_r_proto" in
11566                 REENTRANT_PROTO*) ;;
11567                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11568                 esac
11569                 echo "Prototype: $try" ;;
11570         esac
11571         ;;
11572         *)      case "$usethreads" in
11573                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11574                 esac
11575                 d_endpwent_r=undef
11576                 endpwent_r_proto=0
11577                 ;;
11578         esac
11579         ;;
11580 *)      endpwent_r_proto=0
11581         ;;
11582 esac
11583
11584 : see if endservent exists
11585 set endservent d_endsent
11586 eval $inlibc
11587
11588 : see if endservent_r exists
11589 set endservent_r d_endservent_r
11590 eval $inlibc
11591 case "$d_endservent_r" in
11592 "$define")
11593         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11594         case "$d_endservent_r_proto:$usethreads" in
11595         ":define")      d_endservent_r_proto=define
11596                 set d_endservent_r_proto endservent_r $hdrs
11597                 eval $hasproto ;;
11598         *)      ;;
11599         esac
11600         case "$d_endservent_r_proto" in
11601         define)
11602         case "$endservent_r_proto" in
11603         ''|0) try='int endservent_r(struct servent_data*);'
11604         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11605         esac
11606         case "$endservent_r_proto" in
11607         ''|0) try='void endservent_r(struct servent_data*);'
11608         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11609         esac
11610         case "$endservent_r_proto" in
11611         ''|0)   d_endservent_r=undef
11612                 endservent_r_proto=0
11613                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11614         * )     case "$endservent_r_proto" in
11615                 REENTRANT_PROTO*) ;;
11616                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11617                 esac
11618                 echo "Prototype: $try" ;;
11619         esac
11620         ;;
11621         *)      case "$usethreads" in
11622                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11623                 esac
11624                 d_endservent_r=undef
11625                 endservent_r_proto=0
11626                 ;;
11627         esac
11628         ;;
11629 *)      endservent_r_proto=0
11630         ;;
11631 esac
11632
11633 : Locate the flags for 'open()'
11634 echo " "
11635 $cat >try.c <<EOCP
11636 #include <sys/types.h>
11637 #ifdef I_FCNTL
11638 #include <fcntl.h>
11639 #endif
11640 #ifdef I_SYS_FILE
11641 #include <sys/file.h>
11642 #endif
11643 #$i_stdlib I_STDLIB
11644 #ifdef I_STDLIB
11645 #include <stdlib.h>
11646 #endif
11647 int main() {
11648         if(O_RDONLY);
11649 #ifdef O_TRUNC
11650         exit(0);
11651 #else
11652         exit(1);
11653 #endif
11654 }
11655 EOCP
11656 : check sys/file.h first to get FREAD on Sun
11657 if $test `./findhdr sys/file.h` && \
11658                 set try -DI_SYS_FILE && eval $compile; then
11659         h_sysfile=true;
11660         echo "<sys/file.h> defines the O_* constants..." >&4
11661         if $run ./try; then
11662                 echo "and you have the 3 argument form of open()." >&4
11663                 val="$define"
11664         else
11665                 echo "but not the 3 argument form of open().  Oh, well." >&4
11666                 val="$undef"
11667         fi
11668 elif $test `./findhdr fcntl.h` && \
11669                 set try -DI_FCNTL && eval $compile; then
11670         h_fcntl=true;
11671         echo "<fcntl.h> defines the O_* constants..." >&4
11672         if $run ./try; then
11673                 echo "and you have the 3 argument form of open()." >&4
11674                 val="$define"
11675         else
11676                 echo "but not the 3 argument form of open().  Oh, well." >&4
11677                 val="$undef"
11678         fi
11679 else
11680         val="$undef"
11681         echo "I can't find the O_* constant definitions!  You got problems." >&4
11682 fi
11683 set d_open3
11684 eval $setvar
11685 $rm -f try try.*
11686
11687 : see which of string.h or strings.h is needed
11688 echo " "
11689 strings=`./findhdr string.h`
11690 if $test "$strings" && $test -r "$strings"; then
11691         echo "Using <string.h> instead of <strings.h>." >&4
11692         val="$define"
11693 else
11694         val="$undef"
11695         strings=`./findhdr strings.h`
11696         if $test "$strings" && $test -r "$strings"; then
11697                 echo "Using <strings.h> instead of <string.h>." >&4
11698         else
11699                 echo "No string header found -- You'll surely have problems." >&4
11700         fi
11701 fi
11702 set i_string
11703 eval $setvar
11704 case "$i_string" in
11705 "$undef") strings=`./findhdr strings.h`;;
11706 *)        strings=`./findhdr string.h`;;
11707 esac
11708
11709 : see if this is a sys/file.h system
11710 val=''
11711 set sys/file.h val
11712 eval $inhdr
11713
11714 : do we need to include sys/file.h ?
11715 case "$val" in
11716 "$define")
11717         echo " "
11718         if $h_sysfile; then
11719                 val="$define"
11720                 echo "We'll be including <sys/file.h>." >&4
11721         else
11722                 val="$undef"
11723                 echo "We won't be including <sys/file.h>." >&4
11724         fi
11725         ;;
11726 *)
11727         h_sysfile=false
11728         ;;
11729 esac
11730 set i_sysfile
11731 eval $setvar
11732
11733 : see if fcntl.h is there
11734 val=''
11735 set fcntl.h val
11736 eval $inhdr
11737
11738 : see if we can include fcntl.h
11739 case "$val" in
11740 "$define")
11741         echo " "
11742         if $h_fcntl; then
11743                 val="$define"
11744                 echo "We'll be including <fcntl.h>." >&4
11745         else
11746                 val="$undef"
11747                 if $h_sysfile; then
11748         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11749                 else
11750                         echo "We won't be including <fcntl.h>." >&4
11751                 fi
11752         fi
11753         ;;
11754 *)
11755         h_fcntl=false
11756         val="$undef"
11757         ;;
11758 esac
11759 set i_fcntl
11760 eval $setvar
11761
11762 : check for non-blocking I/O stuff
11763 case "$h_sysfile" in
11764 true) echo "#include <sys/file.h>" > head.c;;
11765 *)
11766        case "$h_fcntl" in
11767        true) echo "#include <fcntl.h>" > head.c;;
11768        *) echo "#include <sys/fcntl.h>" > head.c;;
11769        esac
11770        ;;
11771 esac
11772 echo " "
11773 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11774 case "$o_nonblock" in
11775 '')
11776         $cat head.c > try.c
11777         $cat >>try.c <<EOCP
11778 #include <stdio.h>
11779 #$i_stdlib I_STDLIB
11780 #ifdef I_STDLIB
11781 #include <stdlib.h>
11782 #endif
11783 #$i_fcntl I_FCNTL
11784 #ifdef I_FCNTL
11785 #include <fcntl.h>
11786 #endif
11787 int main() {
11788 #ifdef O_NONBLOCK
11789         printf("O_NONBLOCK\n");
11790         exit(0);
11791 #endif
11792 #ifdef O_NDELAY
11793         printf("O_NDELAY\n");
11794         exit(0);
11795 #endif
11796 #ifdef FNDELAY
11797         printf("FNDELAY\n");
11798         exit(0);
11799 #endif
11800         exit(0);
11801 }
11802 EOCP
11803         set try
11804         if eval $compile_ok; then
11805                 o_nonblock=`$run ./try`
11806                 case "$o_nonblock" in
11807                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11808                 *) echo "Seems like we can use $o_nonblock.";;
11809                 esac
11810         else
11811                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11812         fi
11813         ;;
11814 *) echo "Using $hint value $o_nonblock.";;
11815 esac
11816 $rm -f try try.* .out core
11817
11818 echo " "
11819 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11820 case "$eagain" in
11821 '')
11822         $cat head.c > try.c
11823         $cat >>try.c <<EOCP
11824 #include <errno.h>
11825 #include <sys/types.h>
11826 #include <signal.h>
11827 #include <stdio.h> 
11828 #$i_stdlib I_STDLIB
11829 #ifdef I_STDLIB
11830 #include <stdlib.h>
11831 #endif
11832 #$i_fcntl I_FCNTL
11833 #ifdef I_FCNTL
11834 #include <fcntl.h>
11835 #endif
11836 #define MY_O_NONBLOCK $o_nonblock
11837 #ifndef errno  /* XXX need better Configure test */
11838 extern int errno;
11839 #endif
11840 #$i_unistd I_UNISTD
11841 #ifdef I_UNISTD
11842 #include <unistd.h>
11843 #endif
11844 #$i_string I_STRING
11845 #ifdef I_STRING
11846 #include <string.h>
11847 #else
11848 #include <strings.h>
11849 #endif
11850 $signal_t blech(x) int x; { exit(3); }
11851 EOCP
11852         $cat >> try.c <<'EOCP'
11853 int main()
11854 {
11855         int pd[2];
11856         int pu[2];
11857         char buf[1];
11858         char string[100];
11859
11860         pipe(pd);       /* Down: child -> parent */
11861         pipe(pu);       /* Up: parent -> child */
11862         if (0 != fork()) {
11863                 int ret;
11864                 close(pd[1]);   /* Parent reads from pd[0] */
11865                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11866 #ifdef F_SETFL
11867                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11868                         exit(1);
11869 #else
11870                 exit(4);
11871 #endif
11872                 signal(SIGALRM, blech);
11873                 alarm(5);
11874                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11875                         exit(2);
11876                 sprintf(string, "%d\n", ret);
11877                 write(2, string, strlen(string));
11878                 alarm(0);
11879 #ifdef EAGAIN
11880                 if (errno == EAGAIN) {
11881                         printf("EAGAIN\n");
11882                         goto ok;
11883                 }
11884 #endif
11885 #ifdef EWOULDBLOCK
11886                 if (errno == EWOULDBLOCK)
11887                         printf("EWOULDBLOCK\n");
11888 #endif
11889         ok:
11890                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11891                 sleep(2);                               /* Give it time to close our pipe */
11892                 alarm(5);
11893                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11894                 alarm(0);
11895                 sprintf(string, "%d\n", ret);
11896                 write(4, string, strlen(string));
11897                 exit(0);
11898         }
11899
11900         close(pd[0]);                   /* We write to pd[1] */
11901         close(pu[1]);                   /* We read from pu[0] */
11902         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11903         close(pd[1]);                   /* Pipe pd is now fully closed! */
11904         exit(0);                                /* Bye bye, thank you for playing! */
11905 }
11906 EOCP
11907         set try
11908         if eval $compile_ok; then
11909                 echo "$startsh" >mtry
11910                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11911                 chmod +x mtry
11912                 ./mtry >/dev/null 2>&1
11913                 case $? in
11914                 0) eagain=`$cat try.out`;;
11915                 1) echo "Could not perform non-blocking setting!";;
11916                 2) echo "I did a successful read() for something that was not there!";;
11917                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11918                 4) echo "Could not find F_SETFL!";;
11919                 *) echo "Something terribly wrong happened during testing.";;
11920                 esac
11921                 rd_nodata=`$cat try.ret`
11922                 echo "A read() system call with no data present returns $rd_nodata."
11923                 case "$rd_nodata" in
11924                 0|-1) ;;
11925                 *)
11926                         echo "(That's peculiar, fixing that to be -1.)"
11927                         rd_nodata=-1
11928                         ;;
11929                 esac
11930                 case "$eagain" in
11931                 '')
11932                         echo "Forcing errno EAGAIN on read() with no data available."
11933                         eagain=EAGAIN
11934                         ;;
11935                 *)
11936                         echo "Your read() sets errno to $eagain when no data is available."
11937                         ;;
11938                 esac
11939                 status=`$cat try.err`
11940                 case "$status" in
11941                 0) echo "And it correctly returns 0 to signal EOF.";;
11942                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11943                 *) echo "However, your read() returns '$status' on EOF??";;
11944                 esac
11945                 val="$define"
11946                 if test "$status" = "$rd_nodata"; then
11947                         echo "WARNING: you can't distinguish between EOF and no data!"
11948                         val="$undef"
11949                 fi
11950         else
11951                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11952                 eagain=EAGAIN
11953         fi
11954         set d_eofnblk
11955         eval $setvar
11956         ;;
11957 *)
11958         echo "Using $hint value $eagain."
11959         echo "Your read() returns $rd_nodata when no data is present."
11960         case "$d_eofnblk" in
11961         "$define") echo "And you can see EOF because read() returns 0.";;
11962         "$undef") echo "But you can't see EOF status from read() returned value.";;
11963         *)
11964                 echo "(Assuming you can't see EOF status from read anyway.)"
11965                 d_eofnblk=$undef
11966                 ;;
11967         esac
11968         ;;
11969 esac
11970 $rm -f try try.* .out core head.c mtry
11971
11972 : see if _ptr and _cnt from stdio act std
11973 echo " "
11974
11975 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11976         echo "(Looks like you have stdio.h from BSD.)"
11977         case "$stdio_ptr" in
11978         '') stdio_ptr='((fp)->_p)'
11979                 ptr_lval=$define
11980                 ;;
11981         *)      ptr_lval=$d_stdio_ptr_lval;;
11982         esac
11983         case "$stdio_cnt" in
11984         '') stdio_cnt='((fp)->_r)'
11985                 cnt_lval=$define
11986                 ;;
11987         *)      cnt_lval=$d_stdio_cnt_lval;;
11988         esac
11989         case "$stdio_base" in
11990         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11991         esac
11992         case "$stdio_bufsiz" in
11993         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11994         esac
11995 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11996         echo "(Looks like you have stdio.h from Linux.)"
11997         case "$stdio_ptr" in
11998         '') stdio_ptr='((fp)->_IO_read_ptr)'
11999                 ptr_lval=$define
12000                 ;;
12001         *)      ptr_lval=$d_stdio_ptr_lval;;
12002         esac
12003         case "$stdio_cnt" in
12004         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12005                 cnt_lval=$undef
12006                 ;;
12007         *)      cnt_lval=$d_stdio_cnt_lval;;
12008         esac
12009         case "$stdio_base" in
12010         '') stdio_base='((fp)->_IO_read_base)';;
12011         esac
12012         case "$stdio_bufsiz" in
12013         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12014         esac
12015 else
12016         case "$stdio_ptr" in
12017         '') stdio_ptr='((fp)->_ptr)'
12018                 ptr_lval=$define
12019                 ;;
12020         *)      ptr_lval=$d_stdio_ptr_lval;;
12021         esac
12022         case "$stdio_cnt" in
12023         '') stdio_cnt='((fp)->_cnt)'
12024                 cnt_lval=$define
12025                 ;;
12026         *)      cnt_lval=$d_stdio_cnt_lval;;
12027         esac
12028         case "$stdio_base" in
12029         '') stdio_base='((fp)->_base)';;
12030         esac
12031         case "$stdio_bufsiz" in
12032         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12033         esac
12034 fi
12035
12036 : test whether _ptr and _cnt really work
12037 echo "Checking how std your stdio is..." >&4
12038 $cat >try.c <<EOP
12039 #include <stdio.h>
12040 #$i_stdlib I_STDLIB
12041 #ifdef I_STDLIB
12042 #include <stdlib.h>
12043 #endif
12044 #define FILE_ptr(fp)    $stdio_ptr
12045 #define FILE_cnt(fp)    $stdio_cnt
12046 int main() {
12047         FILE *fp = fopen("try.c", "r");
12048         char c = getc(fp);
12049         if (
12050                 18 <= FILE_cnt(fp) &&
12051                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12052         )
12053                 exit(0);
12054         exit(1);
12055 }
12056 EOP
12057 val="$undef"
12058 set try
12059 if eval $compile && $to try.c; then
12060         if $run ./try; then
12061                 echo "Your stdio acts pretty std."
12062                 val="$define"
12063         else
12064                 echo "Your stdio isn't very std."
12065         fi
12066 else
12067         echo "Your stdio doesn't appear very std."
12068 fi
12069 $rm -f try.c try
12070
12071 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12072 # direct buffer manipulation no longer works.  The Configure tests
12073 # should be changed to correctly detect this, but until then,
12074 # the following check should at least let perl compile and run.
12075 # (This quick fix should be updated before 5.8.1.)
12076 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12077 # A. Dougherty, June 3, 2002.
12078 case "$d_gnulibc" in
12079 $define)
12080         case "$gnulibc_version" in
12081         2.[01]*)  ;;
12082         2.2) ;;
12083         2.2.[0-9]) ;;
12084         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12085                 val="$undef"
12086                 ;;
12087         esac
12088         ;;
12089 esac
12090 set d_stdstdio
12091 eval $setvar
12092
12093 : Can _ptr be used as an lvalue?
12094 case "$d_stdstdio$ptr_lval" in
12095 $define$define) val=$define ;;
12096 *) val=$undef ;;
12097 esac
12098 set d_stdio_ptr_lval
12099 eval $setvar
12100
12101 : Can _cnt be used as an lvalue?
12102 case "$d_stdstdio$cnt_lval" in
12103 $define$define) val=$define ;;
12104 *) val=$undef ;;
12105 esac
12106 set d_stdio_cnt_lval
12107 eval $setvar
12108
12109
12110 : test whether setting _ptr sets _cnt as a side effect
12111 d_stdio_ptr_lval_sets_cnt="$undef"
12112 d_stdio_ptr_lval_nochange_cnt="$undef"
12113 case "$d_stdio_ptr_lval$d_stdstdio" in
12114 $define$define)
12115         echo "Checking to see what happens if we set the stdio ptr..." >&4
12116 $cat >try.c <<EOP
12117 #include <stdio.h>
12118 /* Can we scream? */
12119 /* Eat dust sed :-) */
12120 /* In the buffer space, no one can hear you scream. */
12121 #$i_stdlib I_STDLIB
12122 #ifdef I_STDLIB
12123 #include <stdlib.h>
12124 #endif
12125 #define FILE_ptr(fp)    $stdio_ptr
12126 #define FILE_cnt(fp)    $stdio_cnt
12127 #include <sys/types.h>
12128 int main() {
12129         FILE *fp = fopen("try.c", "r");
12130         int c;
12131         char *ptr;
12132         size_t cnt;
12133         if (!fp) {
12134             puts("Fail even to read");
12135             exit(1);
12136         }
12137         c = getc(fp); /* Read away the first # */
12138         if (c == EOF) {
12139             puts("Fail even to read");
12140             exit(1);
12141         }
12142         if (!(
12143                 18 <= FILE_cnt(fp) &&
12144                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12145         )) {
12146                 puts("Fail even to read");
12147                 exit (1);
12148         }
12149         ptr = (char*) FILE_ptr(fp);
12150         cnt = (size_t)FILE_cnt(fp);
12151
12152         FILE_ptr(fp) += 42;
12153
12154         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12155                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12156                 exit (1);
12157         }
12158         if (FILE_cnt(fp) <= 20) {
12159                 printf ("Fail (<20 chars to test)");
12160                 exit (1);
12161         }
12162         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12163                 puts("Fail compare");
12164                 exit (1);
12165         }
12166         if (cnt == FILE_cnt(fp)) {
12167                 puts("Pass_unchanged");
12168                 exit (0);
12169         }       
12170         if (FILE_cnt(fp) == (cnt - 42)) {
12171                 puts("Pass_changed");
12172                 exit (0);
12173         }
12174         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12175         return 1;
12176
12177 }
12178 EOP
12179         set try
12180         if eval $compile && $to try.c; then
12181                 case `$run ./try` in
12182                 Pass_changed)
12183                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12184                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12185                 Pass_unchanged)
12186                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12187                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12188                 Fail*)
12189                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12190                 *)
12191                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12192         esac
12193         else
12194                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12195         fi
12196         $rm -f try.c try
12197         ;;
12198 esac
12199
12200 : see if _base is also standard
12201 val="$undef"
12202 case "$d_stdstdio" in
12203 $define)
12204         $cat >try.c <<EOP
12205 #include <stdio.h>
12206 #$i_stdlib I_STDLIB
12207 #ifdef I_STDLIB
12208 #include <stdlib.h>
12209 #endif
12210 #define FILE_base(fp)   $stdio_base
12211 #define FILE_bufsiz(fp) $stdio_bufsiz
12212 int main() {
12213         FILE *fp = fopen("try.c", "r");
12214         char c = getc(fp);
12215         if (
12216                 19 <= FILE_bufsiz(fp) &&
12217                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12218         )
12219                 exit(0);
12220         exit(1);
12221 }
12222 EOP
12223         set try
12224         if eval $compile && $to try.c; then
12225                 if $run ./try; then
12226                         echo "And its _base field acts std."
12227                         val="$define"
12228                 else
12229                         echo "But its _base field isn't std."
12230                 fi
12231         else
12232                 echo "However, it seems to be lacking the _base field."
12233         fi
12234         $rm -f try.c try
12235         ;;
12236 esac
12237 set d_stdiobase
12238 eval $setvar
12239
12240 : see if fast_stdio exists
12241 val="$undef"
12242 case "$d_stdstdio:$d_stdio_ptr_lval" in
12243 "$define:$define")
12244         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12245         *$define*)
12246                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12247                 val="$define"
12248                 ;;
12249         esac
12250         ;;
12251 esac
12252 set d_faststdio
12253 eval $setvar
12254
12255
12256
12257 : see if fchdir exists
12258 set fchdir d_fchdir
12259 eval $inlibc
12260
12261 : see if fchmod exists
12262 set fchmod d_fchmod
12263 eval $inlibc
12264
12265 : see if fchown exists
12266 set fchown d_fchown
12267 eval $inlibc
12268
12269 : see if this is an fcntl system
12270 set fcntl d_fcntl
12271 eval $inlibc
12272
12273 echo " "
12274 : See if fcntl-based locking works.
12275 $cat >try.c <<EOCP
12276 #$i_stdlib I_STDLIB
12277 #ifdef I_STDLIB
12278 #include <stdlib.h>
12279 #endif
12280 #include <unistd.h>
12281 #include <fcntl.h>
12282 #include <signal.h>
12283 $signal_t blech(x) int x; { exit(3); }
12284 int main() {
12285 #if defined(F_SETLK) && defined(F_SETLKW)
12286      struct flock flock;
12287      int retval, fd;
12288      fd = open("try.c", O_RDONLY);
12289      flock.l_type = F_RDLCK;
12290      flock.l_whence = SEEK_SET;
12291      flock.l_start = flock.l_len = 0;
12292      signal(SIGALRM, blech);
12293      alarm(10);
12294      retval = fcntl(fd, F_SETLK, &flock);
12295      close(fd);
12296      (retval < 0 ? exit(2) : exit(0));
12297 #else
12298      exit(2);
12299 #endif
12300 }
12301 EOCP
12302 echo "Checking if fcntl-based file locking works... "
12303 case "$d_fcntl" in
12304 "$define")
12305         set try
12306         if eval $compile_ok; then
12307                 if $run ./try; then
12308                         echo "Yes, it seems to work."
12309                         val="$define"
12310                 else
12311                         echo "Nope, it didn't work."
12312                         val="$undef"
12313                         case "$?" in
12314                         3) $cat >&4 <<EOM
12315 ***
12316 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12317 *** This is (almost) impossible.
12318 *** If your NFS lock daemons are not feeling well, something like
12319 *** this may happen, please investigate.  Cannot continue, aborting.
12320 ***
12321 EOM
12322                                 exit 1
12323                                 ;;
12324                         esac
12325                 fi
12326         else
12327                 echo "I'm unable to compile the test program, so I'll assume not."
12328                 val="$undef"
12329         fi
12330         ;;
12331 *) val="$undef";
12332         echo "Nope, since you don't even have fcntl()."
12333         ;;
12334 esac
12335 set d_fcntl_can_lock
12336 eval $setvar
12337 $rm -f try*
12338
12339
12340 : check for fd_set items
12341 $cat <<EOM
12342
12343 Checking to see how well your C compiler handles fd_set and friends ...
12344 EOM
12345 $cat >try.c <<EOCP
12346 #$i_stdlib I_STDLIB
12347 #ifdef I_STDLIB
12348 #include <stdlib.h>
12349 #endif
12350 #$i_systime I_SYS_TIME
12351 #$i_sysselct I_SYS_SELECT
12352 #$d_socket HAS_SOCKET
12353 #include <sys/types.h>
12354 #ifdef HAS_SOCKET
12355 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12356 #endif
12357 #ifdef I_SYS_TIME
12358 #include <sys/time.h>
12359 #endif
12360 #ifdef I_SYS_SELECT
12361 #include <sys/select.h>
12362 #endif
12363 int main() {
12364         fd_set fds;
12365
12366 #ifdef TRYBITS
12367         if(fds.fds_bits);
12368 #endif
12369
12370 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12371         exit(0);
12372 #else
12373         exit(1);
12374 #endif
12375 }
12376 EOCP
12377 set try -DTRYBITS
12378 if eval $compile; then
12379         d_fds_bits="$define"
12380         d_fd_set="$define"
12381         echo "Well, your system knows about the normal fd_set typedef..." >&4
12382         if $run ./try; then
12383                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12384                 d_fd_macros="$define"
12385         else
12386                 $cat >&4 <<'EOM'
12387 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12388 EOM
12389                 d_fd_macros="$undef"
12390         fi
12391 else
12392         $cat <<'EOM'
12393 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12394 EOM
12395         set try
12396         if eval $compile; then
12397                 d_fds_bits="$undef"
12398                 d_fd_set="$define"
12399                 echo "Well, your system has some sort of fd_set available..." >&4
12400                 if $run ./try; then
12401                         echo "and you have the normal fd_set macros." >&4
12402                         d_fd_macros="$define"
12403                 else
12404                         $cat <<'EOM'
12405 but not the normal fd_set macros!  Gross!  More work for me...
12406 EOM
12407                         d_fd_macros="$undef"
12408                 fi
12409         else
12410         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12411                 d_fd_set="$undef"
12412                 d_fds_bits="$undef"
12413                 d_fd_macros="$undef"
12414         fi
12415 fi
12416 $rm -f try try.*
12417
12418 : see if fgetpos exists
12419 set fgetpos d_fgetpos
12420 eval $inlibc
12421
12422 : see if finite exists
12423 set finite d_finite
12424 eval $inlibc
12425
12426 : see if finitel exists
12427 set finitel d_finitel
12428 eval $inlibc
12429
12430 : see if flock exists
12431 set flock d_flock
12432 eval $inlibc
12433
12434 : see if prototype for flock is available
12435 echo " "
12436 set d_flockproto flock $i_sysfile sys/file.h
12437 eval $hasproto
12438
12439 : see if fork exists
12440 set fork d_fork
12441 eval $inlibc
12442
12443 : see if fp_class exists
12444 set fp_class d_fp_class
12445 eval $inlibc
12446
12447 : see if pathconf exists
12448 set pathconf d_pathconf
12449 eval $inlibc
12450
12451 : see if fpathconf exists
12452 set fpathconf d_fpathconf
12453 eval $inlibc
12454
12455 : see if fpclass exists
12456 set fpclass d_fpclass
12457 eval $inlibc
12458
12459 : see if fpclassify exists
12460 set fpclassify d_fpclassify
12461 eval $inlibc
12462
12463 : see if fpclassl exists
12464 set fpclassl d_fpclassl
12465 eval $inlibc
12466
12467
12468 : check for fpos64_t
12469 echo " "
12470 echo "Checking to see if you have fpos64_t..." >&4
12471 $cat >try.c <<EOCP
12472 #include <stdio.h>
12473 int main() { fpos64_t x = 7; }
12474 EOCP
12475 set try
12476 if eval $compile; then
12477         val="$define"
12478         echo "You have fpos64_t."
12479 else
12480         val="$undef"
12481         echo "You do not have fpos64_t."
12482         case "$fpossize" in
12483         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12484         esac
12485 fi
12486 $rm -f try.* try
12487 set d_fpos64_t
12488 eval $setvar
12489
12490 : see if frexpl exists
12491 set frexpl d_frexpl
12492 eval $inlibc
12493
12494 : see if this is a sys/param system
12495 set sys/param.h i_sysparam
12496 eval $inhdr
12497
12498 : see if this is a sys/mount.h system
12499 set sys/mount.h i_sysmount
12500 eval $inhdr
12501
12502
12503 echo " "
12504 echo "Checking to see if your system supports struct fs_data..." >&4
12505 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12506 eval $hasstruct
12507 case "$d_fs_data_s" in
12508 "$define")      echo "Yes, it does."   ;;
12509 *)              echo "No, it doesn't." ;;
12510 esac
12511
12512 : see if fseeko exists
12513 set fseeko d_fseeko
12514 eval $inlibc
12515 case "$longsize" in
12516 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12517 esac
12518
12519 : see if fsetpos exists
12520 set fsetpos d_fsetpos
12521 eval $inlibc
12522
12523
12524 : see if fstatfs exists
12525 set fstatfs d_fstatfs
12526 eval $inlibc
12527
12528
12529 : see if statvfs exists
12530 set statvfs d_statvfs
12531 eval $inlibc
12532
12533 : see if fstatvfs exists
12534 set fstatvfs d_fstatvfs
12535 eval $inlibc
12536
12537
12538 : see if fsync exists
12539 set fsync d_fsync
12540 eval $inlibc
12541
12542 : see if ftello exists
12543 set ftello d_ftello
12544 eval $inlibc
12545 case "$longsize" in
12546 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12547 esac
12548
12549 : see if getcwd exists
12550 set getcwd d_getcwd
12551 eval $inlibc
12552
12553 : see if getespwnam exists
12554 set getespwnam d_getespwnam
12555 eval $inlibc
12556
12557
12558 : see if getfsstat exists
12559 set getfsstat d_getfsstat
12560 eval $inlibc
12561
12562 : see if getgrent exists
12563 set getgrent d_getgrent
12564 eval $inlibc
12565
12566 : see if getgrent_r exists
12567 set getgrent_r d_getgrent_r
12568 eval $inlibc
12569 case "$d_getgrent_r" in
12570 "$define")
12571         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12572         case "$d_getgrent_r_proto:$usethreads" in
12573         ":define")      d_getgrent_r_proto=define
12574                 set d_getgrent_r_proto getgrent_r $hdrs
12575                 eval $hasproto ;;
12576         *)      ;;
12577         esac
12578         case "$d_getgrent_r_proto" in
12579         define)
12580         case "$getgrent_r_proto" in
12581         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12582         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12583         esac
12584         case "$getgrent_r_proto" in
12585         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12586         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12587         esac
12588         case "$getgrent_r_proto" in
12589         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12590         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12591         esac
12592         case "$getgrent_r_proto" in
12593         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12594         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12595         esac
12596         case "$getgrent_r_proto" in
12597         ''|0) try='int getgrent_r(struct group*, char*, int);'
12598         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12599         esac
12600         case "$getgrent_r_proto" in
12601         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12602         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12603         esac
12604         case "$getgrent_r_proto" in
12605         ''|0)   d_getgrent_r=undef
12606                 getgrent_r_proto=0
12607                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12608         * )     case "$getgrent_r_proto" in
12609                 REENTRANT_PROTO*) ;;
12610                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12611                 esac
12612                 echo "Prototype: $try" ;;
12613         esac
12614         ;;
12615         *)      case "$usethreads" in
12616                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12617                 esac
12618                 d_getgrent_r=undef
12619                 getgrent_r_proto=0
12620                 ;;
12621         esac
12622         ;;
12623 *)      getgrent_r_proto=0
12624         ;;
12625 esac
12626
12627 : see if getgrgid_r exists
12628 set getgrgid_r d_getgrgid_r
12629 eval $inlibc
12630 case "$d_getgrgid_r" in
12631 "$define")
12632         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12633         case "$d_getgrgid_r_proto:$usethreads" in
12634         ":define")      d_getgrgid_r_proto=define
12635                 set d_getgrgid_r_proto getgrgid_r $hdrs
12636                 eval $hasproto ;;
12637         *)      ;;
12638         esac
12639         case "$d_getgrgid_r_proto" in
12640         define)
12641         case "$getgrgid_r_proto" in
12642         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12643         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12644         esac
12645         case "$getgrgid_r_proto" in
12646         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12647         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12648         esac
12649         case "$getgrgid_r_proto" in
12650         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12651         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12652         esac
12653         case "$getgrgid_r_proto" in
12654         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12655         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12656         esac
12657         case "$getgrgid_r_proto" in
12658         ''|0)   d_getgrgid_r=undef
12659                 getgrgid_r_proto=0
12660                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12661         * )     case "$getgrgid_r_proto" in
12662                 REENTRANT_PROTO*) ;;
12663                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12664                 esac
12665                 echo "Prototype: $try" ;;
12666         esac
12667         ;;
12668         *)      case "$usethreads" in
12669                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12670                 esac
12671                 d_getgrgid_r=undef
12672                 getgrgid_r_proto=0
12673                 ;;
12674         esac
12675         ;;
12676 *)      getgrgid_r_proto=0
12677         ;;
12678 esac
12679
12680 : see if getgrnam_r exists
12681 set getgrnam_r d_getgrnam_r
12682 eval $inlibc
12683 case "$d_getgrnam_r" in
12684 "$define")
12685         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12686         case "$d_getgrnam_r_proto:$usethreads" in
12687         ":define")      d_getgrnam_r_proto=define
12688                 set d_getgrnam_r_proto getgrnam_r $hdrs
12689                 eval $hasproto ;;
12690         *)      ;;
12691         esac
12692         case "$d_getgrnam_r_proto" in
12693         define)
12694         case "$getgrnam_r_proto" in
12695         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12696         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12697         esac
12698         case "$getgrnam_r_proto" in
12699         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12700         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12701         esac
12702         case "$getgrnam_r_proto" in
12703         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12704         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12705         esac
12706         case "$getgrnam_r_proto" in
12707         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12708         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12709         esac
12710         case "$getgrnam_r_proto" in
12711         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12712         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12713         esac
12714         case "$getgrnam_r_proto" in
12715         ''|0)   d_getgrnam_r=undef
12716                 getgrnam_r_proto=0
12717                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12718         * )     case "$getgrnam_r_proto" in
12719                 REENTRANT_PROTO*) ;;
12720                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12721                 esac
12722                 echo "Prototype: $try" ;;
12723         esac
12724         ;;
12725         *)      case "$usethreads" in
12726                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12727                 esac
12728                 d_getgrnam_r=undef
12729                 getgrnam_r_proto=0
12730                 ;;
12731         esac
12732         ;;
12733 *)      getgrnam_r_proto=0
12734         ;;
12735 esac
12736
12737 : see if gethostbyaddr exists
12738 set gethostbyaddr d_gethbyaddr
12739 eval $inlibc
12740
12741 : see if gethostbyname exists
12742 set gethostbyname d_gethbyname
12743 eval $inlibc
12744
12745 : see if gethostent exists
12746 set gethostent d_gethent
12747 eval $inlibc
12748
12749 : see how we will look up host name
12750 echo " "
12751 call=''
12752 if set gethostname val -f d_gethname; eval $csym; $val; then
12753         echo 'gethostname() found.' >&4
12754         d_gethname="$define"
12755         call=gethostname
12756 fi
12757 if set uname val -f d_uname; eval $csym; $val; then
12758         if ./xenix; then
12759                 $cat <<'EOM'
12760 uname() was found, but you're running xenix, and older versions of xenix
12761 have a broken uname(). If you don't really know whether your xenix is old
12762 enough to have a broken system call, use the default answer.
12763
12764 EOM
12765                 dflt=y
12766                 case "$d_uname" in
12767                 "$define") dflt=n;;
12768                 esac
12769                 rp='Is your uname() broken?'
12770                 . ./myread
12771                 case "$ans" in
12772                 n*) d_uname="$define"; call=uname;;
12773                 esac
12774         else
12775                 echo 'uname() found.' >&4
12776                 d_uname="$define"
12777                 case "$call" in
12778                 '') call=uname ;;
12779                 esac
12780         fi
12781 fi
12782 case "$d_gethname" in
12783 '') d_gethname="$undef";;
12784 esac
12785 case "$d_uname" in
12786 '') d_uname="$undef";;
12787 esac
12788 case "$d_uname$d_gethname" in
12789 *define*)
12790         dflt=n
12791         cat <<EOM
12792  
12793 Every now and then someone has a $call() that lies about the hostname
12794 but can't be fixed for political or economic reasons.  If you wish, I can
12795 pretend $call() isn't there and maybe compute hostname at run-time
12796 thanks to the '$phostname' command.
12797
12798 EOM
12799         rp="Shall I ignore $call() from now on?"
12800         . ./myread
12801         case "$ans" in
12802         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12803         esac;;
12804 esac
12805 case "$phostname" in
12806 '') aphostname='';;
12807 *) case "$aphostname" in
12808         /*) ;;
12809         *) set X $phostname
12810                 shift
12811                 file=$1
12812                 shift
12813                 file=`./loc $file $file $pth`
12814                 aphostname=`echo $file $*`
12815                 ;;
12816         esac
12817         ;;
12818 esac
12819 case "$d_uname$d_gethname" in
12820 *define*) ;;
12821 *)
12822         case "$phostname" in
12823         '')
12824                 echo "There will be no way for $package to get your hostname." >&4;;
12825         *)
12826         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12827                 ;;
12828         esac;;
12829 esac
12830 case "$d_phostname" in
12831 '') d_phostname="$undef";;
12832 esac
12833
12834 : see if gethostbyaddr_r exists
12835 set gethostbyaddr_r d_gethostbyaddr_r
12836 eval $inlibc
12837 case "$d_gethostbyaddr_r" in
12838 "$define")
12839         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12840         case "$d_gethostbyaddr_r_proto:$usethreads" in
12841         ":define")      d_gethostbyaddr_r_proto=define
12842                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12843                 eval $hasproto ;;
12844         *)      ;;
12845         esac
12846         case "$d_gethostbyaddr_r_proto" in
12847         define)
12848         case "$gethostbyaddr_r_proto" in
12849         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12850         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12851         esac
12852         case "$gethostbyaddr_r_proto" in
12853         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12854         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12855         esac
12856         case "$gethostbyaddr_r_proto" in
12857         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12858         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12859         esac
12860         case "$gethostbyaddr_r_proto" in
12861         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12862         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12863         esac
12864         case "$gethostbyaddr_r_proto" in
12865         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12866         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12867         esac
12868         case "$gethostbyaddr_r_proto" in
12869         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12870         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12871         esac
12872         case "$gethostbyaddr_r_proto" in
12873         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12874         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12875         esac
12876         case "$gethostbyaddr_r_proto" in
12877         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12878         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12879         esac
12880         case "$gethostbyaddr_r_proto" in
12881         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12882         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12883         esac
12884         case "$gethostbyaddr_r_proto" in
12885         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12886         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12887         esac
12888         case "$gethostbyaddr_r_proto" in
12889         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12890         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12891         esac
12892         case "$gethostbyaddr_r_proto" in
12893         ''|0)   d_gethostbyaddr_r=undef
12894                 gethostbyaddr_r_proto=0
12895                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12896         * )     case "$gethostbyaddr_r_proto" in
12897                 REENTRANT_PROTO*) ;;
12898                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12899                 esac
12900                 echo "Prototype: $try" ;;
12901         esac
12902         ;;
12903         *)      case "$usethreads" in
12904                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12905                 esac
12906                 d_gethostbyaddr_r=undef
12907                 gethostbyaddr_r_proto=0
12908                 ;;
12909         esac
12910         ;;
12911 *)      gethostbyaddr_r_proto=0
12912         ;;
12913 esac
12914
12915 : see if gethostbyname_r exists
12916 set gethostbyname_r d_gethostbyname_r
12917 eval $inlibc
12918 case "$d_gethostbyname_r" in
12919 "$define")
12920         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12921         case "$d_gethostbyname_r_proto:$usethreads" in
12922         ":define")      d_gethostbyname_r_proto=define
12923                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12924                 eval $hasproto ;;
12925         *)      ;;
12926         esac
12927         case "$d_gethostbyname_r_proto" in
12928         define)
12929         case "$gethostbyname_r_proto" in
12930         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12931         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12932         esac
12933         case "$gethostbyname_r_proto" in
12934         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12935         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12936         esac
12937         case "$gethostbyname_r_proto" in
12938         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12939         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12940         esac
12941         case "$gethostbyname_r_proto" in
12942         ''|0)   d_gethostbyname_r=undef
12943                 gethostbyname_r_proto=0
12944                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12945         * )     case "$gethostbyname_r_proto" in
12946                 REENTRANT_PROTO*) ;;
12947                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12948                 esac
12949                 echo "Prototype: $try" ;;
12950         esac
12951         ;;
12952         *)      case "$usethreads" in
12953                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12954                 esac
12955                 d_gethostbyname_r=undef
12956                 gethostbyname_r_proto=0
12957                 ;;
12958         esac
12959         ;;
12960 *)      gethostbyname_r_proto=0
12961         ;;
12962 esac
12963
12964 : see if gethostent_r exists
12965 set gethostent_r d_gethostent_r
12966 eval $inlibc
12967 case "$d_gethostent_r" in
12968 "$define")
12969         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12970         case "$d_gethostent_r_proto:$usethreads" in
12971         ":define")      d_gethostent_r_proto=define
12972                 set d_gethostent_r_proto gethostent_r $hdrs
12973                 eval $hasproto ;;
12974         *)      ;;
12975         esac
12976         case "$d_gethostent_r_proto" in
12977         define)
12978         case "$gethostent_r_proto" in
12979         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12980         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12981         esac
12982         case "$gethostent_r_proto" in
12983         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12984         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12985         esac
12986         case "$gethostent_r_proto" in
12987         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12988         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12989         esac
12990         case "$gethostent_r_proto" in
12991         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12992         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12993         esac
12994         case "$gethostent_r_proto" in
12995         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12996         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12997         esac
12998         case "$gethostent_r_proto" in
12999         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13000         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13001         esac
13002         case "$gethostent_r_proto" in
13003         ''|0)   d_gethostent_r=undef
13004                 gethostent_r_proto=0
13005                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13006         * )     case "$gethostent_r_proto" in
13007                 REENTRANT_PROTO*) ;;
13008                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13009                 esac
13010                 echo "Prototype: $try" ;;
13011         esac
13012         ;;
13013         *)      case "$usethreads" in
13014                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13015                 esac
13016                 d_gethostent_r=undef
13017                 gethostent_r_proto=0
13018                 ;;
13019         esac
13020         ;;
13021 *)      gethostent_r_proto=0
13022         ;;
13023 esac
13024
13025 : see if prototypes for various gethostxxx netdb.h functions are available
13026 echo " "
13027 set d_gethostprotos gethostent $i_netdb netdb.h
13028 eval $hasproto
13029
13030 : see if getitimer exists
13031 set getitimer d_getitimer
13032 eval $inlibc
13033
13034 : see if getlogin exists
13035 set getlogin d_getlogin
13036 eval $inlibc
13037
13038 : see if getlogin_r exists
13039 set getlogin_r d_getlogin_r
13040 eval $inlibc
13041 case "$d_getlogin_r" in
13042 "$define")
13043         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13044         case "$d_getlogin_r_proto:$usethreads" in
13045         ":define")      d_getlogin_r_proto=define
13046                 set d_getlogin_r_proto getlogin_r $hdrs
13047                 eval $hasproto ;;
13048         *)      ;;
13049         esac
13050         case "$d_getlogin_r_proto" in
13051         define)
13052         case "$getlogin_r_proto" in
13053         ''|0) try='int getlogin_r(char*, size_t);'
13054         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13055         esac
13056         case "$getlogin_r_proto" in
13057         ''|0) try='int getlogin_r(char*, int);'
13058         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13059         esac
13060         case "$getlogin_r_proto" in
13061         ''|0) try='char* getlogin_r(char*, size_t);'
13062         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13063         esac
13064         case "$getlogin_r_proto" in
13065         ''|0) try='char* getlogin_r(char*, int);'
13066         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13067         esac
13068         case "$getlogin_r_proto" in
13069         ''|0)   d_getlogin_r=undef
13070                 getlogin_r_proto=0
13071                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13072         * )     case "$getlogin_r_proto" in
13073                 REENTRANT_PROTO*) ;;
13074                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13075                 esac
13076                 echo "Prototype: $try" ;;
13077         esac
13078         ;;
13079         *)      case "$usethreads" in
13080                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13081                 esac
13082                 d_getlogin_r=undef
13083                 getlogin_r_proto=0
13084                 ;;
13085         esac
13086         ;;
13087 *)      getlogin_r_proto=0
13088         ;;
13089 esac
13090
13091 : see if getmnt exists
13092 set getmnt d_getmnt
13093 eval $inlibc
13094
13095 : see if getmntent exists
13096 set getmntent d_getmntent
13097 eval $inlibc
13098
13099 : see if getnetbyaddr exists
13100 set getnetbyaddr d_getnbyaddr
13101 eval $inlibc
13102
13103 : see if getnetbyname exists
13104 set getnetbyname d_getnbyname
13105 eval $inlibc
13106
13107 : see if getnetent exists
13108 set getnetent d_getnent
13109 eval $inlibc
13110
13111 : see if getnetbyaddr_r exists
13112 set getnetbyaddr_r d_getnetbyaddr_r
13113 eval $inlibc
13114 case "$d_getnetbyaddr_r" in
13115 "$define")
13116         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13117         case "$d_getnetbyaddr_r_proto:$usethreads" in
13118         ":define")      d_getnetbyaddr_r_proto=define
13119                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13120                 eval $hasproto ;;
13121         *)      ;;
13122         esac
13123         case "$d_getnetbyaddr_r_proto" in
13124         define)
13125         case "$getnetbyaddr_r_proto" in
13126         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13127         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13128         esac
13129         case "$getnetbyaddr_r_proto" in
13130         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13131         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13132         esac
13133         case "$getnetbyaddr_r_proto" in
13134         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13135         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13136         esac
13137         case "$getnetbyaddr_r_proto" in
13138         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13139         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13140         esac
13141         case "$getnetbyaddr_r_proto" in
13142         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13143         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13144         esac
13145         case "$getnetbyaddr_r_proto" in
13146         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13147         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13148         esac
13149         case "$getnetbyaddr_r_proto" in
13150         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13151         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13152         esac
13153         case "$getnetbyaddr_r_proto" in
13154         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13155         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13156         esac
13157         case "$getnetbyaddr_r_proto" in
13158         ''|0)   d_getnetbyaddr_r=undef
13159                 getnetbyaddr_r_proto=0
13160                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13161         * )     case "$getnetbyaddr_r_proto" in
13162                 REENTRANT_PROTO*) ;;
13163                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13164                 esac
13165                 echo "Prototype: $try" ;;
13166         esac
13167         ;;
13168         *)      case "$usethreads" in
13169                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13170                 esac
13171                 d_getnetbyaddr_r=undef
13172                 getnetbyaddr_r_proto=0
13173                 ;;
13174         esac
13175         ;;
13176 *)      getnetbyaddr_r_proto=0
13177         ;;
13178 esac
13179
13180 : see if getnetbyname_r exists
13181 set getnetbyname_r d_getnetbyname_r
13182 eval $inlibc
13183 case "$d_getnetbyname_r" in
13184 "$define")
13185         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13186         case "$d_getnetbyname_r_proto:$usethreads" in
13187         ":define")      d_getnetbyname_r_proto=define
13188                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13189                 eval $hasproto ;;
13190         *)      ;;
13191         esac
13192         case "$d_getnetbyname_r_proto" in
13193         define)
13194         case "$getnetbyname_r_proto" in
13195         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13196         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13197         esac
13198         case "$getnetbyname_r_proto" in
13199         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13200         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13201         esac
13202         case "$getnetbyname_r_proto" in
13203         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13204         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13205         esac
13206         case "$getnetbyname_r_proto" in
13207         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13208         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13209         esac
13210         case "$getnetbyname_r_proto" in
13211         ''|0)   d_getnetbyname_r=undef
13212                 getnetbyname_r_proto=0
13213                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13214         * )     case "$getnetbyname_r_proto" in
13215                 REENTRANT_PROTO*) ;;
13216                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13217                 esac
13218                 echo "Prototype: $try" ;;
13219         esac
13220         ;;
13221         *)      case "$usethreads" in
13222                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13223                 esac
13224                 d_getnetbyname_r=undef
13225                 getnetbyname_r_proto=0
13226                 ;;
13227         esac
13228         ;;
13229 *)      getnetbyname_r_proto=0
13230         ;;
13231 esac
13232
13233 : see if getnetent_r exists
13234 set getnetent_r d_getnetent_r
13235 eval $inlibc
13236 case "$d_getnetent_r" in
13237 "$define")
13238         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13239         case "$d_getnetent_r_proto:$usethreads" in
13240         ":define")      d_getnetent_r_proto=define
13241                 set d_getnetent_r_proto getnetent_r $hdrs
13242                 eval $hasproto ;;
13243         *)      ;;
13244         esac
13245         case "$d_getnetent_r_proto" in
13246         define)
13247         case "$getnetent_r_proto" in
13248         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13249         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13250         esac
13251         case "$getnetent_r_proto" in
13252         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13253         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13254         esac
13255         case "$getnetent_r_proto" in
13256         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13257         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13258         esac
13259         case "$getnetent_r_proto" in
13260         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13261         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13262         esac
13263         case "$getnetent_r_proto" in
13264         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13265         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13266         esac
13267         case "$getnetent_r_proto" in
13268         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13269         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13270         esac
13271         case "$getnetent_r_proto" in
13272         ''|0)   d_getnetent_r=undef
13273                 getnetent_r_proto=0
13274                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13275         * )     case "$getnetent_r_proto" in
13276                 REENTRANT_PROTO*) ;;
13277                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13278                 esac
13279                 echo "Prototype: $try" ;;
13280         esac
13281         ;;
13282         *)      case "$usethreads" in
13283                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13284                 esac
13285                 d_getnetent_r=undef
13286                 getnetent_r_proto=0
13287                 ;;
13288         esac
13289         ;;
13290 *)      getnetent_r_proto=0
13291         ;;
13292 esac
13293
13294 : see if prototypes for various getnetxxx netdb.h functions are available
13295 echo " "
13296 set d_getnetprotos getnetent $i_netdb netdb.h
13297 eval $hasproto
13298
13299 : see if getpagesize exists
13300 set getpagesize d_getpagsz
13301 eval $inlibc
13302
13303
13304 : see if getprotobyname exists
13305 set getprotobyname d_getpbyname
13306 eval $inlibc
13307
13308 : see if getprotobynumber exists
13309 set getprotobynumber d_getpbynumber
13310 eval $inlibc
13311
13312 : see if getprotoent exists
13313 set getprotoent d_getpent
13314 eval $inlibc
13315
13316 : see if getpgid exists
13317 set getpgid d_getpgid
13318 eval $inlibc
13319
13320 : see if getpgrp2 exists
13321 set getpgrp2 d_getpgrp2
13322 eval $inlibc
13323
13324 : see if getppid exists
13325 set getppid d_getppid
13326 eval $inlibc
13327
13328 : see if getpriority exists
13329 set getpriority d_getprior
13330 eval $inlibc
13331
13332 : see if getprotobyname_r exists
13333 set getprotobyname_r d_getprotobyname_r
13334 eval $inlibc
13335 case "$d_getprotobyname_r" in
13336 "$define")
13337         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13338         case "$d_getprotobyname_r_proto:$usethreads" in
13339         ":define")      d_getprotobyname_r_proto=define
13340                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13341                 eval $hasproto ;;
13342         *)      ;;
13343         esac
13344         case "$d_getprotobyname_r_proto" in
13345         define)
13346         case "$getprotobyname_r_proto" in
13347         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13348         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13349         esac
13350         case "$getprotobyname_r_proto" in
13351         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13352         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13353         esac
13354         case "$getprotobyname_r_proto" in
13355         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13356         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13357         esac
13358         case "$getprotobyname_r_proto" in
13359         ''|0)   d_getprotobyname_r=undef
13360                 getprotobyname_r_proto=0
13361                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13362         * )     case "$getprotobyname_r_proto" in
13363                 REENTRANT_PROTO*) ;;
13364                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13365                 esac
13366                 echo "Prototype: $try" ;;
13367         esac
13368         ;;
13369         *)      case "$usethreads" in
13370                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13371                 esac
13372                 d_getprotobyname_r=undef
13373                 getprotobyname_r_proto=0
13374                 ;;
13375         esac
13376         ;;
13377 *)      getprotobyname_r_proto=0
13378         ;;
13379 esac
13380
13381 : see if getprotobynumber_r exists
13382 set getprotobynumber_r d_getprotobynumber_r
13383 eval $inlibc
13384 case "$d_getprotobynumber_r" in
13385 "$define")
13386         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13387         case "$d_getprotobynumber_r_proto:$usethreads" in
13388         ":define")      d_getprotobynumber_r_proto=define
13389                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13390                 eval $hasproto ;;
13391         *)      ;;
13392         esac
13393         case "$d_getprotobynumber_r_proto" in
13394         define)
13395         case "$getprotobynumber_r_proto" in
13396         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13397         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13398         esac
13399         case "$getprotobynumber_r_proto" in
13400         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13401         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13402         esac
13403         case "$getprotobynumber_r_proto" in
13404         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13405         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13406         esac
13407         case "$getprotobynumber_r_proto" in
13408         ''|0)   d_getprotobynumber_r=undef
13409                 getprotobynumber_r_proto=0
13410                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13411         * )     case "$getprotobynumber_r_proto" in
13412                 REENTRANT_PROTO*) ;;
13413                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13414                 esac
13415                 echo "Prototype: $try" ;;
13416         esac
13417         ;;
13418         *)      case "$usethreads" in
13419                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13420                 esac
13421                 d_getprotobynumber_r=undef
13422                 getprotobynumber_r_proto=0
13423                 ;;
13424         esac
13425         ;;
13426 *)      getprotobynumber_r_proto=0
13427         ;;
13428 esac
13429
13430 : see if getprotoent_r exists
13431 set getprotoent_r d_getprotoent_r
13432 eval $inlibc
13433 case "$d_getprotoent_r" in
13434 "$define")
13435         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13436         case "$d_getprotoent_r_proto:$usethreads" in
13437         ":define")      d_getprotoent_r_proto=define
13438                 set d_getprotoent_r_proto getprotoent_r $hdrs
13439                 eval $hasproto ;;
13440         *)      ;;
13441         esac
13442         case "$d_getprotoent_r_proto" in
13443         define)
13444         case "$getprotoent_r_proto" in
13445         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13446         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13447         esac
13448         case "$getprotoent_r_proto" in
13449         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13450         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13451         esac
13452         case "$getprotoent_r_proto" in
13453         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13454         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13455         esac
13456         case "$getprotoent_r_proto" in
13457         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13458         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13459         esac
13460         case "$getprotoent_r_proto" in
13461         ''|0)   d_getprotoent_r=undef
13462                 getprotoent_r_proto=0
13463                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13464         * )     case "$getprotoent_r_proto" in
13465                 REENTRANT_PROTO*) ;;
13466                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13467                 esac
13468                 echo "Prototype: $try" ;;
13469         esac
13470         ;;
13471         *)      case "$usethreads" in
13472                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13473                 esac
13474                 d_getprotoent_r=undef
13475                 getprotoent_r_proto=0
13476                 ;;
13477         esac
13478         ;;
13479 *)      getprotoent_r_proto=0
13480         ;;
13481 esac
13482
13483 : see if prototypes for various getprotoxxx netdb.h functions are available
13484 echo " "
13485 set d_getprotoprotos getprotoent $i_netdb netdb.h
13486 eval $hasproto
13487
13488 : see if getprpwnam exists
13489 set getprpwnam d_getprpwnam
13490 eval $inlibc
13491
13492 : see if getpwent exists
13493 set getpwent d_getpwent
13494 eval $inlibc
13495
13496 : see if getpwent_r exists
13497 set getpwent_r d_getpwent_r
13498 eval $inlibc
13499 case "$d_getpwent_r" in
13500 "$define")
13501         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13502         case "$d_getpwent_r_proto:$usethreads" in
13503         ":define")      d_getpwent_r_proto=define
13504                 set d_getpwent_r_proto getpwent_r $hdrs
13505                 eval $hasproto ;;
13506         *)      ;;
13507         esac
13508         case "$d_getpwent_r_proto" in
13509         define)
13510         case "$getpwent_r_proto" in
13511         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13512         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13513         esac
13514         case "$getpwent_r_proto" in
13515         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13516         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13517         esac
13518         case "$getpwent_r_proto" in
13519         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13520         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13521         esac
13522         case "$getpwent_r_proto" in
13523         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13524         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13525         esac
13526         case "$getpwent_r_proto" in
13527         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13528         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13529         esac
13530         case "$getpwent_r_proto" in
13531         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13532         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13533         esac
13534         case "$getpwent_r_proto" in
13535         ''|0)   d_getpwent_r=undef
13536                 getpwent_r_proto=0
13537                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13538         * )     case "$getpwent_r_proto" in
13539                 REENTRANT_PROTO*) ;;
13540                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13541                 esac
13542                 echo "Prototype: $try" ;;
13543         esac
13544         ;;
13545         *)      case "$usethreads" in
13546                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13547                 esac
13548                 d_getpwent_r=undef
13549                 getpwent_r_proto=0
13550                 ;;
13551         esac
13552         ;;
13553 *)      getpwent_r_proto=0
13554         ;;
13555 esac
13556
13557 : see if getpwnam_r exists
13558 set getpwnam_r d_getpwnam_r
13559 eval $inlibc
13560 case "$d_getpwnam_r" in
13561 "$define")
13562         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13563         case "$d_getpwnam_r_proto:$usethreads" in
13564         ":define")      d_getpwnam_r_proto=define
13565                 set d_getpwnam_r_proto getpwnam_r $hdrs
13566                 eval $hasproto ;;
13567         *)      ;;
13568         esac
13569         case "$d_getpwnam_r_proto" in
13570         define)
13571         case "$getpwnam_r_proto" in
13572         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13573         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13574         esac
13575         case "$getpwnam_r_proto" in
13576         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13577         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13578         esac
13579         case "$getpwnam_r_proto" in
13580         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13581         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13582         esac
13583         case "$getpwnam_r_proto" in
13584         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13585         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13586         esac
13587         case "$getpwnam_r_proto" in
13588         ''|0)   d_getpwnam_r=undef
13589                 getpwnam_r_proto=0
13590                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13591         * )     case "$getpwnam_r_proto" in
13592                 REENTRANT_PROTO*) ;;
13593                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13594                 esac
13595                 echo "Prototype: $try" ;;
13596         esac
13597         ;;
13598         *)      case "$usethreads" in
13599                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13600                 esac
13601                 d_getpwnam_r=undef
13602                 getpwnam_r_proto=0
13603                 ;;
13604         esac
13605         ;;
13606 *)      getpwnam_r_proto=0
13607         ;;
13608 esac
13609
13610 : see if getpwuid_r exists
13611 set getpwuid_r d_getpwuid_r
13612 eval $inlibc
13613 case "$d_getpwuid_r" in
13614 "$define")
13615         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13616         case "$d_getpwuid_r_proto:$usethreads" in
13617         ":define")      d_getpwuid_r_proto=define
13618                 set d_getpwuid_r_proto getpwuid_r $hdrs
13619                 eval $hasproto ;;
13620         *)      ;;
13621         esac
13622         case "$d_getpwuid_r_proto" in
13623         define)
13624         case "$getpwuid_r_proto" in
13625         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13626         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13627         esac
13628         case "$getpwuid_r_proto" in
13629         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13630         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13631         esac
13632         case "$getpwuid_r_proto" in
13633         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13634         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13635         esac
13636         case "$getpwuid_r_proto" in
13637         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13638         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13639         esac
13640         case "$getpwuid_r_proto" in
13641         ''|0)   d_getpwuid_r=undef
13642                 getpwuid_r_proto=0
13643                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13644         * )     case "$getpwuid_r_proto" in
13645                 REENTRANT_PROTO*) ;;
13646                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13647                 esac
13648                 echo "Prototype: $try" ;;
13649         esac
13650         ;;
13651         *)      case "$usethreads" in
13652                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13653                 esac
13654                 d_getpwuid_r=undef
13655                 getpwuid_r_proto=0
13656                 ;;
13657         esac
13658         ;;
13659 *)      getpwuid_r_proto=0
13660         ;;
13661 esac
13662
13663
13664 : see if getservbyname exists
13665 set getservbyname d_getsbyname
13666 eval $inlibc
13667
13668 : see if getservbyport exists
13669 set getservbyport d_getsbyport
13670 eval $inlibc
13671
13672 : see if getservent exists
13673 set getservent d_getsent
13674 eval $inlibc
13675
13676 : see if getservbyname_r exists
13677 set getservbyname_r d_getservbyname_r
13678 eval $inlibc
13679 case "$d_getservbyname_r" in
13680 "$define")
13681         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13682         case "$d_getservbyname_r_proto:$usethreads" in
13683         ":define")      d_getservbyname_r_proto=define
13684                 set d_getservbyname_r_proto getservbyname_r $hdrs
13685                 eval $hasproto ;;
13686         *)      ;;
13687         esac
13688         case "$d_getservbyname_r_proto" in
13689         define)
13690         case "$getservbyname_r_proto" in
13691         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13692         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13693         esac
13694         case "$getservbyname_r_proto" in
13695         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13696         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13697         esac
13698         case "$getservbyname_r_proto" in
13699         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13700         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13701         esac
13702         case "$getservbyname_r_proto" in
13703         ''|0)   d_getservbyname_r=undef
13704                 getservbyname_r_proto=0
13705                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13706         * )     case "$getservbyname_r_proto" in
13707                 REENTRANT_PROTO*) ;;
13708                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13709                 esac
13710                 echo "Prototype: $try" ;;
13711         esac
13712         ;;
13713         *)      case "$usethreads" in
13714                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13715                 esac
13716                 d_getservbyname_r=undef
13717                 getservbyname_r_proto=0
13718                 ;;
13719         esac
13720         ;;
13721 *)      getservbyname_r_proto=0
13722         ;;
13723 esac
13724
13725 : see if getservbyport_r exists
13726 set getservbyport_r d_getservbyport_r
13727 eval $inlibc
13728 case "$d_getservbyport_r" in
13729 "$define")
13730         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13731         case "$d_getservbyport_r_proto:$usethreads" in
13732         ":define")      d_getservbyport_r_proto=define
13733                 set d_getservbyport_r_proto getservbyport_r $hdrs
13734                 eval $hasproto ;;
13735         *)      ;;
13736         esac
13737         case "$d_getservbyport_r_proto" in
13738         define)
13739         case "$getservbyport_r_proto" in
13740         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13741         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13742         esac
13743         case "$getservbyport_r_proto" in
13744         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13745         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13746         esac
13747         case "$getservbyport_r_proto" in
13748         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13749         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13750         esac
13751         case "$getservbyport_r_proto" in
13752         ''|0)   d_getservbyport_r=undef
13753                 getservbyport_r_proto=0
13754                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13755         * )     case "$getservbyport_r_proto" in
13756                 REENTRANT_PROTO*) ;;
13757                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13758                 esac
13759                 echo "Prototype: $try" ;;
13760         esac
13761         ;;
13762         *)      case "$usethreads" in
13763                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13764                 esac
13765                 d_getservbyport_r=undef
13766                 getservbyport_r_proto=0
13767                 ;;
13768         esac
13769         ;;
13770 *)      getservbyport_r_proto=0
13771         ;;
13772 esac
13773
13774 : see if getservent_r exists
13775 set getservent_r d_getservent_r
13776 eval $inlibc
13777 case "$d_getservent_r" in
13778 "$define")
13779         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13780         case "$d_getservent_r_proto:$usethreads" in
13781         ":define")      d_getservent_r_proto=define
13782                 set d_getservent_r_proto getservent_r $hdrs
13783                 eval $hasproto ;;
13784         *)      ;;
13785         esac
13786         case "$d_getservent_r_proto" in
13787         define)
13788         case "$getservent_r_proto" in
13789         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13790         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13791         esac
13792         case "$getservent_r_proto" in
13793         ''|0) try='int getservent_r(struct servent*, char*, int);'
13794         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13795         esac
13796         case "$getservent_r_proto" in
13797         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13798         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13799         esac
13800         case "$getservent_r_proto" in
13801         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13802         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13803         esac
13804         case "$getservent_r_proto" in
13805         ''|0)   d_getservent_r=undef
13806                 getservent_r_proto=0
13807                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13808         * )     case "$getservent_r_proto" in
13809                 REENTRANT_PROTO*) ;;
13810                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13811                 esac
13812                 echo "Prototype: $try" ;;
13813         esac
13814         ;;
13815         *)      case "$usethreads" in
13816                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13817                 esac
13818                 d_getservent_r=undef
13819                 getservent_r_proto=0
13820                 ;;
13821         esac
13822         ;;
13823 *)      getservent_r_proto=0
13824         ;;
13825 esac
13826
13827 : see if prototypes for various getservxxx netdb.h functions are available
13828 echo " "
13829 set d_getservprotos getservent $i_netdb netdb.h
13830 eval $hasproto
13831
13832 : see if getspnam exists
13833 set getspnam d_getspnam
13834 eval $inlibc
13835
13836 : see if this is a shadow.h system
13837 set shadow.h i_shadow
13838 eval $inhdr
13839
13840 : see if getspnam_r exists
13841 set getspnam_r d_getspnam_r
13842 eval $inlibc
13843 case "$d_getspnam_r" in
13844 "$define")
13845         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13846         case "$d_getspnam_r_proto:$usethreads" in
13847         ":define")      d_getspnam_r_proto=define
13848                 set d_getspnam_r_proto getspnam_r $hdrs
13849                 eval $hasproto ;;
13850         *)      ;;
13851         esac
13852         case "$d_getspnam_r_proto" in
13853         define)
13854         case "$getspnam_r_proto" in
13855         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13856         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13857         esac
13858         case "$getspnam_r_proto" in
13859         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13860         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13861         esac
13862         case "$getspnam_r_proto" in
13863         ''|0)   d_getspnam_r=undef
13864                 getspnam_r_proto=0
13865                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13866         * )     case "$getspnam_r_proto" in
13867                 REENTRANT_PROTO*) ;;
13868                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13869                 esac
13870                 echo "Prototype: $try" ;;
13871         esac
13872         ;;
13873         *)      case "$usethreads" in
13874                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13875                 esac
13876                 d_getspnam_r=undef
13877                 getspnam_r_proto=0
13878                 ;;
13879         esac
13880         ;;
13881 *)      getspnam_r_proto=0
13882         ;;
13883 esac
13884
13885 : see if gettimeofday or ftime exists
13886 set gettimeofday d_gettimeod
13887 eval $inlibc
13888 case "$d_gettimeod" in
13889 "$undef")
13890         set ftime d_ftime 
13891         eval $inlibc
13892         ;;
13893 *)
13894         val="$undef"; set d_ftime; eval $setvar
13895         ;;
13896 esac
13897 case "$d_gettimeod$d_ftime" in
13898 "$undef$undef")
13899         echo " "
13900         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13901         ;;
13902 esac
13903
13904 : see if gmtime_r exists
13905 set gmtime_r d_gmtime_r
13906 eval $inlibc
13907 case "$d_gmtime_r" in
13908 "$define")
13909         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13910         case "$d_gmtime_r_proto:$usethreads" in
13911         ":define")      d_gmtime_r_proto=define
13912                 set d_gmtime_r_proto gmtime_r $hdrs
13913                 eval $hasproto ;;
13914         *)      ;;
13915         esac
13916         case "$d_gmtime_r_proto" in
13917         define)
13918         case "$gmtime_r_proto" in
13919         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13920         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13921         esac
13922         case "$gmtime_r_proto" in
13923         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13924         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13925         esac
13926         case "$gmtime_r_proto" in
13927         ''|0)   d_gmtime_r=undef
13928                 gmtime_r_proto=0
13929                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13930         * )     case "$gmtime_r_proto" in
13931                 REENTRANT_PROTO*) ;;
13932                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13933                 esac
13934                 echo "Prototype: $try" ;;
13935         esac
13936         ;;
13937         *)      case "$usethreads" in
13938                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13939                 esac
13940                 d_gmtime_r=undef
13941                 gmtime_r_proto=0
13942                 ;;
13943         esac
13944         ;;
13945 *)      gmtime_r_proto=0
13946         ;;
13947 esac
13948
13949 : see if hasmntopt exists
13950 set hasmntopt d_hasmntopt
13951 eval $inlibc
13952
13953 : see if this is a netinet/in.h or sys/in.h system
13954 set netinet/in.h i_niin sys/in.h i_sysin
13955 eval $inhdr
13956
13957 : see if arpa/inet.h has to be included
13958 set arpa/inet.h i_arpainet
13959 eval $inhdr
13960
13961 : see if htonl --and friends-- exists
13962 val=''
13963 set htonl val
13964 eval $inlibc
13965
13966 : Maybe they are macros.
13967 case "$val" in
13968 $undef)
13969         $cat >htonl.c <<EOM
13970 #include <stdio.h>
13971 #include <sys/types.h>
13972 #$i_niin I_NETINET_IN
13973 #$i_sysin I_SYS_IN
13974 #$i_arpainet I_ARPA_INET
13975 #ifdef I_NETINET_IN
13976 #include <netinet/in.h>
13977 #endif
13978 #ifdef I_SYS_IN
13979 #include <sys/in.h>
13980 #endif
13981 #ifdef I_ARPA_INET
13982 #include <arpa/inet.h>
13983 #endif
13984 #ifdef htonl
13985 printf("Defined as a macro.");
13986 #endif
13987 EOM
13988         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13989         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13990                 val="$define"
13991                 echo "But it seems to be defined as a macro." >&4
13992         fi
13993         $rm -f htonl.?
13994         ;;
13995 esac
13996 set d_htonl
13997 eval $setvar
13998
13999 : see if ilogbl exists
14000 set ilogbl d_ilogbl
14001 eval $inlibc
14002
14003 : index or strchr
14004 echo " "
14005 if set index val -f; eval $csym; $val; then
14006         if set strchr val -f d_strchr; eval $csym; $val; then
14007                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14008                         val="$define"
14009                         vali="$undef"
14010                         echo "strchr() found." >&4
14011                 else
14012                         val="$undef"
14013                         vali="$define"
14014                         echo "index() found." >&4
14015                 fi
14016         else
14017                 val="$undef"
14018                 vali="$define"
14019                 echo "index() found." >&4
14020         fi
14021 else
14022         if set strchr val -f d_strchr; eval $csym; $val; then
14023                 val="$define"
14024                 vali="$undef"
14025                 echo "strchr() found." >&4
14026         else
14027                 echo "No index() or strchr() found!" >&4
14028                 val="$undef"
14029                 vali="$undef"
14030         fi
14031 fi
14032 set d_strchr; eval $setvar
14033 val="$vali"
14034 set d_index; eval $setvar
14035
14036 : check whether inet_aton exists
14037 set inet_aton d_inetaton
14038 eval $inlibc
14039
14040 : Look for isascii
14041 echo " "
14042 $cat >isascii.c <<EOCP
14043 #include <stdio.h>
14044 #include <ctype.h>
14045 #$i_stdlib I_STDLIB
14046 #ifdef I_STDLIB
14047 #include <stdlib.h>
14048 #endif
14049 int main() {
14050         int c = 'A';
14051         if (isascii(c))
14052                 exit(0);
14053         else
14054                 exit(1);
14055 }
14056 EOCP
14057 set isascii
14058 if eval $compile; then
14059         echo "isascii() found." >&4
14060         val="$define"
14061 else
14062         echo "isascii() NOT found." >&4
14063         val="$undef"
14064 fi
14065 set d_isascii
14066 eval $setvar
14067 $rm -f isascii*
14068
14069 : see if isfinite exists
14070 set isfinite d_isfinite
14071 eval $inlibc
14072
14073 : see if isinf exists
14074 set isinf d_isinf
14075 eval $inlibc
14076
14077 : see if isnan exists
14078 set isnan d_isnan
14079 eval $inlibc
14080
14081 : see if isnanl exists
14082 set isnanl d_isnanl
14083 eval $inlibc
14084
14085 : see if killpg exists
14086 set killpg d_killpg
14087 eval $inlibc
14088
14089 : see if lchown exists
14090 echo " "
14091 $cat > try.c <<'EOCP'
14092 /* System header to define __stub macros and hopefully few prototypes,
14093     which can conflict with char lchown(); below.  */
14094 #include <assert.h>
14095 /* Override any gcc2 internal prototype to avoid an error.  */
14096 /* We use char because int might match the return type of a gcc2
14097    builtin and then its argument prototype would still apply.  */
14098 char lchown();
14099 int main() {
14100     /*  The GNU C library defines this for functions which it implements
14101         to always fail with ENOSYS.  Some functions are actually named
14102         something starting with __ and the normal name is an alias.  */
14103 #if defined (__stub_lchown) || defined (__stub___lchown)
14104 choke me
14105 #else
14106 lchown();
14107 #endif
14108 ; return 0; }
14109 EOCP
14110 set try
14111 if eval $compile; then
14112     $echo "lchown() found." >&4
14113     val="$define"
14114 else
14115     $echo "lchown() NOT found." >&4
14116     val="$undef"
14117 fi
14118 set d_lchown
14119 eval $setvar
14120
14121 : See if number of significant digits in a double precision number is known
14122 echo " "
14123 $cat >ldbl_dig.c <<EOM
14124 #$i_limits I_LIMITS
14125 #$i_float I_FLOAT
14126 #ifdef I_LIMITS
14127 #include <limits.h>
14128 #endif
14129 #ifdef I_FLOAT
14130 #include <float.h>
14131 #endif
14132 #ifdef LDBL_DIG
14133 printf("Contains LDBL_DIG");
14134 #endif
14135 EOM
14136 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14137 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14138         echo "LDBL_DIG found." >&4
14139         val="$define"
14140 else
14141         echo "LDBL_DIG NOT found." >&4
14142         val="$undef"
14143 fi
14144 $rm -f ldbl_dig.?
14145 set d_ldbl_dig
14146 eval $setvar
14147
14148 : see if this is a math.h system
14149 set math.h i_math
14150 eval $inhdr
14151
14152 d_libm_lib_version="$undef"
14153 case $i_math in
14154     $define)
14155         : check to see if math.h defines _LIB_VERSION
14156         echo " "
14157         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14158         $cat >try.c <<EOCP
14159 #include <unistd.h>
14160 #include <math.h>
14161 int main (int argc, char *argv[])
14162 {
14163     printf ("%d\n", _LIB_VERSION);
14164     return (0);
14165     } /* main */
14166 EOCP
14167         set try
14168         if eval $compile; then
14169             foo=`$run ./try`
14170             echo "Yes, it does ($foo)" >&4
14171             d_libm_lib_version="$define"
14172         else
14173             echo "No, it does not (probably harmless)\n" >&4
14174             fi
14175         $rm -f try.* try core core.try.*
14176         ;;
14177
14178     esac
14179
14180 : see if link exists
14181 set link d_link
14182 eval $inlibc
14183
14184 : see if localtime_r exists
14185 set localtime_r d_localtime_r
14186 eval $inlibc
14187 case "$d_localtime_r" in
14188 "$define")
14189         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14190         case "$d_localtime_r_proto:$usethreads" in
14191         ":define")      d_localtime_r_proto=define
14192                 set d_localtime_r_proto localtime_r $hdrs
14193                 eval $hasproto ;;
14194         *)      ;;
14195         esac
14196         case "$d_localtime_r_proto" in
14197         define)
14198         case "$localtime_r_proto" in
14199         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14200         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14201         esac
14202         case "$localtime_r_proto" in
14203         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14204         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14205         esac
14206         case "$localtime_r_proto" in
14207         ''|0)   d_localtime_r=undef
14208                 localtime_r_proto=0
14209                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14210         * )     case "$localtime_r_proto" in
14211                 REENTRANT_PROTO*) ;;
14212                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14213                 esac
14214                 echo "Prototype: $try" ;;
14215         esac
14216         ;;
14217         *)      case "$usethreads" in
14218                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14219                 esac
14220                 d_localtime_r=undef
14221                 localtime_r_proto=0
14222                 ;;
14223         esac
14224         ;;
14225 *)      localtime_r_proto=0
14226         ;;
14227 esac
14228
14229 : see if localeconv exists
14230 set localeconv d_locconv
14231 eval $inlibc
14232
14233 : see if lockf exists
14234 set lockf d_lockf
14235 eval $inlibc
14236
14237 : see if prototype for lseek is available
14238 echo " "
14239 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14240 eval $hasproto
14241
14242 : see if lstat exists
14243 set lstat d_lstat
14244 eval $inlibc
14245
14246 : see if madvise exists
14247 set madvise d_madvise
14248 eval $inlibc
14249
14250 : see if mblen exists
14251 set mblen d_mblen
14252 eval $inlibc
14253
14254 : see if mbstowcs exists
14255 set mbstowcs d_mbstowcs
14256 eval $inlibc
14257
14258 : see if mbtowc exists
14259 set mbtowc d_mbtowc
14260 eval $inlibc
14261
14262 : see if memchr exists
14263 set memchr d_memchr
14264 eval $inlibc
14265
14266 : see if memcmp exists
14267 set memcmp d_memcmp
14268 eval $inlibc
14269
14270 : see if memcpy exists
14271 set memcpy d_memcpy
14272 eval $inlibc
14273
14274 : see if memmove exists
14275 set memmove d_memmove
14276 eval $inlibc
14277
14278 : see if memset exists
14279 set memset d_memset
14280 eval $inlibc
14281
14282 : see if mkdir exists
14283 set mkdir d_mkdir
14284 eval $inlibc
14285
14286 : see if mkdtemp exists
14287 set mkdtemp d_mkdtemp
14288 eval $inlibc
14289
14290 : see if mkfifo exists
14291 set mkfifo d_mkfifo
14292 eval $inlibc
14293
14294 : see if mkstemp exists
14295 set mkstemp d_mkstemp
14296 eval $inlibc
14297
14298 : see if mkstemps exists
14299 set mkstemps d_mkstemps
14300 eval $inlibc
14301
14302 : see if mktime exists
14303 set mktime d_mktime
14304 eval $inlibc
14305
14306 : see if this is a sys/mman.h system
14307 set sys/mman.h i_sysmman
14308 eval $inhdr
14309
14310 : see if mmap exists
14311 set mmap d_mmap
14312 eval $inlibc
14313 : see what shmat returns
14314 : default to something harmless
14315 mmaptype='void *'
14316 case "$i_sysmman$d_mmap" in
14317 "$define$define")
14318         $cat >mmap.c <<'END'
14319 #include <sys/mman.h>
14320 void *mmap();
14321 END
14322         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14323                 mmaptype='void *'
14324         else
14325                 mmaptype='caddr_t'
14326         fi
14327         echo "and it returns ($mmaptype)." >&4
14328         ;;
14329 esac
14330
14331
14332
14333 : see if sqrtl exists
14334 set sqrtl d_sqrtl
14335 eval $inlibc
14336
14337 : see if scalbnl exists
14338 set scalbnl d_scalbnl
14339 eval $inlibc
14340
14341 : see if modfl exists
14342 set modfl d_modfl
14343 eval $inlibc
14344
14345 : see if prototype for modfl is available
14346 echo " "
14347 set d_modflproto modfl $i_math math.h
14348 eval $hasproto
14349
14350 d_modfl_pow32_bug="$undef"
14351
14352 case "$d_longdbl$d_modfl" in
14353 $define$define)
14354         $cat <<EOM
14355 Checking to see whether your modfl() is okay for large values...
14356 EOM
14357 $cat >try.c <<EOCP
14358 #include <math.h> 
14359 #include <stdio.h>
14360 EOCP
14361 if $test "X$d_modflproto" != "X$define"; then
14362         $cat >>try.c <<EOCP
14363 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14364 long double modfl (long double, long double *);
14365 EOCP
14366 fi
14367 $cat >>try.c <<EOCP
14368 int main() {
14369     long double nv = 4294967303.15;
14370     long double v, w;
14371     v = modfl(nv, &w);         
14372 #ifdef __GLIBC__
14373     printf("glibc");
14374 #endif
14375     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14376     return 0;
14377 }
14378 EOCP
14379         case "$osname:$gccversion" in
14380         aix:)   saveccflags="$ccflags"
14381                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14382         esac
14383         set try
14384         if eval $compile; then
14385                 foo=`$run ./try`
14386                 case "$foo" in
14387                 *" 4294967303.150000 1.150000 4294967302.000000")
14388                         echo >&4 "Your modfl() is broken for large values."
14389                         d_modfl_pow32_bug="$define"
14390                         case "$foo" in
14391                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14392                         ;;
14393                         esac
14394                         ;;
14395                 *" 4294967303.150000 0.150000 4294967303.000000")
14396                         echo >&4 "Your modfl() seems okay for large values."
14397                         ;;
14398                 *)      echo >&4 "I don't understand your modfl() at all."
14399                         d_modfl="$undef"
14400                         ;;
14401                 esac
14402                 $rm -f try.* try core core.try.*
14403         else
14404                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14405                 d_modfl="$undef"
14406         fi
14407         case "$osname:$gccversion" in
14408         aix:)   ccflags="$saveccflags" ;; # restore
14409         esac
14410         ;;
14411 esac
14412
14413 if $test "$uselongdouble" = "$define"; then
14414     message=""
14415     if $test "$d_sqrtl" != "$define"; then
14416         message="$message sqrtl"
14417     fi
14418     if $test "$d_modfl" != "$define"; then
14419         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14420             echo "You have both aintl and copysignl, so I can emulate modfl."
14421         else
14422             message="$message modfl"
14423         fi
14424     fi
14425     if $test "$d_frexpl" != "$define"; then
14426         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14427             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14428         else
14429             message="$message frexpl"
14430         fi
14431     fi
14432
14433     if $test "$message" != ""; then
14434         $cat <<EOM >&4
14435
14436 *** You requested the use of long doubles but you do not seem to have
14437 *** the following mathematical functions needed for long double support:
14438 ***    $message
14439 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14440 *** Cannot continue, aborting.
14441
14442 EOM
14443
14444         exit 1
14445     fi
14446 fi
14447
14448 : see if mprotect exists
14449 set mprotect d_mprotect
14450 eval $inlibc
14451
14452 : see if msgctl exists
14453 set msgctl d_msgctl
14454 eval $inlibc
14455
14456 : see if msgget exists
14457 set msgget d_msgget
14458 eval $inlibc
14459
14460 : see if msgsnd exists
14461 set msgsnd d_msgsnd
14462 eval $inlibc
14463
14464 : see if msgrcv exists
14465 set msgrcv d_msgrcv
14466 eval $inlibc
14467
14468 : see how much of the 'msg*(2)' library is present.
14469 h_msg=true
14470 echo " "
14471 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14472 *"$undef"*) h_msg=false;;
14473 esac
14474 case "$osname" in
14475 freebsd)
14476     case "`ipcs 2>&1`" in
14477     "SVID messages"*"not configured"*)
14478         echo "Your $osname does not have the msg*(2) configured." >&4
14479         h_msg=false
14480         val="$undef"
14481         set msgctl d_msgctl
14482         eval $setvar
14483         set msgget d_msgget
14484         eval $setvar
14485         set msgsnd d_msgsnd
14486         eval $setvar
14487         set msgrcv d_msgrcv
14488         eval $setvar
14489         ;;
14490     esac
14491     ;;
14492 esac
14493 : we could also check for sys/ipc.h ...
14494 if $h_msg && $test `./findhdr sys/msg.h`; then
14495         echo "You have the full msg*(2) library." >&4
14496         val="$define"
14497 else
14498         echo "You don't have the full msg*(2) library." >&4
14499         val="$undef"
14500 fi
14501 set d_msg
14502 eval $setvar
14503
14504
14505 echo " "
14506 echo "Checking to see if your system supports struct msghdr..." >&4
14507 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14508 eval $hasstruct
14509 case "$d_msghdr_s" in
14510 "$define")      echo "Yes, it does."   ;;
14511 *)              echo "No, it doesn't." ;;
14512 esac
14513
14514
14515 : see if msync exists
14516 set msync d_msync
14517 eval $inlibc
14518
14519 : see if munmap exists
14520 set munmap d_munmap
14521 eval $inlibc
14522
14523 : see if nice exists
14524 set nice d_nice
14525 eval $inlibc
14526
14527 : see if this is a langinfo.h system
14528 set langinfo.h i_langinfo
14529 eval $inhdr
14530
14531 : see if nl_langinfo exists
14532 set nl_langinfo d_nl_langinfo
14533 eval $inlibc
14534
14535 : check for length of character
14536 echo " "
14537 case "$charsize" in
14538 '')
14539         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14540         $cat >try.c <<EOCP
14541 #include <stdio.h>
14542 #$i_stdlib I_STDLIB
14543 #ifdef I_STDLIB
14544 #include <stdlib.h>
14545 #endif
14546 int main()
14547 {
14548     printf("%d\n", (int)sizeof(char));
14549     exit(0);
14550 }
14551 EOCP
14552         set try
14553         if eval $compile_ok; then
14554                 dflt=`$run ./try`
14555         else
14556                 dflt='1'
14557                 echo "(I can't seem to compile the test program.  Guessing...)"
14558         fi
14559         ;;
14560 *)
14561         dflt="$charsize"
14562         ;;
14563 esac
14564 rp="What is the size of a character (in bytes)?"
14565 . ./myread
14566 charsize="$ans"
14567 $rm -f try.c try
14568
14569 : check for volatile keyword
14570 echo " "
14571 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14572 $cat >try.c <<'EOCP'
14573 int main()
14574 {
14575         typedef struct _goo_struct goo_struct;
14576         goo_struct * volatile goo = ((goo_struct *)0);
14577         struct _goo_struct {
14578                 long long_int;
14579                 int reg_int;
14580                 char char_var;
14581         };
14582         typedef unsigned short foo_t;
14583         char *volatile foo;
14584         volatile int bar;
14585         volatile foo_t blech;
14586         foo = foo;
14587 }
14588 EOCP
14589 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14590         val="$define"
14591         echo "Yup, it does."
14592 else
14593         val="$undef"
14594         echo "Nope, it doesn't."
14595 fi
14596 set d_volatile
14597 eval $setvar
14598 $rm -f try.*
14599
14600
14601 echo " "
14602 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14603
14604 case "$use64bitint:$d_quad:$quadtype" in
14605 define:define:?*)
14606         ivtype="$quadtype"
14607         uvtype="$uquadtype"
14608         ivsize=8
14609         uvsize=8
14610         ;;
14611 *)      ivtype="long"
14612         uvtype="unsigned long"
14613         ivsize=$longsize
14614         uvsize=$longsize
14615         ;;
14616 esac
14617
14618 case "$uselongdouble:$d_longdbl" in
14619 define:define)
14620         nvtype="long double"
14621         nvsize=$longdblsize
14622         ;;
14623 *)      nvtype=double
14624         nvsize=$doublesize
14625         ;;
14626 esac
14627
14628 $echo "(IV will be "$ivtype", $ivsize bytes)"
14629 $echo "(UV will be "$uvtype", $uvsize bytes)"
14630 $echo "(NV will be "$nvtype", $nvsize bytes)"
14631
14632 $cat >try.c <<EOCP
14633 #$i_inttypes I_INTTYPES
14634 #ifdef I_INTTYPES
14635 #include <inttypes.h>
14636 #endif
14637 #include <stdio.h>
14638 int main() {
14639 #ifdef INT8
14640    int8_t i =  INT8_MAX;
14641   uint8_t u = UINT8_MAX;
14642   printf("int8_t\n");
14643 #endif
14644 #ifdef INT16
14645    int16_t i =  INT16_MAX;
14646   uint16_t i = UINT16_MAX;
14647   printf("int16_t\n");
14648 #endif
14649 #ifdef INT32
14650    int32_t i =  INT32_MAX;
14651   uint32_t u = UINT32_MAX;
14652   printf("int32_t\n");
14653 #endif
14654 }
14655 EOCP
14656
14657 case "$i8type" in
14658 '')     case "$charsize" in
14659         1)      i8type=char
14660                 u8type="unsigned char"
14661                 i8size=$charsize
14662                 u8size=$charsize
14663                 ;;
14664         esac
14665         ;;
14666 esac
14667 case "$i8type" in
14668 '')     set try -DINT8
14669         if eval $compile; then
14670                 case "`$run ./try`" in
14671                 int8_t) i8type=int8_t
14672                         u8type=uint8_t
14673                         i8size=1
14674                         u8size=1
14675                         ;;
14676                 esac
14677         fi
14678         ;;
14679 esac
14680 case "$i8type" in
14681 '')     if $test $charsize -ge 1; then
14682                 i8type=char
14683                 u8type="unsigned char"
14684                 i8size=$charsize
14685                 u8size=$charsize
14686         fi
14687         ;;
14688 esac
14689
14690 case "$i16type" in
14691 '')     case "$shortsize" in
14692         2)      i16type=short
14693                 u16type="unsigned short"
14694                 i16size=$shortsize
14695                 u16size=$shortsize
14696                 ;;
14697         esac
14698         ;;
14699 esac
14700 case "$i16type" in
14701 '')     set try -DINT16
14702         if eval $compile; then
14703                 case "`$run ./try`" in
14704                 int16_t)
14705                         i16type=int16_t
14706                         u16type=uint16_t
14707                         i16size=2
14708                         u16size=2
14709                         ;;
14710                 esac
14711         fi
14712         ;;
14713 esac
14714 case "$i16type" in
14715 '')     if $test $shortsize -ge 2; then
14716                 i16type=short
14717                 u16type="unsigned short"
14718                 i16size=$shortsize
14719                 u16size=$shortsize
14720         fi
14721         ;;
14722 esac
14723
14724 case "$i32type" in
14725 '')     case "$longsize" in
14726         4)      i32type=long
14727                 u32type="unsigned long"
14728                 i32size=$longsize
14729                 u32size=$longsize
14730                 ;;
14731         *)      case "$intsize" in
14732                 4)      i32type=int
14733                         u32type="unsigned int"
14734                         i32size=$intsize
14735                         u32size=$intsize
14736                         ;;
14737                 esac
14738                 ;;
14739         esac
14740         ;;
14741 esac
14742 case "$i32type" in
14743 '')     set try -DINT32
14744         if eval $compile; then
14745                 case "`$run ./try`" in
14746                 int32_t)
14747                         i32type=int32_t
14748                         u32type=uint32_t
14749                         i32size=4
14750                         u32size=4
14751                         ;;
14752                 esac
14753         fi
14754         ;;
14755 esac
14756 case "$i32type" in
14757 '')     if $test $intsize -ge 4; then
14758                 i32type=int
14759                 u32type="unsigned int"
14760                 i32size=$intsize
14761                 u32size=$intsize
14762         fi
14763         ;;
14764 esac
14765
14766 case "$i64type" in
14767 '')     case "$d_quad:$quadtype" in
14768         define:?*)
14769                 i64type="$quadtype"
14770                 u64type="$uquadtype"
14771                 i64size=8
14772                 u64size=8
14773                 ;;
14774         esac
14775         ;;
14776 esac
14777
14778 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14779 : volatile so that the compiler has to store it out to memory.
14780 if test X"$d_volatile" = X"$define"; then
14781         volatile=volatile
14782 fi
14783 $cat <<EOP >try.c
14784 #include <stdio.h>
14785 #$i_stdlib I_STDLIB
14786 #ifdef I_STDLIB
14787 #include <stdlib.h>
14788 #endif
14789 #include <sys/types.h>
14790 #include <signal.h>
14791 #ifdef SIGFPE
14792 $volatile int bletched = 0;
14793 $signal_t blech(s) int s; { bletched = 1; }
14794 #endif
14795 int main() {
14796     $uvtype u = 0;
14797     $nvtype d;
14798     int     n = 8 * $uvsize;
14799     int     i;
14800 #ifdef SIGFPE
14801     signal(SIGFPE, blech);
14802 #endif
14803
14804     for (i = 0; i < n; i++) {
14805       u = u << 1 | ($uvtype)1;
14806       d = ($nvtype)u;
14807       if (($uvtype)d != u)
14808         break;
14809       if (d <= 0)
14810         break;
14811       d = ($nvtype)(u - 1);
14812       if (($uvtype)d != (u - 1))
14813         break;
14814 #ifdef SIGFPE
14815       if (bletched) {
14816         break;
14817 #endif
14818       } 
14819     }
14820     printf("%d\n", ((i == n) ? -n : i));
14821     exit(0);
14822 }
14823 EOP
14824 set try
14825
14826 d_nv_preserves_uv="$undef"
14827 if eval $compile; then
14828         nv_preserves_uv_bits="`$run ./try`"
14829 fi
14830 case "$nv_preserves_uv_bits" in
14831 \-[1-9]*)       
14832         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14833         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14834         d_nv_preserves_uv="$define"
14835         ;;
14836 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14837         d_nv_preserves_uv="$undef" ;;
14838 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14839         nv_preserves_uv_bits="$undef" ;;
14840 esac
14841
14842 $rm -f try.* try
14843
14844 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14845 : volatile so that the compiler has to store it out to memory.
14846 if test X"$d_volatile" = X"$define"; then
14847         volatile=volatile
14848 fi
14849 $cat <<EOP >try.c
14850 #include <stdio.h>
14851 #$i_stdlib I_STDLIB
14852 #ifdef I_STDLIB
14853 #include <stdlib.h>
14854 #endif
14855 #$i_string I_STRING
14856 #ifdef I_STRING
14857 #  include <string.h>
14858 #else
14859 #  include <strings.h>
14860 #endif
14861 #include <sys/types.h>
14862 #include <signal.h>
14863 #ifdef SIGFPE
14864 $volatile int bletched = 0;
14865 $signal_t blech(s) int s; { bletched = 1; }
14866 #endif
14867
14868 int checkit($nvtype d, char *where) {
14869     unsigned char *p = (char *)&d;
14870     unsigned char *end = p + sizeof(d);
14871     int fail = 0;
14872
14873     while (p < end)
14874         fail += *p++;
14875
14876     if (!fail)
14877         return 0;
14878
14879     p = (char *)&d;
14880     printf("No - %s: 0x", where);
14881     while (p < end)
14882         printf ("%02X", *p++);
14883     printf("\n");
14884     return 1;
14885 }
14886
14887 int main(int argc, char **argv) {
14888     $nvtype d = 0.0;
14889     int fail = 0;
14890     fail += checkit(d, "0.0");
14891
14892     /* The compiler shouldn't be assuming that bletched is 0  */
14893     d = bletched;
14894
14895     fail += checkit(d, "bleched");
14896
14897 #ifdef SIGFPE
14898     signal(SIGFPE, blech);
14899 #endif
14900
14901     /* Paranoia - the compiler should have no way of knowing that ANSI says
14902        that argv[argc] will always be NULL.  Actually, if it did assume this it
14903        would be buggy, as this is C and main() can be called from elsewhere in
14904        the program.  */
14905     d = argv[argc] ? 1 : 0;
14906
14907     if (d) {
14908         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14909     }
14910
14911     fail += checkit(d, "ternary");
14912
14913     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14914
14915     if (d != 0.0) {
14916         printf("No - memset doesn't give 0.0\n");
14917         /* This might just blow up:  */
14918         printf("(gives %g)\n", d);
14919         return 1;
14920     }
14921     
14922 #ifdef SIGFPE
14923     if (bletched) {
14924         printf("No - something bleched\n");
14925         return 1;
14926     }
14927 #endif
14928     if (fail) {
14929       printf("No - %d fail(s)\n", fail);
14930       return 1;
14931     }
14932     printf("Yes\n");
14933     return 0;
14934 }
14935 EOP
14936 set try
14937
14938 d_nv_zero_is_allbits_zero="$undef"
14939 if eval $compile; then
14940     xxx="`$run ./try`"
14941     case "$?" in
14942         0)
14943             case "$xxx" in
14944                 Yes)  cat >&4 <<EOM
14945 0.0 is represented as all bits zero in memory
14946 EOM
14947                     d_nv_zero_is_allbits_zero="$define"
14948                     ;;
14949                 *)  cat >&4 <<EOM
14950 0.0 is not represented as all bits zero in memory
14951 EOM
14952                     d_nv_zero_is_allbits_zero="$undef"
14953                     ;;
14954             esac
14955             ;;
14956         *)  cat >&4 <<EOM
14957 0.0 is not represented as all bits zero in memory
14958 EOM
14959             d_nv_zero_is_allbits_zero="$undef"
14960             ;;
14961     esac
14962 fi
14963
14964 $rm -f try.* try
14965
14966
14967 : check for off64_t
14968 echo " "
14969 echo "Checking to see if you have off64_t..." >&4
14970 $cat >try.c <<EOCP
14971 #include <sys/types.h>
14972 #include <unistd.h>
14973 int main() { off64_t x = 7; }
14974 EOCP
14975 set try
14976 if eval $compile; then
14977         val="$define"
14978         echo "You have off64_t."
14979 else
14980         val="$undef"
14981         echo "You do not have off64_t."
14982         case "$lseeksize" in
14983         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14984         esac
14985 fi
14986 $rm -f try.* try
14987 set d_off64_t
14988 eval $setvar
14989
14990 : how to create joinable pthreads
14991 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14992         echo " "
14993         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14994         $cat >try.c <<'EOCP'
14995 #include <pthread.h>
14996 int main() {
14997     int detachstate = JOINABLE;
14998 }
14999 EOCP
15000         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15001         if eval $compile; then
15002                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15003                 val="$undef" # Yes, undef.
15004                 set d_old_pthread_create_joinable
15005                 eval $setvar
15006                 val=""
15007                 set old_pthread_create_joinable
15008                 eval $setvar
15009         else
15010                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15011                 if eval $compile; then
15012                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15013                         val="$define"
15014                         set d_old_pthread_create_joinable
15015                         eval $setvar
15016                         val=PTHREAD_CREATE_UNDETACHED
15017                         set old_pthread_create_joinable
15018                         eval $setvar
15019                 else            
15020                         set try -DJOINABLE=__UNDETACHED
15021                         if eval $compile; then
15022                                 echo "You seem to use __UNDETACHED." >&4
15023                                 val="$define"
15024                                 set d_old_pthread_create_joinable
15025                                 eval $setvar
15026                                 val=__UNDETACHED
15027                                 set old_pthread_create_joinable
15028                                 eval $setvar
15029                         else
15030                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15031                                 val="$define"
15032                                 set d_old_pthread_create_joinable
15033                                 eval $setvar
15034                                 val=0
15035                                 set old_pthread_create_joinable
15036                                 eval $setvar
15037                         fi
15038                 fi
15039         fi
15040         $rm -f try try.*
15041 else
15042     d_old_pthread_create_joinable="$undef"
15043     old_pthread_create_joinable=""
15044 fi
15045
15046 : see if pause exists
15047 set pause d_pause
15048 eval $inlibc
15049
15050 : see if pipe exists
15051 set pipe d_pipe
15052 eval $inlibc
15053
15054 : see if poll exists
15055 set poll d_poll
15056 eval $inlibc
15057
15058 : see if readlink exists
15059 set readlink d_readlink
15060 eval $inlibc
15061
15062 echo " "
15063 procselfexe=''
15064 val="$undef"
15065 case "$d_readlink" in
15066 "$define")
15067         if $issymlink /proc/self/exe ; then
15068                 $ls -l /proc/self/exe > reflect
15069                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15070                         echo "You have Linux-like /proc/self/exe."
15071                         procselfexe='"/proc/self/exe"'
15072                         val="$define"
15073                 fi
15074         fi
15075         if $issymlink /proc/curproc/file ; then
15076                 $ls -l /proc/curproc/file > reflect
15077                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15078                         echo "You have BSD-like /proc/curproc/file."
15079                         procselfexe='"/proc/curproc/file"'
15080                         val="$define"
15081                 fi
15082         fi
15083         ;;
15084 esac
15085 $rm -f reflect
15086 set d_procselfexe
15087 eval $setvar
15088
15089 : see whether the pthread_atfork exists
15090 $cat >try.c <<EOP
15091 #include <pthread.h>
15092 #include <stdio.h>
15093 int main() {
15094 #ifdef  PTHREAD_ATFORK
15095         pthread_atfork(NULL,NULL,NULL);
15096 #endif
15097 }
15098 EOP
15099
15100 : see if pthread_atfork exists
15101 set try -DPTHREAD_ATFORK
15102 if eval $compile; then
15103     val="$define"
15104 else
15105     val="$undef"
15106 fi
15107 case "$usethreads" in
15108 $define)
15109         case "$val" in
15110         $define) echo 'pthread_atfork found.' >&4        ;;
15111         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15112         esac
15113 esac
15114 set d_pthread_atfork
15115 eval $setvar
15116
15117 : see if pthread_attr_setscope exists
15118 set pthread_attr_setscope d_pthread_attr_setscope
15119 eval $inlibc
15120
15121
15122 : see whether the various POSIXish _yields exist
15123 $cat >try.c <<EOP
15124 #include <pthread.h>
15125 #include <stdio.h>
15126 int main() {
15127 #ifdef SCHED_YIELD
15128         sched_yield();
15129 #else
15130 #ifdef PTHREAD_YIELD
15131         pthread_yield();
15132 #else
15133 #ifdef PTHREAD_YIELD_NULL
15134         pthread_yield(NULL);
15135 #endif
15136 #endif
15137 #endif
15138 }
15139 EOP
15140 : see if sched_yield exists
15141 set try -DSCHED_YIELD
15142 if eval $compile; then
15143     val="$define"
15144     sched_yield='sched_yield()'
15145 else
15146     val="$undef"
15147 fi
15148 case "$usethreads" in
15149 $define)
15150         case "$val" in
15151         $define) echo 'sched_yield() found.' >&4        ;;
15152         *)       echo 'sched_yield() NOT found.' >&4    ;;
15153         esac
15154 esac
15155 set d_sched_yield
15156 eval $setvar
15157
15158 : see if pthread_yield exists
15159 set try -DPTHREAD_YIELD
15160 if eval $compile; then
15161     val="$define"
15162     case "$sched_yield" in
15163     '') sched_yield='pthread_yield()' ;;
15164     esac
15165 else
15166     set try -DPTHREAD_YIELD_NULL
15167     if eval $compile; then
15168         val="$define"
15169         case "$sched_yield" in
15170         '') sched_yield='pthread_yield(NULL)' ;;
15171         esac
15172     else
15173         val="$undef"
15174     fi
15175 fi
15176 case "$usethreads" in
15177 $define)
15178         case "$val" in
15179         $define) echo 'pthread_yield() found.' >&4      ;;
15180         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15181         esac
15182         ;;
15183 esac
15184 set d_pthread_yield
15185 eval $setvar
15186
15187 case "$sched_yield" in
15188 '') sched_yield=undef ;;
15189 esac
15190
15191 $rm -f try try.*
15192
15193 : see if random_r exists
15194 set random_r d_random_r
15195 eval $inlibc
15196 case "$d_random_r" in
15197 "$define")
15198         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15199         case "$d_random_r_proto:$usethreads" in
15200         ":define")      d_random_r_proto=define
15201                 set d_random_r_proto random_r $hdrs
15202                 eval $hasproto ;;
15203         *)      ;;
15204         esac
15205         case "$d_random_r_proto" in
15206         define)
15207         case "$random_r_proto" in
15208         ''|0) try='int random_r(int*, struct random_data*);'
15209         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15210         esac
15211         case "$random_r_proto" in
15212         ''|0) try='int random_r(long*, struct random_data*);'
15213         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15214         esac
15215         case "$random_r_proto" in
15216         ''|0) try='int random_r(struct random_data*, int32_t*);'
15217         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15218         esac
15219         case "$random_r_proto" in
15220         ''|0)   d_random_r=undef
15221                 random_r_proto=0
15222                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15223         * )     case "$random_r_proto" in
15224                 REENTRANT_PROTO*) ;;
15225                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15226                 esac
15227                 echo "Prototype: $try" ;;
15228         esac
15229         ;;
15230         *)      case "$usethreads" in
15231                 define) echo "random_r has no prototype, not using it." >&4 ;;
15232                 esac
15233                 d_random_r=undef
15234                 random_r_proto=0
15235                 ;;
15236         esac
15237         ;;
15238 *)      random_r_proto=0
15239         ;;
15240 esac
15241
15242 : see if readdir and friends exist
15243 set readdir d_readdir
15244 eval $inlibc
15245 set seekdir d_seekdir
15246 eval $inlibc
15247 set telldir d_telldir
15248 eval $inlibc
15249 set rewinddir d_rewinddir
15250 eval $inlibc
15251
15252 : see if readdir64_r exists
15253 set readdir64_r d_readdir64_r
15254 eval $inlibc
15255 case "$d_readdir64_r" in
15256 "$define")
15257         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15258         case "$d_readdir64_r_proto:$usethreads" in
15259         ":define")      d_readdir64_r_proto=define
15260                 set d_readdir64_r_proto readdir64_r $hdrs
15261                 eval $hasproto ;;
15262         *)      ;;
15263         esac
15264         case "$d_readdir64_r_proto" in
15265         define)
15266         case "$readdir64_r_proto" in
15267         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15268         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15269         esac
15270         case "$readdir64_r_proto" in
15271         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15272         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15273         esac
15274         case "$readdir64_r_proto" in
15275         ''|0)   d_readdir64_r=undef
15276                 readdir64_r_proto=0
15277                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15278         * )     case "$readdir64_r_proto" in
15279                 REENTRANT_PROTO*) ;;
15280                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15281                 esac
15282                 echo "Prototype: $try" ;;
15283         esac
15284         ;;
15285         *)      case "$usethreads" in
15286                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15287                 esac
15288                 d_readdir64_r=undef
15289                 readdir64_r_proto=0
15290                 ;;
15291         esac
15292         ;;
15293 *)      readdir64_r_proto=0
15294         ;;
15295 esac
15296
15297 : see if readdir_r exists
15298 set readdir_r d_readdir_r
15299 eval $inlibc
15300 case "$d_readdir_r" in
15301 "$define")
15302         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15303         case "$d_readdir_r_proto:$usethreads" in
15304         ":define")      d_readdir_r_proto=define
15305                 set d_readdir_r_proto readdir_r $hdrs
15306                 eval $hasproto ;;
15307         *)      ;;
15308         esac
15309         case "$d_readdir_r_proto" in
15310         define)
15311         case "$readdir_r_proto" in
15312         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15313         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15314         esac
15315         case "$readdir_r_proto" in
15316         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15317         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15318         esac
15319         case "$readdir_r_proto" in
15320         ''|0)   d_readdir_r=undef
15321                 readdir_r_proto=0
15322                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15323         * )     case "$readdir_r_proto" in
15324                 REENTRANT_PROTO*) ;;
15325                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15326                 esac
15327                 echo "Prototype: $try" ;;
15328         esac
15329         ;;
15330         *)      case "$usethreads" in
15331                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15332                 esac
15333                 d_readdir_r=undef
15334                 readdir_r_proto=0
15335                 ;;
15336         esac
15337         ;;
15338 *)      readdir_r_proto=0
15339         ;;
15340 esac
15341
15342 : see if readv exists
15343 set readv d_readv
15344 eval $inlibc
15345
15346 : see if recvmsg exists
15347 set recvmsg d_recvmsg
15348 eval $inlibc
15349
15350 : see if rename exists
15351 set rename d_rename
15352 eval $inlibc
15353
15354 : see if rmdir exists
15355 set rmdir d_rmdir
15356 eval $inlibc
15357
15358 : see if memory.h is available.
15359 val=''
15360 set memory.h val
15361 eval $inhdr
15362
15363 : See if it conflicts with string.h
15364 case "$val" in
15365 $define)
15366         case "$strings" in
15367         '') ;;
15368         *)
15369                 $cppstdin $cppflags $cppminus < $strings > mem.h
15370                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15371                         echo " "
15372                         echo "We won't be including <memory.h>."
15373                         val="$undef"
15374                 fi
15375                 $rm -f mem.h
15376                 ;;
15377         esac
15378 esac
15379 set i_memory
15380 eval $setvar
15381
15382 : can bcopy handle overlapping blocks?
15383 echo " "
15384 val="$undef"
15385 case "$d_memmove" in
15386 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15387 *)      case "$d_bcopy" in
15388         "$define")
15389                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15390                 $cat >try.c <<EOCP
15391 #$i_memory I_MEMORY
15392 #$i_stdlib I_STDLIB
15393 #$i_string I_STRING
15394 #$i_unistd I_UNISTD
15395 EOCP
15396         $cat >>try.c <<'EOCP'
15397 #include <stdio.h>
15398 #ifdef I_MEMORY
15399 #  include <memory.h>
15400 #endif
15401 #ifdef I_STDLIB
15402 #  include <stdlib.h>
15403 #endif
15404 #ifdef I_STRING
15405 #  include <string.h>
15406 #else
15407 #  include <strings.h>
15408 #endif
15409 #ifdef I_UNISTD
15410 #  include <unistd.h>  /* Needed for NetBSD */
15411 #endif
15412 int main()
15413 {
15414 char buf[128], abc[128];
15415 char *b;
15416 int len;
15417 int off;
15418 int align;
15419
15420 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15421    try to store the string in read-only memory. */
15422 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15423
15424 for (align = 7; align >= 0; align--) {
15425         for (len = 36; len; len--) {
15426                 b = buf+align;
15427                 bcopy(abc, b, len);
15428                 for (off = 1; off <= len; off++) {
15429                         bcopy(b, b+off, len);
15430                         bcopy(b+off, b, len);
15431                         if (bcmp(b, abc, len))
15432                                 exit(1);
15433                 }
15434         }
15435 }
15436 exit(0);
15437 }
15438 EOCP
15439                 set try
15440                 if eval $compile_ok; then
15441                         if ./try 2>/dev/null; then
15442                                 echo "Yes, it can."
15443                                 val="$define"
15444                         else
15445                                 echo "It can't, sorry."
15446                         fi
15447                 else
15448                         echo "(I can't compile the test program, so we'll assume not...)"
15449                 fi
15450                 ;;
15451         esac
15452         $rm -f try.* try core
15453         ;;
15454 esac
15455 set d_safebcpy
15456 eval $setvar
15457
15458 : can memcpy handle overlapping blocks?
15459 echo " "
15460 val="$undef"
15461 case "$d_memmove" in
15462 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15463 *)      case "$d_memcpy" in
15464         "$define")
15465                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15466                 $cat >try.c <<EOCP
15467 #$i_memory I_MEMORY
15468 #$i_stdlib I_STDLIB
15469 #$i_string I_STRING
15470 #$i_unistd I_UNISTD
15471 EOCP
15472         $cat >>try.c <<'EOCP'
15473 #include <stdio.h>
15474 #ifdef I_MEMORY
15475 #  include <memory.h>
15476 #endif
15477 #ifdef I_STDLIB
15478 #  include <stdlib.h>
15479 #endif
15480 #ifdef I_STRING
15481 #  include <string.h>
15482 #else
15483 #  include <strings.h>
15484 #endif
15485 #ifdef I_UNISTD
15486 #  include <unistd.h>  /* Needed for NetBSD */
15487 #endif
15488 int main()
15489 {
15490 char buf[128], abc[128];
15491 char *b;
15492 int len;
15493 int off;
15494 int align;
15495
15496 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15497    try to store the string in read-only memory. */
15498 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15499
15500 for (align = 7; align >= 0; align--) {
15501         for (len = 36; len; len--) {
15502                 b = buf+align;
15503                 memcpy(b, abc, len);
15504                 for (off = 1; off <= len; off++) {
15505                         memcpy(b+off, b, len);
15506                         memcpy(b, b+off, len);
15507                         if (memcmp(b, abc, len))
15508                                 exit(1);
15509                 }
15510         }
15511 }
15512 exit(0);
15513 }
15514 EOCP
15515                 set try
15516                 if eval $compile_ok; then
15517                         if ./try 2>/dev/null; then
15518                                 echo "Yes, it can."
15519                                 val="$define"
15520                         else
15521                                 echo "It can't, sorry."
15522                         fi
15523                 else
15524                         echo "(I can't compile the test program, so we'll assume not...)"
15525                 fi
15526                 ;;
15527         esac
15528         $rm -f try.* try core
15529         ;;
15530 esac
15531 set d_safemcpy
15532 eval $setvar
15533
15534 : can memcmp be trusted to compare relative magnitude?
15535 val="$undef"
15536 case "$d_memcmp" in
15537 "$define")
15538         echo " "
15539         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15540         $cat >try.c <<EOCP
15541 #$i_memory I_MEMORY
15542 #$i_stdlib I_STDLIB
15543 #$i_string I_STRING
15544 #$i_unistd I_UNISTD
15545 EOCP
15546         $cat >>try.c <<'EOCP'
15547 #include <stdio.h>
15548 #ifdef I_MEMORY
15549 #  include <memory.h>
15550 #endif
15551 #ifdef I_STDLIB
15552 #  include <stdlib.h>
15553 #endif
15554 #ifdef I_STRING
15555 #  include <string.h>
15556 #else
15557 #  include <strings.h>
15558 #endif
15559 #ifdef I_UNISTD
15560 #  include <unistd.h>  /* Needed for NetBSD */
15561 #endif
15562 int main()
15563 {
15564 char a = -1;
15565 char b = 0;
15566 if ((a < b) && memcmp(&a, &b, 1) < 0)
15567         exit(1);
15568 exit(0);
15569 }
15570 EOCP
15571         set try
15572         if eval $compile_ok; then
15573                 if $run ./try 2>/dev/null; then
15574                         echo "Yes, it can."
15575                         val="$define"
15576                 else
15577                         echo "No, it can't (it uses signed chars)."
15578                 fi
15579         else
15580                 echo "(I can't compile the test program, so we'll assume not...)"
15581         fi
15582         ;;
15583 esac
15584 $rm -f try.* try core
15585 set d_sanemcmp
15586 eval $setvar
15587
15588 : see if prototype for sbrk is available
15589 echo " "
15590 set d_sbrkproto sbrk $i_unistd unistd.h
15591 eval $hasproto
15592
15593 : see if select exists
15594 set select d_select
15595 eval $inlibc
15596
15597 : see if semctl exists
15598 set semctl d_semctl
15599 eval $inlibc
15600
15601 : see if semget exists
15602 set semget d_semget
15603 eval $inlibc
15604
15605 : see if semop exists
15606 set semop d_semop
15607 eval $inlibc
15608
15609 : see how much of the 'sem*(2)' library is present.
15610 h_sem=true
15611 echo " "
15612 case "$d_semctl$d_semget$d_semop" in
15613 *"$undef"*) h_sem=false;;
15614 esac
15615 case "$osname" in
15616 freebsd)
15617     case "`ipcs 2>&1`" in
15618     "SVID messages"*"not configured"*)
15619         echo "Your $osname does not have the sem*(2) configured." >&4
15620         h_sem=false
15621         val="$undef"
15622         set semctl d_semctl
15623         eval $setvar
15624         set semget d_semget
15625         eval $setvar
15626         set semop d_semop
15627         eval $setvar
15628         ;;
15629     esac
15630     ;;
15631 esac
15632 : we could also check for sys/ipc.h ...
15633 if $h_sem && $test `./findhdr sys/sem.h`; then
15634         echo "You have the full sem*(2) library." >&4
15635         val="$define"
15636 else
15637         echo "You don't have the full sem*(2) library." >&4
15638         val="$undef"
15639 fi
15640 set d_sem
15641 eval $setvar
15642
15643 : see whether sys/sem.h defines union semun
15644 echo " "
15645 $cat > try.c <<'END'
15646 #include <sys/types.h>
15647 #include <sys/ipc.h>
15648 #include <sys/sem.h>
15649 int main () { union semun semun; semun.buf = 0; }
15650 END
15651 set try
15652 if eval $compile; then
15653     echo "You have union semun in <sys/sem.h>." >&4
15654     val="$define"
15655 else
15656     echo "You do not have union semun in <sys/sem.h>." >&4
15657     val="$undef"
15658 fi
15659 $rm -f try try.c
15660 set d_union_semun
15661 eval $setvar
15662
15663 : see how to do semctl IPC_STAT
15664 case "$d_sem" in
15665 $define)
15666     echo " "
15667     $cat > try.h <<END
15668 #ifndef S_IRUSR
15669 #   ifdef S_IREAD
15670 #       define S_IRUSR S_IREAD
15671 #       define S_IWUSR S_IWRITE
15672 #       define S_IXUSR S_IEXEC
15673 #   else
15674 #       define S_IRUSR 0400
15675 #       define S_IWUSR 0200
15676 #       define S_IXUSR 0100
15677 #   endif
15678 #   define S_IRGRP (S_IRUSR>>3)
15679 #   define S_IWGRP (S_IWUSR>>3)
15680 #   define S_IXGRP (S_IXUSR>>3)
15681 #   define S_IROTH (S_IRUSR>>6)
15682 #   define S_IWOTH (S_IWUSR>>6)
15683 #   define S_IXOTH (S_IXUSR>>6)
15684 #endif
15685 #ifndef S_IRWXU
15686 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15687 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15688 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15689 #endif
15690 END
15691     : see whether semctl IPC_STAT can use union semun
15692     val="$undef"
15693     case "$d_semctl_semun" in
15694     '')
15695       $cat > try.c <<END
15696 #include <sys/types.h>
15697 #include <sys/ipc.h>
15698 #include <sys/sem.h>
15699 #include <sys/stat.h>
15700 #include <stdio.h>
15701 #include <errno.h>
15702 #include "try.h"
15703 #ifndef errno
15704 extern int errno;
15705 #endif
15706 #$d_union_semun HAS_UNION_SEMUN
15707 int main() {
15708     union semun
15709 #ifndef HAS_UNION_SEMUN
15710     {
15711         int val;
15712         struct semid_ds *buf;
15713         unsigned short *array;
15714     }
15715 #endif
15716     arg;
15717     int sem, st;
15718
15719 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15720     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15721     if (sem > -1) {
15722         struct semid_ds argbuf;
15723         arg.buf = &argbuf;
15724 #       ifdef IPC_STAT
15725         st = semctl(sem, 0, IPC_STAT, arg);
15726         if (st == 0)
15727             printf("semun\n");
15728         else
15729 #       endif /* IPC_STAT */
15730             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15731 #       ifdef IPC_RMID
15732         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15733 #       endif /* IPC_RMID */
15734             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15735     } else
15736 #endif /* IPC_PRIVATE && ... */
15737         printf("semget failed: errno = %d\n", errno);
15738   return 0;
15739 }
15740 END
15741       set try
15742       if eval $compile; then
15743           xxx=`$run ./try`
15744           case "$xxx" in
15745           semun) val="$define" ;;
15746           esac
15747       fi
15748       $rm -f try try.c
15749       ;;
15750     esac
15751     set d_semctl_semun
15752     eval $setvar
15753     case "$d_semctl_semun" in
15754     $define)
15755         echo "You can use union semun for semctl IPC_STAT." >&4
15756         also='also'
15757         ;;
15758     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15759         also=''
15760         ;;
15761     esac
15762
15763     : see whether semctl IPC_STAT can use struct semid_ds pointer
15764     val="$undef"
15765     case "$d_semctl_semid_ds" in
15766     '')
15767       $cat > try.c <<'END'
15768 #include <sys/types.h>
15769 #include <sys/ipc.h>
15770 #include <sys/sem.h>
15771 #include <sys/stat.h>
15772 #include "try.h"
15773 #include <stdio.h>
15774 #include <errno.h>
15775 #ifndef errno
15776 extern int errno;
15777 #endif
15778 int main() {
15779     struct semid_ds arg;
15780     int sem, st;
15781
15782 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15783     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15784     if (sem > -1) {
15785 #       ifdef IPC_STAT
15786         st = semctl(sem, 0, IPC_STAT, &arg);
15787         if (st == 0)
15788             printf("semid_ds\n");
15789         else
15790 #       endif /* IPC_STAT */
15791             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15792 #       ifdef IPC_RMID
15793         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15794 #       endif /* IPC_RMID */
15795             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15796     } else
15797 #endif /* IPC_PRIVATE && ... */
15798         printf("semget failed: errno = %d\n", errno);
15799
15800     return 0;
15801 }
15802 END
15803       set try
15804       if eval $compile; then
15805           xxx=`$run ./try`
15806           case "$xxx" in
15807           semid_ds) val="$define" ;;
15808           esac
15809       fi
15810       $rm -f try try.c
15811       ;;
15812     esac
15813     set d_semctl_semid_ds
15814     eval $setvar
15815     case "$d_semctl_semid_ds" in
15816     $define)
15817         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15818         ;;
15819     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15820         ;;
15821     esac
15822     $rm -f try.h
15823     ;;
15824 *)  val="$undef"
15825
15826     # We do not have the full sem*(2) library, so assume we can not
15827     # use either.
15828
15829     set d_semctl_semun
15830     eval $setvar
15831
15832     set d_semctl_semid_ds
15833     eval $setvar
15834     ;;
15835 esac
15836
15837 : see if sendmsg exists
15838 set sendmsg d_sendmsg
15839 eval $inlibc
15840
15841 : see if setegid exists
15842 set setegid d_setegid
15843 eval $inlibc
15844
15845 : see if seteuid exists
15846 set seteuid d_seteuid
15847 eval $inlibc
15848
15849 : see if setgrent exists
15850 set setgrent d_setgrent
15851 eval $inlibc
15852
15853 : see if setgrent_r exists
15854 set setgrent_r d_setgrent_r
15855 eval $inlibc
15856 case "$d_setgrent_r" in
15857 "$define")
15858         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15859         case "$d_setgrent_r_proto:$usethreads" in
15860         ":define")      d_setgrent_r_proto=define
15861                 set d_setgrent_r_proto setgrent_r $hdrs
15862                 eval $hasproto ;;
15863         *)      ;;
15864         esac
15865         case "$d_setgrent_r_proto" in
15866         define)
15867         case "$setgrent_r_proto" in
15868         ''|0) try='int setgrent_r(FILE**);'
15869         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15870         esac
15871         case "$setgrent_r_proto" in
15872         ''|0) try='void setgrent_r(FILE**);'
15873         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15874         esac
15875         case "$setgrent_r_proto" in
15876         ''|0)   d_setgrent_r=undef
15877                 setgrent_r_proto=0
15878                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15879         * )     case "$setgrent_r_proto" in
15880                 REENTRANT_PROTO*) ;;
15881                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15882                 esac
15883                 echo "Prototype: $try" ;;
15884         esac
15885         ;;
15886         *)      case "$usethreads" in
15887                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15888                 esac
15889                 d_setgrent_r=undef
15890                 setgrent_r_proto=0
15891                 ;;
15892         esac
15893         ;;
15894 *)      setgrent_r_proto=0
15895         ;;
15896 esac
15897
15898 : see if sethostent exists
15899 set sethostent d_sethent
15900 eval $inlibc
15901
15902 : see if sethostent_r exists
15903 set sethostent_r d_sethostent_r
15904 eval $inlibc
15905 case "$d_sethostent_r" in
15906 "$define")
15907         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15908         case "$d_sethostent_r_proto:$usethreads" in
15909         ":define")      d_sethostent_r_proto=define
15910                 set d_sethostent_r_proto sethostent_r $hdrs
15911                 eval $hasproto ;;
15912         *)      ;;
15913         esac
15914         case "$d_sethostent_r_proto" in
15915         define)
15916         case "$sethostent_r_proto" in
15917         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15918         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15919         esac
15920         case "$sethostent_r_proto" in
15921         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15922         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15923         esac
15924         case "$sethostent_r_proto" in
15925         ''|0)   d_sethostent_r=undef
15926                 sethostent_r_proto=0
15927                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15928         * )     case "$sethostent_r_proto" in
15929                 REENTRANT_PROTO*) ;;
15930                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15931                 esac
15932                 echo "Prototype: $try" ;;
15933         esac
15934         ;;
15935         *)      case "$usethreads" in
15936                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15937                 esac
15938                 d_sethostent_r=undef
15939                 sethostent_r_proto=0
15940                 ;;
15941         esac
15942         ;;
15943 *)      sethostent_r_proto=0
15944         ;;
15945 esac
15946
15947 : see if setitimer exists
15948 set setitimer d_setitimer
15949 eval $inlibc
15950
15951 : see if setlinebuf exists
15952 set setlinebuf d_setlinebuf
15953 eval $inlibc
15954
15955 : see if setlocale exists
15956 set setlocale d_setlocale
15957 eval $inlibc
15958
15959 : see if locale.h is available
15960 set locale.h i_locale
15961 eval $inhdr
15962
15963 : see if setlocale_r exists
15964 set setlocale_r d_setlocale_r
15965 eval $inlibc
15966 case "$d_setlocale_r" in
15967 "$define")
15968         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15969         case "$d_setlocale_r_proto:$usethreads" in
15970         ":define")      d_setlocale_r_proto=define
15971                 set d_setlocale_r_proto setlocale_r $hdrs
15972                 eval $hasproto ;;
15973         *)      ;;
15974         esac
15975         case "$d_setlocale_r_proto" in
15976         define)
15977         case "$setlocale_r_proto" in
15978         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15979         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15980         esac
15981         case "$setlocale_r_proto" in
15982         ''|0)   d_setlocale_r=undef
15983                 setlocale_r_proto=0
15984                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15985         * )     case "$setlocale_r_proto" in
15986                 REENTRANT_PROTO*) ;;
15987                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15988                 esac
15989                 echo "Prototype: $try" ;;
15990         esac
15991         ;;
15992         *)      case "$usethreads" in
15993                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15994                 esac
15995                 d_setlocale_r=undef
15996                 setlocale_r_proto=0
15997                 ;;
15998         esac
15999         ;;
16000 *)      setlocale_r_proto=0
16001         ;;
16002 esac
16003
16004 : see if setnetent exists
16005 set setnetent d_setnent
16006 eval $inlibc
16007
16008 : see if setnetent_r exists
16009 set setnetent_r d_setnetent_r
16010 eval $inlibc
16011 case "$d_setnetent_r" in
16012 "$define")
16013         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16014         case "$d_setnetent_r_proto:$usethreads" in
16015         ":define")      d_setnetent_r_proto=define
16016                 set d_setnetent_r_proto setnetent_r $hdrs
16017                 eval $hasproto ;;
16018         *)      ;;
16019         esac
16020         case "$d_setnetent_r_proto" in
16021         define)
16022         case "$setnetent_r_proto" in
16023         ''|0) try='int setnetent_r(int, struct netent_data*);'
16024         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16025         esac
16026         case "$setnetent_r_proto" in
16027         ''|0) try='void setnetent_r(int, struct netent_data*);'
16028         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16029         esac
16030         case "$setnetent_r_proto" in
16031         ''|0)   d_setnetent_r=undef
16032                 setnetent_r_proto=0
16033                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16034         * )     case "$setnetent_r_proto" in
16035                 REENTRANT_PROTO*) ;;
16036                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16037                 esac
16038                 echo "Prototype: $try" ;;
16039         esac
16040         ;;
16041         *)      case "$usethreads" in
16042                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16043                 esac
16044                 d_setnetent_r=undef
16045                 setnetent_r_proto=0
16046                 ;;
16047         esac
16048         ;;
16049 *)      setnetent_r_proto=0
16050         ;;
16051 esac
16052
16053 : see if setprotoent exists
16054 set setprotoent d_setpent
16055 eval $inlibc
16056
16057 : see if setpgid exists
16058 set setpgid d_setpgid
16059 eval $inlibc
16060
16061 : see if setpgrp2 exists
16062 set setpgrp2 d_setpgrp2
16063 eval $inlibc
16064
16065 : see if setpriority exists
16066 set setpriority d_setprior
16067 eval $inlibc
16068
16069 : see if setproctitle exists
16070 set setproctitle d_setproctitle
16071 eval $inlibc
16072
16073 : see if setprotoent_r exists
16074 set setprotoent_r d_setprotoent_r
16075 eval $inlibc
16076 case "$d_setprotoent_r" in
16077 "$define")
16078         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16079         case "$d_setprotoent_r_proto:$usethreads" in
16080         ":define")      d_setprotoent_r_proto=define
16081                 set d_setprotoent_r_proto setprotoent_r $hdrs
16082                 eval $hasproto ;;
16083         *)      ;;
16084         esac
16085         case "$d_setprotoent_r_proto" in
16086         define)
16087         case "$setprotoent_r_proto" in
16088         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16089         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16090         esac
16091         case "$setprotoent_r_proto" in
16092         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16093         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16094         esac
16095         case "$setprotoent_r_proto" in
16096         ''|0)   d_setprotoent_r=undef
16097                 setprotoent_r_proto=0
16098                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16099         * )     case "$setprotoent_r_proto" in
16100                 REENTRANT_PROTO*) ;;
16101                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16102                 esac
16103                 echo "Prototype: $try" ;;
16104         esac
16105         ;;
16106         *)      case "$usethreads" in
16107                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16108                 esac
16109                 d_setprotoent_r=undef
16110                 setprotoent_r_proto=0
16111                 ;;
16112         esac
16113         ;;
16114 *)      setprotoent_r_proto=0
16115         ;;
16116 esac
16117
16118 : see if setpwent exists
16119 set setpwent d_setpwent
16120 eval $inlibc
16121
16122 : see if setpwent_r exists
16123 set setpwent_r d_setpwent_r
16124 eval $inlibc
16125 case "$d_setpwent_r" in
16126 "$define")
16127         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16128         case "$d_setpwent_r_proto:$usethreads" in
16129         ":define")      d_setpwent_r_proto=define
16130                 set d_setpwent_r_proto setpwent_r $hdrs
16131                 eval $hasproto ;;
16132         *)      ;;
16133         esac
16134         case "$d_setpwent_r_proto" in
16135         define)
16136         case "$setpwent_r_proto" in
16137         ''|0) try='int setpwent_r(FILE**);'
16138         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16139         esac
16140         case "$setpwent_r_proto" in
16141         ''|0) try='void setpwent_r(FILE**);'
16142         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16143         esac
16144         case "$setpwent_r_proto" in
16145         ''|0)   d_setpwent_r=undef
16146                 setpwent_r_proto=0
16147                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16148         * )     case "$setpwent_r_proto" in
16149                 REENTRANT_PROTO*) ;;
16150                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16151                 esac
16152                 echo "Prototype: $try" ;;
16153         esac
16154         ;;
16155         *)      case "$usethreads" in
16156                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16157                 esac
16158                 d_setpwent_r=undef
16159                 setpwent_r_proto=0
16160                 ;;
16161         esac
16162         ;;
16163 *)      setpwent_r_proto=0
16164         ;;
16165 esac
16166
16167 : see if setregid exists
16168 set setregid d_setregid
16169 eval $inlibc
16170 set setresgid d_setresgid
16171 eval $inlibc
16172
16173 : see if setreuid exists
16174 set setreuid d_setreuid
16175 eval $inlibc
16176 set setresuid d_setresuid
16177 eval $inlibc
16178
16179 : see if setrgid exists
16180 set setrgid d_setrgid
16181 eval $inlibc
16182
16183 : see if setruid exists
16184 set setruid d_setruid
16185 eval $inlibc
16186
16187 : see if setservent exists
16188 set setservent d_setsent
16189 eval $inlibc
16190
16191 : see if setservent_r exists
16192 set setservent_r d_setservent_r
16193 eval $inlibc
16194 case "$d_setservent_r" in
16195 "$define")
16196         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16197         case "$d_setservent_r_proto:$usethreads" in
16198         ":define")      d_setservent_r_proto=define
16199                 set d_setservent_r_proto setservent_r $hdrs
16200                 eval $hasproto ;;
16201         *)      ;;
16202         esac
16203         case "$d_setservent_r_proto" in
16204         define)
16205         case "$setservent_r_proto" in
16206         ''|0) try='int setservent_r(int, struct servent_data*);'
16207         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16208         esac
16209         case "$setservent_r_proto" in
16210         ''|0) try='void setservent_r(int, struct servent_data*);'
16211         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16212         esac
16213         case "$setservent_r_proto" in
16214         ''|0)   d_setservent_r=undef
16215                 setservent_r_proto=0
16216                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16217         * )     case "$setservent_r_proto" in
16218                 REENTRANT_PROTO*) ;;
16219                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16220                 esac
16221                 echo "Prototype: $try" ;;
16222         esac
16223         ;;
16224         *)      case "$usethreads" in
16225                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16226                 esac
16227                 d_setservent_r=undef
16228                 setservent_r_proto=0
16229                 ;;
16230         esac
16231         ;;
16232 *)      setservent_r_proto=0
16233         ;;
16234 esac
16235
16236 : see if setsid exists
16237 set setsid d_setsid
16238 eval $inlibc
16239
16240 : see if setvbuf exists
16241 set setvbuf d_setvbuf
16242 eval $inlibc
16243
16244 : see if sfio.h is available
16245 set sfio.h i_sfio
16246 eval $inhdr
16247
16248
16249 : see if sfio library is available
16250 case "$i_sfio" in
16251 $define)
16252         val=''
16253         set sfreserve val
16254         eval $inlibc
16255         ;;
16256 *)
16257         val="$undef"
16258         ;;
16259 esac
16260 : Ok, but do we want to use it.
16261 case "$val" in
16262 $define)
16263         case "$usesfio" in
16264         true|$define|[yY]*) dflt='y';;
16265         *) dflt='n';;
16266         esac
16267         echo "$package can use the sfio library, but it is experimental."
16268         case "$useperlio" in
16269         "$undef")
16270             echo "For sfio also the PerlIO abstraction layer is needed."
16271             echo "Earlier you said you wouldn't want that."
16272             ;;
16273         esac
16274         rp="You seem to have sfio available, do you want to try using it?"
16275         . ./myread
16276         case "$ans" in
16277         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16278                 useperlio="$define"
16279                 val="$define"
16280                 ;;
16281         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16282                 val="$undef"
16283                 ;;
16284         esac
16285         ;;
16286 *)      case "$usesfio" in
16287         true|$define|[yY]*)
16288                 echo "Sorry, cannot find sfio on this machine." >&4
16289                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16290                 val="$undef"
16291                 ;;
16292         esac
16293         ;;
16294 esac
16295 set d_sfio
16296 eval $setvar
16297 case "$d_sfio" in
16298 $define) usesfio='true';;
16299 *) usesfio='false';;
16300 esac
16301 case "$d_sfio" in
16302 $define) ;;
16303 *)      : Remove sfio from list of libraries to use
16304         case "$libs" in
16305         *-lsfio*)
16306                 echo "Removing unneeded -lsfio from library list" >&4
16307                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16308                 shift
16309                 libs="$*"
16310                 echo "libs = $libs" >&4
16311                 ;;
16312         esac
16313 ;;
16314 esac
16315
16316
16317 : see if shmctl exists
16318 set shmctl d_shmctl
16319 eval $inlibc
16320
16321 : see if shmget exists
16322 set shmget d_shmget
16323 eval $inlibc
16324
16325 : see if shmat exists
16326 set shmat d_shmat
16327 eval $inlibc
16328 : see what shmat returns
16329 case "$d_shmat" in
16330 "$define")
16331         $cat >shmat.c <<'END'
16332 #include <sys/shm.h>
16333 void *shmat();
16334 END
16335         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16336                 shmattype='void *'
16337         else
16338                 shmattype='char *'
16339         fi
16340         echo "and it returns ($shmattype)." >&4
16341         : see if a prototype for shmat is available
16342         xxx=`./findhdr sys/shm.h`
16343         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16344         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16345                 val="$define"
16346         else
16347                 val="$undef"
16348         fi
16349         $rm -f shmat.[co]
16350         ;;
16351 *)
16352         val="$undef"
16353         ;;
16354 esac
16355 set d_shmatprototype
16356 eval $setvar
16357
16358 : see if shmdt exists
16359 set shmdt d_shmdt
16360 eval $inlibc
16361
16362 : see how much of the 'shm*(2)' library is present.
16363 h_shm=true
16364 echo " "
16365 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16366 *"$undef"*) h_shm=false;;
16367 esac
16368 case "$osname" in
16369 freebsd)
16370     case "`ipcs 2>&1`" in
16371     "SVID shared memory"*"not configured"*)
16372         echo "Your $osname does not have the shm*(2) configured." >&4
16373         h_shm=false
16374         val="$undef"
16375         set shmctl d_shmctl
16376         evat $setvar
16377         set shmget d_shmget
16378         evat $setvar
16379         set shmat d_shmat
16380         evat $setvar
16381         set shmdt d_shmdt
16382         evat $setvar
16383         ;;
16384     esac
16385     ;;
16386 esac
16387 : we could also check for sys/ipc.h ...
16388 if $h_shm && $test `./findhdr sys/shm.h`; then
16389         echo "You have the full shm*(2) library." >&4
16390         val="$define"
16391 else
16392         echo "You don't have the full shm*(2) library." >&4
16393         val="$undef"
16394 fi
16395 set d_shm
16396 eval $setvar
16397
16398 echo " "
16399 : see if we have sigaction
16400 if set sigaction val -f d_sigaction; eval $csym; $val; then
16401         echo 'sigaction() found.' >&4
16402         $cat > try.c <<EOP
16403 #include <stdio.h>
16404 #include <sys/types.h>
16405 #include <signal.h>
16406 #$i_stdlib I_STDLIB
16407 #ifdef I_STDLIB
16408 #include <stdlib.h>
16409 #endif
16410 int main()
16411 {
16412     struct sigaction act, oact;
16413     act.sa_flags = 0;
16414     oact.sa_handler = 0;
16415     /* so that act and oact are used */
16416     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16417 }
16418 EOP
16419         set try
16420         if eval $compile_ok; then
16421                 val="$define"
16422         else
16423                 echo "But you don't seem to have a useable struct sigaction." >&4
16424                 val="$undef"
16425         fi
16426 else
16427         echo 'sigaction NOT found.' >&4
16428         val="$undef"
16429 fi
16430 set d_sigaction; eval $setvar
16431 $rm -f try try$_o try.c
16432
16433 : see if sigprocmask exists
16434 set sigprocmask d_sigprocmask
16435 eval $inlibc
16436
16437 : see if sigsetjmp exists
16438 echo " "
16439 case "$d_sigsetjmp" in
16440 '')
16441         $cat >try.c <<EOP
16442 #include <setjmp.h>
16443 #$i_stdlib I_STDLIB
16444 #ifdef I_STDLIB
16445 #include <stdlib.h>
16446 #endif
16447 sigjmp_buf env;
16448 int set = 1;
16449 int main()
16450 {
16451         if (sigsetjmp(env,1))
16452                 exit(set);
16453         set = 0;
16454         siglongjmp(env, 1);
16455         exit(1);
16456 }
16457 EOP
16458         set try
16459         if eval $compile; then
16460                 if $run ./try >/dev/null 2>&1; then
16461                         echo "POSIX sigsetjmp found." >&4
16462                         val="$define"
16463                 else
16464                         $cat >&4 <<EOM
16465 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16466 I'll ignore them.
16467 EOM
16468                         val="$undef"
16469                 fi
16470         else
16471                 echo "sigsetjmp not found." >&4
16472                 val="$undef"
16473         fi
16474         ;;
16475 *) val="$d_sigsetjmp"
16476         case "$d_sigsetjmp" in
16477         $define) echo "POSIX sigsetjmp found." >&4;;
16478         $undef) echo "sigsetjmp not found." >&4;;
16479         esac
16480         ;;
16481 esac
16482 set d_sigsetjmp
16483 eval $setvar
16484 $rm -f try.c try
16485
16486 : see if sockatmark exists
16487 set sockatmark d_sockatmark
16488 eval $inlibc
16489
16490 : see if prototype for sockatmark is available
16491 echo " "
16492 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16493 eval $hasproto
16494
16495 : see if socks5_init exists
16496 set socks5_init d_socks5_init
16497 eval $inlibc
16498
16499 : see if srand48_r exists
16500 set srand48_r d_srand48_r
16501 eval $inlibc
16502 case "$d_srand48_r" in
16503 "$define")
16504         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16505         case "$d_srand48_r_proto:$usethreads" in
16506         ":define")      d_srand48_r_proto=define
16507                 set d_srand48_r_proto srand48_r $hdrs
16508                 eval $hasproto ;;
16509         *)      ;;
16510         esac
16511         case "$d_srand48_r_proto" in
16512         define)
16513         case "$srand48_r_proto" in
16514         ''|0) try='int srand48_r(long, struct drand48_data*);'
16515         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16516         esac
16517         case "$srand48_r_proto" in
16518         ''|0)   d_srand48_r=undef
16519                 srand48_r_proto=0
16520                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16521         * )     case "$srand48_r_proto" in
16522                 REENTRANT_PROTO*) ;;
16523                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16524                 esac
16525                 echo "Prototype: $try" ;;
16526         esac
16527         ;;
16528         *)      case "$usethreads" in
16529                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16530                 esac
16531                 d_srand48_r=undef
16532                 srand48_r_proto=0
16533                 ;;
16534         esac
16535         ;;
16536 *)      srand48_r_proto=0
16537         ;;
16538 esac
16539
16540 : see if srandom_r exists
16541 set srandom_r d_srandom_r
16542 eval $inlibc
16543 case "$d_srandom_r" in
16544 "$define")
16545         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16546         case "$d_srandom_r_proto:$usethreads" in
16547         ":define")      d_srandom_r_proto=define
16548                 set d_srandom_r_proto srandom_r $hdrs
16549                 eval $hasproto ;;
16550         *)      ;;
16551         esac
16552         case "$d_srandom_r_proto" in
16553         define)
16554         case "$srandom_r_proto" in
16555         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16556         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16557         esac
16558         case "$srandom_r_proto" in
16559         ''|0)   d_srandom_r=undef
16560                 srandom_r_proto=0
16561                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16562         * )     case "$srandom_r_proto" in
16563                 REENTRANT_PROTO*) ;;
16564                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16565                 esac
16566                 echo "Prototype: $try" ;;
16567         esac
16568         ;;
16569         *)      case "$usethreads" in
16570                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16571                 esac
16572                 d_srandom_r=undef
16573                 srandom_r_proto=0
16574                 ;;
16575         esac
16576         ;;
16577 *)      srandom_r_proto=0
16578         ;;
16579 esac
16580
16581 : see if prototype for setresgid is available
16582 echo " "
16583 set d_sresgproto setresgid $i_unistd unistd.h
16584 eval $hasproto
16585
16586 : see if prototype for setresuid is available
16587 echo " "
16588 set d_sresuproto setresuid $i_unistd unistd.h
16589 eval $hasproto
16590
16591 : see if sys/stat.h is available
16592 set sys/stat.h i_sysstat
16593 eval $inhdr
16594
16595
16596 : see if stat knows about block sizes
16597 echo " "
16598 echo "Checking to see if your struct stat has st_blocks field..." >&4
16599 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16600 eval $hasfield
16601
16602
16603 : see if this is a sys/vfs.h system
16604 set sys/vfs.h i_sysvfs
16605 eval $inhdr
16606
16607
16608 : see if this is a sys/statfs.h system
16609 set sys/statfs.h i_sysstatfs
16610 eval $inhdr
16611
16612
16613 echo " "
16614 echo "Checking to see if your system supports struct statfs..." >&4
16615 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
16616 eval $hasstruct
16617 case "$d_statfs_s" in
16618 "$define")      echo "Yes, it does."   ;;
16619 *)              echo "No, it doesn't." ;;
16620 esac
16621
16622
16623
16624 : see if struct statfs knows about f_flags
16625 case "$d_statfs_s" in
16626 define) 
16627         echo " "
16628         echo "Checking to see if your struct statfs has f_flags field..." >&4
16629         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
16630         eval $hasfield
16631         ;;
16632 *)      val="$undef"
16633         set d_statfs_f_flags
16634         eval $setvar
16635         ;;
16636 esac
16637 case "$d_statfs_f_flags" in
16638 "$define")      echo "Yes, it does."   ;;
16639 *)              echo "No, it doesn't." ;;
16640 esac
16641
16642 $cat >&4 <<EOM
16643 Checking how to access stdio streams by file descriptor number...
16644 EOM
16645 case "$stdio_stream_array" in
16646 '')     $cat >try.c <<EOCP
16647 #include <stdio.h>
16648 int main() {
16649   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16650     printf("yes\n");
16651 }
16652 EOCP
16653         for s in _iob __iob __sF
16654         do
16655                 set try -DSTDIO_STREAM_ARRAY=$s
16656                 if eval $compile; then
16657                         case "`$run ./try`" in
16658                         yes)    stdio_stream_array=$s; break ;;
16659                         esac
16660                 fi
16661         done
16662         $rm -f try.* try$exe_ext
16663 esac
16664 case "$stdio_stream_array" in
16665 '')     $cat >&4 <<EOM
16666 I can't figure out how to access stdio streams by file descriptor number.
16667 EOM
16668         d_stdio_stream_array="$undef"
16669         ;;
16670 *)      $cat >&4 <<EOM
16671 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16672 EOM
16673         d_stdio_stream_array="$define"
16674         ;;
16675 esac
16676
16677 : see if strcoll exists
16678 set strcoll d_strcoll
16679 eval $inlibc
16680
16681 : check for structure copying
16682 echo " "
16683 echo "Checking to see if your C compiler can copy structs..." >&4
16684 $cat >try.c <<'EOCP'
16685 int main()
16686 {
16687         struct blurfl {
16688                 int dyick;
16689         } foo, bar;
16690
16691         foo = bar;
16692 }
16693 EOCP
16694 if $cc -c try.c >/dev/null 2>&1 ; then
16695         val="$define"
16696         echo "Yup, it can."
16697 else
16698         val="$undef"
16699         echo "Nope, it can't."
16700 fi
16701 set d_strctcpy
16702 eval $setvar
16703 $rm -f try.*
16704
16705 : see if strerror and/or sys_errlist[] exist
16706 echo " "
16707 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16708     if set strerror val -f d_strerror; eval $csym; $val; then
16709                 echo 'strerror() found.' >&4
16710                 d_strerror="$define"
16711                 d_strerrm='strerror(e)'
16712                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16713                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16714                         d_syserrlst="$define"
16715                 else
16716                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16717                         d_syserrlst="$undef"
16718                 fi
16719     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16720                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16721                 echo 'strerror() found in string header.' >&4
16722                 d_strerror="$define"
16723                 d_strerrm='strerror(e)'
16724                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16725                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16726                                 d_syserrlst="$define"
16727                 else
16728                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16729                         d_syserrlst="$undef"
16730                 fi
16731     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16732                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16733                 d_strerror="$undef"
16734                 d_syserrlst="$define"
16735                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16736     else
16737                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16738                 d_strerror="$undef"
16739                 d_syserrlst="$undef"
16740                 d_strerrm='"unknown"'
16741     fi
16742 fi
16743
16744 : see if strerror_r exists
16745 set strerror_r d_strerror_r
16746 eval $inlibc
16747 case "$d_strerror_r" in
16748 "$define")
16749         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16750         case "$d_strerror_r_proto:$usethreads" in
16751         ":define")      d_strerror_r_proto=define
16752                 set d_strerror_r_proto strerror_r $hdrs
16753                 eval $hasproto ;;
16754         *)      ;;
16755         esac
16756         case "$d_strerror_r_proto" in
16757         define)
16758         case "$strerror_r_proto" in
16759         ''|0) try='int strerror_r(int, char*, size_t);'
16760         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16761         esac
16762         case "$strerror_r_proto" in
16763         ''|0) try='int strerror_r(int, char*, int);'
16764         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16765         esac
16766         case "$strerror_r_proto" in
16767         ''|0) try='char* strerror_r(int, char*, size_t);'
16768         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16769         esac
16770         case "$strerror_r_proto" in
16771         ''|0)   d_strerror_r=undef
16772                 strerror_r_proto=0
16773                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16774         * )     case "$strerror_r_proto" in
16775                 REENTRANT_PROTO*) ;;
16776                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16777                 esac
16778                 echo "Prototype: $try" ;;
16779         esac
16780         ;;
16781         *)      case "$usethreads" in
16782                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16783                 esac
16784                 d_strerror_r=undef
16785                 strerror_r_proto=0
16786                 ;;
16787         esac
16788         ;;
16789 *)      strerror_r_proto=0
16790         ;;
16791 esac
16792
16793 : see if strftime exists
16794 set strftime d_strftime
16795 eval $inlibc
16796
16797 : see if strlcat exists
16798 set strlcat d_strlcat
16799 eval $inlibc
16800
16801 : see if strlcpy exists
16802 set strlcpy d_strlcpy
16803 eval $inlibc
16804
16805 : see if strtod exists
16806 set strtod d_strtod
16807 eval $inlibc
16808
16809 : see if strtol exists
16810 set strtol d_strtol
16811 eval $inlibc
16812
16813 : see if strtold exists
16814 set strtold d_strtold
16815 eval $inlibc
16816
16817 : see if strtoll exists
16818 set strtoll d_strtoll
16819 eval $inlibc
16820
16821 case "$d_longlong-$d_strtoll" in
16822 "$define-$define")
16823         $cat <<EOM
16824 Checking whether your strtoll() works okay...
16825 EOM
16826         $cat >try.c <<'EOCP'
16827 #include <errno.h>
16828 #ifdef __hpux
16829 #define strtoll __strtoll
16830 #endif
16831 #ifdef __EMX__
16832 #define strtoll _strtoll
16833 #endif
16834 #include <stdio.h>
16835 extern long long int strtoll(char *s, char **, int); 
16836 static int bad = 0;
16837 int check(char *s, long long ell, int een) {
16838         long long gll;
16839         errno = 0;
16840         gll = strtoll(s, 0, 10);
16841         if (!((gll == ell) && (errno == een)))
16842                 bad++;
16843 }
16844 int main() {
16845         check(" 1",                                      1LL, 0);
16846         check(" 0",                                      0LL, 0);
16847         check("-1",                                     -1LL, 0);
16848         check("-9223372036854775808", -9223372036854775808LL, 0);
16849         check("-9223372036854775808", -9223372036854775808LL, 0);
16850         check(" 9223372036854775807",  9223372036854775807LL, 0);
16851         check("-9223372036854775808", -9223372036854775808LL, 0);
16852         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16853         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16854         if (!bad)
16855                 printf("ok\n");
16856 }
16857 EOCP
16858         set try
16859         if eval $compile; then
16860                 yyy=`$run ./try`
16861                 case "$yyy" in
16862                 ok) echo "Your strtoll() seems to be working okay." ;;
16863                 *) cat <<EOM >&4
16864 Your strtoll() doesn't seem to be working okay.
16865 EOM
16866                    d_strtoll="$undef"
16867                    ;;
16868                 esac
16869         else
16870                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16871                 d_strtoll="$undef"
16872         fi
16873         ;;
16874 esac
16875
16876 : see if strtoq exists
16877 set strtoq d_strtoq
16878 eval $inlibc
16879
16880 : see if strtoul exists
16881 set strtoul d_strtoul
16882 eval $inlibc
16883
16884 case "$d_strtoul" in
16885 "$define")
16886         $cat <<EOM
16887 Checking whether your strtoul() works okay...
16888 EOM
16889         $cat >try.c <<'EOCP'
16890 #include <errno.h>
16891 #include <stdio.h>
16892 extern unsigned long int strtoul(char *s, char **, int); 
16893 static int bad = 0;
16894 void check(char *s, unsigned long eul, int een) {
16895         unsigned long gul;
16896         errno = 0;
16897         gul = strtoul(s, 0, 10);
16898         if (!((gul == eul) && (errno == een)))
16899                 bad++;
16900 }
16901 int main() {
16902         check(" 1", 1L, 0);
16903         check(" 0", 0L, 0);
16904 EOCP
16905         case "$longsize" in
16906         8)
16907             $cat >>try.c <<'EOCP'
16908         check("18446744073709551615", 18446744073709551615UL, 0);
16909         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16910 #if 0 /* strtoul() for /^-/ strings is undefined. */
16911         check("-1", 18446744073709551615UL, 0);
16912         check("-18446744073709551614", 2, 0);
16913         check("-18446744073709551615", 1, 0);
16914         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16915         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16916 #endif
16917 EOCP
16918                 ;;
16919         4)
16920                     $cat >>try.c <<'EOCP'
16921         check("4294967295", 4294967295UL, 0);
16922         check("4294967296", 4294967295UL, ERANGE);
16923 #if 0 /* strtoul() for /^-/ strings is undefined. */
16924         check("-1", 4294967295UL, 0);
16925         check("-4294967294", 2, 0);
16926         check("-4294967295", 1, 0);
16927         check("-4294967296", 4294967295UL, ERANGE);
16928         check("-4294967297", 4294967295UL, ERANGE);
16929 #endif
16930 EOCP
16931                 ;;
16932         *)
16933 : Should we write these tests to be more portable by sprintf-ing
16934 : ~0 and then manipulating that char string as input for strtol?
16935                 ;;
16936         esac
16937         $cat >>try.c <<'EOCP'
16938         if (!bad)
16939                 printf("ok\n");
16940         return 0;
16941 }
16942 EOCP
16943         set try
16944         if eval $compile; then
16945                 case "`$run ./try`" in
16946                 ok) echo "Your strtoul() seems to be working okay." ;;
16947                 *) cat <<EOM >&4
16948 Your strtoul() doesn't seem to be working okay.
16949 EOM
16950                    d_strtoul="$undef"
16951                    ;;
16952                 esac
16953         fi
16954         ;;
16955 esac
16956
16957 : see if strtoull exists
16958 set strtoull d_strtoull
16959 eval $inlibc
16960
16961 case "$d_longlong-$d_strtoull" in
16962 "$define-$define")
16963         $cat <<EOM
16964 Checking whether your strtoull() works okay...
16965 EOM
16966         $cat >try.c <<'EOCP'
16967 #include <errno.h>
16968 #ifdef __hpux
16969 #define strtoull __strtoull
16970 #endif
16971 #include <stdio.h>
16972 extern unsigned long long int strtoull(char *s, char **, int); 
16973 static int bad = 0;
16974 int check(char *s, long long eull, int een) {
16975         long long gull;
16976         errno = 0;
16977         gull = strtoull(s, 0, 10);
16978         if (!((gull == eull) && (errno == een)))
16979                 bad++;
16980 }
16981 int main() {
16982         check(" 1",                                        1LL, 0);
16983         check(" 0",                                        0LL, 0);
16984         check("18446744073709551615",  18446744073709551615ULL, 0);
16985         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16986 #if 0 /* strtoull() for /^-/ strings is undefined. */
16987         check("-1",                    18446744073709551615ULL, 0);
16988         check("-18446744073709551614",                     2LL, 0);
16989         check("-18446744073709551615",                     1LL, 0);
16990         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16991         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16992 #endif
16993         if (!bad)
16994                 printf("ok\n");
16995 }
16996 EOCP
16997         set try
16998         if eval $compile; then
16999                 case "`$run ./try`" in
17000                 ok) echo "Your strtoull() seems to be working okay." ;;
17001                 *) cat <<EOM >&4
17002 Your strtoull() doesn't seem to be working okay.
17003 EOM
17004                    d_strtoull="$undef"
17005                    ;;
17006                 esac
17007         fi
17008         ;;
17009 esac
17010
17011 : see if strtouq exists
17012 set strtouq d_strtouq
17013 eval $inlibc
17014
17015 case "$d_strtouq" in
17016 "$define")
17017         $cat <<EOM
17018 Checking whether your strtouq() works okay...
17019 EOM
17020         $cat >try.c <<'EOCP'
17021 #include <errno.h>
17022 #include <stdio.h>
17023 extern unsigned long long int strtouq(char *s, char **, int); 
17024 static int bad = 0;
17025 void check(char *s, unsigned long long eull, int een) {
17026         unsigned long long gull;
17027         errno = 0;
17028         gull = strtouq(s, 0, 10);
17029         if (!((gull == eull) && (errno == een)))
17030                 bad++;
17031 }
17032 int main() {
17033         check(" 1",                                        1LL, 0);
17034         check(" 0",                                        0LL, 0);
17035         check("18446744073709551615",  18446744073709551615ULL, 0);
17036         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17037 #if 0 /* strtouq() for /^-/ strings is undefined. */
17038         check("-1",                    18446744073709551615ULL, 0);
17039         check("-18446744073709551614",                     2LL, 0);
17040         check("-18446744073709551615",                     1LL, 0);
17041         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17042         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17043 #endif
17044         if (!bad)
17045                 printf("ok\n");
17046         return 0;
17047 }
17048 EOCP
17049         set try
17050         if eval $compile; then
17051                 case "`$run ./try`" in
17052                 ok) echo "Your strtouq() seems to be working okay." ;;
17053                 *) cat <<EOM >&4
17054 Your strtouq() doesn't seem to be working okay.
17055 EOM
17056                    d_strtouq="$undef"
17057                    ;;
17058                 esac
17059         fi
17060         ;;
17061 esac
17062
17063 : see if strxfrm exists
17064 set strxfrm d_strxfrm
17065 eval $inlibc
17066
17067 : see if symlink exists
17068 set symlink d_symlink
17069 eval $inlibc
17070
17071 : see if syscall exists
17072 set syscall d_syscall
17073 eval $inlibc
17074
17075 : see if prototype for syscall is available
17076 echo " "
17077 set d_syscallproto syscall $i_unistd unistd.h
17078 eval $hasproto
17079
17080 : see if sysconf exists
17081 set sysconf d_sysconf
17082 eval $inlibc
17083
17084 : see if system exists
17085 set system d_system
17086 eval $inlibc
17087
17088 : see if tcgetpgrp exists
17089 set tcgetpgrp d_tcgetpgrp
17090 eval $inlibc
17091
17092 : see if tcsetpgrp exists
17093 set tcsetpgrp d_tcsetpgrp
17094 eval $inlibc
17095
17096 : see if prototype for telldir is available
17097 echo " "
17098 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17099 eval $hasproto
17100
17101 : see if time exists
17102 echo " "
17103 if test "X$d_time" = X -o X"$timetype" = X; then
17104     if set time val -f d_time; eval $csym; $val; then
17105                 echo 'time() found.' >&4
17106                 val="$define"
17107                 rp="What is the type returned by time() on this system?"
17108                 set time_t timetype long stdio.h sys/types.h
17109                 eval $typedef_ask
17110     else
17111                 echo 'time() not found, hope that will do.' >&4
17112                 val="$undef"
17113                 timetype='int';
17114     fi
17115     set d_time
17116     eval $setvar
17117 fi
17118
17119 : see if this is a sys/times.h system
17120 set sys/times.h i_systimes
17121 eval $inhdr
17122
17123 : see if times exists
17124 echo " "
17125 if set times val -f d_times; eval $csym; $val; then
17126         echo 'times() found.' >&4
17127         d_times="$define"
17128         inc=''
17129         case "$i_systimes" in
17130         "$define") inc='sys/times.h';;
17131         esac
17132         rp="What is the type returned by times() on this system?"
17133         set clock_t clocktype long stdio.h sys/types.h $inc
17134         eval $typedef_ask
17135 else
17136         echo 'times() NOT found, hope that will do.' >&4
17137         d_times="$undef"
17138         clocktype='int'
17139 fi
17140
17141 : see if tmpnam_r exists
17142 set tmpnam_r d_tmpnam_r
17143 eval $inlibc
17144 case "$d_tmpnam_r" in
17145 "$define")
17146         hdrs="$i_systypes sys/types.h define stdio.h "
17147         case "$d_tmpnam_r_proto:$usethreads" in
17148         ":define")      d_tmpnam_r_proto=define
17149                 set d_tmpnam_r_proto tmpnam_r $hdrs
17150                 eval $hasproto ;;
17151         *)      ;;
17152         esac
17153         case "$d_tmpnam_r_proto" in
17154         define)
17155         case "$tmpnam_r_proto" in
17156         ''|0) try='char* tmpnam_r(char*);'
17157         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17158         esac
17159         case "$tmpnam_r_proto" in
17160         ''|0)   d_tmpnam_r=undef
17161                 tmpnam_r_proto=0
17162                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17163         * )     case "$tmpnam_r_proto" in
17164                 REENTRANT_PROTO*) ;;
17165                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17166                 esac
17167                 echo "Prototype: $try" ;;
17168         esac
17169         ;;
17170         *)      case "$usethreads" in
17171                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17172                 esac
17173                 d_tmpnam_r=undef
17174                 tmpnam_r_proto=0
17175                 ;;
17176         esac
17177         ;;
17178 *)      tmpnam_r_proto=0
17179         ;;
17180 esac
17181
17182 : see if truncate exists
17183 set truncate d_truncate
17184 eval $inlibc
17185
17186 : see if ttyname_r exists
17187 set ttyname_r d_ttyname_r
17188 eval $inlibc
17189 case "$d_ttyname_r" in
17190 "$define")
17191         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17192         case "$d_ttyname_r_proto:$usethreads" in
17193         ":define")      d_ttyname_r_proto=define
17194                 set d_ttyname_r_proto ttyname_r $hdrs
17195                 eval $hasproto ;;
17196         *)      ;;
17197         esac
17198         case "$d_ttyname_r_proto" in
17199         define)
17200         case "$ttyname_r_proto" in
17201         ''|0) try='int ttyname_r(int, char*, size_t);'
17202         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17203         esac
17204         case "$ttyname_r_proto" in
17205         ''|0) try='int ttyname_r(int, char*, int);'
17206         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17207         esac
17208         case "$ttyname_r_proto" in
17209         ''|0) try='char* ttyname_r(int, char*, int);'
17210         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17211         esac
17212         case "$ttyname_r_proto" in
17213         ''|0)   d_ttyname_r=undef
17214                 ttyname_r_proto=0
17215                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17216         * )     case "$ttyname_r_proto" in
17217                 REENTRANT_PROTO*) ;;
17218                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17219                 esac
17220                 echo "Prototype: $try" ;;
17221         esac
17222         ;;
17223         *)      case "$usethreads" in
17224                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17225                 esac
17226                 d_ttyname_r=undef
17227                 ttyname_r_proto=0
17228                 ;;
17229         esac
17230         ;;
17231 *)      ttyname_r_proto=0
17232         ;;
17233 esac
17234
17235 : see if tzname[] exists
17236 echo " "
17237 if set tzname val -a d_tzname; eval $csym; $val; then
17238         val="$define"
17239         echo 'tzname[] found.' >&4
17240 else
17241         val="$undef"
17242         echo 'tzname[] NOT found.' >&4
17243 fi
17244 set d_tzname
17245 eval $setvar
17246
17247 case "$osname" in
17248 next|rhapsody|darwin) multiarch="$define" ;;
17249 esac
17250 case "$multiarch" in
17251 ''|[nN]*) multiarch="$undef" ;;
17252 esac
17253
17254 : check for ordering of bytes in a UV
17255 echo " "
17256 case "$usecrosscompile$multiarch" in
17257 *$define*)
17258         $cat <<EOM
17259 You seem to be either cross-compiling or doing a multiarchitecture build,
17260 skipping the byteorder check.
17261
17262 EOM
17263         byteorder='ffff'
17264         ;;
17265 *)
17266         case "$byteorder" in
17267         '')
17268                 $cat <<'EOM'
17269 In the following, larger digits indicate more significance.  A big-endian
17270 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17271 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17272 machines may have weird orders like 3412.  A Cray will report 87654321,
17273 an Alpha will report 12345678. If the test program works the default is
17274 probably right.
17275 I'm now running the test program...
17276 EOM
17277                 $cat >try.c <<EOCP
17278 #include <stdio.h>
17279 #$i_stdlib I_STDLIB
17280 #ifdef I_STDLIB
17281 #include <stdlib.h>
17282 #endif
17283 #include <sys/types.h>
17284 typedef $uvtype UV;
17285 int main()
17286 {
17287         int i;
17288         union {
17289                 UV l;
17290                 char c[$uvsize];
17291         } u;
17292
17293         if ($uvsize > 4)
17294                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17295         else
17296                 u.l = (UV)0x04030201;
17297         for (i = 0; i < $uvsize; i++)
17298                 printf("%c", u.c[i]+'0');
17299         printf("\n");
17300         exit(0);
17301 }
17302 EOCP
17303                 xxx_prompt=y
17304                 set try
17305                 if eval $compile && ./try > /dev/null; then
17306                         dflt=`$run ./try`
17307                         case "$dflt" in
17308                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17309                                 echo "(The test program ran ok.)"
17310                                 echo "byteorder=$dflt"
17311                                 xxx_prompt=n
17312                         ;;
17313                         ????|????????) echo "(The test program ran ok.)" ;;
17314                         *) echo "(The test program didn't run right for some reason.)" ;;
17315                         esac
17316                 else
17317                         dflt='4321'
17318                         cat <<'EOM'
17319 (I can't seem to compile the test program.  Guessing big-endian...)
17320 EOM
17321                 fi
17322                 case "$xxx_prompt" in
17323                 y)
17324                         rp="What is the order of bytes in $uvtype?"
17325                         . ./myread
17326                         byteorder="$ans"
17327                         ;;
17328                 *)      byteorder=$dflt
17329                         ;;
17330                 esac
17331                 ;;
17332         esac
17333         $rm -f try.c try
17334         ;;
17335 esac
17336
17337
17338 $cat <<EOM
17339
17340 Checking to see whether you can access character data unalignedly...
17341 EOM
17342 case "$d_u32align" in
17343 '')   $cat >try.c <<EOCP
17344 #include <stdio.h>
17345 #$i_stdlib I_STDLIB
17346 #ifdef I_STDLIB
17347 #include <stdlib.h>
17348 #endif
17349 #define U32 $u32type
17350 #define BYTEORDER 0x$byteorder
17351 #define U8 $u8type
17352 #include <signal.h>
17353 #ifdef SIGBUS
17354 $signal_t bletch(s) int s; { exit(4); }
17355 #endif
17356 int main() {
17357 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17358     U8 buf[8];
17359     U32 *up;
17360     int i;
17361
17362     if (sizeof(U32) != 4) {
17363         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17364         exit(1);
17365     }
17366
17367     fflush(stdout);
17368
17369 #ifdef SIGBUS
17370     signal(SIGBUS, bletch);
17371 #endif
17372
17373     buf[0] = 0;
17374     buf[1] = 0;
17375     buf[2] = 0;
17376     buf[3] = 1;
17377     buf[4] = 0;
17378     buf[5] = 0;
17379     buf[6] = 0;
17380     buf[7] = 1;
17381
17382     for (i = 0; i < 4; i++) {
17383         up = (U32*)(buf + i);
17384         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17385                (*up == 1 << (8*(3-i)))  /* little-endian */
17386               )
17387            )
17388         {
17389             printf("read failed (%x)\n", *up);
17390             exit(2);
17391         }
17392     }
17393
17394     /* write test */
17395     for (i = 0; i < 4; i++) {
17396         up = (U32*)(buf + i);
17397         *up = 0xBeef;
17398         if (*up != 0xBeef) {
17399             printf("write failed (%x)\n", *up);
17400             exit(3);
17401         }
17402     }
17403
17404     exit(0);
17405 #else
17406     printf("1\n");
17407     exit(1);
17408 #endif
17409     return 0;
17410 }
17411 EOCP
17412 set try
17413 if eval $compile_ok; then
17414         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17415         $run ./try 2>&1 >/dev/null
17416         case "$?" in
17417         0)      cat >&4 <<EOM
17418 You can access character data pretty unalignedly.
17419 EOM
17420                 d_u32align="$undef"
17421                 ;;
17422         *)      cat >&4 <<EOM
17423 It seems that you must access character data in an aligned manner.
17424 EOM
17425                 d_u32align="$define"
17426                 ;;
17427         esac
17428 else
17429         rp='Can you access character data at unaligned addresses?'
17430         dflt='n'
17431         . ./myread
17432         case "$ans" in
17433         [yY]*)  d_u32align="$undef"  ;;
17434         *)      d_u32align="$define" ;;
17435         esac
17436 fi
17437 $rm -f core core.try.* try.core
17438 ;;
17439 esac
17440
17441 : see if ualarm exists
17442 set ualarm d_ualarm
17443 eval $inlibc
17444
17445 : see if umask exists
17446 set umask d_umask
17447 eval $inlibc
17448
17449 : see if unordered exists
17450 set unordered d_unordered
17451 eval $inlibc
17452
17453 : see if usleep exists
17454 set usleep d_usleep
17455 eval $inlibc
17456
17457 : see if prototype for usleep is available
17458 echo " "
17459 set d_usleepproto usleep $i_unistd unistd.h
17460 eval $hasproto
17461
17462 : see if ustat exists
17463 set ustat d_ustat
17464 eval $inlibc
17465
17466 : backward compatibility for d_hvfork
17467 if test X$d_hvfork != X; then
17468         d_vfork="$d_hvfork"
17469         d_hvfork=''
17470 fi
17471 : see if there is a vfork
17472 val=''
17473 set vfork val
17474 eval $inlibc
17475
17476 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17477 : perl on Solaris 2.x, and probably elsewhere.
17478 case "$val" in
17479 $define)
17480         echo " "
17481         case "$usevfork" in
17482         false) dflt='n';;
17483         *) dflt='y';;
17484         esac
17485         cat <<'EOM'
17486  
17487 Perl can only use a vfork() that doesn't suffer from strict
17488 restrictions on calling functions or modifying global data in
17489 the child.  For example, glibc-2.1 contains such a vfork()
17490 that is unsuitable.  If your system provides a proper fork()
17491 call, chances are that you do NOT want perl to use vfork().
17492
17493 EOM
17494         rp="Do you still want to use vfork()?"
17495         . ./myread
17496         case "$ans" in
17497         y|Y) ;;
17498         *)
17499                 echo "Ok, we won't use vfork()."
17500                 val="$undef"
17501                 ;;
17502         esac
17503         ;;
17504 esac
17505 set d_vfork
17506 eval $setvar
17507 case "$d_vfork" in
17508 $define) usevfork='true';;
17509 *) usevfork='false';;
17510 esac
17511
17512 : see if closedir exists
17513 set closedir d_closedir
17514 eval $inlibc
17515
17516 case "$d_closedir" in
17517 "$define")
17518         echo " "
17519         echo "Checking whether closedir() returns a status..." >&4
17520         cat > try.c <<EOM
17521 #$i_dirent I_DIRENT             /**/
17522 #$i_sysdir I_SYS_DIR            /**/
17523 #$i_sysndir I_SYS_NDIR          /**/
17524 #$i_systypes I_SYS_TYPES        /**/
17525
17526 #if defined(I_SYS_TYPES)
17527 #include <sys/types.h>
17528 #endif
17529 #if defined(I_DIRENT)
17530 #include <dirent.h>
17531 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17532 #include <sys/dir.h>
17533 #endif
17534 #else
17535 #ifdef I_SYS_NDIR
17536 #include <sys/ndir.h>
17537 #else
17538 #ifdef I_SYS_DIR
17539 #ifdef hp9000s500
17540 #include <ndir.h>       /* may be wrong in the future */
17541 #else
17542 #include <sys/dir.h>
17543 #endif
17544 #endif
17545 #endif
17546 #endif 
17547 int main() { return closedir(opendir(".")); }
17548 EOM
17549         set try
17550         if eval $compile_ok; then
17551                 if $run ./try > /dev/null 2>&1 ; then
17552                         echo "Yes, it does."
17553                         val="$undef"
17554                 else
17555                         echo "No, it doesn't."
17556                         val="$define"
17557                 fi
17558         else
17559                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17560                 val="$define"
17561         fi
17562         ;;
17563 *)
17564         val="$undef";
17565         ;;
17566 esac
17567 set d_void_closedir
17568 eval $setvar
17569 $rm -f try try.*
17570 : see if there is a wait4
17571 set wait4 d_wait4
17572 eval $inlibc
17573
17574 : see if waitpid exists
17575 set waitpid d_waitpid
17576 eval $inlibc
17577
17578 : see if wcstombs exists
17579 set wcstombs d_wcstombs
17580 eval $inlibc
17581
17582 : see if wctomb exists
17583 set wctomb d_wctomb
17584 eval $inlibc
17585
17586 : see if writev exists
17587 set writev d_writev
17588 eval $inlibc
17589
17590 : preserve RCS keywords in files with variable substitution, grrr
17591 Date='$Date'
17592 Id='$Id'
17593 Log='$Log'
17594 RCSfile='$RCSfile'
17595 Revision='$Revision'
17596
17597 : check for alignment requirements
17598 echo " "
17599 case "$usecrosscompile$multiarch" in
17600 *$define*)
17601         $cat <<EOM
17602 You seem to be either cross-compiling or doing a multiarchitecture build,
17603 skipping the memory alignment check.
17604
17605 EOM
17606         case "$alignbytes" in
17607         '') alignbytes=8 ;;
17608         esac
17609         ;;
17610 *)
17611         case "$alignbytes" in
17612         '') echo "Checking alignment constraints..." >&4
17613                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17614                         $cat >try.c <<'EOCP'
17615 typedef long double NV;
17616 EOCP
17617                 else
17618                         $cat >try.c <<'EOCP'
17619 typedef double NV;
17620 EOCP
17621                 fi
17622                 $cat >>try.c <<'EOCP'
17623 #include <stdio.h>
17624 struct foobar {
17625         char foo;
17626         NV bar;
17627 } try_algn;
17628 int main()
17629 {
17630     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17631     return(0);
17632 }
17633 EOCP
17634                 set try
17635                 if eval $compile_ok; then
17636                         dflt=`$run ./try`
17637                 else
17638                         dflt='8'
17639                         echo "(I can't seem to compile the test program...)"
17640                 fi
17641                 ;;
17642         *) dflt="$alignbytes"
17643                 ;;
17644         esac
17645         rp="Doubles must be aligned on a how-many-byte boundary?"
17646         . ./myread
17647         alignbytes="$ans"
17648         $rm -f try.c try
17649         ;;
17650 esac
17651
17652
17653 : set the base revision
17654 baserev=5.0
17655
17656 : how do we concatenate cpp tokens here?
17657 echo " "
17658 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17659 $cat >cpp_stuff.c <<'EOCP'
17660 #define RCAT(a,b)a/**/b
17661 #define ACAT(a,b)a ## b
17662 RCAT(Rei,ser)
17663 ACAT(Cir,cus)
17664 EOCP
17665 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17666 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17667         echo "Oh!  Smells like ANSI's been here." >&4
17668         echo "We can catify or stringify, separately or together!"
17669         cpp_stuff=42
17670 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17671         echo "Ah, yes!  The good old days!" >&4
17672         echo "However, in the good old days we don't know how to stringify and"
17673         echo "catify at the same time."
17674         cpp_stuff=1
17675 else
17676         $cat >&4 <<EOM
17677 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17678 You're going to have to edit the values of CAT[2-5] in config.h...
17679 EOM
17680         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17681 fi
17682 $rm -f cpp_stuff.*
17683
17684 : see if this is a db.h system
17685 set db.h i_db
17686 eval $inhdr
17687
17688 case "$i_db" in
17689 $define)
17690         : Check db version.
17691         echo " "
17692         echo "Checking Berkeley DB version ..." >&4
17693         $cat >try.c <<EOCP
17694 #$d_const HASCONST
17695 #ifndef HASCONST
17696 #define const
17697 #endif
17698 #include <sys/types.h>
17699 #include <stdio.h>
17700 #$i_stdlib I_STDLIB
17701 #ifdef I_STDLIB
17702 #include <stdlib.h>
17703 #endif
17704 #include <db.h>
17705 int main(int argc, char *argv[])
17706 {
17707 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17708     int Major, Minor, Patch ;
17709     unsigned long Version ;
17710     (void)db_version(&Major, &Minor, &Patch) ;
17711     if (argc == 2) {
17712         printf("%d %d %d %d %d %d\n",
17713                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17714                Major, Minor, Patch);
17715         exit(0);
17716     }
17717     printf("You have Berkeley DB Version 2 or greater.\n");
17718
17719     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17720                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17721     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17722                 Major, Minor, Patch) ;
17723
17724     /* check that db.h & libdb are compatible */
17725     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17726         printf("db.h and libdb are incompatible.\n") ;
17727         exit(3);        
17728     }
17729
17730     printf("db.h and libdb are compatible.\n") ;
17731
17732     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17733                 + DB_VERSION_PATCH ;
17734
17735     /* needs to be >= 2.3.4 */
17736     if (Version < 2003004) {
17737     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17738         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17739         exit(2);        
17740     }
17741
17742     exit(0);
17743 #else
17744 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17745     if (argc == 2) {
17746         printf("1 0 0\n");
17747         exit(0);
17748     }
17749     printf("You have Berkeley DB Version 1.\n");
17750     exit(0);    /* DB version < 2: the coast is clear. */
17751 #else
17752     exit(1);    /* <db.h> not Berkeley DB? */
17753 #endif
17754 #endif
17755 }
17756 EOCP
17757         set try
17758         if eval $compile_ok && $run ./try; then
17759                 echo 'Looks OK.' >&4
17760                 set `$run ./try 1`
17761                 db_version_major=$1
17762                 db_version_minor=$2
17763                 db_version_patch=$3
17764         else
17765                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17766                 i_db=$undef
17767                 case " $libs " in
17768                 *"-ldb "*)
17769                         : Remove db from list of libraries to use
17770                         echo "Removing unusable -ldb from library list" >&4
17771                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17772                         shift
17773                         libs="$*"
17774                         echo "libs = $libs" >&4
17775                         ;;
17776                 esac
17777         fi
17778         $rm -f try.*
17779         ;;
17780 esac
17781
17782 case "$i_db" in
17783 define)
17784         : Check the return type needed for hash 
17785         echo " "
17786         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17787         $cat >try.c <<EOCP
17788 #$d_const HASCONST
17789 #ifndef HASCONST
17790 #define const
17791 #endif
17792 #include <sys/types.h>
17793 #include <db.h>
17794
17795 #ifndef DB_VERSION_MAJOR
17796 u_int32_t hash_cb (ptr, size)
17797 const void *ptr;
17798 size_t size;
17799 {
17800 }
17801 HASHINFO info;
17802 int main()
17803 {
17804         info.hash = hash_cb;
17805 }
17806 #endif
17807 EOCP
17808         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17809                 if $contains warning try.out >>/dev/null 2>&1 ; then
17810                         db_hashtype='int'
17811                 else
17812                         db_hashtype='u_int32_t'
17813                 fi
17814         else
17815                 : XXX Maybe we should just give up here.
17816                 db_hashtype=u_int32_t
17817                 $cat try.out >&4
17818                 echo "Help:  I can't seem to compile the db test program." >&4
17819                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17820         fi
17821         $rm -f try.*
17822         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17823         ;;
17824 *)      db_hashtype=u_int32_t
17825         ;;
17826 esac
17827 case "$i_db" in
17828 define)
17829         : Check the return type needed for prefix 
17830         echo " "
17831         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17832         cat >try.c <<EOCP
17833 #$d_const HASCONST
17834 #ifndef HASCONST
17835 #define const
17836 #endif
17837 #include <sys/types.h>
17838 #include <db.h>
17839
17840 #ifndef DB_VERSION_MAJOR
17841 size_t prefix_cb (key1, key2)
17842 const DBT *key1;
17843 const DBT *key2;
17844 {
17845 }
17846 BTREEINFO info;
17847 int main()
17848 {
17849         info.prefix = prefix_cb;
17850 }
17851 #endif
17852 EOCP
17853         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17854                 if $contains warning try.out >>/dev/null 2>&1 ; then
17855                         db_prefixtype='int'
17856                 else
17857                         db_prefixtype='size_t'
17858                 fi
17859         else
17860                 db_prefixtype='size_t'
17861                 : XXX Maybe we should just give up here.
17862                 $cat try.out >&4
17863                 echo "Help:  I can't seem to compile the db test program." >&4
17864                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17865         fi
17866         $rm -f try.*
17867         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17868         ;;
17869 *)      db_prefixtype='size_t'
17870         ;;
17871 esac
17872
17873
17874 : How can we generate normalized random numbers ?
17875 echo " "
17876 echo "Looking for a random number function..." >&4
17877 case "$randfunc" in
17878 '')
17879         if set drand48 val -f; eval $csym; $val; then
17880                 dflt="drand48"
17881                 echo "Good, found drand48()." >&4
17882         elif set random val -f; eval $csym; $val; then
17883                 dflt="random"
17884                 echo "OK, found random()." >&4
17885         else
17886                 dflt="rand"
17887                 echo "Yick, looks like I have to use rand()." >&4
17888         fi
17889         echo " "
17890         ;;
17891 *)
17892         dflt="$randfunc"
17893         ;;
17894 esac
17895 cont=true
17896
17897 case "$ccflags" in
17898 *-Dmy_rand=*|*-Dmy_srand=*)
17899         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17900         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17901         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17902         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17903         ;;
17904 esac
17905
17906 while $test "$cont"; do
17907         rp="Use which function to generate random numbers?"
17908         . ./myread
17909         if $test "$ans" = "$dflt"; then
17910                 : null
17911         else
17912                 randbits=''
17913         fi
17914         randfunc="$ans"
17915         if set $ans val -f; eval $csym; $val; then
17916                 cont=''
17917         else
17918                 dflt=y
17919                 rp="I cannot find function $ans. Use that name anyway?"
17920                 . ./myread
17921                 dflt=rand
17922                 case "$ans" in
17923                         [yY]*) cont='';;
17924                 esac
17925         fi
17926         case "$cont" in
17927         '')
17928                 case "$randfunc" in
17929                 drand48)
17930                         drand01="drand48()"
17931                         seedfunc="srand48"
17932                         randbits=48
17933                         randseedtype=long
17934                         ;;
17935                 rand|random)
17936                         case "$randbits" in
17937                         '')
17938 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17939                                 $cat >try.c <<EOCP
17940 #$i_unistd I_UNISTD
17941 #$i_stdlib I_STDLIB
17942 #include <stdio.h>
17943 #ifdef I_UNISTD
17944 #  include <unistd.h>
17945 #endif
17946 #ifdef I_STDLIB
17947 #  include <stdlib.h>
17948 #endif
17949 int main()
17950 {
17951         register int i;
17952         register unsigned long tmp;
17953         register unsigned long max = 0L;
17954
17955         for (i = 1000; i; i--) {
17956                 tmp = (unsigned long) $randfunc();
17957                 if (tmp > max) max = tmp;
17958         }
17959         for (i = 0; max; i++)
17960                 max /= 2;
17961         printf("%d\n",i);
17962 }
17963 EOCP
17964                                 set try
17965                                 if eval $compile_ok; then
17966                                         dflt=`try`
17967                                 else
17968                                         dflt='?'
17969                                         echo "(I can't seem to compile the test program...)"
17970                                 fi
17971                                 ;;
17972                         *)
17973                                 dflt="$randbits"
17974                                 ;;
17975                         esac
17976                         rp="How many bits does your $randfunc() function produce?"
17977                         . ./myread
17978                         randbits="$ans"
17979                         $rm -f try.c try
17980                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17981                         seedfunc="s$randfunc"
17982                         randseedtype=unsigned
17983                         ;;
17984                 *)
17985                         dflt="31"
17986                         rp="How many bits does your $randfunc() function produce?"
17987                         . ./myread
17988                         randbits="$ans"
17989                         seedfunc="s$randfunc"
17990                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17991                         if set $seedfunc val -f; eval $csym; $val; then
17992                                 echo "(Using $seedfunc() to seed random generator)"
17993                         else
17994                                 echo "(Warning: no $seedfunc() to seed random generator)"
17995                                 seedfunc=rand
17996                         fi
17997                         randseedtype=unsigned
17998                         ;;
17999                 esac
18000                 ;;
18001         esac
18002 done
18003
18004 echo " "
18005 echo "Determining whether or not we are on an EBCDIC system..." >&4
18006 $cat >try.c <<'EOM'
18007 int main()
18008 {
18009   if ('M'==0xd4) return 0;
18010   return 1;
18011 }
18012 EOM
18013
18014 val=$undef
18015 set try
18016 if eval $compile_ok; then
18017         if $run ./try; then
18018                 echo "You seem to speak EBCDIC." >&4
18019                 val="$define"
18020         else
18021                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18022         fi
18023 else
18024         echo "I'm unable to compile the test program." >&4
18025         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18026 fi
18027 $rm -f try try.*
18028 set ebcdic
18029 eval $setvar
18030
18031 echo " "
18032 $cat >&4 <<EOM
18033 Checking how to flush all pending stdio output...
18034 EOM
18035 # I only know how to find the first 32 possibly open files on SunOS.
18036 # See also hints/sunos_4_1.sh and util.c  --AD
18037 case "$osname" in
18038 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18039 esac
18040 $cat >>try.c <<EOCP
18041 #include <stdio.h>
18042 #$i_stdlib I_STDLIB
18043 #ifdef I_STDLIB
18044 #include <stdlib.h>
18045 #endif
18046 #$i_unistd I_UNISTD
18047 #ifdef I_UNISTD
18048 # include <unistd.h>
18049 #endif
18050 #$d_sysconf HAS_SYSCONF
18051 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18052 #ifdef HAS_STDIO_STREAM_ARRAY
18053 # define STDIO_STREAM_ARRAY $stdio_stream_array
18054 #endif
18055 int main() {
18056   FILE* p;
18057   unlink("try.out");
18058   p = fopen("try.out", "w");
18059 #ifdef TRY_FPUTC
18060   fputc('x', p);
18061 #else
18062 # ifdef TRY_FPRINTF
18063   fprintf(p, "x");
18064 # endif
18065 #endif
18066 #ifdef TRY_FFLUSH_NULL
18067   fflush(NULL);
18068 #endif
18069 #ifdef TRY_FFLUSH_ALL
18070   {
18071     long open_max = -1;
18072 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18073     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18074 # else
18075 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18076     open_max = sysconf(_SC_OPEN_MAX);
18077 #  else
18078 #   ifdef FOPEN_MAX
18079     open_max = FOPEN_MAX;
18080 #   else
18081 #    ifdef OPEN_MAX
18082     open_max = OPEN_MAX;
18083 #    else
18084 #     ifdef _NFILE
18085     open_max = _NFILE;
18086 #     endif
18087 #    endif
18088 #   endif
18089 #  endif
18090 # endif 
18091 # ifdef HAS_STDIO_STREAM_ARRAY
18092     if (open_max > 0) {
18093       long i;
18094       for (i = 0; i < open_max; i++)
18095             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18096                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18097                 STDIO_STREAM_ARRAY[i]._flag)
18098                 fflush(&STDIO_STREAM_ARRAY[i]);
18099     }   
18100   }
18101 # endif
18102 #endif
18103   _exit(42);
18104 }
18105 EOCP
18106 : first we have to find out how _not_ to flush
18107 $to try.c
18108 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18109     output=''
18110     set try -DTRY_FPUTC
18111     if eval $compile; then
18112             $run ./try 2>/dev/null
18113             code="$?"
18114             $from try.out
18115             if $test ! -s try.out -a "X$code" = X42; then
18116                 output=-DTRY_FPUTC
18117             fi
18118     fi
18119     case "$output" in
18120     '')
18121             set try -DTRY_FPRINTF
18122             if eval $compile; then
18123                     $run ./try 2>/dev/null
18124                     code="$?"
18125                     $from try.out
18126                     if $test ! -s try.out -a "X$code" = X42; then
18127                         output=-DTRY_FPRINTF
18128                     fi
18129             fi
18130         ;;
18131     esac
18132 fi
18133 : check for fflush NULL behaviour
18134 case "$fflushNULL" in
18135 '')     set try -DTRY_FFLUSH_NULL $output
18136         if eval $compile; then
18137                 $run ./try 2>/dev/null
18138                 code="$?"
18139                 $from try.out
18140                 if $test -s try.out -a "X$code" = X42; then
18141                         fflushNULL="`$cat try.out`"
18142                 else
18143                         if $test "X$code" != X42; then
18144                                 $cat >&4 <<EOM
18145 (If this test failed, don't worry, we'll try another method shortly.)
18146 EOM
18147                         fi
18148                 fi
18149         fi
18150         $rm -f core try.core core.try.*
18151         case "$fflushNULL" in
18152         x)      $cat >&4 <<EOM
18153 Your fflush(NULL) works okay for output streams.
18154 Let's see if it clobbers input pipes...
18155 EOM
18156 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18157 # bug that improperly flushes the input end of pipes.  So we avoid the
18158 # autoflush on fork/system/exec support for now. :-(
18159 $cat >tryp.c <<EOCP
18160 #include <stdio.h>
18161 int
18162 main(int argc, char **argv)
18163 {
18164     char buf[1024];
18165     int i;
18166     char *bp = buf;
18167     while (1) {
18168         while ((i = getc(stdin)) != -1
18169                && (*bp++ = i) != '\n'
18170                && bp < &buf[1024])
18171         /* DO NOTHING */ ;
18172         *bp = '\0';
18173         fprintf(stdout, "%s", buf);
18174         fflush(NULL);
18175         if (i == -1)
18176             return 0;
18177         bp = buf;
18178     }
18179 }
18180 EOCP
18181                 fflushNULL="$define"
18182                 set tryp
18183                 if eval $compile; then
18184                     $rm -f tryp.out
18185                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18186                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18187                        $cat >&4 <<EOM
18188 fflush(NULL) seems to behave okay with input streams.
18189 EOM
18190                         fflushNULL="$define"
18191                     else
18192                         $cat >&4 <<EOM
18193 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18194 EOM
18195                         fflushNULL="$undef"
18196                     fi
18197                 fi
18198                 $rm -f core tryp.c tryp.core core.tryp.*
18199                 ;;
18200         '')     $cat >&4 <<EOM
18201 Your fflush(NULL) isn't working (contrary to ANSI C).
18202 EOM
18203                 fflushNULL="$undef"
18204                 ;;
18205         *)      $cat >&4 <<EOM
18206 Cannot figure out whether your fflush(NULL) works or not.
18207 I'm assuming it doesn't (contrary to ANSI C).
18208 EOM
18209                 fflushNULL="$undef"
18210                 ;;
18211         esac
18212         ;;
18213 $define|true|[yY]*)
18214         fflushNULL="$define"
18215         ;;
18216 *)
18217         fflushNULL="$undef"
18218         ;;
18219 esac
18220 : check explicit looping only if NULL did not work, and if the pipe
18221 : bug does not show up on an explicit flush too
18222 case "$fflushNULL" in
18223 "$undef")
18224         $cat >tryp.c <<EOCP
18225 #include <stdio.h>
18226 int
18227 main(int argc, char **argv)
18228 {
18229     char buf[1024];
18230     int i;
18231     char *bp = buf;
18232     while (1) {
18233         while ((i = getc(stdin)) != -1
18234                && (*bp++ = i) != '\n'
18235                && bp < &buf[1024])
18236         /* DO NOTHING */ ;
18237         *bp = '\0';
18238         fprintf(stdout, "%s", buf);
18239         fflush(stdin);
18240         if (i == -1)
18241             return 0;
18242         bp = buf;
18243     }
18244 }
18245 EOCP
18246         set tryp
18247         if eval $compile; then
18248             $rm -f tryp.out
18249             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18250             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18251                $cat >&4 <<EOM
18252 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18253 EOM
18254                 : now check for fflushall behaviour
18255                 case "$fflushall" in
18256                 '')     set try -DTRY_FFLUSH_ALL $output
18257                         if eval $compile; then
18258                                 $cat >&4 <<EOM
18259 (Now testing the other method--but note that this also may fail.)
18260 EOM
18261                                 $run ./try 2>/dev/null
18262                                 code=$?
18263                                 $from try.out
18264                                 if $test -s try.out -a "X$code" = X42; then
18265                                         fflushall="`$cat try.out`"
18266                                 fi
18267                         fi
18268                         $rm -f core try.core core.try.*
18269                         case "$fflushall" in
18270                         x)      $cat >&4 <<EOM
18271 Whew. Flushing explicitly all the stdio streams works.
18272 EOM
18273                                 fflushall="$define"
18274                                 ;;
18275                         '')     $cat >&4 <<EOM
18276 Sigh. Flushing explicitly all the stdio streams doesn't work.
18277 EOM
18278                                 fflushall="$undef"
18279                                 ;;
18280                         *)      $cat >&4 <<EOM
18281 Cannot figure out whether flushing stdio streams explicitly works or not.
18282 I'm assuming it doesn't.
18283 EOM
18284                                 fflushall="$undef"
18285                                 ;;
18286                         esac
18287                         ;;
18288                 "$define"|true|[yY]*)
18289                         fflushall="$define"
18290                         ;;
18291                 *)
18292                         fflushall="$undef"
18293                         ;;
18294                 esac
18295             else
18296                 $cat >&4 <<EOM
18297 All is futile.  Even fflush(stdin) clobbers input pipes!
18298 EOM
18299                 fflushall="$undef"
18300             fi
18301         else
18302             fflushall="$undef"
18303         fi
18304         $rm -f core tryp.c tryp.core core.tryp.*
18305         ;;
18306 *)      fflushall="$undef"
18307         ;;
18308 esac
18309
18310 case "$fflushNULL$fflushall" in
18311 undefundef)
18312         $cat <<EOM
18313 OK, I give up.  I cannot figure out how to flush pending stdio output.
18314 We won't be flushing handles at all before fork/exec/popen.
18315 EOM
18316         ;;
18317 esac
18318 $rm -f try.* try$exe_ext
18319
18320 : Store the full pathname to the ar program for use in the C program
18321 : Respect a hint or command line value for full_ar.
18322 case "$full_ar" in
18323 '') full_ar=$ar ;;
18324 esac
18325
18326 : Store the full pathname to the sed program for use in the C program
18327 full_sed=$sed
18328
18329 : see what type gids are declared as in the kernel
18330 echo " "
18331 echo "Looking for the type for group ids returned by getgid()."
18332 set gid_t gidtype xxx stdio.h sys/types.h
18333 eval $typedef
18334 case "$gidtype" in
18335 xxx)
18336         xxx=`./findhdr sys/user.h`
18337         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18338         case $1 in
18339         unsigned) dflt="$1 $2" ;;
18340         *) dflt="$1" ;;
18341         esac
18342         ;;
18343 *) dflt="$gidtype";;
18344 esac
18345 case "$gidtype" in
18346 gid_t) echo "gid_t found." ;;
18347 *)      rp="What is the type for group ids returned by getgid()?"
18348         . ./myread
18349         gidtype="$ans"
18350         ;;
18351 esac
18352
18353 echo " "
18354 case "$gidtype" in
18355 *_t) zzz="$gidtype"     ;;
18356 *)   zzz="gid"          ;;
18357 esac
18358 echo "Checking the size of $zzz..." >&4 
18359 cat > try.c <<EOCP
18360 #include <sys/types.h>
18361 #include <stdio.h>
18362 #$i_stdlib I_STDLIB
18363 #ifdef I_STDLIB
18364 #include <stdlib.h>
18365 #endif
18366 int main() {
18367     printf("%d\n", (int)sizeof($gidtype));
18368     exit(0);
18369 }
18370 EOCP
18371 set try
18372 if eval $compile_ok; then
18373         yyy=`$run ./try`
18374         case "$yyy" in
18375         '')     gidsize=4
18376                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18377                 ;;
18378         *)      gidsize=$yyy
18379                 echo "Your $zzz is $gidsize bytes long."
18380                 ;;
18381         esac
18382 else
18383         gidsize=4
18384         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18385 fi
18386
18387
18388 echo " "
18389 case "$gidtype" in
18390 *_t) zzz="$gidtype"     ;;
18391 *)   zzz="gid"          ;;
18392 esac
18393 echo "Checking the sign of $zzz..." >&4 
18394 cat > try.c <<EOCP
18395 #include <sys/types.h>
18396 #include <stdio.h>
18397 int main() {
18398         $gidtype foo = -1;
18399         if (foo < 0)
18400                 printf("-1\n");
18401         else
18402                 printf("1\n");
18403 }
18404 EOCP
18405 set try
18406 if eval $compile; then
18407         yyy=`$run ./try`
18408         case "$yyy" in
18409         '')     gidsign=1
18410                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18411                 ;;
18412         *)      gidsign=$yyy
18413                 case "$gidsign" in
18414                  1) echo "Your $zzz is unsigned." ;;
18415                 -1) echo "Your $zzz is signed."   ;;
18416                 esac
18417                 ;;
18418         esac
18419 else
18420         gidsign=1
18421         echo "(I can't compile the test program--guessing unsigned.)" >&4
18422 fi
18423
18424
18425 echo " "
18426
18427 if $test X"$quadtype" != X; then
18428
18429 echo "Checking how to print 64-bit integers..." >&4
18430
18431 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18432         $cat >try.c <<'EOCP'
18433 #include <sys/types.h>
18434 #include <stdio.h>
18435 int main() {
18436   int q = 12345678901;
18437   printf("%ld\n", q);
18438 }
18439 EOCP
18440         set try
18441         if eval $compile; then
18442                 yyy=`$run ./try`
18443                 case "$yyy" in
18444                 12345678901)
18445                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18446                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18447                         echo "We will use %d."
18448                         ;;
18449                 esac
18450         fi
18451 fi
18452
18453 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18454         $cat >try.c <<'EOCP'
18455 #include <sys/types.h>
18456 #include <stdio.h>
18457 int main() {
18458   long q = 12345678901;
18459   printf("%ld\n", q);
18460 }
18461 EOCP
18462         set try
18463         if eval $compile; then
18464                 yyy=`$run ./try`
18465                 case "$yyy" in
18466                 12345678901)
18467                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18468                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18469                         echo "We will use %ld."
18470                         ;;
18471                 esac
18472         fi
18473 fi
18474
18475 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18476         $cat >try.c <<'EOCP'
18477 #include <sys/types.h>
18478 #include <inttypes.h>
18479 #include <stdio.h>
18480 int main() {
18481   int64_t q = 12345678901;
18482   printf("%" PRId64 "\n", q);
18483 }
18484 EOCP
18485         set try
18486         if eval $compile; then
18487                 yyy=`$run ./try`
18488                 case "$yyy" in
18489                 12345678901)
18490                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18491                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18492                         echo "We will use the C9X style."
18493                         ;;
18494                 esac
18495         fi
18496 fi
18497
18498 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18499         $cat >try.c <<EOCP
18500 #include <sys/types.h>
18501 #include <stdio.h>
18502 int main() {
18503   $quadtype q = 12345678901;
18504   printf("%Ld\n", q);
18505 }
18506 EOCP
18507         set try
18508         if eval $compile; then
18509                 yyy=`$run ./try`
18510                 case "$yyy" in
18511                 12345678901)
18512                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18513                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18514                         echo "We will use %Ld."
18515                         ;;
18516                 esac
18517         fi
18518 fi
18519
18520 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18521         $cat >try.c <<'EOCP'
18522 #include <sys/types.h>
18523 #include <stdio.h>
18524 int main() {
18525   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18526   printf("%lld\n", q);
18527 }
18528 EOCP
18529         set try
18530         if eval $compile; then
18531                 yyy=`$run ./try`
18532                 case "$yyy" in
18533                 12345678901)
18534                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18535                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18536                         echo "We will use the %lld style."
18537                         ;;
18538                 esac
18539         fi
18540 fi
18541
18542 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18543         $cat >try.c <<EOCP
18544 #include <sys/types.h>
18545 #include <stdio.h>
18546 int main() {
18547   $quadtype q = 12345678901;
18548   printf("%qd\n", q);
18549 }
18550 EOCP
18551         set try
18552         if eval $compile; then
18553                 yyy=`$run ./try`
18554                 case "$yyy" in
18555                 12345678901)
18556                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18557                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18558                         echo "We will use %qd."
18559                         ;;
18560                 esac
18561         fi
18562 fi
18563
18564 if $test X"$sPRId64" = X; then
18565         echo "Cannot figure out how to print 64-bit integers." >&4
18566 fi
18567
18568 $rm -f try try.*
18569
18570 fi
18571
18572 case "$sPRId64" in
18573 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18574         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18575         ;;
18576 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18577         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18578         ;;
18579 esac
18580
18581
18582 echo " "
18583 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18584
18585 if $test X"$ivsize" = X8; then
18586         ivdformat="$sPRId64"
18587         uvuformat="$sPRIu64"
18588         uvoformat="$sPRIo64"
18589         uvxformat="$sPRIx64"
18590         uvXUformat="$sPRIXU64"
18591 else
18592         if $test X"$ivsize" = X"$longsize"; then
18593                 ivdformat='"ld"'
18594                 uvuformat='"lu"'
18595                 uvoformat='"lo"'
18596                 uvxformat='"lx"'
18597                 uvXUformat='"lX"'
18598         else
18599                 if $test X"$ivsize" = X"$intsize"; then
18600                         ivdformat='"d"'
18601                         uvuformat='"u"'
18602                         uvoformat='"o"'
18603                         uvxformat='"x"'
18604                         uvXUformat='"X"'
18605                 else
18606                         : far out
18607                         if $test X"$ivsize" = X"$shortsize"; then
18608                                 ivdformat='"hd"'
18609                                 uvuformat='"hu"'
18610                                 uvoformat='"ho"'
18611                                 uvxformat='"hx"'
18612                                 uvXUformat='"hX"'
18613                         fi
18614                 fi
18615         fi
18616 fi
18617
18618 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18619         nveformat="$sPRIeldbl"
18620         nvfformat="$sPRIfldbl"
18621         nvgformat="$sPRIgldbl"
18622         nvEUformat="$sPRIEUldbl"
18623         nvFUformat="$sPRIFUldbl"
18624         nvGUformat="$sPRIGUldbl"
18625 else
18626         nveformat='"e"'
18627         nvfformat='"f"'
18628         nvgformat='"g"'
18629         nvEUformat='"E"'
18630         nvFUformat='"F"'
18631         nvGUformat='"G"'
18632 fi
18633
18634 case "$ivdformat" in
18635 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18636     exit 1
18637     ;;
18638 esac
18639
18640
18641 echo " "
18642 $echo "Checking the format string to be used for gids..." >&4
18643
18644 case "$gidsign" in
18645 -1)     if $test X"$gidsize" = X"$ivsize"; then
18646                 gidformat="$ivdformat"
18647         else
18648                 if $test X"$gidsize" = X"$longsize"; then
18649                         gidformat='"ld"'
18650                 else
18651                         if $test X"$gidsize" = X"$intsize"; then
18652                                 gidformat='"d"'
18653                         else
18654                                 if $test X"$gidsize" = X"$shortsize"; then
18655                                         gidformat='"hd"'
18656                                 fi
18657                         fi
18658                 fi
18659         fi
18660         ;;
18661 *)      if $test X"$gidsize" = X"$uvsize"; then
18662                 gidformat="$uvuformat"
18663         else
18664                 if $test X"$gidsize" = X"$longsize"; then
18665                         gidformat='"lu"'
18666                 else
18667                         if $test X"$gidsize" = X"$intsize"; then
18668                                 gidformat='"u"'
18669                         else
18670                                 if $test X"$gidsize" = X"$shortsize"; then
18671                                         gidformat='"hu"'
18672                                 fi
18673                         fi
18674                 fi
18675         fi
18676         ;;
18677 esac
18678
18679 : see if getgroups exists
18680 set getgroups d_getgrps
18681 eval $inlibc
18682
18683 : see if setgroups exists
18684 set setgroups d_setgrps
18685 eval $inlibc
18686
18687
18688 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18689 echo " "
18690 case "$d_getgrps$d_setgrps" in
18691 *define*)
18692         case "$groupstype" in
18693         '') dflt="$gidtype" ;;
18694         *)  dflt="$groupstype" ;;
18695         esac
18696         $cat <<EOM
18697 What type of pointer is the second argument to getgroups() and setgroups()?
18698 Usually this is the same as group ids, $gidtype, but not always.
18699
18700 EOM
18701         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18702         . ./myread
18703         groupstype="$ans"
18704         ;;
18705 *)  groupstype="$gidtype";;
18706 esac
18707
18708 echo " "
18709 echo "Checking if your $make program sets \$(MAKE)..." >&4
18710 case "$make_set_make" in
18711 '')
18712         $sed 's/^X //' > testmake.mak << 'EOF'
18713 Xall:
18714 X       @echo 'maketemp="$(MAKE)"'
18715 EOF
18716         case "`$make -f testmake.mak 2>/dev/null`" in
18717         *maketemp=*) make_set_make='#' ;;
18718         *)      make_set_make="MAKE=$make" ;;
18719         esac
18720         $rm -f testmake.mak
18721         ;;
18722 esac
18723 case "$make_set_make" in
18724 '#') echo "Yup, it does.";;
18725 *) echo "Nope, it doesn't.";;
18726 esac
18727
18728 : see what type is used for mode_t
18729 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18730 set mode_t modetype int stdio.h sys/types.h
18731 eval $typedef_ask
18732
18733 : see if stdarg is available
18734 echo " "
18735 if $test `./findhdr stdarg.h`; then
18736         echo "<stdarg.h> found." >&4
18737         valstd="$define"
18738 else
18739         echo "<stdarg.h> NOT found." >&4
18740         valstd="$undef"
18741 fi
18742
18743 : see if varags is available
18744 echo " "
18745 if $test `./findhdr varargs.h`; then
18746         echo "<varargs.h> found." >&4
18747 else
18748         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18749 fi
18750
18751 : set up the varargs testing programs
18752 $cat > varargs.c <<EOP
18753 #ifdef I_STDARG
18754 #include <stdarg.h>
18755 #endif
18756 #ifdef I_VARARGS
18757 #include <varargs.h>
18758 #endif
18759
18760 #ifdef I_STDARG
18761 int f(char *p, ...)
18762 #else
18763 int f(va_alist)
18764 va_dcl
18765 #endif
18766 {
18767         va_list ap;
18768 #ifndef I_STDARG
18769         char *p;
18770 #endif
18771 #ifdef I_STDARG
18772         va_start(ap,p);
18773 #else
18774         va_start(ap);
18775         p = va_arg(ap, char *);
18776 #endif
18777         va_end(ap);
18778 }
18779 EOP
18780 $cat > varargs <<EOP
18781 $startsh
18782 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18783         echo "true"
18784 else
18785         echo "false"
18786 fi
18787 $rm -f varargs$_o
18788 EOP
18789 chmod +x varargs
18790
18791 : now check which varargs header should be included
18792 echo " "
18793 i_varhdr=''
18794 case "$valstd" in
18795 "$define")
18796         if `./varargs I_STDARG`; then
18797                 val='stdarg.h'
18798         elif `./varargs I_VARARGS`; then
18799                 val='varargs.h'
18800         fi
18801         ;;
18802 *)
18803         if `./varargs I_VARARGS`; then
18804                 val='varargs.h'
18805         fi
18806         ;;
18807 esac
18808 case "$val" in
18809 '')
18810 echo "I could not find the definition for va_dcl... You have problems..." >&4
18811         val="$undef"; set i_stdarg; eval $setvar
18812         val="$undef"; set i_varargs; eval $setvar
18813         ;;
18814 *) 
18815         set i_varhdr
18816         eval $setvar
18817         case "$i_varhdr" in
18818         stdarg.h)
18819                 val="$define"; set i_stdarg; eval $setvar
18820                 val="$undef"; set i_varargs; eval $setvar
18821                 ;;
18822         varargs.h)
18823                 val="$undef"; set i_stdarg; eval $setvar
18824                 val="$define"; set i_varargs; eval $setvar
18825                 ;;
18826         esac
18827         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18828 esac
18829 $rm -f varargs*
18830
18831 : see if we need va_copy
18832 echo " "
18833 case "$i_stdarg" in
18834 "$define")
18835         $cat >try.c <<EOCP
18836 #include <stdarg.h>
18837 #include <stdio.h>
18838 #$i_stdlib I_STDLIB
18839 #ifdef I_STDLIB
18840 #include <stdlib.h>
18841 #endif
18842 #include <signal.h>
18843
18844 int
18845 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18846 {
18847   return vfprintf(f, fmt, *valp);
18848 }
18849  
18850 int    
18851 myvfprintf(FILE *f, const  char *fmt, va_list val)
18852 {
18853   return ivfprintf(f, fmt, &val);
18854 }
18855       
18856 int
18857 myprintf(char *fmt, ...) 
18858 {
18859   va_list val;
18860   va_start(val, fmt);
18861   return myvfprintf(stdout, fmt, val); 
18862 }         
18863
18864 int
18865 main(int ac, char **av)
18866 {
18867   signal(SIGSEGV, exit);
18868
18869   myprintf("%s%cs all right, then\n", "that", '\'');                            
18870   exit(0);      
18871 }
18872 EOCP
18873         set try
18874         if eval $compile && $run ./try 2>&1 >/dev/null; then
18875                 case "`$run ./try`" in
18876                 "that's all right, then")
18877                         okay=yes
18878                         ;;
18879                 esac
18880         fi
18881         case "$okay" in
18882         yes)    echo "It seems that you don't need va_copy()." >&4
18883                 need_va_copy="$undef"
18884                 ;;
18885         *)      echo "It seems that va_copy() or similar will be needed." >&4
18886                 need_va_copy="$define"
18887                 ;;
18888         esac
18889         $rm -f try.* core core.* *.core *.core.*
18890         ;;
18891 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18892         ;;
18893 esac
18894
18895 : see what type is used for size_t
18896 rp="What is the type used for the length parameter for string functions?"
18897 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18898 eval $typedef_ask
18899
18900 : check for type of arguments to gethostbyaddr. 
18901 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18902         case "$d_gethbyaddr" in
18903         $define)
18904                 $cat <<EOM
18905
18906 Checking to see what type of arguments are accepted by gethostbyaddr().
18907 EOM
18908                 hdrs="$define sys/types.h
18909                         $d_socket sys/socket.h 
18910                         $i_niin netinet/in.h 
18911                         $i_netdb netdb.h
18912                         $i_unistd unistd.h"
18913                 : The first arg can 'char *' or 'void *'
18914                 : The second arg is some of integral type
18915                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18916                         for yyy in size_t long int; do
18917                                 case "$netdb_host_type" in
18918                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18919                                         if ./protochk "$try" $hdrs; then
18920                                                 echo "Your system accepts $xxx for the first arg."
18921                                                 echo "...and $yyy for the second arg."
18922                                                 netdb_host_type="$xxx"
18923                                                 netdb_hlen_type="$yyy"
18924                                         fi
18925                                         ;;
18926                                 esac
18927                         done
18928                 done
18929                 : In case none of those worked, prompt the user.
18930                 case "$netdb_host_type" in
18931                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18932                         dflt='char *'
18933                         . ./myread
18934                         netdb_host_type=$ans
18935                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18936                         dflt="$sizetype"
18937                         . ./myread
18938                         netdb_hlen_type=$ans
18939                         ;;
18940                 esac
18941                 ;;
18942         *)      : no gethostbyaddr, so pick harmless defaults
18943                 netdb_host_type='char *'
18944                 netdb_hlen_type="$sizetype"
18945                 ;;
18946         esac
18947         # Remove the "const" if needed. -- but then we'll have a 
18948         # prototype clash!
18949         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18950 fi
18951
18952 : check for type of argument to gethostbyname. 
18953 if test "X$netdb_name_type" = X ; then
18954         case "$d_gethbyname" in
18955         $define)
18956                 $cat <<EOM
18957
18958 Checking to see what type of argument is accepted by gethostbyname().
18959 EOM
18960                 hdrs="$define sys/types.h
18961                         $d_socket sys/socket.h 
18962                         $i_niin netinet/in.h 
18963                         $i_netdb netdb.h
18964                         $i_unistd unistd.h"
18965                 for xxx in "const char *" "char *"; do
18966                         case "$netdb_name_type" in
18967                         '')     try="extern struct hostent *gethostbyname($xxx);"
18968                                 if ./protochk "$try" $hdrs; then
18969                                         echo "Your system accepts $xxx."
18970                                         netdb_name_type="$xxx"
18971                                 fi
18972                                 ;;
18973                         esac
18974                 done
18975                 : In case none of those worked, prompt the user.
18976                 case "$netdb_name_type" in
18977                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18978                         dflt='char *'
18979                         . ./myread
18980                         netdb_name_type=$ans
18981                         ;;
18982                 esac
18983                 ;;
18984         *)      : no gethostbyname, so pick harmless default
18985                 netdb_name_type='char *'
18986                 ;;
18987         esac
18988 fi
18989
18990 : check for type of 1st argument to getnetbyaddr. 
18991 if test "X$netdb_net_type" = X ; then
18992         case "$d_getnbyaddr" in
18993         $define)
18994                 $cat <<EOM
18995
18996 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18997 EOM
18998                 hdrs="$define sys/types.h
18999                         $d_socket sys/socket.h 
19000                         $i_niin netinet/in.h 
19001                         $i_netdb netdb.h
19002                         $i_unistd unistd.h"
19003                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19004                         case "$netdb_net_type" in
19005                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19006                                 if ./protochk "$try" $hdrs; then
19007                                         echo "Your system accepts $xxx."
19008                                         netdb_net_type="$xxx"
19009                                 fi
19010                                 ;;
19011                         esac
19012                 done
19013                 : In case none of those worked, prompt the user.
19014                 case "$netdb_net_type" in
19015                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19016                         dflt='long'
19017                         . ./myread
19018                         netdb_net_type=$ans
19019                         ;;
19020                 esac
19021                 ;;
19022         *)      : no getnetbyaddr, so pick harmless default
19023                 netdb_net_type='long'
19024                 ;;
19025         esac
19026 fi
19027 : locate the preferred pager for this system
19028 fn=f/
19029 case "$pager" in
19030 '')
19031         dflt=''
19032         case "$pg" in
19033         /*) dflt=$pg;;
19034         [a-zA-Z]:/*) dflt=$pg;;
19035         esac
19036         case "$more" in
19037         /*) dflt=$more;;
19038         [a-zA-Z]:/*) dflt=$more;;
19039         esac
19040         case "$less" in
19041         /*) dflt=$less;;
19042         [a-zA-Z]:/*) dflt=$less;;
19043         esac
19044         case "$dflt" in
19045         '') dflt=/usr/ucb/more;;
19046         esac
19047         ;;
19048 *)      dflt="$pager"
19049         : Instruct ./getfile to trust the hinted or previous pager value,
19050         : even if it does not begin with a slash.  For example, on os2,
19051         : pager might be cmd /c more.  See comments in UU/getfile.
19052         fn="f/($pager)"
19053         ;;
19054 esac
19055 echo " "
19056 rp='What pager is used on your system?'
19057 . ./getfile
19058 pager="$ans"
19059
19060 : see what type pids are declared as in the kernel
19061 rp="What is the type of process ids on this system?"
19062 set pid_t pidtype int stdio.h sys/types.h
19063 eval $typedef_ask
19064
19065 : see if ar generates random libraries by itself
19066 echo " "
19067 echo "Checking how to generate random libraries on your machine..." >&4
19068 echo 'int bar1() { return bar2(); }' > bar1.c
19069 echo 'int bar2() { return 2; }' > bar2.c
19070 $cat > foo.c <<EOP
19071 #$i_stdlib I_STDLIB
19072 #ifdef I_STDLIB
19073 #include <stdlib.h>
19074 #endif
19075 int main() { printf("%d\n", bar1()); exit(0); }
19076 EOP
19077 $cc $ccflags -c bar1.c >/dev/null 2>&1
19078 $cc $ccflags -c bar2.c >/dev/null 2>&1
19079 $cc $ccflags -c foo.c >/dev/null 2>&1
19080 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19081 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19082         $run ./foobar >/dev/null 2>&1; then
19083         echo "$ar appears to generate random libraries itself."
19084         orderlib=false
19085         ranlib=":"
19086 elif $ar ts bar$_a >/dev/null 2>&1 &&
19087         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19088         $run ./foobar >/dev/null 2>&1; then
19089                 echo "a table of contents needs to be added with '$ar ts'."
19090                 orderlib=false
19091                 ranlib="$ar ts"
19092 else
19093         case "$ranlib" in
19094         :) ranlib='';;
19095         '')
19096                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19097                 $test -f $ranlib || ranlib=''
19098                 ;;
19099         esac
19100         if $test -n "$ranlib"; then
19101                 echo "your system has '$ranlib'; we'll use that."
19102                 orderlib=false
19103         else
19104                 echo "your system doesn't seem to support random libraries"
19105                 echo "so we'll use lorder and tsort to order the libraries."
19106                 orderlib=true
19107                 ranlib=":"
19108         fi
19109 fi
19110 $rm -f foo* bar* 
19111
19112 : check for type of arguments to select. 
19113 case "$selecttype" in
19114 '') case "$d_select" in
19115         $define)
19116                 echo " "
19117                 $cat <<EOM
19118 Checking to see what type of arguments are accepted by select().
19119 EOM
19120                 hdrs="$define sys/types.h
19121                         $i_systime sys/time.h 
19122                         $i_sysselct sys/select.h
19123                         $d_socket sys/socket.h"
19124                 : The first arg can be int, unsigned, or size_t
19125                 : The last arg may or may not be 'const'
19126                 val=''
19127                 : void pointer has been seen but using that
19128                 : breaks the selectminbits test
19129                 for xxx in 'fd_set *' 'int *'; do
19130                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19131                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19132                                         case "$val" in
19133                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19134                                                 if ./protochk "$try" $hdrs; then
19135                                                         echo "Your system accepts $xxx."
19136                                                         val="$xxx"
19137                                                 fi
19138                                                 ;;
19139                                         esac
19140                                 done
19141                         done
19142                 done
19143                 case "$val" in
19144                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19145                         case "$d_fd_set" in
19146                                 $define) dflt="fd_set *" ;;
19147                                 *)              dflt="int *" ;;
19148                         esac
19149                         . ./myread
19150                         val=$ans
19151                         ;;
19152                 esac
19153                 selecttype="$val"
19154                 ;;
19155         *)      : no select, so pick a harmless default
19156                 selecttype='int *'
19157                 ;;
19158         esac
19159         ;;
19160 esac
19161
19162 : check for the select 'width'
19163 case "$selectminbits" in
19164 '') safebits=`expr $ptrsize \* 8`
19165     case "$d_select" in
19166         $define)
19167                 $cat <<EOM
19168
19169 Checking to see on how many bits at a time your select() operates...
19170 EOM
19171                 $cat >try.c <<EOCP
19172 #include <sys/types.h>
19173 #$i_time I_TIME
19174 #$i_systime I_SYS_TIME
19175 #$i_systimek I_SYS_TIME_KERNEL
19176 #ifdef I_TIME
19177 #   include <time.h>
19178 #endif
19179 #ifdef I_SYS_TIME
19180 #   ifdef I_SYS_TIME_KERNEL
19181 #       define KERNEL
19182 #   endif
19183 #   include <sys/time.h>
19184 #   ifdef I_SYS_TIME_KERNEL
19185 #       undef KERNEL
19186 #   endif
19187 #endif
19188 #$i_sysselct I_SYS_SELECT
19189 #ifdef I_SYS_SELECT
19190 #include <sys/select.h>
19191 #endif
19192 #$d_socket HAS_SOCKET
19193 #ifdef HAS_SOCKET
19194 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19195 #endif
19196 #include <stdio.h>
19197 #$i_stdlib I_STDLIB
19198 #ifdef I_STDLIB
19199 #include <stdlib.h>
19200 #endif
19201 $selecttype b;
19202 #define S sizeof(*(b))
19203 #define MINBITS 64
19204 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19205 #define NBITS  (NBYTES * 8)
19206 int main() {
19207     char *s = malloc(NBYTES);
19208     struct timeval t;
19209     int i;
19210     FILE* fp;
19211     int fd;
19212
19213     if (!s)
19214         exit(1);
19215     fclose(stdin);
19216     fp = fopen("try.c", "r");
19217     if (fp == 0)
19218       exit(2);
19219     fd = fileno(fp);
19220     if (fd < 0)
19221       exit(3);
19222     b = ($selecttype)s;
19223     for (i = 0; i < NBITS; i++)
19224         FD_SET(i, b);
19225     t.tv_sec  = 0;
19226     t.tv_usec = 0;
19227     select(fd + 1, b, 0, 0, &t);
19228     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19229     free(s);
19230     printf("%d\n", i + 1);
19231     return 0;
19232 }
19233 EOCP
19234                 set try
19235                 if eval $compile_ok; then
19236                         selectminbits=`$run ./try`
19237                         case "$selectminbits" in
19238                         '')     cat >&4 <<EOM
19239 Cannot figure out on how many bits at a time your select() operates.
19240 I'll play safe and guess it is $safebits bits.
19241 EOM
19242                                 selectminbits=$safebits
19243                                 bits="$safebits bits"
19244                                 ;;
19245                         1)      bits="1 bit" ;;
19246                         *)      bits="$selectminbits bits" ;;
19247                         esac
19248                         echo "Your select() operates on $bits at a time." >&4
19249                 else
19250                         rp='What is the minimum number of bits your select() operates on?'
19251                         case "$byteorder" in
19252                         12345678)       dflt=64 ;;
19253                         1234)           dflt=32 ;;
19254                         *)              dflt=1  ;;
19255                         esac
19256                         . ./myread
19257                         val=$ans
19258                         selectminbits="$val"
19259                 fi
19260                 $rm -f try.* try
19261                 ;;
19262         *)      : no select, so pick a harmless default
19263                 selectminbits=$safebits
19264                 ;;
19265         esac
19266         ;;
19267 esac
19268
19269 : Trace out the files included by signal.h, then look for SIGxxx names.
19270 : Remove SIGARRAYSIZE used by HPUX.
19271 : Remove SIGSTKSIZE used by Linux.
19272 : Remove SIGSTKSZ used by Posix.
19273 : Remove SIGTYP void lines used by OS2.
19274 : Some cpps, like os390, dont give the file name anywhere
19275 if [ "X$fieldn" = X ]; then
19276         : Just make some guesses.  We check them later.
19277         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19278 else
19279         xxx=`echo '#include <signal.h>' |
19280         $cppstdin $cppminus $cppflags 2>/dev/null |
19281         $grep '^[       ]*#.*include' | 
19282         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19283 fi
19284 : Check this list of files to be sure we have parsed the cpp output ok.
19285 : This will also avoid potentially non-existent files, such 
19286 : as ../foo/bar.h
19287 xxxfiles=''
19288 for xx in $xxx /dev/null ; do
19289         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19290 done
19291 : If we have found no files, at least try signal.h
19292 case "$xxxfiles" in
19293 '')     xxxfiles=`./findhdr signal.h` ;;
19294 esac
19295 xxx=`awk '
19296 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19297         print substr($2, 4, 20)
19298 }
19299 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19300         print substr($3, 4, 20)
19301 }' $xxxfiles`
19302 : Append some common names just in case the awk scan failed.
19303 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19304 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19305 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19306 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19307 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19308
19309 : generate a few handy files for later
19310 $cat > signal.c <<EOCP
19311 #include <sys/types.h>
19312 #include <signal.h>
19313 #$i_stdlib I_STDLIB
19314 #ifdef I_STDLIB
19315 #include <stdlib.h>
19316 #endif
19317 #include <stdio.h>
19318 int main() {
19319
19320 /* Strange style to avoid deeply-nested #if/#else/#endif */
19321 #ifndef NSIG
19322 #  ifdef _NSIG
19323 #    define NSIG (_NSIG)
19324 #  endif
19325 #endif
19326
19327 #ifndef NSIG
19328 #  ifdef SIGMAX
19329 #    define NSIG (SIGMAX+1)
19330 #  endif
19331 #endif
19332
19333 #ifndef NSIG
19334 #  ifdef SIG_MAX
19335 #    define NSIG (SIG_MAX+1)
19336 #  endif
19337 #endif
19338
19339 #ifndef NSIG
19340 #  ifdef _SIG_MAX
19341 #    define NSIG (_SIG_MAX+1)
19342 #  endif
19343 #endif
19344
19345 #ifndef NSIG
19346 #  ifdef MAXSIG
19347 #    define NSIG (MAXSIG+1)
19348 #  endif
19349 #endif
19350
19351 #ifndef NSIG
19352 #  ifdef MAX_SIG
19353 #    define NSIG (MAX_SIG+1)
19354 #  endif
19355 #endif
19356
19357 #ifndef NSIG
19358 #  ifdef SIGARRAYSIZE
19359 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19360 #  endif
19361 #endif
19362
19363 #ifndef NSIG
19364 #  ifdef _sys_nsig
19365 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19366 #  endif
19367 #endif
19368
19369 /* Default to some arbitrary number that's big enough to get most
19370    of the common signals.
19371 */
19372 #ifndef NSIG
19373 #    define NSIG 50
19374 #endif
19375
19376 printf("NSIG %d\n", NSIG);
19377
19378 #ifndef JUST_NSIG
19379
19380 EOCP
19381
19382 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19383 {
19384         printf "#ifdef SIG"; printf $1; printf "\n"
19385         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19386         printf $1; printf ");\n"
19387         printf "#endif\n"
19388 }
19389 END {
19390         printf "#endif /* JUST_NSIG */\n";
19391         printf "exit(0);\n}\n";
19392 }
19393 ' >>signal.c
19394 $cat >signal.awk <<'EOP'
19395 BEGIN { ndups = 0 }
19396 $1 ~ /^NSIG$/ { nsig = $2 }
19397 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19398     if ($2 > maxsig) { maxsig = $2 }
19399     if (sig_name[$2]) {
19400         dup_name[ndups] = $1
19401         dup_num[ndups] = $2
19402         ndups++ 
19403     }
19404     else {
19405         sig_name[$2] = $1
19406         sig_num[$2] = $2
19407     }
19408 }
19409 END { 
19410     if (nsig == 0) {
19411         nsig = maxsig + 1
19412     }
19413     printf("NSIG %d\n", nsig);
19414     for (n = 1; n < nsig; n++) {
19415         if (sig_name[n]) {
19416             printf("%s %d\n", sig_name[n], sig_num[n])
19417         }
19418         else {
19419             printf("NUM%d %d\n", n, n) 
19420         }
19421     }
19422     for (n = 0; n < ndups; n++) {
19423         printf("%s %d\n", dup_name[n], dup_num[n])
19424     }
19425 }
19426 EOP
19427 $cat >signal_cmd <<EOS
19428 $startsh
19429 if $test -s signal.lst; then
19430     echo "Using your existing signal.lst file"
19431         exit 0
19432 fi
19433 xxx="$xxx"
19434 EOS
19435 $cat >>signal_cmd <<'EOS'
19436
19437 set signal
19438 if eval $compile_ok; then
19439         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19440 else
19441         echo "(I can't seem be able to compile the whole test program)" >&4
19442         echo "(I'll try it in little pieces.)" >&4
19443         set signal -DJUST_NSIG
19444         if eval $compile_ok; then
19445                 $run ./signal$_exe > signal.nsg
19446                 $cat signal.nsg
19447         else
19448                 echo "I can't seem to figure out how many signals you have." >&4
19449                 echo "Guessing 50." >&4
19450                 echo 'NSIG 50' > signal.nsg
19451         fi
19452         : Now look at all the signal names, one at a time.
19453         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19454                 $cat > signal.c <<EOCP
19455 #include <sys/types.h>
19456 #include <signal.h>
19457 #include <stdio.h>
19458 int main() {
19459 printf("$xx %d\n", SIG${xx});
19460 return 0;
19461 }
19462 EOCP
19463                 set signal
19464                 if eval $compile; then
19465                         echo "SIG${xx} found."
19466                         $run ./signal$_exe  >> signal.ls1
19467                 else
19468                         echo "SIG${xx} NOT found."
19469                 fi
19470         done
19471         if $test -s signal.ls1; then
19472                 $cat signal.nsg signal.ls1 |
19473                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19474         fi
19475
19476 fi
19477 if $test -s signal.lst; then
19478         :
19479 else
19480         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19481         echo 'kill -l' >signal
19482         set X `csh -f <signal`
19483         $rm -f signal
19484         shift
19485         case $# in
19486         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19487         esac
19488         echo $@ | $tr ' ' $trnl | \
19489             $awk '{ printf "%s %d\n", $1, ++s; }
19490                   END { printf "NSIG %d\n", ++s }' >signal.lst
19491 fi
19492 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19493 EOS
19494 chmod a+x signal_cmd
19495 $eunicefix signal_cmd
19496
19497 : generate list of signal names
19498 echo " "
19499 case "$sig_name_init" in
19500 '') doinit=yes ;;
19501 *)  case "$sig_num_init" in
19502     ''|*,*) doinit=yes ;;
19503     esac ;;
19504 esac
19505 case "$doinit" in
19506 yes)
19507         echo "Generating a list of signal names and numbers..." >&4
19508         . ./signal_cmd
19509         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19510         sig_name=`$awk 'BEGIN { printf "ZERO " }
19511                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19512         sig_num=`$awk  'BEGIN { printf "0 " }
19513                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19514         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19515                              !/^NSIG/   { printf "\"%s\", ", $1 }
19516                              END        { printf "0\n" }' signal.lst`
19517         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19518                              !/^NSIG/   { printf "%d, ", $2}
19519                              END        { printf "0\n"}' signal.lst`
19520         ;;
19521 esac
19522 echo "The following $sig_count signals are available:"
19523 echo " "
19524 echo $sig_name | $awk \
19525 'BEGIN { linelen = 0 }
19526 {
19527         for (i = 1; i <= NF; i++) {
19528                 name = "SIG" $i " "
19529                 linelen = linelen + length(name)
19530                 if (linelen > 70) {
19531                         printf "\n"
19532                         linelen = length(name)
19533                 }
19534                 printf "%s", name
19535         }
19536         printf "\n"
19537 }'
19538 sig_size=`echo $sig_name | awk '{print NF}'`
19539 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19540
19541 echo " "
19542 case "$sizetype" in
19543 *_t) zzz="$sizetype"    ;;
19544 *)   zzz="filesize"     ;;
19545 esac
19546 echo "Checking the size of $zzz..." >&4 
19547 cat > try.c <<EOCP
19548 #include <sys/types.h>
19549 #include <stdio.h>
19550 #$i_stdlib I_STDLIB
19551 #ifdef I_STDLIB
19552 #include <stdlib.h>
19553 #endif
19554 int main() {
19555     printf("%d\n", (int)sizeof($sizetype));
19556     exit(0);
19557 }
19558 EOCP
19559 set try
19560 if eval $compile_ok; then
19561         yyy=`$run ./try`
19562         case "$yyy" in
19563         '')     sizesize=4
19564                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19565                 ;;
19566         *)      sizesize=$yyy
19567                 echo "Your $zzz size is $sizesize bytes."
19568                 ;;
19569         esac
19570 else
19571         sizesize=4
19572         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19573 fi
19574
19575
19576 : check for socklen_t
19577 echo " "
19578 echo "Checking to see if you have socklen_t..." >&4
19579 $cat >try.c <<EOCP
19580 #include <sys/types.h>
19581 #$d_socket HAS_SOCKET
19582 #ifdef HAS_SOCKET
19583 #include <sys/socket.h>
19584 #endif
19585 int main() { socklen_t x = 16; }
19586 EOCP
19587 set try
19588 if eval $compile; then
19589         val="$define"
19590         echo "You have socklen_t."
19591 else
19592         val="$undef"
19593         echo "You do not have socklen_t."
19594         case "$sizetype" in
19595         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19596         esac
19597 fi
19598 $rm -f try try.*
19599 set d_socklen_t
19600 eval $setvar
19601
19602 : see if this is a socks.h system
19603 set socks.h i_socks
19604 eval $inhdr
19605
19606 : check for type of the size argument to socket calls
19607 case "$d_socket" in
19608 "$define")
19609         $cat <<EOM
19610
19611 Checking to see what type is the last argument of accept().
19612 EOM
19613         yyy=''
19614         case "$d_socklen_t" in
19615         "$define") yyy="$yyy socklen_t"
19616         esac
19617         yyy="$yyy $sizetype int long unsigned"
19618         for xxx in $yyy; do
19619                 case "$socksizetype" in
19620                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19621                         case "$usesocks" in
19622                         "$define")
19623                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19624                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19625                                         socksizetype="$xxx"
19626                                 fi
19627                                 ;;
19628                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19629                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19630                                         socksizetype="$xxx"
19631                                 fi
19632                                 ;;
19633                         esac
19634                         ;;
19635                 esac
19636         done
19637 : In case none of those worked, prompt the user.
19638         case "$socksizetype" in
19639         '')     rp='What is the type for socket address structure sizes?'
19640                 dflt='int'
19641                 . ./myread
19642                 socksizetype=$ans
19643                 ;;
19644         esac
19645         ;;
19646 *)      : no sockets, so pick relatively harmless default
19647         socksizetype='int'
19648         ;;
19649 esac
19650
19651 : see what type is used for signed size_t
19652 set ssize_t ssizetype int stdio.h sys/types.h
19653 eval $typedef
19654 dflt="$ssizetype"
19655 $cat > try.c <<EOM
19656 #include <stdio.h>
19657 #$i_stdlib I_STDLIB
19658 #ifdef I_STDLIB
19659 #include <stdlib.h>
19660 #endif
19661 #include <sys/types.h>
19662 #define Size_t $sizetype
19663 #define SSize_t $dflt
19664 int main()
19665 {
19666         if (sizeof(Size_t) == sizeof(SSize_t))
19667                 printf("$dflt\n");
19668         else if (sizeof(Size_t) == sizeof(int))
19669                 printf("int\n");
19670         else 
19671                 printf("long\n");
19672         exit(0);
19673 }
19674 EOM
19675 echo " "
19676 set try
19677 if eval $compile_ok && $run ./try > /dev/null; then
19678         ssizetype=`$run ./try`
19679         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19680 else
19681         $cat >&4 <<EOM
19682 Help! I can't compile and run the ssize_t test program: please enlighten me!
19683 (This is probably a misconfiguration in your system or libraries, and
19684 you really ought to fix it.  Still, I'll try anyway.)
19685
19686 I need a type that is the same size as $sizetype, but is guaranteed to
19687 be signed.  Common values are ssize_t, int and long.
19688
19689 EOM
19690         rp="What signed type is the same size as $sizetype?"
19691         . ./myread
19692         ssizetype="$ans"
19693 fi
19694 $rm -f try try.*
19695
19696 : see what type of char stdio uses.
19697 echo " "
19698 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19699 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19700         echo "Your stdio uses unsigned chars." >&4
19701         stdchar="unsigned char"
19702 else
19703         echo "Your stdio uses signed chars." >&4
19704         stdchar="char"
19705 fi
19706 $rm -f stdioh
19707
19708
19709
19710 : see what type uids are declared as in the kernel
19711 echo " "
19712 echo "Looking for the type for user ids returned by getuid()."
19713 set uid_t uidtype xxx stdio.h sys/types.h
19714 eval $typedef
19715 case "$uidtype" in
19716 xxx)
19717         xxx=`./findhdr sys/user.h`
19718         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19719         case $1 in
19720         unsigned) dflt="$1 $2" ;;
19721         *) dflt="$1" ;;
19722         esac
19723         ;;
19724 *) dflt="$uidtype";;
19725 esac
19726 case "$uidtype" in
19727 uid_t)  echo "uid_t found." ;;
19728 *)      rp="What is the type for user ids returned by getuid()?"
19729         . ./myread
19730         uidtype="$ans"
19731         ;;
19732 esac
19733
19734 echo " "
19735 case "$uidtype" in
19736 *_t) zzz="$uidtype"     ;;
19737 *)   zzz="uid"          ;;
19738 esac
19739 echo "Checking the size of $zzz..." >&4 
19740 cat > try.c <<EOCP
19741 #include <sys/types.h>
19742 #include <stdio.h>
19743 #$i_stdlib I_STDLIB
19744 #ifdef I_STDLIB
19745 #include <stdlib.h>
19746 #endif
19747 int main() {
19748     printf("%d\n", (int)sizeof($uidtype));
19749     exit(0);
19750 }
19751 EOCP
19752 set try
19753 if eval $compile_ok; then
19754         yyy=`$run ./try`
19755         case "$yyy" in
19756         '')     uidsize=4
19757                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19758                 ;;
19759         *)      uidsize=$yyy
19760                 echo "Your $zzz is $uidsize bytes long."
19761                 ;;
19762         esac
19763 else
19764         uidsize=4
19765         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19766 fi
19767
19768 echo " "
19769 case "$uidtype" in
19770 *_t) zzz="$uidtype"     ;;
19771 *)   zzz="uid"          ;;
19772 esac
19773 echo "Checking the sign of $zzz..." >&4
19774 cat > try.c <<EOCP
19775 #include <sys/types.h>
19776 #include <stdio.h>
19777 int main() {
19778         $uidtype foo = -1;
19779         if (foo < 0)
19780                 printf("-1\n");
19781         else
19782                 printf("1\n");
19783 }
19784 EOCP
19785 set try
19786 if eval $compile; then
19787         yyy=`$run ./try`
19788         case "$yyy" in
19789         '')     uidsign=1
19790                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19791                 ;;
19792         *)      uidsign=$yyy
19793                 case "$uidsign" in
19794                  1) echo "Your $zzz is unsigned." ;;
19795                 -1) echo "Your $zzz is signed."   ;;
19796                 esac
19797                 ;;
19798         esac
19799 else
19800         uidsign=1
19801         echo "(I can't compile the test program--guessing unsigned.)" >&4
19802 fi
19803
19804
19805
19806 echo " "
19807 $echo "Checking the format string to be used for uids..." >&4
19808
19809 case "$uidsign" in
19810 -1)     if $test X"$uidsize" = X"$ivsize"; then
19811                 uidformat="$ivdformat"
19812         else
19813                 if $test X"$uidsize" = X"$longsize"; then
19814                         uidformat='"ld"'
19815                 else
19816                         if $test X"$uidsize" = X"$intsize"; then
19817                                 uidformat='"d"'
19818                         else
19819                                 if $test X"$uidsize" = X"$shortsize"; then
19820                                         uidformat='"hd"'
19821                                 fi
19822                         fi
19823                 fi
19824         fi
19825         ;;
19826 *)      if $test X"$uidsize" = X"$uvsize"; then
19827                 uidformat="$uvuformat"
19828         else
19829                 if $test X"$uidsize" = X"$longsize"; then
19830                         uidformat='"lu"'
19831                 else
19832                         if $test X"$uidsize" = X"$intsize"; then
19833                                 uidformat='"u"'
19834                         else
19835                                 if $test X"$uidsize" = X"$shortsize"; then
19836                                         uidformat='"hu"'
19837                                 fi
19838                         fi
19839                 fi
19840         fi
19841         ;;
19842 esac
19843
19844
19845 case "$usesitecustomize" in
19846     $define|true|[Yy]*)
19847         usesitecustomize="$define"
19848         ;;
19849     *)
19850         usesitecustomize="$undef"
19851         ;;
19852     esac
19853
19854 : determine compiler compiler
19855 case "$yacc" in
19856 '')
19857         dflt=yacc;;
19858 *)
19859         dflt="$yacc";;
19860 esac
19861 echo " "
19862 comp='yacc'
19863 if $test -f "$byacc$_exe"; then
19864         dflt="$byacc"
19865         comp="byacc or $comp"
19866 fi
19867 if $test -f "$bison$_exe"; then
19868         comp="$comp or bison -y"
19869 fi
19870 rp="Which compiler compiler ($comp) shall I use?"
19871 . ./myread
19872 yacc="$ans"
19873 case "$yacc" in
19874 *bis*)
19875         case "$yacc" in
19876         *-y*) ;;
19877         *)
19878                 yacc="$yacc -y"
19879                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19880                 ;;
19881         esac
19882         ;;
19883 esac
19884
19885 : see if this is a fp.h system
19886 set fp.h i_fp
19887 eval $inhdr
19888
19889 : see if this is a fp_class.h system
19890 set fp_class.h i_fp_class
19891 eval $inhdr
19892
19893 : see if this is a ieeefp.h system
19894 case "$i_ieeefp" in
19895 '' ) set ieeefp.h i_ieeefp
19896      eval $inhdr
19897      ;;
19898 esac
19899
19900 : see if this is a libutil.h system
19901 set libutil.h i_libutil
19902 eval $inhdr
19903
19904 : see if mach cthreads are available
19905 if test "X$usethreads" = "X$define"; then
19906         set mach/cthreads.h i_machcthr
19907         eval $inhdr
19908 else
19909         i_machcthr="$undef"
19910 fi
19911
19912
19913
19914 : see if this is a mntent.h system
19915 set mntent.h i_mntent
19916 eval $inhdr
19917
19918 : see if ndbm.h is available
19919 set ndbm.h t_ndbm
19920 eval $inhdr
19921
19922 case "$t_ndbm" in
19923 $undef)
19924     # Some Linux distributions such as RedHat 7.1 put the
19925     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19926     if $test -f /usr/include/gdbm/ndbm.h; then
19927         echo '<gdbm/ndbm.h> found.'
19928         ccflags="$ccflags -I/usr/include/gdbm"
19929         cppflags="$cppflags -I/usr/include/gdbm"
19930         t_ndbm=$define
19931     fi
19932     ;;
19933 esac
19934
19935 case "$t_ndbm" in
19936 $define)
19937         : see if dbm_open exists
19938         set dbm_open d_dbm_open
19939         eval $inlibc
19940         case "$d_dbm_open" in
19941         $undef)
19942                 t_ndbm="$undef"
19943                 echo "We won't be including <ndbm.h>"
19944                 ;;
19945         esac
19946         ;;
19947 esac
19948 val="$t_ndbm"
19949 set i_ndbm
19950 eval $setvar
19951
19952 : see if net/errno.h is available
19953 val=''
19954 set net/errno.h val
19955 eval $inhdr
19956
19957 : Unfortunately, it causes problems on some systems.  Arrgh.
19958 case "$val" in
19959 $define)
19960         cat > try.c <<'EOM'
19961 #include <stdio.h>
19962 #include <errno.h>
19963 #include <net/errno.h>
19964 int func()
19965 {
19966         return ENOTSOCK;
19967 }
19968 EOM
19969         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19970                 echo "We'll be including <net/errno.h>." >&4
19971         else
19972                 echo "We won't be including <net/errno.h>." >&4
19973                 val="$undef"
19974         fi
19975         $rm -f try.* try
19976         ;;
19977 esac
19978 set i_neterrno
19979 eval $setvar
19980
19981 : see if netinet/tcp.h is available
19982 set netinet/tcp.h i_netinettcp
19983 eval $inhdr
19984
19985 : see if this is a poll.h system
19986 set poll.h i_poll
19987 eval $inhdr
19988
19989 : see if this is a prot.h system
19990 set prot.h i_prot
19991 eval $inhdr
19992
19993 echo " "
19994 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19995 $cat <<'EOSH' > Cppsym.know
19996 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19997 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19998 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19999 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20000 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20001 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20002 bull c cadmus clipper CMU COFF COMPILER_VERSION
20003 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20004 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20005 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20006 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20007 GLIBC GLIBC_MINOR
20008 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20009 H3050R H3050RX hbullx20 hcx host_mips
20010 hp200 hp300 hp700 HP700 hp800 hp9000
20011 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20012 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20013 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20014 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20015 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20016 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20017 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20018 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20019 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20020 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20021 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20022 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20023 MATH_HAS_NO_SIDE_EFFECTS
20024 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20025 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20026 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20027 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20028 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20029 NetBSD news1500 news1700 news1800 news1900 news3700
20030 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20031 ns32016 ns32332 ns32k nsc32000
20032 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20033 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20034 pc532 pdp11 PGC PIC plexus PORTAR posix
20035 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20036 POSIX_C_SOURCE POSIX_SOURCE POWER
20037 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20038 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20039 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20040 sony sony_news sonyrisc sparc sparclite spectrum
20041 stardent stdc STDC_EXT stratos sun sun3 sun386
20042 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20043 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20044 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20045 sysV68 sysV88 Tek4132 Tek4300 titan
20046 TM3200 TM5400 TM5600
20047 tower tower32 tower32_200 tower32_600 tower32_700
20048 tower32_800 tower32_850 tss
20049 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20050 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20051 unix UNIX95 UNIX99 unixpc unos
20052 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20053 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20054 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20055 USGr4 USGr4_2
20056 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
20057 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20058 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20059 z8000
20060 EOSH
20061 # Maybe put other stuff here too.
20062 cat <<EOSH >>Cppsym.know
20063 $osname
20064 EOSH
20065 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20066 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20067 $cat Cppsym.know > Cppsym.c
20068 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20069 $rm -f Cppsym.a Cppsym.b Cppsym.c
20070 cat <<EOSH > Cppsym
20071 $startsh
20072 if $test \$# -gt 0; then
20073     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20074     if $test -s Cppsym.got; then
20075         $rm -f Cppsym.got
20076         exit 0
20077     fi
20078     $rm -f Cppsym.got
20079     exit 1
20080 else
20081     $tr " " "$trnl" | ./Cppsym.try
20082     exit 0
20083 fi
20084 EOSH
20085 chmod +x Cppsym
20086 $eunicefix Cppsym
20087 cat <<EOSH > Cppsym.try
20088 $startsh
20089 cat <<'EOCP' > try.c
20090 #include <stdio.h>
20091 int main() {
20092 EOCP
20093 $awk \\
20094 EOSH
20095 cat <<'EOSH' >> Cppsym.try
20096 'length($1) > 0 {
20097     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
20098     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
20099     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
20100     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
20101 }'       >> try.c
20102 echo 'return 0;}' >> try.c
20103 EOSH
20104 cat <<EOSH >> Cppsym.try
20105 ccflags="$ccflags"
20106 case "$osname-$gccversion" in
20107 irix-) ccflags="\$ccflags -woff 1178" ;;
20108 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20109 esac
20110 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
20111 EOSH
20112 chmod +x Cppsym.try
20113 $eunicefix Cppsym.try
20114 ./Cppsym < Cppsym.know > Cppsym.true
20115 : now check the C compiler for additional symbols
20116 postprocess_cc_v=''
20117 case "$osname" in
20118 aix) postprocess_cc_v="|$tr , ' '" ;;
20119 esac
20120 $cat >ccsym <<EOS
20121 $startsh
20122 $cat >tmp.c <<EOF
20123 extern int foo;
20124 EOF
20125 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20126 do
20127         case "\$i" in
20128         -D*) echo "\$i" | $sed 's/^-D//';;
20129         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20130         esac
20131 done
20132 $rm -f try.c
20133 EOS
20134 postprocess_cc_v=''
20135 chmod +x ccsym
20136 $eunicefix ccsym
20137 ./ccsym > ccsym1.raw
20138 if $test -s ccsym1.raw; then
20139        $sort ccsym1.raw | $uniq >ccsym.raw
20140 else
20141        mv ccsym1.raw ccsym.raw
20142 fi
20143
20144 $awk '/\=/ { print $0; next }
20145         { print $0"=1" }' ccsym.raw >ccsym.list
20146 $awk '/\=/ { print $0; next }
20147         { print $0"=1" }' Cppsym.true >ccsym.true
20148 $comm -13 ccsym.true ccsym.list >ccsym.own
20149 $comm -12 ccsym.true ccsym.list >ccsym.com
20150 $comm -23 ccsym.true ccsym.list >ccsym.cpp
20151 also=''
20152 if $test -z ccsym.raw; then
20153         echo "Your C compiler doesn't seem to define any symbols!" >&4
20154         echo " "
20155         echo "However, your C preprocessor defines the following symbols:"
20156         $cat Cppsym.true
20157         ccsymbols=''
20158         cppsymbols=`$cat Cppsym.true`
20159         cppsymbols=`echo $cppsymbols`
20160         cppccsymbols="$cppsymbols"
20161 else
20162         if $test -s ccsym.com; then
20163                 echo "Your C compiler and pre-processor define these symbols:"
20164                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20165                 also='also '
20166                 symbols='ones'
20167                 cppccsymbols=`$cat ccsym.com`
20168                 cppccsymbols=`echo $cppccsymbols`
20169                 $test "$silent" || sleep 1
20170         fi
20171         if $test -s ccsym.cpp; then
20172                 $test "$also" && echo " "
20173                 echo "Your C pre-processor ${also}defines the following symbols:"
20174                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20175                 also='further '
20176                 cppsymbols=`$cat ccsym.cpp`
20177                 cppsymbols=`echo $cppsymbols`
20178                 $test "$silent" || sleep 1
20179         fi
20180         if $test -s ccsym.own; then
20181                 $test "$also" && echo " "
20182                 echo "Your C compiler ${also}defines the following cpp symbols:"
20183                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20184                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20185                 ccsymbols=`$cat ccsym.own`
20186                 ccsymbols=`echo $ccsymbols`
20187                 $test "$silent" || sleep 1
20188         fi
20189 fi
20190
20191 : see if this is a termio system
20192 val="$undef"
20193 val2="$undef"
20194 val3="$undef"
20195 if $test `./findhdr termios.h`; then
20196         set tcsetattr i_termios
20197         eval $inlibc
20198         val3="$i_termios"
20199 fi
20200 echo " "
20201 case "$val3" in
20202 "$define") echo "You have POSIX termios.h... good!" >&4;;
20203 *) if ./Cppsym pyr; then
20204                 case "`/bin/universe`" in
20205                 ucb) if $test `./findhdr sgtty.h`; then
20206                                 val2="$define"
20207                                 echo "<sgtty.h> found." >&4
20208                         else
20209                                 echo "System is pyramid with BSD universe."
20210                                 echo "<sgtty.h> not found--you could have problems." >&4
20211                         fi;;
20212                 *) if $test `./findhdr termio.h`; then
20213                                 val="$define"
20214                                 echo "<termio.h> found." >&4
20215                         else
20216                                 echo "System is pyramid with USG universe."
20217                                 echo "<termio.h> not found--you could have problems." >&4
20218                         fi;;
20219                 esac
20220         elif ./usg; then
20221                 if $test `./findhdr termio.h`; then
20222                         echo "<termio.h> found." >&4
20223                         val="$define"
20224                 elif $test `./findhdr sgtty.h`; then
20225                         echo "<sgtty.h> found." >&4
20226                         val2="$define"
20227                 else
20228 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20229                 fi
20230         else
20231                 if $test `./findhdr sgtty.h`; then
20232                         echo "<sgtty.h> found." >&4
20233                         val2="$define"
20234                 elif $test `./findhdr termio.h`; then
20235                         echo "<termio.h> found." >&4
20236                         val="$define"
20237                 else
20238 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20239                 fi
20240         fi;;
20241 esac
20242 set i_termio; eval $setvar
20243 val=$val2; set i_sgtty; eval $setvar
20244 val=$val3; set i_termios; eval $setvar
20245
20246 : see if stddef is available
20247 set stddef.h i_stddef
20248 eval $inhdr
20249
20250 : see if this is a sunmath.h system
20251 set sunmath.h i_sunmath
20252 eval $inhdr
20253
20254 : see if sys/access.h is available
20255 set sys/access.h i_sysaccess
20256 eval $inhdr
20257
20258 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20259 set sys/filio.h i_sysfilio
20260 eval $inhdr
20261 echo " "
20262 if $test `./findhdr sys/ioctl.h`; then
20263         val="$define"
20264         echo '<sys/ioctl.h> found.' >&4
20265 else
20266         val="$undef"
20267         if $test $i_sysfilio = "$define"; then
20268             echo '<sys/ioctl.h> NOT found.' >&4
20269         else
20270                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20271                 $test $i_termio = "$define" && xxx="termio.h"
20272                 $test $i_termios = "$define" && xxx="termios.h"
20273 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20274         fi
20275 fi
20276 set i_sysioctl
20277 eval $setvar
20278
20279 : see if socket ioctl defs are in sys/sockio.h
20280 echo " "
20281 xxx=`./findhdr sys/sockio.h`
20282 if $test "$xxx"; then
20283         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20284                 val="$define"
20285                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20286         else
20287                 val="$undef"
20288                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20289         fi
20290 else
20291         val="$undef"
20292         $cat <<EOM
20293 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20294 EOM
20295 fi
20296 set i_syssockio
20297 eval $setvar
20298
20299
20300 : see if this is a syslog.h system
20301 set syslog.h i_syslog
20302 eval $inhdr
20303
20304
20305 : see if this is a sys/mode.h system
20306 set sys/mode.h i_sysmode
20307 eval $inhdr
20308
20309 : see if sys/resource.h has to be included
20310 set sys/resource.h i_sysresrc
20311 eval $inhdr
20312
20313 : see if sys/security.h is available
20314 set sys/security.h i_syssecrt
20315 eval $inhdr
20316
20317 : see if this is a sys/statvfs.h system
20318 set sys/statvfs.h i_sysstatvfs
20319 eval $inhdr
20320
20321 : see if this is a sys/un.h system
20322 set sys/un.h i_sysun
20323 eval $inhdr
20324
20325
20326 : see if this is a sys/utsname.h system
20327 set sys/utsname.h i_sysutsname
20328 eval $inhdr
20329
20330 : see if this is a syswait system
20331 set sys/wait.h i_syswait
20332 eval $inhdr
20333
20334 : see if this is a ustat.h system
20335 set ustat.h i_ustat
20336 eval $inhdr
20337
20338 : see if this is an utime system
20339 set utime.h i_utime
20340 eval $inhdr
20341
20342 : see if this is a values.h system
20343 set values.h i_values
20344 eval $inhdr
20345
20346 : see if this is a vfork system
20347 case "$d_vfork" in
20348 "$define")
20349         set vfork.h i_vfork
20350         eval $inhdr
20351         ;;
20352 *)
20353         i_vfork="$undef"
20354         ;;
20355 esac
20356
20357 : see if gdbm.h is available
20358 set gdbm.h t_gdbm
20359 eval $inhdr
20360 case "$t_gdbm" in
20361 $define)
20362         : see if gdbm_open exists
20363         set gdbm_open d_gdbm_open
20364         eval $inlibc
20365         case "$d_gdbm_open" in
20366         $undef)
20367                 t_gdbm="$undef"
20368                 echo "We won't be including <gdbm.h>"
20369                 ;;
20370         esac
20371         ;;
20372 esac
20373 val="$t_gdbm"
20374 set i_gdbm
20375 eval $setvar
20376
20377 echo " "
20378 echo "Looking for extensions..." >&4
20379 : If we are using the old config.sh, known_extensions may contain
20380 : old or inaccurate or duplicate values.
20381 known_extensions=''
20382 nonxs_extensions=''
20383 : We do not use find because it might not be available.
20384 : We do not just use MANIFEST because the user may have dropped
20385 : some additional extensions into the source tree and expect them
20386 : to be built.
20387
20388 : Function to recursively find available extensions, ignoring DynaLoader
20389 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20390 find_extensions='
20391     for xxx in *; do
20392        case "$xxx" in
20393            DynaLoader|dynaload) ;;
20394            *)
20395            if $test -f $xxx/$xxx.xs; then
20396                known_extensions="$known_extensions $1$xxx";
20397            elif $test -f $xxx/Makefile.PL; then
20398                nonxs_extensions="$nonxs_extensions $1$xxx";
20399            else
20400                if $test -d $xxx -a $# -lt 10; then
20401                    set $1$xxx/ $*;
20402                    cd "$xxx";
20403                    eval $find_extensions;
20404                    cd ..;
20405                    shift;
20406                fi;
20407            fi
20408            ;;
20409        esac;
20410     done'
20411 tdir=`pwd`
20412 cd "$rsrc/ext"
20413 set X
20414 shift
20415 eval $find_extensions
20416 # Special case:  Add in threads/shared since it is not picked up by the
20417 # recursive find above (and adding in general recursive finding breaks
20418 # SDBM_File/sdbm).  A.D.  10/25/2001.
20419 known_extensions="$known_extensions threads/shared"
20420 set X $nonxs_extensions
20421 shift
20422 nonxs_extensions="$*"
20423 set X $known_extensions
20424 shift
20425 known_extensions="$*"
20426 cd "$tdir"
20427
20428 : Now see which are supported on this system.
20429 avail_ext=''
20430 for xxx in $known_extensions ; do
20431         case "$xxx" in
20432         DB_File|db_file)
20433                 case "$i_db" in
20434                 $define) avail_ext="$avail_ext $xxx" ;;
20435                 esac
20436                 ;;
20437         GDBM_File|gdbm_fil)
20438                 case "$i_gdbm" in 
20439                 $define) avail_ext="$avail_ext $xxx" ;;
20440                 esac
20441                 ;;
20442         I18N/Langinfo|i18n_lan)
20443                 case "$i_langinfo$d_nl_langinfo" in 
20444                 $define$define) avail_ext="$avail_ext $xxx" ;;
20445                 esac
20446                 ;;
20447         NDBM_File|ndbm_fil)
20448                 case "$i_ndbm" in
20449                 $define)
20450                     case "$osname-$use64bitint" in
20451                     hpux-define)
20452                         case "$libs" in
20453                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20454                         esac
20455                         ;;
20456                     *) avail_ext="$avail_ext $xxx" ;;
20457                     esac
20458                     ;;
20459                 esac
20460                 ;;
20461         ODBM_File|odbm_fil) 
20462                 case "${i_dbm}${i_rpcsvcdbm}" in
20463                 *"${define}"*)
20464                     case "$osname-$use64bitint" in
20465                     hpux-define)
20466                         case "$libs" in
20467                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20468                         esac
20469                         ;;
20470                     *) avail_ext="$avail_ext $xxx" ;;
20471                     esac
20472                     ;;
20473                 esac
20474                 ;;
20475         POSIX|posix)
20476                 case "$useposix" in
20477                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20478                 esac
20479                 ;;
20480         Opcode|opcode)
20481                 case "$useopcode" in
20482                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20483                 esac
20484                 ;;
20485         Socket|socket)
20486                 case "$d_socket" in 
20487                 true|$define|y)
20488                     case "$osname" in
20489                     beos) ;; # not unless BONE
20490                     *) avail_ext="$avail_ext $xxx" ;;
20491                     esac
20492                     ;;
20493                 esac
20494                 ;;
20495         Sys/Syslog|sys/syslog)
20496                 : XXX syslog requires socket
20497                 case "$d_socket" in 
20498                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20499                 esac
20500                 ;;
20501         Thread|thread)
20502                 case "$usethreads" in
20503                 true|$define|y)
20504                         case "$useithreads" in
20505                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20506                         esac
20507                 esac
20508                 ;;
20509         XS/APItest|xs/apitest)
20510                 # This is just for testing.  Skip it unless we have dynamic loading.
20511
20512                 case "$usedl" in
20513                 $define) avail_ext="$avail_ext $xxx" ;;
20514                 esac
20515                 ;;
20516         XS/Typemap|xs/typemap)
20517                 # This is just for testing.  Skip it unless we have dynamic loading.
20518                 case "$usedl" in
20519                 $define) avail_ext="$avail_ext $xxx" ;;
20520                 esac
20521                 ;;
20522         threads|threads/shared)
20523                 # threads and threads::shared are special cases.
20524                 # To stop people from asking "Perl 5.8.0 was supposed
20525                 # to have this new fancy threads implementation but my
20526                 # perl doesn't have it" and from people trying to
20527                 # (re)install the threads module using CPAN.pm and
20528                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20529                 # the threads.pm and threads/shared.pm will always be
20530                 # there, croaking informatively ("you need to rebuild
20531                 # all of Perl with threads, sorry") when threads haven't
20532                 # been compiled in.
20533                 # --jhi
20534                 avail_ext="$avail_ext $xxx"
20535                 ;;
20536         IPC/SysV|ipc/sysv)
20537                 : XXX Do we need a useipcsysv variable here
20538                 case "${d_msg}${d_sem}${d_shm}" in 
20539                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20540                 esac
20541                 ;;
20542         *)      avail_ext="$avail_ext $xxx"
20543                 ;;
20544         esac
20545 done
20546
20547 set X $avail_ext
20548 shift
20549 avail_ext="$*"
20550
20551 case "$onlyextensions" in
20552 '') ;;
20553 *)  keepextensions=''
20554     echo "You have requested that only certains extensions be included..." >&4
20555     for i in $onlyextensions; do
20556         case " $avail_ext " in
20557         *" $i "*)
20558             echo "Keeping extension $i."
20559             keepextensions="$keepextensions $i"
20560             ;;
20561         *) echo "Ignoring extension $i." ;;
20562         esac
20563     done
20564     avail_ext="$keepextensions"
20565     ;;
20566 esac
20567
20568 case "$noextensions" in
20569 '') ;;
20570 *)  keepextensions=''
20571     echo "You have requested that certain extensions be ignored..." >&4
20572     for i in $avail_ext; do
20573         case " $noextensions " in
20574         *" $i "*) echo "Ignoring extension $i." ;;
20575         *) echo "Keeping extension $i.";
20576            keepextensions="$keepextensions $i"
20577            ;;
20578         esac
20579     done
20580     avail_ext="$keepextensions"
20581     ;;
20582 esac
20583
20584 : Now see which nonxs extensions are supported on this system.
20585 : For now assume all are.
20586 nonxs_ext=''
20587 for xxx in $nonxs_extensions ; do
20588         case "$xxx" in
20589         *)      nonxs_ext="$nonxs_ext $xxx"
20590                 ;;
20591         esac
20592 done
20593
20594 set X $nonxs_ext
20595 shift
20596 nonxs_ext="$*"
20597
20598 case $usedl in
20599 $define)
20600         $cat <<EOM
20601 A number of extensions are supplied with $package.  You may choose to
20602 compile these extensions for dynamic loading (the default), compile
20603 them into the $package executable (static loading), or not include
20604 them at all.  Answer "none" to include no extensions.
20605 Note that DynaLoader is always built and need not be mentioned here.
20606
20607 EOM
20608         case "$dynamic_ext" in
20609         '')
20610                 : Exclude those listed in static_ext
20611                 dflt=''
20612                 for xxx in $avail_ext; do
20613                         case " $static_ext " in
20614                         *" $xxx "*) ;;
20615                         *) dflt="$dflt $xxx" ;;
20616                         esac
20617                 done
20618                 set X $dflt
20619                 shift
20620                 dflt="$*"
20621                 ;;
20622         *)      dflt="$dynamic_ext"
20623                 # Perhaps we are reusing an old out-of-date config.sh.
20624                 case "$hint" in
20625                 previous)
20626                         if test X"$dynamic_ext" != X"$avail_ext"; then
20627                                 $cat <<EOM
20628 NOTICE:  Your previous config.sh list may be incorrect. 
20629 The extensions now available to you are 
20630         ${avail_ext}
20631 but the default list from your previous config.sh is
20632         ${dynamic_ext} 
20633
20634 EOM
20635                         fi
20636                         ;;
20637                 esac
20638                 ;;
20639         esac
20640         case "$dflt" in
20641         '')     dflt=none;;
20642         esac
20643         rp="What extensions do you wish to load dynamically?"
20644         . ./myread
20645         case "$ans" in
20646         none) dynamic_ext=' ' ;;
20647         *) dynamic_ext="$ans" ;;
20648         esac
20649
20650         case "$static_ext" in
20651         '')
20652                 : Exclude those already listed in dynamic linking
20653                 dflt=''
20654                 for xxx in $avail_ext; do
20655                         case " $dynamic_ext " in
20656                         *" $xxx "*) ;;
20657                         *) dflt="$dflt $xxx" ;;
20658                         esac
20659                 done
20660                 set X $dflt
20661                 shift
20662                 dflt="$*"
20663                 ;;
20664         *)  dflt="$static_ext" 
20665                 ;;
20666         esac
20667
20668         case "$dflt" in
20669         '')     dflt=none;;
20670         esac
20671         rp="What extensions do you wish to load statically?"
20672         . ./myread
20673         case "$ans" in
20674         none) static_ext=' ' ;;
20675         *) static_ext="$ans" ;;
20676         esac
20677         ;;
20678 *)
20679         $cat <<EOM
20680 A number of extensions are supplied with $package.  Answer "none" 
20681 to include no extensions. 
20682 Note that DynaLoader is always built and need not be mentioned here.
20683
20684 EOM
20685         case "$static_ext" in
20686         '') dflt="$avail_ext" ;;
20687         *)      dflt="$static_ext"
20688                 # Perhaps we are reusing an old out-of-date config.sh.
20689                 case "$hint" in
20690                 previous)
20691                         if test X"$static_ext" != X"$avail_ext"; then
20692                                 $cat <<EOM
20693 NOTICE:  Your previous config.sh list may be incorrect. 
20694 The extensions now available to you are 
20695         ${avail_ext}
20696 but the default list from your previous config.sh is
20697         ${static_ext} 
20698
20699 EOM
20700                         fi
20701                         ;;
20702                 esac
20703                 ;;
20704         esac
20705         : Exclude those that are not xs extensions
20706         case "$dflt" in
20707         '')     dflt=none;;
20708         esac
20709         rp="What extensions do you wish to include?"
20710         . ./myread
20711         case "$ans" in
20712         none) static_ext=' ' ;;
20713         *) static_ext="$ans" ;;
20714         esac
20715         ;;
20716 esac
20717 #        
20718 # Encode is a special case.  If we are building Encode as a static
20719 # extension, we need to explicitly list its subextensions as well.
20720 # For other nested extensions, this is handled automatically by
20721 # the appropriate Makefile.PL.
20722 case " $static_ext " in
20723         *" Encode "*) # Add the subextensions of Encode
20724         cd "$rsrc/ext"
20725         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20726                 static_ext="$static_ext Encode/$xxx"
20727         done
20728         cd "$tdir"
20729         ;;
20730 esac
20731
20732 set X $dynamic_ext $static_ext $nonxs_ext
20733 shift
20734 extensions="$*"
20735
20736 # Sanity check:  We require an extension suitable for use with
20737 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20738 # should show up as failures in the test suite, but it's helpful to
20739 # catch them now.) The 'extensions' list is normally sorted
20740 # alphabetically, so we need to accept either
20741 #    DB_File ... Fcntl ... IO  ....
20742 # or something like
20743 #    Fcntl ... NDBM_File ... IO  ....
20744 case " $extensions"  in
20745 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20746 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20747 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20748 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20749    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20750    ;;
20751 esac
20752
20753 : Remove libraries needed only for extensions
20754 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20755 : The exception is SunOS 4.x, which needs them.
20756 case "${osname}X${osvers}" in
20757 sunos*X4*)
20758     perllibs="$libs"
20759     ;;
20760 *) case "$usedl" in
20761     $define|true|[yY]*)
20762             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20763             shift
20764             perllibs="$*"
20765             ;;
20766     *)  perllibs="$libs"
20767             ;;
20768     esac
20769     ;;
20770 esac
20771
20772 : Remove build directory name from cppstdin so it can be used from
20773 : either the present location or the final installed location.
20774 echo " "
20775 : Get out of the UU directory to get correct path name.
20776 cd ..
20777 case "$cppstdin" in
20778 `pwd`/cppstdin)
20779         echo "Stripping down cppstdin path name"
20780         cppstdin=cppstdin
20781         ;;
20782 esac
20783 cd UU
20784
20785 : end of configuration questions
20786 echo " "
20787 echo "End of configuration questions."
20788 echo " "
20789
20790 : back to where it started
20791 if test -d ../UU; then
20792         cd ..
20793 fi
20794
20795 : configuration may be patched via a 'config.arch' file
20796 if $test -f config.arch; then
20797         echo "I see a config.arch file, loading it."
20798         . ./config.arch
20799 fi
20800
20801 : configuration may be patched via a 'config.over' file
20802 if $test -f config.over; then
20803         echo " "
20804         dflt=y
20805         rp='I see a config.over file.  Do you wish to load it?'
20806         . UU/myread
20807         case "$ans" in
20808         n*) echo "OK, I'll ignore it.";;
20809         *)      . ./config.over
20810                 echo "Configuration override changes have been loaded."
20811                 ;;
20812         esac
20813 fi
20814
20815 : in case they want portability, strip down executable paths
20816 case "$d_portable" in
20817 "$define")
20818         echo " "
20819         echo "Stripping down executable paths..." >&4
20820         for file in $loclist $trylist; do
20821                 eval temp=\$$file
20822                 eval $file=`basename $temp`
20823         done
20824         ;;
20825 esac
20826
20827 : create config.sh file
20828 echo " "
20829 echo "Creating config.sh..." >&4
20830 $spitshell <<EOT >config.sh
20831 $startsh
20832 #
20833 # This file was produced by running the Configure script. It holds all the
20834 # definitions figured out by Configure. Should you modify one of these values,
20835 # do not forget to propagate your changes by running "Configure -der". You may
20836 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20837 #
20838
20839 # Package name      : $package
20840 # Source directory  : $src
20841 # Configuration time: $cf_time
20842 # Configured by     : $cf_by
20843 # Target system     : $myuname
20844
20845 Author='$Author'
20846 Date='$Date'
20847 Header='$Header'
20848 Id='$Id'
20849 Locker='$Locker'
20850 Log='$Log'
20851 Mcc='$Mcc'
20852 RCSfile='$RCSfile'
20853 Revision='$Revision'
20854 Source='$Source'
20855 State='$State'
20856 _a='$_a'
20857 _exe='$_exe'
20858 _o='$_o'
20859 afs='$afs'
20860 afsroot='$afsroot'
20861 alignbytes='$alignbytes'
20862 ansi2knr='$ansi2knr'
20863 aphostname='$aphostname'
20864 api_revision='$api_revision'
20865 api_subversion='$api_subversion'
20866 api_version='$api_version'
20867 api_versionstring='$api_versionstring'
20868 ar='$ar'
20869 archlib='$archlib'
20870 archlibexp='$archlibexp'
20871 archname64='$archname64'
20872 archname='$archname'
20873 archobjs='$archobjs'
20874 asctime_r_proto='$asctime_r_proto'
20875 awk='$awk'
20876 baserev='$baserev'
20877 bash='$bash'
20878 bin='$bin'
20879 binexp='$binexp'
20880 bison='$bison'
20881 byacc='$byacc'
20882 byteorder='$byteorder'
20883 c='$c'
20884 castflags='$castflags'
20885 cat='$cat'
20886 cc='$cc'
20887 cccdlflags='$cccdlflags'
20888 ccdlflags='$ccdlflags'
20889 ccflags='$ccflags'
20890 ccflags_uselargefiles='$ccflags_uselargefiles'
20891 ccname='$ccname'
20892 ccsymbols='$ccsymbols'
20893 ccversion='$ccversion'
20894 cf_by='$cf_by'
20895 cf_email='$cf_email'
20896 cf_time='$cf_time'
20897 charsize='$charsize'
20898 chgrp='$chgrp'
20899 chmod='$chmod'
20900 chown='$chown'
20901 clocktype='$clocktype'
20902 comm='$comm'
20903 compress='$compress'
20904 contains='$contains'
20905 cp='$cp'
20906 cpio='$cpio'
20907 cpp='$cpp'
20908 cpp_stuff='$cpp_stuff'
20909 cppccsymbols='$cppccsymbols'
20910 cppflags='$cppflags'
20911 cpplast='$cpplast'
20912 cppminus='$cppminus'
20913 cpprun='$cpprun'
20914 cppstdin='$cppstdin'
20915 cppsymbols='$cppsymbols'
20916 crypt_r_proto='$crypt_r_proto'
20917 cryptlib='$cryptlib'
20918 csh='$csh'
20919 ctermid_r_proto='$ctermid_r_proto'
20920 ctime_r_proto='$ctime_r_proto'
20921 d_Gconvert='$d_Gconvert'
20922 d_PRIEUldbl='$d_PRIEUldbl'
20923 d_PRIFUldbl='$d_PRIFUldbl'
20924 d_PRIGUldbl='$d_PRIGUldbl'
20925 d_PRIXU64='$d_PRIXU64'
20926 d_PRId64='$d_PRId64'
20927 d_PRIeldbl='$d_PRIeldbl'
20928 d_PRIfldbl='$d_PRIfldbl'
20929 d_PRIgldbl='$d_PRIgldbl'
20930 d_PRIi64='$d_PRIi64'
20931 d_PRIo64='$d_PRIo64'
20932 d_PRIu64='$d_PRIu64'
20933 d_PRIx64='$d_PRIx64'
20934 d_SCNfldbl='$d_SCNfldbl'
20935 d__fwalk='$d__fwalk'
20936 d_access='$d_access'
20937 d_accessx='$d_accessx'
20938 d_aintl='$d_aintl'
20939 d_alarm='$d_alarm'
20940 d_archlib='$d_archlib'
20941 d_asctime_r='$d_asctime_r'
20942 d_atolf='$d_atolf'
20943 d_atoll='$d_atoll'
20944 d_attribute_format='$d_attribute_format'
20945 d_attribute_malloc='$d_attribute_malloc'
20946 d_attribute_nonnull='$d_attribute_nonnull'
20947 d_attribute_noreturn='$d_attribute_noreturn'
20948 d_attribute_pure='$d_attribute_pure'
20949 d_attribute_unused='$d_attribute_unused'
20950 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
20951 d_bcmp='$d_bcmp'
20952 d_bcopy='$d_bcopy'
20953 d_bsd='$d_bsd'
20954 d_bsdgetpgrp='$d_bsdgetpgrp'
20955 d_bsdsetpgrp='$d_bsdsetpgrp'
20956 d_bzero='$d_bzero'
20957 d_casti32='$d_casti32'
20958 d_castneg='$d_castneg'
20959 d_charvspr='$d_charvspr'
20960 d_chown='$d_chown'
20961 d_chroot='$d_chroot'
20962 d_chsize='$d_chsize'
20963 d_class='$d_class'
20964 d_closedir='$d_closedir'
20965 d_cmsghdr_s='$d_cmsghdr_s'
20966 d_const='$d_const'
20967 d_copysignl='$d_copysignl'
20968 d_crypt='$d_crypt'
20969 d_crypt_r='$d_crypt_r'
20970 d_csh='$d_csh'
20971 d_ctermid_r='$d_ctermid_r'
20972 d_ctime_r='$d_ctime_r'
20973 d_cuserid='$d_cuserid'
20974 d_dbl_dig='$d_dbl_dig'
20975 d_dbminitproto='$d_dbminitproto'
20976 d_difftime='$d_difftime'
20977 d_dirfd='$d_dirfd'
20978 d_dirnamlen='$d_dirnamlen'
20979 d_dlerror='$d_dlerror'
20980 d_dlopen='$d_dlopen'
20981 d_dlsymun='$d_dlsymun'
20982 d_dosuid='$d_dosuid'
20983 d_drand48_r='$d_drand48_r'
20984 d_drand48proto='$d_drand48proto'
20985 d_dup2='$d_dup2'
20986 d_eaccess='$d_eaccess'
20987 d_endgrent='$d_endgrent'
20988 d_endgrent_r='$d_endgrent_r'
20989 d_endhent='$d_endhent'
20990 d_endhostent_r='$d_endhostent_r'
20991 d_endnent='$d_endnent'
20992 d_endnetent_r='$d_endnetent_r'
20993 d_endpent='$d_endpent'
20994 d_endprotoent_r='$d_endprotoent_r'
20995 d_endpwent='$d_endpwent'
20996 d_endpwent_r='$d_endpwent_r'
20997 d_endsent='$d_endsent'
20998 d_endservent_r='$d_endservent_r'
20999 d_eofnblk='$d_eofnblk'
21000 d_eunice='$d_eunice'
21001 d_faststdio='$d_faststdio'
21002 d_fchdir='$d_fchdir'
21003 d_fchmod='$d_fchmod'
21004 d_fchown='$d_fchown'
21005 d_fcntl='$d_fcntl'
21006 d_fcntl_can_lock='$d_fcntl_can_lock'
21007 d_fd_macros='$d_fd_macros'
21008 d_fd_set='$d_fd_set'
21009 d_fds_bits='$d_fds_bits'
21010 d_fgetpos='$d_fgetpos'
21011 d_finite='$d_finite'
21012 d_finitel='$d_finitel'
21013 d_flexfnam='$d_flexfnam'
21014 d_flock='$d_flock'
21015 d_flockproto='$d_flockproto'
21016 d_fork='$d_fork'
21017 d_fp_class='$d_fp_class'
21018 d_fpathconf='$d_fpathconf'
21019 d_fpclass='$d_fpclass'
21020 d_fpclassify='$d_fpclassify'
21021 d_fpclassl='$d_fpclassl'
21022 d_fpos64_t='$d_fpos64_t'
21023 d_frexpl='$d_frexpl'
21024 d_fs_data_s='$d_fs_data_s'
21025 d_fseeko='$d_fseeko'
21026 d_fsetpos='$d_fsetpos'
21027 d_fstatfs='$d_fstatfs'
21028 d_fstatvfs='$d_fstatvfs'
21029 d_fsync='$d_fsync'
21030 d_ftello='$d_ftello'
21031 d_ftime='$d_ftime'
21032 d_getcwd='$d_getcwd'
21033 d_getespwnam='$d_getespwnam'
21034 d_getfsstat='$d_getfsstat'
21035 d_getgrent='$d_getgrent'
21036 d_getgrent_r='$d_getgrent_r'
21037 d_getgrgid_r='$d_getgrgid_r'
21038 d_getgrnam_r='$d_getgrnam_r'
21039 d_getgrps='$d_getgrps'
21040 d_gethbyaddr='$d_gethbyaddr'
21041 d_gethbyname='$d_gethbyname'
21042 d_gethent='$d_gethent'
21043 d_gethname='$d_gethname'
21044 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21045 d_gethostbyname_r='$d_gethostbyname_r'
21046 d_gethostent_r='$d_gethostent_r'
21047 d_gethostprotos='$d_gethostprotos'
21048 d_getitimer='$d_getitimer'
21049 d_getlogin='$d_getlogin'
21050 d_getlogin_r='$d_getlogin_r'
21051 d_getmnt='$d_getmnt'
21052 d_getmntent='$d_getmntent'
21053 d_getnbyaddr='$d_getnbyaddr'
21054 d_getnbyname='$d_getnbyname'
21055 d_getnent='$d_getnent'
21056 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21057 d_getnetbyname_r='$d_getnetbyname_r'
21058 d_getnetent_r='$d_getnetent_r'
21059 d_getnetprotos='$d_getnetprotos'
21060 d_getpagsz='$d_getpagsz'
21061 d_getpbyname='$d_getpbyname'
21062 d_getpbynumber='$d_getpbynumber'
21063 d_getpent='$d_getpent'
21064 d_getpgid='$d_getpgid'
21065 d_getpgrp2='$d_getpgrp2'
21066 d_getpgrp='$d_getpgrp'
21067 d_getppid='$d_getppid'
21068 d_getprior='$d_getprior'
21069 d_getprotobyname_r='$d_getprotobyname_r'
21070 d_getprotobynumber_r='$d_getprotobynumber_r'
21071 d_getprotoent_r='$d_getprotoent_r'
21072 d_getprotoprotos='$d_getprotoprotos'
21073 d_getprpwnam='$d_getprpwnam'
21074 d_getpwent='$d_getpwent'
21075 d_getpwent_r='$d_getpwent_r'
21076 d_getpwnam_r='$d_getpwnam_r'
21077 d_getpwuid_r='$d_getpwuid_r'
21078 d_getsbyname='$d_getsbyname'
21079 d_getsbyport='$d_getsbyport'
21080 d_getsent='$d_getsent'
21081 d_getservbyname_r='$d_getservbyname_r'
21082 d_getservbyport_r='$d_getservbyport_r'
21083 d_getservent_r='$d_getservent_r'
21084 d_getservprotos='$d_getservprotos'
21085 d_getspnam='$d_getspnam'
21086 d_getspnam_r='$d_getspnam_r'
21087 d_gettimeod='$d_gettimeod'
21088 d_gmtime_r='$d_gmtime_r'
21089 d_gnulibc='$d_gnulibc'
21090 d_grpasswd='$d_grpasswd'
21091 d_hasmntopt='$d_hasmntopt'
21092 d_htonl='$d_htonl'
21093 d_ilogbl='$d_ilogbl'
21094 d_index='$d_index'
21095 d_inetaton='$d_inetaton'
21096 d_int64_t='$d_int64_t'
21097 d_isascii='$d_isascii'
21098 d_isfinite='$d_isfinite'
21099 d_isinf='$d_isinf'
21100 d_isnan='$d_isnan'
21101 d_isnanl='$d_isnanl'
21102 d_killpg='$d_killpg'
21103 d_lchown='$d_lchown'
21104 d_ldbl_dig='$d_ldbl_dig'
21105 d_libm_lib_version='$d_libm_lib_version'
21106 d_link='$d_link'
21107 d_localtime_r='$d_localtime_r'
21108 d_locconv='$d_locconv'
21109 d_lockf='$d_lockf'
21110 d_longdbl='$d_longdbl'
21111 d_longlong='$d_longlong'
21112 d_lseekproto='$d_lseekproto'
21113 d_lstat='$d_lstat'
21114 d_madvise='$d_madvise'
21115 d_mblen='$d_mblen'
21116 d_mbstowcs='$d_mbstowcs'
21117 d_mbtowc='$d_mbtowc'
21118 d_memchr='$d_memchr'
21119 d_memcmp='$d_memcmp'
21120 d_memcpy='$d_memcpy'
21121 d_memmove='$d_memmove'
21122 d_memset='$d_memset'
21123 d_mkdir='$d_mkdir'
21124 d_mkdtemp='$d_mkdtemp'
21125 d_mkfifo='$d_mkfifo'
21126 d_mkstemp='$d_mkstemp'
21127 d_mkstemps='$d_mkstemps'
21128 d_mktime='$d_mktime'
21129 d_mmap='$d_mmap'
21130 d_modfl='$d_modfl'
21131 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21132 d_modflproto='$d_modflproto'
21133 d_mprotect='$d_mprotect'
21134 d_msg='$d_msg'
21135 d_msg_ctrunc='$d_msg_ctrunc'
21136 d_msg_dontroute='$d_msg_dontroute'
21137 d_msg_oob='$d_msg_oob'
21138 d_msg_peek='$d_msg_peek'
21139 d_msg_proxy='$d_msg_proxy'
21140 d_msgctl='$d_msgctl'
21141 d_msgget='$d_msgget'
21142 d_msghdr_s='$d_msghdr_s'
21143 d_msgrcv='$d_msgrcv'
21144 d_msgsnd='$d_msgsnd'
21145 d_msync='$d_msync'
21146 d_munmap='$d_munmap'
21147 d_mymalloc='$d_mymalloc'
21148 d_nice='$d_nice'
21149 d_nl_langinfo='$d_nl_langinfo'
21150 d_nv_preserves_uv='$d_nv_preserves_uv'
21151 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21152 d_off64_t='$d_off64_t'
21153 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21154 d_oldpthreads='$d_oldpthreads'
21155 d_oldsock='$d_oldsock'
21156 d_open3='$d_open3'
21157 d_pathconf='$d_pathconf'
21158 d_pause='$d_pause'
21159 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21160 d_phostname='$d_phostname'
21161 d_pipe='$d_pipe'
21162 d_poll='$d_poll'
21163 d_portable='$d_portable'
21164 d_procselfexe='$d_procselfexe'
21165 d_pthread_atfork='$d_pthread_atfork'
21166 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21167 d_pthread_yield='$d_pthread_yield'
21168 d_pwage='$d_pwage'
21169 d_pwchange='$d_pwchange'
21170 d_pwclass='$d_pwclass'
21171 d_pwcomment='$d_pwcomment'
21172 d_pwexpire='$d_pwexpire'
21173 d_pwgecos='$d_pwgecos'
21174 d_pwpasswd='$d_pwpasswd'
21175 d_pwquota='$d_pwquota'
21176 d_qgcvt='$d_qgcvt'
21177 d_quad='$d_quad'
21178 d_random_r='$d_random_r'
21179 d_readdir64_r='$d_readdir64_r'
21180 d_readdir='$d_readdir'
21181 d_readdir_r='$d_readdir_r'
21182 d_readlink='$d_readlink'
21183 d_readv='$d_readv'
21184 d_recvmsg='$d_recvmsg'
21185 d_rename='$d_rename'
21186 d_rewinddir='$d_rewinddir'
21187 d_rmdir='$d_rmdir'
21188 d_safebcpy='$d_safebcpy'
21189 d_safemcpy='$d_safemcpy'
21190 d_sanemcmp='$d_sanemcmp'
21191 d_sbrkproto='$d_sbrkproto'
21192 d_scalbnl='$d_scalbnl'
21193 d_sched_yield='$d_sched_yield'
21194 d_scm_rights='$d_scm_rights'
21195 d_seekdir='$d_seekdir'
21196 d_select='$d_select'
21197 d_sem='$d_sem'
21198 d_semctl='$d_semctl'
21199 d_semctl_semid_ds='$d_semctl_semid_ds'
21200 d_semctl_semun='$d_semctl_semun'
21201 d_semget='$d_semget'
21202 d_semop='$d_semop'
21203 d_sendmsg='$d_sendmsg'
21204 d_setegid='$d_setegid'
21205 d_seteuid='$d_seteuid'
21206 d_setgrent='$d_setgrent'
21207 d_setgrent_r='$d_setgrent_r'
21208 d_setgrps='$d_setgrps'
21209 d_sethent='$d_sethent'
21210 d_sethostent_r='$d_sethostent_r'
21211 d_setitimer='$d_setitimer'
21212 d_setlinebuf='$d_setlinebuf'
21213 d_setlocale='$d_setlocale'
21214 d_setlocale_r='$d_setlocale_r'
21215 d_setnent='$d_setnent'
21216 d_setnetent_r='$d_setnetent_r'
21217 d_setpent='$d_setpent'
21218 d_setpgid='$d_setpgid'
21219 d_setpgrp2='$d_setpgrp2'
21220 d_setpgrp='$d_setpgrp'
21221 d_setprior='$d_setprior'
21222 d_setproctitle='$d_setproctitle'
21223 d_setprotoent_r='$d_setprotoent_r'
21224 d_setpwent='$d_setpwent'
21225 d_setpwent_r='$d_setpwent_r'
21226 d_setregid='$d_setregid'
21227 d_setresgid='$d_setresgid'
21228 d_setresuid='$d_setresuid'
21229 d_setreuid='$d_setreuid'
21230 d_setrgid='$d_setrgid'
21231 d_setruid='$d_setruid'
21232 d_setsent='$d_setsent'
21233 d_setservent_r='$d_setservent_r'
21234 d_setsid='$d_setsid'
21235 d_setvbuf='$d_setvbuf'
21236 d_sfio='$d_sfio'
21237 d_shm='$d_shm'
21238 d_shmat='$d_shmat'
21239 d_shmatprototype='$d_shmatprototype'
21240 d_shmctl='$d_shmctl'
21241 d_shmdt='$d_shmdt'
21242 d_shmget='$d_shmget'
21243 d_sigaction='$d_sigaction'
21244 d_sigprocmask='$d_sigprocmask'
21245 d_sigsetjmp='$d_sigsetjmp'
21246 d_sockatmark='$d_sockatmark'
21247 d_sockatmarkproto='$d_sockatmarkproto'
21248 d_socket='$d_socket'
21249 d_socklen_t='$d_socklen_t'
21250 d_sockpair='$d_sockpair'
21251 d_socks5_init='$d_socks5_init'
21252 d_sqrtl='$d_sqrtl'
21253 d_srand48_r='$d_srand48_r'
21254 d_srandom_r='$d_srandom_r'
21255 d_sresgproto='$d_sresgproto'
21256 d_sresuproto='$d_sresuproto'
21257 d_statblks='$d_statblks'
21258 d_statfs_f_flags='$d_statfs_f_flags'
21259 d_statfs_s='$d_statfs_s'
21260 d_statvfs='$d_statvfs'
21261 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21262 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21263 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21264 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21265 d_stdio_stream_array='$d_stdio_stream_array'
21266 d_stdiobase='$d_stdiobase'
21267 d_stdstdio='$d_stdstdio'
21268 d_strchr='$d_strchr'
21269 d_strcoll='$d_strcoll'
21270 d_strctcpy='$d_strctcpy'
21271 d_strerrm='$d_strerrm'
21272 d_strerror='$d_strerror'
21273 d_strerror_r='$d_strerror_r'
21274 d_strftime='$d_strftime'
21275 d_strlcat='$d_strlcat'
21276 d_strlcpy='$d_strlcpy'
21277 d_strtod='$d_strtod'
21278 d_strtol='$d_strtol'
21279 d_strtold='$d_strtold'
21280 d_strtoll='$d_strtoll'
21281 d_strtoq='$d_strtoq'
21282 d_strtoul='$d_strtoul'
21283 d_strtoull='$d_strtoull'
21284 d_strtouq='$d_strtouq'
21285 d_strxfrm='$d_strxfrm'
21286 d_suidsafe='$d_suidsafe'
21287 d_symlink='$d_symlink'
21288 d_syscall='$d_syscall'
21289 d_syscallproto='$d_syscallproto'
21290 d_sysconf='$d_sysconf'
21291 d_sysernlst='$d_sysernlst'
21292 d_syserrlst='$d_syserrlst'
21293 d_system='$d_system'
21294 d_tcgetpgrp='$d_tcgetpgrp'
21295 d_tcsetpgrp='$d_tcsetpgrp'
21296 d_telldir='$d_telldir'
21297 d_telldirproto='$d_telldirproto'
21298 d_time='$d_time'
21299 d_times='$d_times'
21300 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21301 d_tm_tm_zone='$d_tm_tm_zone'
21302 d_tmpnam_r='$d_tmpnam_r'
21303 d_truncate='$d_truncate'
21304 d_ttyname_r='$d_ttyname_r'
21305 d_tzname='$d_tzname'
21306 d_u32align='$d_u32align'
21307 d_ualarm='$d_ualarm'
21308 d_umask='$d_umask'
21309 d_uname='$d_uname'
21310 d_union_semun='$d_union_semun'
21311 d_unordered='$d_unordered'
21312 d_usleep='$d_usleep'
21313 d_usleepproto='$d_usleepproto'
21314 d_ustat='$d_ustat'
21315 d_vendorarch='$d_vendorarch'
21316 d_vendorbin='$d_vendorbin'
21317 d_vendorlib='$d_vendorlib'
21318 d_vendorscript='$d_vendorscript'
21319 d_vfork='$d_vfork'
21320 d_void_closedir='$d_void_closedir'
21321 d_voidsig='$d_voidsig'
21322 d_voidtty='$d_voidtty'
21323 d_volatile='$d_volatile'
21324 d_vprintf='$d_vprintf'
21325 d_wait4='$d_wait4'
21326 d_waitpid='$d_waitpid'
21327 d_wcstombs='$d_wcstombs'
21328 d_wctomb='$d_wctomb'
21329 d_writev='$d_writev'
21330 d_xenix='$d_xenix'
21331 date='$date'
21332 db_hashtype='$db_hashtype'
21333 db_prefixtype='$db_prefixtype'
21334 db_version_major='$db_version_major'
21335 db_version_minor='$db_version_minor'
21336 db_version_patch='$db_version_patch'
21337 defvoidused='$defvoidused'
21338 direntrytype='$direntrytype'
21339 dlext='$dlext'
21340 dlsrc='$dlsrc'
21341 doublesize='$doublesize'
21342 drand01='$drand01'
21343 drand48_r_proto='$drand48_r_proto'
21344 dynamic_ext='$dynamic_ext'
21345 eagain='$eagain'
21346 ebcdic='$ebcdic'
21347 echo='$echo'
21348 egrep='$egrep'
21349 emacs='$emacs'
21350 endgrent_r_proto='$endgrent_r_proto'
21351 endhostent_r_proto='$endhostent_r_proto'
21352 endnetent_r_proto='$endnetent_r_proto'
21353 endprotoent_r_proto='$endprotoent_r_proto'
21354 endpwent_r_proto='$endpwent_r_proto'
21355 endservent_r_proto='$endservent_r_proto'
21356 eunicefix='$eunicefix'
21357 exe_ext='$exe_ext'
21358 expr='$expr'
21359 extensions='$extensions'
21360 extras='$extras'
21361 fflushNULL='$fflushNULL'
21362 fflushall='$fflushall'
21363 find='$find'
21364 firstmakefile='$firstmakefile'
21365 flex='$flex'
21366 fpossize='$fpossize'
21367 fpostype='$fpostype'
21368 freetype='$freetype'
21369 from='$from'
21370 full_ar='$full_ar'
21371 full_csh='$full_csh'
21372 full_sed='$full_sed'
21373 gccansipedantic='$gccansipedantic'
21374 gccosandvers='$gccosandvers'
21375 gccversion='$gccversion'
21376 getgrent_r_proto='$getgrent_r_proto'
21377 getgrgid_r_proto='$getgrgid_r_proto'
21378 getgrnam_r_proto='$getgrnam_r_proto'
21379 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21380 gethostbyname_r_proto='$gethostbyname_r_proto'
21381 gethostent_r_proto='$gethostent_r_proto'
21382 getlogin_r_proto='$getlogin_r_proto'
21383 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21384 getnetbyname_r_proto='$getnetbyname_r_proto'
21385 getnetent_r_proto='$getnetent_r_proto'
21386 getprotobyname_r_proto='$getprotobyname_r_proto'
21387 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21388 getprotoent_r_proto='$getprotoent_r_proto'
21389 getpwent_r_proto='$getpwent_r_proto'
21390 getpwnam_r_proto='$getpwnam_r_proto'
21391 getpwuid_r_proto='$getpwuid_r_proto'
21392 getservbyname_r_proto='$getservbyname_r_proto'
21393 getservbyport_r_proto='$getservbyport_r_proto'
21394 getservent_r_proto='$getservent_r_proto'
21395 getspnam_r_proto='$getspnam_r_proto'
21396 gidformat='$gidformat'
21397 gidsign='$gidsign'
21398 gidsize='$gidsize'
21399 gidtype='$gidtype'
21400 glibpth='$glibpth'
21401 gmake='$gmake'
21402 gmtime_r_proto='$gmtime_r_proto'
21403 gnulibc_version='$gnulibc_version'
21404 grep='$grep'
21405 groupcat='$groupcat'
21406 groupstype='$groupstype'
21407 gzip='$gzip'
21408 h_fcntl='$h_fcntl'
21409 h_sysfile='$h_sysfile'
21410 hint='$hint'
21411 hostcat='$hostcat'
21412 html1dir='$html1dir'
21413 html1direxp='$html1direxp'
21414 html3dir='$html3dir'
21415 html3direxp='$html3direxp'
21416 i16size='$i16size'
21417 i16type='$i16type'
21418 i32size='$i32size'
21419 i32type='$i32type'
21420 i64size='$i64size'
21421 i64type='$i64type'
21422 i8size='$i8size'
21423 i8type='$i8type'
21424 i_arpainet='$i_arpainet'
21425 i_bsdioctl='$i_bsdioctl'
21426 i_crypt='$i_crypt'
21427 i_db='$i_db'
21428 i_dbm='$i_dbm'
21429 i_dirent='$i_dirent'
21430 i_dld='$i_dld'
21431 i_dlfcn='$i_dlfcn'
21432 i_fcntl='$i_fcntl'
21433 i_float='$i_float'
21434 i_fp='$i_fp'
21435 i_fp_class='$i_fp_class'
21436 i_gdbm='$i_gdbm'
21437 i_grp='$i_grp'
21438 i_ieeefp='$i_ieeefp'
21439 i_inttypes='$i_inttypes'
21440 i_langinfo='$i_langinfo'
21441 i_libutil='$i_libutil'
21442 i_limits='$i_limits'
21443 i_locale='$i_locale'
21444 i_machcthr='$i_machcthr'
21445 i_malloc='$i_malloc'
21446 i_math='$i_math'
21447 i_memory='$i_memory'
21448 i_mntent='$i_mntent'
21449 i_ndbm='$i_ndbm'
21450 i_netdb='$i_netdb'
21451 i_neterrno='$i_neterrno'
21452 i_netinettcp='$i_netinettcp'
21453 i_niin='$i_niin'
21454 i_poll='$i_poll'
21455 i_prot='$i_prot'
21456 i_pthread='$i_pthread'
21457 i_pwd='$i_pwd'
21458 i_rpcsvcdbm='$i_rpcsvcdbm'
21459 i_sfio='$i_sfio'
21460 i_sgtty='$i_sgtty'
21461 i_shadow='$i_shadow'
21462 i_socks='$i_socks'
21463 i_stdarg='$i_stdarg'
21464 i_stddef='$i_stddef'
21465 i_stdlib='$i_stdlib'
21466 i_string='$i_string'
21467 i_sunmath='$i_sunmath'
21468 i_sysaccess='$i_sysaccess'
21469 i_sysdir='$i_sysdir'
21470 i_sysfile='$i_sysfile'
21471 i_sysfilio='$i_sysfilio'
21472 i_sysin='$i_sysin'
21473 i_sysioctl='$i_sysioctl'
21474 i_syslog='$i_syslog'
21475 i_sysmman='$i_sysmman'
21476 i_sysmode='$i_sysmode'
21477 i_sysmount='$i_sysmount'
21478 i_sysndir='$i_sysndir'
21479 i_sysparam='$i_sysparam'
21480 i_sysresrc='$i_sysresrc'
21481 i_syssecrt='$i_syssecrt'
21482 i_sysselct='$i_sysselct'
21483 i_syssockio='$i_syssockio'
21484 i_sysstat='$i_sysstat'
21485 i_sysstatfs='$i_sysstatfs'
21486 i_sysstatvfs='$i_sysstatvfs'
21487 i_systime='$i_systime'
21488 i_systimek='$i_systimek'
21489 i_systimes='$i_systimes'
21490 i_systypes='$i_systypes'
21491 i_sysuio='$i_sysuio'
21492 i_sysun='$i_sysun'
21493 i_sysutsname='$i_sysutsname'
21494 i_sysvfs='$i_sysvfs'
21495 i_syswait='$i_syswait'
21496 i_termio='$i_termio'
21497 i_termios='$i_termios'
21498 i_time='$i_time'
21499 i_unistd='$i_unistd'
21500 i_ustat='$i_ustat'
21501 i_utime='$i_utime'
21502 i_values='$i_values'
21503 i_varargs='$i_varargs'
21504 i_varhdr='$i_varhdr'
21505 i_vfork='$i_vfork'
21506 ignore_versioned_solibs='$ignore_versioned_solibs'
21507 inc_version_list='$inc_version_list'
21508 inc_version_list_init='$inc_version_list_init'
21509 incpath='$incpath'
21510 inews='$inews'
21511 installarchlib='$installarchlib'
21512 installbin='$installbin'
21513 installhtml1dir='$installhtml1dir'
21514 installhtml3dir='$installhtml3dir'
21515 installman1dir='$installman1dir'
21516 installman3dir='$installman3dir'
21517 installprefix='$installprefix'
21518 installprefixexp='$installprefixexp'
21519 installprivlib='$installprivlib'
21520 installscript='$installscript'
21521 installsitearch='$installsitearch'
21522 installsitebin='$installsitebin'
21523 installsitehtml1dir='$installsitehtml1dir'
21524 installsitehtml3dir='$installsitehtml3dir'
21525 installsitelib='$installsitelib'
21526 installsiteman1dir='$installsiteman1dir'
21527 installsiteman3dir='$installsiteman3dir'
21528 installsitescript='$installsitescript'
21529 installstyle='$installstyle'
21530 installusrbinperl='$installusrbinperl'
21531 installvendorarch='$installvendorarch'
21532 installvendorbin='$installvendorbin'
21533 installvendorhtml1dir='$installvendorhtml1dir'
21534 installvendorhtml3dir='$installvendorhtml3dir'
21535 installvendorlib='$installvendorlib'
21536 installvendorman1dir='$installvendorman1dir'
21537 installvendorman3dir='$installvendorman3dir'
21538 installvendorscript='$installvendorscript'
21539 intsize='$intsize'
21540 issymlink='$issymlink'
21541 ivdformat='$ivdformat'
21542 ivsize='$ivsize'
21543 ivtype='$ivtype'
21544 known_extensions='$known_extensions'
21545 ksh='$ksh'
21546 ld='$ld'
21547 lddlflags='$lddlflags'
21548 ldflags='$ldflags'
21549 ldflags_uselargefiles='$ldflags_uselargefiles'
21550 ldlibpthname='$ldlibpthname'
21551 less='$less'
21552 lib_ext='$lib_ext'
21553 libc='$libc'
21554 libperl='$libperl'
21555 libpth='$libpth'
21556 libs='$libs'
21557 libsdirs='$libsdirs'
21558 libsfiles='$libsfiles'
21559 libsfound='$libsfound'
21560 libspath='$libspath'
21561 libswanted='$libswanted'
21562 libswanted_uselargefiles='$libswanted_uselargefiles'
21563 line='$line'
21564 lint='$lint'
21565 lkflags='$lkflags'
21566 ln='$ln'
21567 lns='$lns'
21568 localtime_r_proto='$localtime_r_proto'
21569 locincpth='$locincpth'
21570 loclibpth='$loclibpth'
21571 longdblsize='$longdblsize'
21572 longlongsize='$longlongsize'
21573 longsize='$longsize'
21574 lp='$lp'
21575 lpr='$lpr'
21576 ls='$ls'
21577 lseeksize='$lseeksize'
21578 lseektype='$lseektype'
21579 mail='$mail'
21580 mailx='$mailx'
21581 make='$make'
21582 make_set_make='$make_set_make'
21583 mallocobj='$mallocobj'
21584 mallocsrc='$mallocsrc'
21585 malloctype='$malloctype'
21586 man1dir='$man1dir'
21587 man1direxp='$man1direxp'
21588 man1ext='$man1ext'
21589 man3dir='$man3dir'
21590 man3direxp='$man3direxp'
21591 man3ext='$man3ext'
21592 mips_type='$mips_type'
21593 mistrustnm='$mistrustnm'
21594 mkdir='$mkdir'
21595 mmaptype='$mmaptype'
21596 modetype='$modetype'
21597 more='$more'
21598 multiarch='$multiarch'
21599 mv='$mv'
21600 myarchname='$myarchname'
21601 mydomain='$mydomain'
21602 myhostname='$myhostname'
21603 myuname='$myuname'
21604 n='$n'
21605 need_va_copy='$need_va_copy'
21606 netdb_hlen_type='$netdb_hlen_type'
21607 netdb_host_type='$netdb_host_type'
21608 netdb_name_type='$netdb_name_type'
21609 netdb_net_type='$netdb_net_type'
21610 nm='$nm'
21611 nm_opt='$nm_opt'
21612 nm_so_opt='$nm_so_opt'
21613 nonxs_ext='$nonxs_ext'
21614 nroff='$nroff'
21615 nvEUformat='$nvEUformat'
21616 nvFUformat='$nvFUformat'
21617 nvGUformat='$nvGUformat'
21618 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21619 nveformat='$nveformat'
21620 nvfformat='$nvfformat'
21621 nvgformat='$nvgformat'
21622 nvsize='$nvsize'
21623 nvtype='$nvtype'
21624 o_nonblock='$o_nonblock'
21625 obj_ext='$obj_ext'
21626 old_pthread_create_joinable='$old_pthread_create_joinable'
21627 optimize='$optimize'
21628 orderlib='$orderlib'
21629 osname='$osname'
21630 osvers='$osvers'
21631 otherlibdirs='$otherlibdirs'
21632 package='$package'
21633 pager='$pager'
21634 passcat='$passcat'
21635 patchlevel='$patchlevel'
21636 path_sep='$path_sep'
21637 perl5='$perl5'
21638 perl='$perl'
21639 perl_patchlevel='$perl_patchlevel'
21640 perladmin='$perladmin'
21641 perllibs='$perllibs'
21642 perlpath='$perlpath'
21643 pg='$pg'
21644 phostname='$phostname'
21645 pidtype='$pidtype'
21646 plibpth='$plibpth'
21647 pmake='$pmake'
21648 pr='$pr'
21649 prefix='$prefix'
21650 prefixexp='$prefixexp'
21651 privlib='$privlib'
21652 privlibexp='$privlibexp'
21653 procselfexe='$procselfexe'
21654 prototype='$prototype'
21655 ptrsize='$ptrsize'
21656 quadkind='$quadkind'
21657 quadtype='$quadtype'
21658 randbits='$randbits'
21659 randfunc='$randfunc'
21660 random_r_proto='$random_r_proto'
21661 randseedtype='$randseedtype'
21662 ranlib='$ranlib'
21663 rd_nodata='$rd_nodata'
21664 readdir64_r_proto='$readdir64_r_proto'
21665 readdir_r_proto='$readdir_r_proto'
21666 revision='$revision'
21667 rm='$rm'
21668 rmail='$rmail'
21669 run='$run'
21670 runnm='$runnm'
21671 sPRIEUldbl='$sPRIEUldbl'
21672 sPRIFUldbl='$sPRIFUldbl'
21673 sPRIGUldbl='$sPRIGUldbl'
21674 sPRIXU64='$sPRIXU64'
21675 sPRId64='$sPRId64'
21676 sPRIeldbl='$sPRIeldbl'
21677 sPRIfldbl='$sPRIfldbl'
21678 sPRIgldbl='$sPRIgldbl'
21679 sPRIi64='$sPRIi64'
21680 sPRIo64='$sPRIo64'
21681 sPRIu64='$sPRIu64'
21682 sPRIx64='$sPRIx64'
21683 sSCNfldbl='$sSCNfldbl'
21684 sched_yield='$sched_yield'
21685 scriptdir='$scriptdir'
21686 scriptdirexp='$scriptdirexp'
21687 sed='$sed'
21688 seedfunc='$seedfunc'
21689 selectminbits='$selectminbits'
21690 selecttype='$selecttype'
21691 sendmail='$sendmail'
21692 setgrent_r_proto='$setgrent_r_proto'
21693 sethostent_r_proto='$sethostent_r_proto'
21694 setlocale_r_proto='$setlocale_r_proto'
21695 setnetent_r_proto='$setnetent_r_proto'
21696 setprotoent_r_proto='$setprotoent_r_proto'
21697 setpwent_r_proto='$setpwent_r_proto'
21698 setservent_r_proto='$setservent_r_proto'
21699 sh='$sh'
21700 shar='$shar'
21701 sharpbang='$sharpbang'
21702 shmattype='$shmattype'
21703 shortsize='$shortsize'
21704 shrpenv='$shrpenv'
21705 shsharp='$shsharp'
21706 sig_count='$sig_count'
21707 sig_name='$sig_name'
21708 sig_name_init='$sig_name_init'
21709 sig_num='$sig_num'
21710 sig_num_init='$sig_num_init'
21711 sig_size='$sig_size'
21712 signal_t='$signal_t'
21713 sitearch='$sitearch'
21714 sitearchexp='$sitearchexp'
21715 sitebin='$sitebin'
21716 sitebinexp='$sitebinexp'
21717 sitehtml1dir='$sitehtml1dir'
21718 sitehtml1direxp='$sitehtml1direxp'
21719 sitehtml3dir='$sitehtml3dir'
21720 sitehtml3direxp='$sitehtml3direxp'
21721 sitelib='$sitelib'
21722 sitelib_stem='$sitelib_stem'
21723 sitelibexp='$sitelibexp'
21724 siteman1dir='$siteman1dir'
21725 siteman1direxp='$siteman1direxp'
21726 siteman3dir='$siteman3dir'
21727 siteman3direxp='$siteman3direxp'
21728 siteprefix='$siteprefix'
21729 siteprefixexp='$siteprefixexp'
21730 sitescript='$sitescript'
21731 sitescriptexp='$sitescriptexp'
21732 sizesize='$sizesize'
21733 sizetype='$sizetype'
21734 sleep='$sleep'
21735 smail='$smail'
21736 so='$so'
21737 sockethdr='$sockethdr'
21738 socketlib='$socketlib'
21739 socksizetype='$socksizetype'
21740 sort='$sort'
21741 spackage='$spackage'
21742 spitshell='$spitshell'
21743 srand48_r_proto='$srand48_r_proto'
21744 srandom_r_proto='$srandom_r_proto'
21745 src='$src'
21746 ssizetype='$ssizetype'
21747 startperl='$startperl'
21748 startsh='$startsh'
21749 static_ext='$static_ext'
21750 stdchar='$stdchar'
21751 stdio_base='$stdio_base'
21752 stdio_bufsiz='$stdio_bufsiz'
21753 stdio_cnt='$stdio_cnt'
21754 stdio_filbuf='$stdio_filbuf'
21755 stdio_ptr='$stdio_ptr'
21756 stdio_stream_array='$stdio_stream_array'
21757 strerror_r_proto='$strerror_r_proto'
21758 strings='$strings'
21759 submit='$submit'
21760 subversion='$subversion'
21761 sysman='$sysman'
21762 tail='$tail'
21763 tar='$tar'
21764 targetarch='$targetarch'
21765 tbl='$tbl'
21766 tee='$tee'
21767 test='$test'
21768 timeincl='$timeincl'
21769 timetype='$timetype'
21770 tmpnam_r_proto='$tmpnam_r_proto'
21771 to='$to'
21772 touch='$touch'
21773 tr='$tr'
21774 trnl='$trnl'
21775 troff='$troff'
21776 ttyname_r_proto='$ttyname_r_proto'
21777 u16size='$u16size'
21778 u16type='$u16type'
21779 u32size='$u32size'
21780 u32type='$u32type'
21781 u64size='$u64size'
21782 u64type='$u64type'
21783 u8size='$u8size'
21784 u8type='$u8type'
21785 uidformat='$uidformat'
21786 uidsign='$uidsign'
21787 uidsize='$uidsize'
21788 uidtype='$uidtype'
21789 uname='$uname'
21790 uniq='$uniq'
21791 uquadtype='$uquadtype'
21792 use5005threads='$use5005threads'
21793 use64bitall='$use64bitall'
21794 use64bitint='$use64bitint'
21795 usecrosscompile='$usecrosscompile'
21796 usedl='$usedl'
21797 usefaststdio='$usefaststdio'
21798 useithreads='$useithreads'
21799 uselargefiles='$uselargefiles'
21800 uselongdouble='$uselongdouble'
21801 usemallocwrap='$usemallocwrap'
21802 usemorebits='$usemorebits'
21803 usemultiplicity='$usemultiplicity'
21804 usemymalloc='$usemymalloc'
21805 usenm='$usenm'
21806 useopcode='$useopcode'
21807 useperlio='$useperlio'
21808 useposix='$useposix'
21809 usereentrant='$usereentrant'
21810 userelocatableinc='$userelocatableinc'
21811 usesfio='$usesfio'
21812 useshrplib='$useshrplib'
21813 usesitecustomize='$usesitecustomize'
21814 usesocks='$usesocks'
21815 usethreads='$usethreads'
21816 usevendorprefix='$usevendorprefix'
21817 usevfork='$usevfork'
21818 usrinc='$usrinc'
21819 uuname='$uuname'
21820 uvXUformat='$uvXUformat'
21821 uvoformat='$uvoformat'
21822 uvsize='$uvsize'
21823 uvtype='$uvtype'
21824 uvuformat='$uvuformat'
21825 uvxformat='$uvxformat'
21826 vendorarch='$vendorarch'
21827 vendorarchexp='$vendorarchexp'
21828 vendorbin='$vendorbin'
21829 vendorbinexp='$vendorbinexp'
21830 vendorhtml1dir='$vendorhtml1dir'
21831 vendorhtml1direxp='$vendorhtml1direxp'
21832 vendorhtml3dir='$vendorhtml3dir'
21833 vendorhtml3direxp='$vendorhtml3direxp'
21834 vendorlib='$vendorlib'
21835 vendorlib_stem='$vendorlib_stem'
21836 vendorlibexp='$vendorlibexp'
21837 vendorman1dir='$vendorman1dir'
21838 vendorman1direxp='$vendorman1direxp'
21839 vendorman3dir='$vendorman3dir'
21840 vendorman3direxp='$vendorman3direxp'
21841 vendorprefix='$vendorprefix'
21842 vendorprefixexp='$vendorprefixexp'
21843 vendorscript='$vendorscript'
21844 vendorscriptexp='$vendorscriptexp'
21845 version='$version'
21846 version_patchlevel_string='$version_patchlevel_string'
21847 versiononly='$versiononly'
21848 vi='$vi'
21849 voidflags='$voidflags'
21850 xlibpth='$xlibpth'
21851 yacc='$yacc'
21852 yaccflags='$yaccflags'
21853 zcat='$zcat'
21854 zip='$zip'
21855 EOT
21856
21857 : Add in command line options if available
21858 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21859
21860 : add special variables
21861 $test -f $src/patchlevel.h && \
21862 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21863 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21864 echo "PERL_CONFIG_SH=true" >>config.sh
21865
21866 : propagate old symbols
21867 if $test -f UU/config.sh; then
21868         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21869         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21870         $sort | $uniq -u >UU/oldsyms
21871         set X `cat UU/oldsyms`
21872         shift
21873         case $# in
21874         0) ;;
21875         *)
21876                 cat <<EOM
21877 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21878 EOM
21879                 echo "# Variables propagated from previous config.sh file." >>config.sh
21880                 for sym in `cat UU/oldsyms`; do
21881                         echo "    Propagating $hint variable "'$'"$sym..."
21882                         eval 'tmp="$'"${sym}"'"'
21883                         echo "$tmp" | \
21884                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21885                 done
21886                 ;;
21887         esac
21888 fi
21889
21890 : Finish up by extracting the .SH files
21891 case "$alldone" in
21892 exit)
21893         $rm -rf UU
21894         echo "Extraction done."
21895         exit 0
21896         ;;
21897 cont)
21898         ;;
21899 '')
21900         dflt=''
21901         nostick=true
21902         $cat <<EOM
21903
21904 If you'd like to make any changes to the config.sh file before I begin
21905 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21906
21907 EOM
21908         rp="Press return or use a shell escape to edit config.sh:"
21909         . UU/myread
21910         nostick=''
21911         case "$ans" in
21912         '') ;;
21913         *) : in case they cannot read
21914                 sh 1>&4 -c "$ans";;
21915         esac
21916         ;;
21917 esac
21918
21919 : if this fails, just run all the .SH files by hand
21920 . ./config.sh
21921
21922 echo " "
21923 exec 1>&4
21924 pwd=`pwd`
21925 . ./UU/extract
21926 cd "$pwd"
21927
21928 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21929         dflt=y
21930         case "$silent" in
21931         true) ;;
21932         *)
21933                 $cat <<EOM
21934
21935 Now you need to generate make dependencies by running "$make depend".
21936 You might prefer to run it in background: "$make depend > makedepend.out &"
21937 It can take a while, so you might not want to run it right now.
21938
21939 EOM
21940                 ;;
21941         esac
21942         rp="Run $make depend now?"
21943         . UU/myread
21944         case "$ans" in
21945         y*)
21946                 $make depend && echo "Now you must run '$make'."
21947                 ;;
21948         *)
21949                 echo "You must run '$make depend' then '$make'."
21950                 ;;
21951         esac
21952 elif test -f [Mm]akefile; then
21953         echo " "
21954         echo "Now you must run a $make."
21955 else
21956         echo "Configure done."
21957 fi
21958
21959 if $test -f Policy.sh; then
21960     $cat <<EOM
21961
21962 If you compile $package on a different machine or from a different object
21963 directory, copy the Policy.sh file from this object directory to the
21964 new one before you run Configure -- this will help you with most of
21965 the policy defaults.
21966
21967 EOM
21968 fi
21969 if $test -f config.msg; then
21970     echo "Hmm.  I also noted the following information while running:"
21971     echo " "
21972     $cat config.msg >&4
21973     $rm -f config.msg
21974 fi
21975 $rm -f kit*isdone ark*isdone
21976 $rm -rf UU
21977
21978 : End of Configure
21979